001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.dms.model.v1;
009:
010: //base classes
011:
012: //project specific classes
013: import org.jfolder.common.UnexpectedSystemException;
014: import org.jfolder.common.entity.InitializeSystemEntityTagContext;
015: import org.jfolder.common.tagging.AppraiseConceptTagContext;
016: import org.jfolder.common.tagging.ConceptTagCharacteristic;
017: import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
018: import org.jfolder.common.tagging.ConceptTagConstraint;
019: import org.jfolder.common.tagging.ConceptTagConstraintHolder;
020: import org.jfolder.common.tagging.InitializeConceptTagContext;
021: import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
022: import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
023: import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
024: import org.jfolder.dms.model.DocumentFileSystemDirectoryUpdates;
025:
026: //other classes
027:
028: public class DocumentFileSystemDirectoryUpdatesTag implements
029: DocumentFileSystemDirectoryUpdates {
030:
031: //
032: private ConceptTagCharacteristic pathCtchar = null;
033: private ConceptTagCharacteristic nameCtchar = null;
034:
035: //path details
036: private final static String PATH_CTCON = "path";
037: private final static String PATH_TITLE = "Path";
038: private final static String PATH_SHORT_DESCRIPTION = "Path";
039:
040: //name details
041: private final static String NAME_CTCON = "name";
042: private final static String NAME_TITLE = "Name";
043: private final static String NAME_SHORT_DESCRIPTION = "Name";
044:
045: //
046: public DocumentFileSystemDirectoryUpdatesTag() {
047: }
048:
049: protected final static DocumentFileSystemDirectoryUpdatesTag newInstance(
050: ConceptTagCharacteristic inCtchar, int inIndex,
051: String inPath, String inName) {
052:
053: DocumentFileSystemDirectoryUpdatesTag outValue = new DocumentFileSystemDirectoryUpdatesTag();
054:
055: ConceptTagCharacteristicHolder ctcharh = inCtchar.addValue(
056: inIndex, outValue, true);
057:
058: InitializeSystemEntityTagContext isetc = new InitializeSystemEntityTagContext(
059: ctcharh);
060:
061: outValue.initialize(isetc);
062:
063: //
064: outValue.setPath(inPath);
065: outValue.setName(inName);
066:
067: return outValue;
068: }
069:
070: //
071: public void initialize(InitializeConceptTagContext inIctc) {
072:
073: //
074: ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
075: .newInstance(inIctc);
076:
077: //constrain "path"
078: ConceptTagConstraint pathCtcon = ConceptTagConstraint
079: .newInstance(PATH_CTCON, rootCtconh);
080: pathCtcon.setTitle(PATH_TITLE);
081: pathCtcon.setShortDescription(PATH_SHORT_DESCRIPTION);
082: //
083: StaticConceptTagConstraintContext pathSctcc = StaticConceptTagConstraintContext
084: .newInstance(pathCtcon);
085:
086: //constrain "name"
087: ConceptTagConstraint nameCtcon = ConceptTagConstraint
088: .newInstance(NAME_CTCON, rootCtconh);
089: nameCtcon.setTitle(NAME_TITLE);
090: nameCtcon.setShortDescription(NAME_SHORT_DESCRIPTION);
091: //
092: StaticConceptTagConstraintContext nameSctcc = StaticConceptTagConstraintContext
093: .newInstance(nameCtcon);
094:
095: //
096: inIctc.initialize();
097:
098: //
099: this .pathCtchar = pathCtcon.getCharacteristic();
100: this .nameCtchar = nameCtcon.getCharacteristic();
101: //this.deleteInstanceCtchar = deleteInstanceCtcon.getCharacteristic();
102: }
103:
104: public void appraise(AppraiseConceptTagContext inCtic) {
105: if (inCtic instanceof StudioConceptTagInstanceInfoContext) {
106: StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inCtic;
107: sctiic.setInstanceTitle("Document Directory Updates");
108: sctiic.setInstanceDescription("Document Directory Updates");
109: } else if (inCtic instanceof StudioConceptTagTypeInfoContext) {
110: StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inCtic;
111: scttic.setTypeTitle("Document Directory Updates");
112: scttic.setTypeDescription("Document Directory Updates");
113: }
114: }
115:
116: //
117: public String getName() {
118:
119: String outValue = null;
120:
121: if (this .nameCtchar.getValueLength() > 0) {
122: outValue = this .nameCtchar.getValueAsString(0, null);
123: } else {
124: throw UnexpectedSystemException.unknownState();
125: }
126:
127: return outValue;
128: }
129:
130: protected void setName(String inName) {
131:
132: if (this .nameCtchar.getValueLength() > 0) {
133: this .nameCtchar.replaceValueAndRemoveLocalFiles(0, inName);
134: } else {
135: this .nameCtchar.addValue(0, inName);
136: }
137: }
138:
139: //
140: public String getPath() {
141:
142: String outValue = null;
143:
144: if (this .pathCtchar.getValueLength() > 0) {
145: outValue = this .pathCtchar.getValueAsString(0, null);
146: } else {
147: throw UnexpectedSystemException.unknownState();
148: }
149:
150: return outValue;
151: }
152:
153: protected void setPath(String inPath) {
154:
155: if (this .pathCtchar.getValueLength() > 0) {
156: this .pathCtchar.replaceValueAndRemoveLocalFiles(0, inPath);
157: } else {
158: this .pathCtchar.addValue(0, inPath);
159: }
160: }
161:
162: }
|