public String toString() { long thickTime = Terms.get().convertToThickVersion(time); try { I_GetConceptData path = Terms.get().getConcept(pathId); return new Date(thickTime) + " on path " + path; } catch (TerminologyException e) { AceLog.getAppLog().alertAndLogException(e); } catch (IOException e) { AceLog.getAppLog().alertAndLogException(e); } return new Date(thickTime) + " on path " + pathId; }
@Override public Collection<RefsetMember<?, ?>> entryToObject(TupleInput input) { assert enclosingConcept != null; int listSize = input.readInt(); Collection<RefsetMember<?, ?>> newRefsetMemberList; HashMap<Integer, RefsetMember<?, ?>> nidToRefsetMemberMap = null; if (refsetMemberList != null) { newRefsetMemberList = refsetMemberList; nidToRefsetMemberMap = new HashMap<Integer, RefsetMember<?, ?>>(listSize); for (RefsetMember<?, ?> component : refsetMemberList) { nidToRefsetMemberMap.put(component.nid, component); } } else { newRefsetMemberList = new ArrayList<RefsetMember<?, ?>>(listSize); } for (int index = 0; index < listSize; index++) { int typeNid = input.readInt(); // Can be removed in the future, here strictly for read/write conformance testing. try { REFSET_TYPES.nidToType(typeNid); } catch (IOException e1) { AceLog.getAppLog() .alertAndLogException(new Exception("For concept: " + enclosingConcept.toString(), e1)); AceLog.getAppLog().info("List prior to exception: " + newRefsetMemberList); return newRefsetMemberList; } input.mark(8); int nid = input.readInt(); input.reset(); RefsetMember<?, ?> refsetMember = (RefsetMember<?, ?>) Concept.componentsCRHM.get(nid); if (nidToRefsetMemberMap != null && nidToRefsetMemberMap.containsKey(nid)) { if (refsetMember == null) { refsetMember = nidToRefsetMemberMap.get(nid); RefsetMember<?, ?> oldMember = (RefsetMember<?, ?>) Concept.componentsCRHM.putIfAbsent(nid, refsetMember); if (oldMember != null) { refsetMember = oldMember; if (nidToRefsetMemberMap != null) { nidToRefsetMemberMap.put(nid, refsetMember); } } } refsetMember.readComponentFromBdb(input); } else { try { if (refsetMember == null) { refsetMember = factory.create(nid, typeNid, enclosingConcept, input); if (refsetMember.getTime() != Long.MIN_VALUE) { Concept.componentsCRHM.putIfAbsent(nid, refsetMember); RefsetMember<?, ?> oldMember = (RefsetMember<?, ?>) Concept.componentsCRHM.putIfAbsent(nid, refsetMember); if (oldMember != null) { refsetMember = oldMember; if (nidToRefsetMemberMap != null) { nidToRefsetMemberMap.put(nid, refsetMember); } } } else { AceLog.getAppLog() .warning( "\n########## Suppressing refset member:\n " + refsetMember + "\n##########"); } } else { refsetMember.merge(factory.create(nid, typeNid, enclosingConcept, input)); } } catch (IOException e) { throw new RuntimeException(e); } if (refsetMember.getTime() != Long.MIN_VALUE) { newRefsetMemberList.add(refsetMember); } } } return newRefsetMemberList; }