public void processConcept(I_GetConceptData concept) throws Exception { // get origins I_Path architectonicPath = termFactory.getPath(ArchitectonicAuxiliary.Concept.ARCHITECTONIC_BRANCH.getUids()); I_Position latestOnArchitectonicPath = termFactory.newPosition(architectonicPath, Integer.MAX_VALUE); origins.add(latestOnArchitectonicPath); Set<I_Position> branchPositions = new HashSet<I_Position>(); // TODO replace with passed in config... I_ConfigAceFrame config = Terms.get().getActiveAceFrameConfig(); // get all the concepts/paths/positions for the specified branches if (branches == null) { branchPositions = null; } else { for (ConceptDescriptor branch : branches) { I_GetConceptData currentConcept = branch.getVerifiedConcept(); I_Path currentPath = termFactory.getPath(currentConcept.getUids()); I_Position currentPosition = termFactory.newPosition(currentPath, Integer.MAX_VALUE); branchPositions.add(currentPosition); } } // get latest IS-A relationships I_IntSet isARel = termFactory.newIntSet(); isARel.add( termFactory.getConcept(ArchitectonicAuxiliary.Concept.IS_A_REL.getUids()).getConceptId()); List<? extends I_RelTuple> results = concept.getDestRelTuples( null, isARel, new PositionSetReadOnly(branchPositions), config.getPrecedence(), config.getConflictResolutionStrategy()); if (results.size() > count) { String message = "Concept: " + concept + " has > 20 children."; getLog().info(message); htmlWriter.append(message); htmlWriter.append("<br>"); textWriter.append(concept.getUids().toString()); textWriter.newLine(); } termFactory.addUncommitted(concept); }
@BeanList(specs = {@Spec(directory = "tasks/ide/path", type = BeanType.TASK_BEAN)}) public class SetEditPath extends AbstractTask { /** */ private static final long serialVersionUID = 1L; private static final int dataVersion = 1; private TermEntry editPathEntry = new TermEntry(ArchitectonicAuxiliary.Concept.ARCHITECTONIC_BRANCH.getUids()); private void writeObject(ObjectOutputStream out) throws IOException { out.writeInt(dataVersion); out.writeObject(editPathEntry); } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int objDataVersion = in.readInt(); if (objDataVersion == dataVersion) { editPathEntry = (TermEntry) 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_TermFactory tf = Terms.get(); I_Path editPath = tf.getPath(editPathEntry.ids); I_ConfigAceFrame frameConfig = tf.getActiveAceFrameConfig(); Set<I_Path> editSet = frameConfig.getEditingPathSet(); editSet.clear(); frameConfig.addEditingPath(editPath); frameConfig.fireUpdateHierarchyView(); return Condition.CONTINUE; } catch (IllegalArgumentException 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 TermEntry getEditPathEntry() { return editPathEntry; } public void setEditPathEntry(TermEntry editPathEntry) { this.editPathEntry = editPathEntry; } }