1 19 package org.openharmonise.rm.resources.workflow.properties.ranges; 20 21 import java.util.*; 22 23 import org.openharmonise.commons.dsi.*; 24 import org.openharmonise.rm.DataAccessException; 25 import org.openharmonise.rm.dsi.DataStoreInterfaceFactory; 26 import org.openharmonise.rm.factory.*; 27 import org.openharmonise.rm.resources.*; 28 import org.openharmonise.rm.resources.metadata.properties.ranges.AbsoluteChildObjectRange; 29 import org.openharmonise.rm.resources.workflow.values.WorkflowStageValue; 30 import org.openharmonise.rm.workflow.WorkflowPropertyInstance; 31 32 33 40 public class WorkflowRange extends AbsoluteChildObjectRange { 41 42 45 public WorkflowRange() { 46 super(WorkflowRange.class.getName()); 47 } 48 49 53 public WorkflowRange(String sObjClassName, String sDetails) { 54 super(sObjClassName, sDetails); 55 } 56 57 64 public List getStageDefinitions() throws DataAccessException { 65 return getAvailableValues(); 66 } 67 68 71 public Class getPropertyInstanceClass() throws ClassNotFoundException { 72 return WorkflowPropertyInstance.class; 73 } 74 75 82 public List getAvailableValues() throws DataAccessException { 83 Vector result = new Vector(); 84 try { 85 AbstractDataStoreInterface dsi = 86 DataStoreInterfaceFactory.getDataStoreInterface(); 87 88 AbstractChildObject child = 89 (AbstractChildObject) WorkflowStageValue.class.newInstance(); 90 91 String sParentClassName = child.getParentObjectClassName(); 92 93 Iterator iter = getAllowedParents().iterator(); 94 95 while (iter.hasNext()) { 96 String sPath = (String ) iter.next(); 97 98 AbstractParentObject parent = 99 ( 100 AbstractParentObject) HarmoniseObjectFactory 101 .instantiateHarmoniseObject( 102 dsi, 103 sParentClassName, 104 sPath); 105 106 addAllChildObjectsToList(result, parent); 107 108 } 109 110 } catch (HarmoniseFactoryException e) { 111 throw new DataAccessException( 112 "Error occured getting parent from factory", 113 e); 114 } catch (InstantiationException e) { 115 throw new DataAccessException( 116 "Error occured getting class for child", 117 e); 118 } catch (IllegalAccessException e) { 119 throw new DataAccessException( 120 "Error occured getting class for child", 121 e); 122 } catch (DataStoreException e) { 123 throw new DataAccessException( 124 "Error occured getting class for child:", 125 e); 126 } 127 128 return result; 129 } 130 131 134 public boolean isValid(Object obj) { 135 136 return (obj instanceof WorkflowStageValue); 137 } 138 139 142 public String getChildObjectValueClassName(AbstractChildObject child) { 143 return WorkflowStageValue.class.getName(); 144 } 145 146 149 public void setObjectRestriction(String sClassname) { 150 } 152 153 } 154 | Popular Tags |