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.workflow.model.template.v1;
009:
010: //base classes
011:
012: //project specific classes
013: import org.jfolder.common.tagging.AppraiseConceptTagContext;
014: import org.jfolder.common.tagging.ConceptTagCharacteristic;
015: import org.jfolder.common.tagging.ConceptTagConstraint;
016: import org.jfolder.common.tagging.ConceptTagConstraintHolder;
017: import org.jfolder.common.tagging.ConceptTagHelper;
018: import org.jfolder.common.tagging.DetermineClassConceptTagContext;
019: import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
020: import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
021: import org.jfolder.common.tagging.InitializeConceptTagContext;
022: import org.jfolder.common.tagging.ReturnableConceptTag;
023: import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
024: import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
025: import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
026: import org.jfolder.common.tagging.ValueAndClassForConceptTag;
027: import org.jfolder.common.utils.misc.CommonExpressions;
028: import org.jfolder.common.utils.misc.MiscHelper;
029:
030: //other classes
031:
032: public class IsTriggerAttributePresentWorkflowTemplateTag implements
033: ReturnableConceptTag {
034:
035: //ConceptTag characteristic
036: private ConceptTagCharacteristic pathCtchar = null;
037: private ConceptTagCharacteristic attributeCtchar = null;
038:
039: //path details
040: private final static String PATH_CTCON = "path";
041: private final static String PATH_TITLE = "Path";
042: private final static String PATH_SHORT_DESCRIPTION = "Path to the element in the trigger containing the attribute";
043: //TO DO: elaborate above
044:
045: //attribute details
046: private final static String ATTRIBUTE_CTCON = "attribute";
047: private final static String ATTRIBUTE_TITLE = "Attribute";
048: private final static String ATTRIBUTE_SHORT_DESCRIPTION = "Attribute, not workflow but XML, sought";
049:
050: //TO DO: elaborate above
051:
052: public void initialize(InitializeConceptTagContext inIctc) {
053:
054: //
055: ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
056: .newInstance(inIctc);
057:
058: //constrain "path"
059: ConceptTagConstraint pathCtcon = ConceptTagConstraint
060: .newInstance(PATH_CTCON, rootCtconh);
061: pathCtcon.setTitle(PATH_TITLE);
062: pathCtcon.setShortDescription(PATH_SHORT_DESCRIPTION);
063: //
064: StaticConceptTagConstraintContext pathSctcc = StaticConceptTagConstraintContext
065: .newInstance(pathCtcon);
066: pathSctcc.setRegularExpression(CommonExpressions.ANY_STRING);
067: //
068: pathSctcc.addDefaultValue("XMLPATH");
069: //TO DO: provide better default
070: //TO DO: define regular expression
071:
072: //constrain "attribute"
073: ConceptTagConstraint attributeCtcon = ConceptTagConstraint
074: .newInstance(ATTRIBUTE_CTCON, rootCtconh);
075: attributeCtcon.setTitle(ATTRIBUTE_TITLE);
076: attributeCtcon.setShortDescription(ATTRIBUTE_SHORT_DESCRIPTION);
077: //
078: StaticConceptTagConstraintContext attributeSctcc = StaticConceptTagConstraintContext
079: .newInstance(attributeCtcon);
080: attributeSctcc
081: .setRegularExpression(CommonExpressions.ANY_STRING);
082: //
083: attributeSctcc.addDefaultValue("XMLAttribute");
084: //TO DO: provide better default
085: //TO DO: define regular expression
086:
087: inIctc.initialize();
088:
089: //initialize characteristics
090: this .pathCtchar = pathCtcon.getCharacteristic();
091: this .attributeCtchar = attributeCtcon.getCharacteristic();
092:
093: }
094:
095: public void appraise(AppraiseConceptTagContext inCtic) {
096: if (inCtic instanceof StudioConceptTagInstanceInfoContext) {
097: StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inCtic;
098: sctiic.setInstanceTitle("Is Trigger Attribute Present");
099: sctiic
100: .setInstanceDescription("Determines if an attribute is within a trigger element");
101: } else if (inCtic instanceof StudioConceptTagTypeInfoContext) {
102: StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inCtic;
103: scttic.setTypeTitle("Is Trigger Attribute Present");
104: scttic
105: .setTypeDescription("Determines if an attribute is within a trigger element");
106: }
107: }
108:
109: public void determineValueAndClass(
110: DetermineValueAndClassConceptTagContext inRvacc) {
111:
112: inRvacc
113: .setDetermineException(new DetermineValueAndClassConceptTagException(
114: "Not Implemented"));
115: //ValueAndClassForConceptTag outValue = null;
116: //
117: //return outValue;
118: }
119:
120: public void determineClass(DetermineClassConceptTagContext inRcc) {
121: inRcc.setDetermineClass(Boolean.TYPE);
122: }
123: }
|