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); }
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); } }
private void listRefset() throws Exception { // TODO replace with passed in config... I_ConfigAceFrame config = Terms.get().getActiveAceFrameConfig(); getLog().info("refset list"); list_file.getParentFile().mkdirs(); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(this.list_file))); final I_TermFactory tf = Terms.get(); if (this.path_uuid != null) { this.path = tf.getPath(Arrays.asList(UUID.fromString(this.path_uuid))); } // I_IntSet allowed_status = tf.newIntSet(); // allowed_status.add(ArchitectonicAuxiliary.Concept.CURRENT.localize().getNid()); refset_con = tf.getConcept(Arrays.asList(UUID.fromString(this.refset_con_uuid))); out.println("<html>"); out.println("<head>"); out.println("<style type=\"text/css\">"); out.println("BODY {font:10pt sans-serif}"); out.println("TABLE {font:10pt sans-serif; border-collapse:collapse}"); out.println("TD {border: 1px solid; padding:5px}"); out.println("</style>"); out.println("</head>"); out.println("<body>"); out.println("<h2>"); out.println("Refset Report"); out.println("</h2>"); out.println("<p>"); out.println( escapeString( DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(new Date()))); ArrayList<Integer> refsets = getCoreDescendants(refset_con.getConceptId(), getActiveStatus(), this.path); if (this.sort_by_name) { Collections.sort( refsets, new Comparator<Integer>() { public int compare(Integer obj1, Integer obj2) { try { String s1 = tf.getConcept(obj1).getInitialText(); String s2 = tf.getConcept(obj2).getInitialText(); return s1.compareTo(s2); } catch (Exception e) { } return obj1.compareTo(obj2); } }); } for (Integer con_id : refsets) { I_GetConceptData con = tf.getConcept(con_id); out.println("<h3>"); out.println(escapeString(con.getInitialText())); out.println("</h3>"); out.println("<table border=\"1\">"); for (UUID id : con.getUids()) { out.println("<tr>"); out.println("<td>"); out.println("ID"); out.println("<td>"); out.println(escapeString(String.valueOf(id))); } for (String r : Arrays.asList( "dd413e49-c124-3b05-8c25-0da5922379d3", "7a981930-621f-3935-b26c-47f54413a59d", "41fbef7f-7210-3288-97cb-c860dfc90601", "f60922c9-cb3d-3099-8960-1097d2c5afdc")) { I_GetConceptData r_con = tf.getConcept(Arrays.asList(UUID.fromString(r))); if (r_con != null) { boolean found = false; String head = r_con.getInitialText().replace(" rel", ""); I_IntSet r_set = tf.newIntSet(); r_set.add(r_con.getConceptId()); for (I_GetConceptData val_con : con.getSourceRelTargets( getActiveStatus(), r_set, null, config.getPrecedence(), config.getConflictResolutionStrategy())) { // for (int val_id : getRelationship(con.getConceptId(), // r_con.getConceptId(), null, Integer.MAX_VALUE)) { // I_GetConceptData val_con = tf.getConcept(val_id); if (val_con != null) { found = true; out.println("<tr>"); out.println("<td>"); out.println(escapeString(head)); out.println("<td>"); out.println(escapeString(val_con.getInitialText())); } } if (!found) { out.println("<tr>"); out.println("<td>"); out.println(escapeString(head)); out.println("<td>"); } } } // comments rel "ff1b55d3-2b7b-382c-ae42-eceffcc47c71" // promotion rel "9a801240-b3b0-3475-8a7b-07111d3ff564" for (String r : Arrays.asList( "ff1b55d3-2b7b-382c-ae42-eceffcc47c71", "9a801240-b3b0-3475-8a7b-07111d3ff564")) { I_GetConceptData r_con = tf.getConcept(Arrays.asList(UUID.fromString(r))); if (r_con != null) { boolean found = false; String head = r_con.getInitialText().replace(" rel", ""); I_IntSet r_set = tf.newIntSet(); r_set.add(r_con.getConceptId()); for (I_GetConceptData val_con : con.getSourceRelTargets( getActiveStatus(), r_set, null, config.getPrecedence(), config.getConflictResolutionStrategy())) { if (val_con != null) { found = true; out.println("<tr>"); out.println("<td>"); out.println(escapeString(head)); out.println("<td>"); // out.println(val_con.getInitialText()); // for (I_ExtendByRef mem : tf.getRefsetExtensionMembers(val_con.getConceptId())) { I_GetConceptData mem_con = tf.getConcept(mem.getComponentId()); I_ExtendByRefPart p = mem.getMutableParts().get(0); if (p instanceof I_ExtendByRefPartStr) { I_ExtendByRefPartStr pccs = (I_ExtendByRefPartStr) p; out.println("<tr>"); out.println("<td>"); out.println("<td>"); out.println(escapeString(pccs.getStringValue())); } else { getLog().info("Wrong type: " + p.getClass() + " " + mem_con.getInitialText()); } } // } } if (!found) { out.println("<tr>"); out.println("<td>"); out.println(escapeString(head)); out.println("<td>"); } } } out.println("</table>"); } out.println("</body>"); out.println("</html>"); out.close(); // make a copy of the report file, in Maven's site folder site_output_file.getParentFile().mkdirs(); copy(list_file, site_output_file); }