private String getType(CObject constrainedObj, CAttribute att) { String type; if (att != null) { if (att.getChildren() != null && !att.getChildren().isEmpty()) { type = att.getChildren().get(0).getRmTypeName(); } else { type = constrainedObj.getRmTypeName(); } } else { type = constrainedObj.getRmTypeName(); } type = convertTypeIfQuantityOrOrdinal(type); return type; }
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 } }
log.debug("Checking: "+ cattr.getRmAttributeName() +"; "+ parentObj.getRmTypeName() +" at "+cattr.path() +" parent path: "+parentObj.path()); if (parentObj.getRmTypeName().equalsIgnoreCase("CLUSTER") ) { // Note: For SECTION items, the intention seems to be cardinality = 0 log.debug("--> >=1"); return new Interval<Integer>(1,null); if (parentObj.getRmTypeName().equalsIgnoreCase("COMPOSITION")) { log.debug("--> >=1"); return new Interval<Integer>(1,null); if (parentObj.getRmTypeName().equalsIgnoreCase("CAPABILITY")) { log.debug("--> ==1"); return new Interval<Integer>(1,1);
private Map<String, String> checkInternalReferences(Archetype archetype, CComplexObject ccobj, Map<String, String> errors) { for (CAttribute cattribute : ccobj.getAttributes()) { for (CObject cobj : cattribute.getChildren()) { if (cobj instanceof ArchetypeInternalRef) { ArchetypeInternalRef ref = (ArchetypeInternalRef) cobj; ArchetypeConstraint target = archetype.node(ref.getTargetPath()); if (target == null || (! (target instanceof CObject)) || (!((CObject) target).getRmTypeName().equals( cobj.getRmTypeName()))) { // either target unknown or wrong type errors.put(ref.path(), ref.getTargetPath()); } } if (cobj instanceof CComplexObject) { checkInternalReferences(archetype, (CComplexObject) cobj, errors); } } } return errors; }
private Map<String, String> checkInternalReferences(Archetype archetype, CComplexObject ccobj, Map<String, String> errors) { for (CAttribute cattribute : ccobj.getAttributes()) { for (CObject cobj : cattribute.getChildren()) { if (cobj instanceof ArchetypeInternalRef) { ArchetypeInternalRef ref = (ArchetypeInternalRef) cobj; CObject target = (CObject) archetype.node(ref.getTargetPath()); if (target == null || !target.getRmTypeName().equals( cobj.getRmTypeName())) { // either target unknown or wrong type errors.put(ref.path(), ref.getTargetPath()); } } if (cobj instanceof CComplexObject) { checkInternalReferences(archetype, (CComplexObject) cobj, errors); } } } return errors; }
private Map<String, String> checkInternalReferences(Archetype archetype, CComplexObject ccobj, Map<String, String> errors) { for (CAttribute cattribute : ccobj.getAttributes()) { for (CObject cobj : cattribute.getChildren()) { if (cobj instanceof ArchetypeInternalRef) { ArchetypeInternalRef ref = (ArchetypeInternalRef) cobj; ArchetypeConstraint target = archetype.node(ref.getTargetPath()); if (target == null || (! (target instanceof CObject)) || (!((CObject) target).getRmTypeName().equals( cobj.getRmTypeName()))) { // either target unknown or wrong type errors.put(ref.path(), ref.getTargetPath()); } } if (cobj instanceof CComplexObject) { checkInternalReferences(archetype, (CComplexObject) cobj, errors); } } } return errors; }
&& "EVENT".equals(cobj.getRmTypeName())) {
/** Checks that the RM type of the parent's corresponding node conforms to the child'S node RM type. * * @param parentNode * @param ccobj * @param errors */ private void checkSpecialisedRMTypeCompatiblityForNonValueItems(CObject parentNode, CComplexObject ccobj, List<ValidationError> errors) { if (ccobj.path().endsWith("value") || ccobj.path().endsWith("value/")) { return; // as value items have a choice construct without further node ids we need to test these differently, i.e. as a whole for all value restrictions. } String rmChild = ccobj.getRmTypeName(); rmChild = removeGenericTypes(rmChild); Class childRMType = rmInspector.retrieveRMType(rmChild); String rmParent = parentNode.getRmTypeName(); rmParent = removeGenericTypes(rmParent); Class parentRMType = rmInspector.retrieveRMType(rmParent); if (parentRMType == null || rmChild == null) { errors.add (new ValidationError(ErrorType.VSONCT, "UNKNOWN", rmChild, ccobj.path(), rmParent)); // or simply return ?? // there is a problem with the rmtypes (probably one that is unknown), this is a different validation, so ignore here. } else if (! parentRMType.isAssignableFrom(childRMType)) { errors.add (new ValidationError(ErrorType.VSONCT, "NORMAL", childRMType.getSimpleName(), ccobj.path(), parentRMType.getSimpleName())); } }
String childType = child.getRmTypeName(); for (String type : includedTypes) { if ((DATA_TYPES_PREFIX + type).equalsIgnoreCase(childType)
for (CObject childInParent : parentAttr.getChildren()) { String childInParentRMTypeWithoutGenerics = removeGenericTypes(childInParent.getRmTypeName()); Class parentRMType = rmInspector.retrieveRMType(childInParentRMTypeWithoutGenerics); if (parentRMType == null) { errors.add (new ValidationError(ErrorType.VSONCT, "UNKNOWNFORPARENT", childInParent.getRmTypeName(), childInParent.path())); } else { parentObjectsToRMTypesWithoutGenerics.put(childInParent, parentRMType); String rmChildWithoutGenerics = removeGenericTypes(child.getRmTypeName()); Class childRMType = rmInspector.retrieveRMType(rmChildWithoutGenerics); String genericTypeInParentArchetype = getGenericType (parentToRMTypeWithoutGenerics.getKey().getRmTypeName()); if (genericTypeInParentArchetype != null) { String genericTypeInChildArchetype = getGenericType(child.getRmTypeName()); if (genericTypeInChildArchetype != null) {
String childType = child.getRmTypeName(); for(String type : includedTypes) { if((DATA_TYPES_PREFIX + type).equalsIgnoreCase(childType)
String childType = child.getRmTypeName(); for(String type : includedTypes) { if((DATA_TYPES_PREFIX + type).equalsIgnoreCase(childType)
protected void printCObjectElements(CObject cobj, Element out) { // we always need the upper case with underscore notation for the rm type name printString("rm_type_name", getUpperCaseWithUnderscoreFromCamelCase(cobj.getRmTypeName()), out); printOccurrences(cobj.getOccurrences(), out); printString("node_id", cobj.getNodeId(), out); }
for (CObject cobj : cattr.getChildren()) { log.debug("-----"); log.debug(cobj.getRmTypeName() + " " +cobj.path());
errors.add(error); } else { Class targetType = rmInspector.retrieveRMType(target.getRmTypeName()); log.debug("Target type: " + targetType); log.debug("rmtype: " + rmType);
String childRMTypeName = cobj.getRmTypeName(); childRMTypeName = removeGenericTypes(childRMTypeName); if (cobj2.getRmTypeName().equals(cobj.getRmTypeName()) && cobj.getNodeId() == null) { error = new ValidationError(ErrorType.VACSU, null, error = new ValidationError(ErrorType.VACMC, "CONTAIN", rmInspector.toUnderscoreSeparated(cobj.getClass().getSimpleName()).toUpperCase(), cobj.getRmTypeName(), cobj.getNodeId(), getIntervalFormalString(cardinalityInterval),
if (!c1.getRmTypeName().equals(c2.getRmTypeName())) { return false;
ccobj.path(), ccobj.getRmTypeName(), parentNode.getRmTypeName(), ccobj.getNodeId())); ccobj.path(), ccobj.getRmTypeName(), parentNode.getRmTypeName(), ccobj.getNodeId(), langPrim)); ccobj.path(), ccobj.getRmTypeName(), parentNode.getRmTypeName(), ccobj.getNodeId(), trans.getValue().getLanguage().getCodeString()));