@BeanList(specs = {@Spec(directory = "tasks/ide/address", type = BeanType.TASK_BEAN)}) public class GetAddressesAndPositionsFromConceptStatusChanges extends AbstractTask { /** */ private static final long serialVersionUID = 1L; private static final int dataVersion = 1; private String activeConceptPropName = ProcessAttachmentKeys.ACTIVE_CONCEPT.getAttachmentKey(); private String profilePropName = ProcessAttachmentKeys.WORKING_PROFILE.getAttachmentKey(); private String addressListPropName = ProcessAttachmentKeys.ADDRESS_LIST.getAttachmentKey(); private String positionListPropName = ProcessAttachmentKeys.POSITION_LIST.getAttachmentKey(); private void writeObject(ObjectOutputStream out) throws IOException { out.writeInt(dataVersion); out.writeObject(profilePropName); out.writeObject(activeConceptPropName); out.writeObject(addressListPropName); out.writeObject(positionListPropName); } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int objDataVersion = in.readInt(); if (objDataVersion == dataVersion) { profilePropName = (String) in.readObject(); activeConceptPropName = (String) in.readObject(); addressListPropName = (String) in.readObject(); positionListPropName = (String) in.readObject(); } else { throw new IOException("Can't handle dataversion: " + objDataVersion); } } public void complete(I_EncodeBusinessProcess process, I_Work worker) throws TaskFailedException { // Nothing to do... } public Condition evaluate(I_EncodeBusinessProcess process, I_Work worker) throws TaskFailedException { try { I_ConfigAceFrame config = (I_ConfigAceFrame) worker.readAttachement(WorkerAttachmentKeys.ACE_FRAME_CONFIG.name()); I_TermFactory tf = Terms.get(); I_ConfigAceFrame workingProfile = (I_ConfigAceFrame) process.getProperty(profilePropName); if (workingProfile == null) { workingProfile = (I_ConfigAceFrame) worker.readAttachement(WorkerAttachmentKeys.ACE_FRAME_CONFIG.name()); } Object conceptObj = process.getProperty(activeConceptPropName); I_GetConceptData concept = AceTaskUtil.getConceptFromObject(conceptObj); List<? extends I_ConceptAttributeTuple> attrTupels = concept.getConceptAttributeTuples( workingProfile.getAllowedStatus(), workingProfile.getViewPositionSetReadOnly(), workingProfile.getPrecedence(), workingProfile.getConflictResolutionStrategy()); I_IntSet pathSet = Terms.get().newIntSet(); ArrayList<UniversalAcePosition> positionList = new ArrayList<UniversalAcePosition>(); for (I_ConceptAttributeTuple t : attrTupels) { positionList.add( new UniversalAcePosition( tf.getUids(t.getPathId()), tf.convertToThickVersion(t.getVersion()))); pathSet.add(t.getPathId()); } ArrayList<String> addressList = new ArrayList<String>(); I_IntList inboxDescTypeList = Terms.get().newIntList(); inboxDescTypeList.add(ArchitectonicAuxiliary.Concept.USER_INBOX.localize().getNid()); for (int pathId : pathSet.getSetValues()) { I_GetConceptData pathConcept = Terms.get().getConcept(pathId); I_DescriptionTuple inboxDesc = pathConcept.getDescTuple(inboxDescTypeList, config); if (inboxDesc == null) { worker.getLogger().info("Cannot find inbox for: " + pathConcept.getInitialText()); worker.getLogger().info(" inboxDescTypeList: " + inboxDescTypeList.getListArray()); for (I_DescriptionVersioned desc : pathConcept.getDescriptions()) { for (I_DescriptionTuple tuple : desc.getTuples()) { worker.getLogger().info(" desc tuple: " + tuple); } } } else { addressList.add(inboxDesc.getText()); } } process.setProperty(addressListPropName, addressList); process.setProperty(positionListPropName, positionList); worker.getLogger().info("Selected status values have these positions: " + positionList); worker.getLogger().info("Got addresses from status values: " + addressList); return Condition.CONTINUE; } catch (IllegalArgumentException e) { throw new TaskFailedException(e); } catch (IllegalAccessException e) { throw new TaskFailedException(e); } catch (InvocationTargetException e) { throw new TaskFailedException(e); } catch (IntrospectionException e) { throw new TaskFailedException(e); } catch (IOException e) { throw new TaskFailedException(e); } catch (TerminologyException e) { throw new TaskFailedException(e); } } public Collection<Condition> getConditions() { return CONTINUE_CONDITION; } public int[] getDataContainerIds() { return new int[] {}; } public String getActiveConceptPropName() { return activeConceptPropName; } public void setActiveConceptPropName(String propName) { this.activeConceptPropName = propName; } public String getProfilePropName() { return profilePropName; } public void setProfilePropName(String newStatusPropName) { this.profilePropName = newStatusPropName; } public String getPositionListPropName() { return positionListPropName; } public void setPositionListPropName(String pathListListPropName) { this.positionListPropName = pathListListPropName; } public String getAddressListPropName() { return addressListPropName; } public void setAddressListPropName(String addressListPropName) { this.addressListPropName = addressListPropName; } }
@BeanList(specs = {@Spec(directory = "tasks/ide/view", type = BeanType.TASK_BEAN)}) public class ClearViewPositions extends AbstractTask { /** */ private static final long serialVersionUID = 1L; private static final int dataVersion = 1; private String profilePropName = ProcessAttachmentKeys.WORKING_PROFILE.getAttachmentKey(); private void writeObject(ObjectOutputStream out) throws IOException { out.writeInt(dataVersion); out.writeObject(profilePropName); } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int objDataVersion = in.readInt(); if (objDataVersion == dataVersion) { profilePropName = (String) in.readObject(); } else { throw new IOException("Can't handle dataversion: " + objDataVersion); } } public void complete(I_EncodeBusinessProcess process, I_Work worker) throws TaskFailedException { // Nothing to do... } public Condition evaluate(I_EncodeBusinessProcess process, I_Work worker) throws TaskFailedException { try { I_ConfigAceFrame profile = (I_ConfigAceFrame) process.getProperty(profilePropName); profile.getViewPositionSet().clear(); return Condition.CONTINUE; } catch (IllegalArgumentException e) { throw new TaskFailedException(e); } catch (IllegalAccessException e) { throw new TaskFailedException(e); } catch (InvocationTargetException e) { throw new TaskFailedException(e); } catch (IntrospectionException e) { throw new TaskFailedException(e); } } public Collection<Condition> getConditions() { return CONTINUE_CONDITION; } public int[] getDataContainerIds() { return new int[] {}; } public String getProfilePropName() { return profilePropName; } public void setProfilePropName(String profilePropName) { this.profilePropName = profilePropName; } }