001: /*
002: * Copyright 2001-2006 C:1 Financial Services GmbH
003: *
004: * This software is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License Version 2.1, as published by the Free Software Foundation.
007: *
008: * This software is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011: * Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public
014: * License along with this library; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016: */
017:
018: package de.finix.contelligent.xml.elements;
019:
020: import java.util.HashMap;
021: import java.util.Iterator;
022: import java.util.LinkedList;
023: import java.util.List;
024: import java.util.Map;
025:
026: public class PackageElement {
027:
028: private String name;
029:
030: private String version;
031:
032: private String readOnly = "false";
033:
034: private String display;
035:
036: private String provider;
037:
038: private List descriptionElementList = new LinkedList();
039:
040: private List requiredPackages = new LinkedList();
041:
042: private List types = new LinkedList();
043:
044: private List components = new LinkedList();
045:
046: private List clientModules = new LinkedList();
047:
048: public String toString() {
049: return name + " " + version;
050: }
051:
052: public void setName(final String name) {
053: this .name = name;
054: }
055:
056: public String getName() {
057: return name;
058: }
059:
060: public void setVersion(final String version) {
061: this .version = version;
062: }
063:
064: public String getVersion() {
065: return version;
066: }
067:
068: public String getReadOnly() {
069: return readOnly;
070: }
071:
072: public void setReadOnly(final String readOnly) {
073: this .readOnly = readOnly;
074: }
075:
076: public void setReadOnly(final boolean readOnly) {
077: this .readOnly = String.valueOf(readOnly);
078: }
079:
080: public boolean isReadOnly() {
081: return Boolean.valueOf(readOnly.trim()).booleanValue();
082: }
083:
084: public void setDisplayName(String name) {
085: display = name;
086: }
087:
088: public String getDisplayName() {
089: return display;
090: }
091:
092: public void setProvider(String name) {
093: provider = name;
094: }
095:
096: public String getProvider() {
097: return provider;
098: }
099:
100: public void addDescriptionElement(
101: DescriptionElement typeDescriptionElement) {
102: descriptionElementList.add(typeDescriptionElement);
103: }
104:
105: public List getDescriptionElementList() {
106: return descriptionElementList;
107: }
108:
109: public void addRequiredPackage(PackageRequiresElement pkg) {
110: requiredPackages.add(pkg);
111: }
112:
113: public List updateRequiredPackages(List requiredPackages) {
114: List oldList = this .requiredPackages;
115: this .requiredPackages = requiredPackages;
116: return oldList;
117: }
118:
119: /**
120: * @return List of <code>PackageImportElement</code> instances
121: */
122: public List getRequiredPackages() {
123: return requiredPackages;
124: }
125:
126: public void addTypes(PackageImportElement types) {
127: this .types.add(types);
128: }
129:
130: /**
131: * @return List of <code>PackageImportElement</code> instances
132: */
133: public List getTypes() {
134: return types;
135: }
136:
137: public void addComponents(PackageImportElement comp) {
138: components.add(comp);
139: }
140:
141: /**
142: * Returns the list
143: *
144: * @return List of <code>PackageImportElement</code> instances
145: */
146: public List getComponents() {
147: return components;
148: }
149:
150: public void addClientModule(ClientModuleElement module) {
151: clientModules.add(module);
152: }
153:
154: /**
155: * @return List ClientModuleElement instances
156: */
157: public List getClientModules() {
158: return clientModules;
159: }
160:
161: public Map getRequirementsMap() {
162: Map answer = new HashMap();
163: Iterator iterator = getRequiredPackages().iterator();
164:
165: while (iterator.hasNext()) {
166: PackageRequiresElement element = (PackageRequiresElement) iterator
167: .next();
168: answer.put(element.getPackage(), element.getVersion());
169: }
170: return answer;
171: }
172:
173: }
|