/** * Updates the pathNodeMap with given cobj * * @param cobj */ public void updatePathNodeMap(CObject cobj) { if(cobj != null) { pathNodeMap.put(cobj.path(), cobj); } }
/** * Updates the pathNodeMap with given cobj * * @param cobj */ public void updatePathNodeMap(CObject cobj) { if(cobj != null) { pathNodeMap.put(cobj.path(), cobj); } }
/** * Check if this object node is required by occurrences * and path of nodes for which values are submitted * * @param paths a set of path of nodes for which values submitted * @return ture if this node is required */ public boolean isRequired(Set<String> paths) { if (isRequired()) { return true; } // if any submitted value for descendant nodes for (String path : paths) { if (path.startsWith(path())) { return true; } } return false; }
/** * Check if this object node is required by occurrences * and path of nodes for which values are submitted * * @param paths a set of path of nodes for which values submitted * @return ture if this node is required */ public boolean isRequired(Set<String> paths) { if (isRequired()) { return true; } // if any submitted value for descendant nodes for (String path : paths) { if (path.startsWith(path())) { return true; } } return false; }
void replaceSlotWithFlattened(CAttribute cattr, Archetyped definition, CObject cobj) { List<CObject> children = cattr.getChildren(); if (children == null) { return; } for (int index = 0, j = children.size(); index < j; index++) { CObject child = children.get(index); if (child instanceof ArchetypeSlot) { // if the slot matches the template def children.remove(index); cobj.setPath(child.path()); children.add(index, cobj); } } }
/** * Finds and replaces according archetypeSlot with fully flattened cobj * * @param cattr * @param definition * @param cobj */ void replaceSlotWithFlattened(CAttribute cattr, Archetyped definition, CObject cobj) { List<CObject> children = cattr.getChildren(); if(children == null) { return; } for(int i = 0, j = children.size(); i < j; i++) { CObject child = children.get(i); if(child instanceof ArchetypeSlot) { // if the slot matches the template def children.remove(i); cobj.setPath(child.path()); children.add(i, cobj); } } }
/** * Finds and replaces according archetypeSlot with fully flattened cobj * * @param cattr * @param definition * @param cobj */ void replaceSlotWithFlattened(CAttribute cattr, Archetyped definition, CObject cobj) { List<CObject> children = cattr.getChildren(); if(children == null) { return; } for(int i = 0, j = children.size(); i < j; i++) { CObject child = children.get(i); if(child instanceof ArchetypeSlot) { // if the slot matches the template def children.remove(i); cobj.setPath(child.path()); children.add(i, cobj); } } }
private void checkSiblingNodeIdAndName(CAttribute parent, String nodeId, String name) throws FlatteningException { for(CObject cobj : parent.getChildren()) { if(nodeId.equals(cobj.path()) && name.equals(cobj.getNodeId())) { throw new FlatteningException("duplicated node_id/name: " + nodeId + "/" + name + "at path: " + parent.path()); } } }
private void checkSiblingNodeIdAndName(CAttribute parent, String nodeId, String name) throws FlatteningException { for (CObject cobj : parent.getChildren()) { if (nodeId.equals(cobj.path()) && name.equals(cobj.getNodeId())) { throw new FlatteningException("duplicated node_id/name: " + nodeId + "/" + name + "at path: " + parent.path()); } } }
private void checkSiblingNodeIdAndName(CAttribute parent, String nodeId, String name) throws FlatteningException { for(CObject cobj : parent.getChildren()) { if(nodeId.equals(cobj.path()) && name.equals(cobj.getNodeId())) { throw new FlatteningException("duplicated node_id/name: " + nodeId + "/" + name + "at path: " + parent.path()); } } }
private void validateSpecialisedCObject(CObject cobj, Archetype archetype, Archetype parentArchetype, int childSpecialisationDepth, List<ValidationError> errors) { String pathInParent = getExpectedPathInParentArchetype(cobj.path(), childSpecialisationDepth-1); if (pathInParent== null) { return; } CObject nodeInParent = (CObject)parentArchetype.node(pathInParent); if (nodeInParent == null) { return; } checkSpecialisedOccurrencesCompatiblity(nodeInParent, cobj, errors); }
private void processCObject(CObject constrainedObj) { String path = constrainedObj.path(); String archetypeId = ar.getArchetypeId().getValue(); if (!OpenEHRConst.PARSABLE_OPENEHR_RM_NAMES.contains(constrainedObj.getRmTypeName())) { return; } if (constrainedObj instanceof CComplexObject) { processComplexObject(constrainedObj, path, archetypeId); } else if (constrainedObj instanceof ArchetypeSlot) { //Skip } }
String path = cobj.path(); if ("/".equals(path)) { path = prefix;
String path = cobj.path(); if("/".equals(path)) { path = prefix;
String path = cobj.path(); path = replaceNodeIdWithNamedNode(path, nodeId, name); cobj.setPath(path);
String path = cobj.path(); path = replaceNodeIdWithNamedNode(path, nodeId, name); cobj.setPath(path);
String path = cobj.path(); path = replaceNodeIdWithNamedNode(path, nodeId, name); cobj.setPath(path);
/** Checks that the occurrences of the corresponding node in the parent conforms to the specialised node's occurrences * * @param parentNode * @param ccobj * @param errors */ private void checkSpecialisedOccurrencesCompatiblity(CObject parentNode, CObject ccobj, List<ValidationError> errors) { if (! parentNode.getOccurrences().isUpperUnbounded() && ( ccobj.getOccurrences().isUpperUnbounded() || parentNode.getOccurrences().getUpper().compareTo( ccobj.getOccurrences().getUpper()) <0)) { errors.add(new ValidationError (ErrorType.VSONCO, null, getIntervalFormalString(ccobj.getOccurrences()), ccobj.path(), getIntervalFormalString(parentNode.getOccurrences()), parentNode.path())); } }