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