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.common.tagging;
009:
010: //base classes
011:
012: //project specific classes
013:
014: //other classes
015:
016: public abstract class BaseInitializeConceptTagContext extends
017: BaseConceptTagCallContext implements
018: InitializeConceptTagContext {
019:
020: //
021: private ConceptTagPreferences ctp = null;
022: private ConceptTagConstraintHolder ctconh = null;
023: private ConceptTagConstraint parentCtcon = null;
024: private boolean initialized = false;
025:
026: protected BaseInitializeConceptTagContext(
027: ConceptTagPreferences inCtp, ConceptTagFlags inCtf) {
028: //
029: super (inCtp, inCtf);
030: this .ctp = inCtp;
031: }
032:
033: //below function only used by ConceptRollupTag
034: public void setPreferences(ConceptTagPreferences inCtp) {
035: this .ctp = inCtp;
036: }
037:
038: public ConceptTagPreferences getPreferences() {
039: return this .ctp;
040: }
041:
042: //
043: public abstract void nonImmediateValidation();
044:
045: //
046: public void initialize() {
047: this .initialized = true;
048: this .ctconh.validate(this );
049: }
050:
051: //
052: public ConceptTagConstraintHolder getConstraintHolder() {
053: return this .ctconh;
054: }
055:
056: public void setConstraintHolder(ConceptTagConstraintHolder inCtconh) {
057: this .ctconh = inCtconh;
058: }
059:
060: //
061: public ConceptTagConstraint getParentConstraint() {
062: return this .parentCtcon;
063: }
064:
065: public void setParentConstraint(ConceptTagConstraint inCtcon) {
066: this .parentCtcon = inCtcon;
067: }
068:
069: //
070: public boolean isInitialized() {
071: return this .initialized;
072: }
073:
074: public void setInitialized(boolean inInitialized) {
075: this .initialized = inInitialized;
076: }
077:
078: //
079: public void reset() {
080: }
081:
082: protected final static ConceptTagConstraintHolder createConstraintHolder(
083: //ConceptTagFlags inCtf,
084: ConceptTagPreferences inCtp,
085: ConceptTagCharacteristicHolder inCtcharh,
086: ConceptTagConstraint inParentCtcon) {
087:
088: return ConceptTagConstraintHolder.newInstance(
089: //inCtf,
090: inCtp, inCtcharh, inParentCtcon);
091: }
092:
093: protected final static ConceptTagPreferences getPreferences(
094: ConceptTagCharacteristicHolder inCtcharh) {
095: //
096: return inCtcharh.getPreferences();
097: }
098:
099: protected final static RootConceptTagHolder getEmptyRcth(
100: ConceptTagPreferences inCtp) {
101: //
102: RootConceptTagHolder outValue = null;
103:
104: outValue = new RootConceptTagHolder(inCtp);
105:
106: ConceptTagCharacteristicHolder rootCtcharh = ConceptTagCharacteristicHolder
107: .createRoot(inCtp, outValue);
108: ConceptTagHelper.getRootHolder(rootCtcharh, outValue);
109: //
110: ConceptTagCharacteristic firstCtchar = outValue
111: .getFirstCharacteristic();
112: int lastIndex = (firstCtchar.getValueLength() - 1);
113: for (int i = lastIndex; i >= 0; i--) {
114: firstCtchar.removeValueWithLocalFiles(i);
115: }
116: //outValue.setCharacteristicHolder(rootCtcharh);
117:
118: return outValue;
119: }
120:
121: protected final static SelectionCriteriaForConceptTag getSelectionCriteria(
122: ConceptTag inCt) {
123: //
124: SelectionCriteriaForConceptTag outValue = null;
125:
126: outValue = SelectionCriteriaForConceptTag.newInstance(inCt);
127:
128: inCt.appraise(outValue);
129:
130: return outValue;
131: }
132: }
|