001: /*--
002:
003: Copyright (C) 2002-2005 Adrian Price.
004: All rights reserved.
005:
006: Redistribution and use in source and binary forms, with or without
007: modification, are permitted provided that the following conditions
008: are met:
009:
010: 1. Redistributions of source code must retain the above copyright
011: notice, this list of conditions, and the following disclaimer.
012:
013: 2. Redistributions in binary form must reproduce the above copyright
014: notice, this list of conditions, and the disclaimer that follows
015: these conditions in the documentation and/or other materials
016: provided with the distribution.
017:
018: 3. The names "OBE" and "Open Business Engine" must not be used to
019: endorse or promote products derived from this software without prior
020: written permission. For written permission, please contact
021: adrianprice@sourceforge.net.
022:
023: 4. Products derived from this software may not be called "OBE" or
024: "Open Business Engine", nor may "OBE" or "Open Business Engine"
025: appear in their name, without prior written permission from
026: Adrian Price (adrianprice@users.sourceforge.net).
027:
028: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
029: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
030: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
031: DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
032: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
033: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
034: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
035: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
036: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
037: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
038: POSSIBILITY OF SUCH DAMAGE.
039:
040: For more information on OBE, please see
041: <http://obe.sourceforge.net/>.
042:
043: */
044:
045: package org.obe.xpdl.model.misc;
046:
047: import org.obe.util.AbstractBean;
048: import org.obe.xpdl.model.XPDLProperties;
049:
050: import java.beans.PropertyVetoException;
051: import java.util.Arrays;
052:
053: /**
054: * Header information which can be used for entities such as the package or
055: * individual workflow processes.
056: *
057: * @author Adrian Price
058: */
059: public final class RedefinableHeader extends AbstractBean {
060: private static final long serialVersionUID = -7749373588413143522L;
061: public static final String AUTHOR = XPDLProperties.AUTHOR;
062: public static final String CODE_PAGE = XPDLProperties.CODEPAGE;
063: public static final String COUNTRY_KEY = XPDLProperties.COUNTRYKEY;
064: public static final String PUBLICATION_STATUS = XPDLProperties.PUBLICATION_STATUS;
065: public static final String RESPONSIBLE = XPDLProperties.RESPONSIBLE;
066: public static final String VERSION = XPDLProperties.VERSION;
067: private static final String[] EMPTY_RESPONSIBLE = {};
068: private static final String[] _indexedPropertyNames = { RESPONSIBLE };
069: private static final Object[] _indexedPropertyValues = { EMPTY_RESPONSIBLE };
070: private static final int RESPONSIBLE_IDX = 0;
071:
072: private String _author;
073: private String _version;
074: private String _codepage;
075: private String _countrykey;
076: private String[] _responsible = EMPTY_RESPONSIBLE;
077: private PublicationStatus _publicationStatus;
078:
079: /**
080: * Construct a new RedefinableHeader.
081: */
082: public RedefinableHeader() {
083: super (_indexedPropertyNames, _indexedPropertyValues);
084: }
085:
086: /**
087: * Get the entity's author.
088: *
089: * @return The entity's author
090: */
091: public String getAuthor() {
092: return _author;
093: }
094:
095: /**
096: * Set the entity's author.
097: *
098: * @param author The entity's new author
099: */
100: public void setAuthor(String author) {
101: _author = author;
102: }
103:
104: /**
105: * Get the entity's version.
106: *
107: * @return The version
108: */
109: public String getVersion() {
110: return _version;
111: }
112:
113: /**
114: * Set the entity's version.
115: *
116: * @param version The version
117: */
118: public void setVersion(String version) {
119: _version = version;
120: }
121:
122: public String getCodepage() {
123: return _codepage;
124: }
125:
126: public void setCodepage(String codepage) {
127: _codepage = codepage;
128: }
129:
130: public String getCountrykey() {
131: return _countrykey;
132: }
133:
134: public void setCountrykey(String countrykey) {
135: _countrykey = countrykey;
136: }
137:
138: public void add(String responsible) throws PropertyVetoException {
139: _responsible = (String[]) add(RESPONSIBLE_IDX, responsible);
140: }
141:
142: public void remove(String responsible) throws PropertyVetoException {
143: _responsible = (String[]) remove(RESPONSIBLE_IDX, responsible);
144: }
145:
146: /**
147: * Returns the responsible participants' IDs.
148: *
149: * @return Array of participant IDs.
150: */
151: public String[] getResponsible() {
152: return (String[]) get(RESPONSIBLE_IDX);
153: }
154:
155: public String getResponsible(int i) {
156: return _responsible[i];
157: }
158:
159: public void setResponsible(String[] responsibles)
160: throws PropertyVetoException {
161:
162: set(RESPONSIBLE_IDX,
163: _responsible = responsibles == null ? EMPTY_RESPONSIBLE
164: : responsibles);
165: }
166:
167: public void setResponsible(int i, String responsible)
168: throws PropertyVetoException {
169:
170: set(RESPONSIBLE_IDX, i, responsible);
171: }
172:
173: /**
174: * Get the publication status for this workflow definition.
175: *
176: * @return The publication status
177: */
178: public PublicationStatus getPublicationStatus() {
179: return _publicationStatus;
180: }
181:
182: /**
183: * Set the publication status for this workflow definition.
184: *
185: * @param publicationStatus The new publication status
186: */
187: public void setPublicationStatus(PublicationStatus publicationStatus) {
188: _publicationStatus = publicationStatus;
189: }
190:
191: public String toString() {
192: return "RedefinableHeader[author=" + _author + ", version="
193: + _version + ", codepage=" + _codepage
194: + ", countrykey=" + _countrykey + ", responsible="
195: + Arrays.asList(_responsible) + ", publicationStatus="
196: + _publicationStatus + ']';
197: }
198: }
|