View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.vafer.jdeb.descriptors;
17  
18  import org.vafer.jdeb.changes.ChangeSet;
19  
20  /**
21   * Reflecting a changes file
22   * 
23   * @author Torsten Curdt <tcurdt@vafer.org>
24   */
25  public final class ChangesDescriptor extends AbstractDescriptor {
26  
27  	private final static String[] keys = {
28  		"Format",
29  		"Date",
30  		"Source",
31  		"Binary",
32  		"Architecture",
33  		"Version",
34  		"Distribution",
35  		"Urgency",
36  		"Maintainer",
37  		"Changed-By",
38  		"Description",
39  		"Changes",
40  		"Closes",
41  		"Files"
42  	};
43  	
44  	private final static String[] mandatoryKeys = {
45  		"Format",
46  		"Date",
47  		"Source",
48  		"Binary",
49  		"Architecture",
50  		"Version",
51  		"Distribution",
52  		"Urgency",
53  		"Maintainer",
54  		"Description",
55  		"Changes",
56  		"Files"
57  	};
58  
59  	private final ChangeSet[] changeSets;
60  	
61  	public ChangesDescriptor( final AbstractDescriptor pDescriptor, final ChangeSet[] pChangeSets ) {
62  		super(pDescriptor);
63  		changeSets = pChangeSets;
64  
65  		final ChangeSet lastestChangeSet = changeSets[0];
66  		
67  		set("Urgency", lastestChangeSet.getUrgency());
68  		set("Changed-By", lastestChangeSet.getChangedBy());
69  
70  		final StringBuffer sb = new StringBuffer();
71  
72  		for (int i = 0; i < 1; i++) {
73  			final ChangeSet changeSet = changeSets[i];
74  			sb.append(changeSet.toString());			
75  		}
76  
77  		set("Changes", sb.toString());
78  	}
79  	
80  	public String[] getMandatoryKeys() {
81  		return mandatoryKeys;
82  	}
83  	
84  	public String toString() {
85  		return toString(keys);
86  	}
87  }