Type TPI Created Date 06-Aug-1999 Last Updated Title Constructing a SearchCondition to Query on the Life Cycle State of a LifeCycleManaged Object Details Additional Information Description ----------- It is not obvious how to construct a SearchCondition to query on the life cycle state of a LifeCycleManaged business object. Alternate Technique ------------------- See Resolution below. Resolution ---------- Since the "state" of a LifeCycleManaged object is an EnumeratedType, the appropriate SearchCondition constructor has the following signature: SearchCondition(Class, String, String, EnumeratedType) The following example Java code constructs a QuerySpec to search for WTDocument instances in the "In Work" life cycle state -- assuming the default locale is US English and the default definitions in StateRB.java (line 5 should be modified to select the Locale appropriately for the application): wt.query.QuerySpec qs = new wt.query.QuerySpec(wt.doc.WTDocument.class); java.util.Hashtable states = new java.util.Hashtable(); wt.lifecycle.State[] stateArray = wt.lifecycle.LifeCycleHelper.service.allStates(); for (int i = 0; i < stateArray.length; i++) states.put(stateArray[i].getDisplay(java.util.Locale.getDefault()), stateArray[i]); qs.appendSearchCondition(new wt.query.SearchCondition(wt.doc.WTDocument.class, wt.doc.WTDocument.LIFE_CYCLE_STATE, wt.query.SearchCondition.EQUAL, (wt.lifecycle.State)states.get("In Work")));