001 /*
002 * Copyright 2010 The Apache Software Foundation.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.vafer.jdeb.descriptors;
017
018 import org.vafer.jdeb.changes.ChangeSet;
019
020 /**
021 * Reflecting a changes file
022 *
023 * @author Torsten Curdt <tcurdt@vafer.org>
024 */
025 public final class ChangesDescriptor extends AbstractDescriptor {
026
027 private final static String[] keys = {
028 "Format",
029 "Date",
030 "Source",
031 "Binary",
032 "Architecture",
033 "Version",
034 "Distribution",
035 "Urgency",
036 "Maintainer",
037 "Changed-By",
038 "Description",
039 "Changes",
040 "Closes",
041 "Files"
042 };
043
044 private final static String[] mandatoryKeys = {
045 "Format",
046 "Date",
047 "Source",
048 "Binary",
049 "Architecture",
050 "Version",
051 "Distribution",
052 "Urgency",
053 "Maintainer",
054 "Description",
055 "Changes",
056 "Files"
057 };
058
059 private final ChangeSet[] changeSets;
060
061 public ChangesDescriptor( final AbstractDescriptor pDescriptor, final ChangeSet[] pChangeSets ) {
062 super(pDescriptor);
063 changeSets = pChangeSets;
064
065 final ChangeSet lastestChangeSet = changeSets[0];
066
067 set("Urgency", lastestChangeSet.getUrgency());
068 set("Changed-By", lastestChangeSet.getChangedBy());
069
070 final StringBuffer sb = new StringBuffer();
071
072 for (int i = 0; i < 1; i++) {
073 final ChangeSet changeSet = changeSets[i];
074 sb.append(changeSet.toString());
075 }
076
077 set("Changes", sb.toString());
078 }
079
080 public String[] getMandatoryKeys() {
081 return mandatoryKeys;
082 }
083
084 public String toString() {
085 return toString(keys);
086 }
087 }