JAVA if (choiceDefinition != null && choiceDefinition.getMaximumMultiplicity() != null) { if (choiceDefinition.get__parent() instanceof RuleDefinition) { RuleDefinition rd = (RuleDefinition)choiceDefinition.get__parent(); String type = RuleDefinitionUtil.getConstrainedUMLTypeName(rd); if (type != null) { Integer maximumMultiplicity = MultiplicityUtil.extractMaximumMultiplicity( choiceDefinition.getMaximumMultiplicity()); ChoiceDefault choiceDefault = ChoiceDefinitionAnalyzer.extractChoiceDefaultFromChoiceDefinition(choiceDefinition); if (choiceDefault!= null && choiceDefault.getMax()!= null && maximumMultiplicity != null && maximumMultiplicity &gt; choiceDefault.getMax()) { return false; } } } } return true; JAVA if (choiceDefinition != null && choiceDefinition.getMinimumMultiplicity() != null) { if (choiceDefinition.get__parent() instanceof RuleDefinition) { RuleDefinition rd = (RuleDefinition)choiceDefinition.get__parent(); String type = RuleDefinitionUtil.getConstrainedUMLTypeName(rd); if (type != null) { Integer minimumMultiplicity = choiceDefinition.getMinimumMultiplicity(); ChoiceDefault choiceDefault = ChoiceDefinitionAnalyzer.extractChoiceDefaultFromChoiceDefinition(choiceDefinition); if (choiceDefault!= null && choiceDefault.getMin()!= null && minimumMultiplicity != null && minimumMultiplicity < choiceDefault.getMin()) { return false; } } } } return true; JAVA if (choiceDefinition != null && choiceDefinition.getMinimumMultiplicity() != null) { if (choiceDefinition.get__parent() instanceof RuleDefinition) { RuleDefinition rd = (RuleDefinition)choiceDefinition.get__parent(); String type = RuleDefinitionUtil.getConstrainedUMLTypeName(rd); if (type != null && ChoiceDefinitionUtil.getElements(choiceDefinition) != null) { for (RuleDefinition child : ChoiceDefinitionUtil.getElements(choiceDefinition)) { String typeChild = RuleDefinitionUtil.getConstrainedUMLTypeName(child); if (typeChild == null) { return false; } } } } } return true; JAVA if (includeDefinition != null) { } return true; JAVA if (vocab != null) { return vocab.getCode()!=null || vocab.getCodeSystem() != null || vocab.getValueSet() != null; } return true; JAVA if (vocab != null) { if (vocab.getValueSet() != null) { Decor decor = null; if (vocab.get__parent() instanceof Attribute) { Attribute par = (Attribute)vocab.get__parent(); decor = AttributeUtil.getParentTemplateDefinition(par).get__parent().get__parent(); } else if (vocab.get__parent() instanceof RuleDefinition) { RuleDefinition par = (RuleDefinition)vocab.get__parent(); decor = RuleDefinitionUtil.getParentTemplateDefinition(par).get__parent().get__parent(); } if (decor != null) { return DecorUtil.containValueSet(vocab.getValueSet(), decor); } } } return true; JAVA if (vocab != null) { if (vocab.getValueSet() != null) { Decor decor = null; if (vocab.get__parent() instanceof Attribute) { Attribute par = (Attribute)vocab.get__parent(); decor = AttributeUtil.getParentTemplateDefinition(par).get__parent().get__parent(); String type = AttributeUtil.getUMLTypeName(par, null); if (!UMLLoader.isEnumeration(type)){ return true; } if (DecorUtil.containValueSet(vocab.getValueSet(), decor)) { String vv = DecorUtil.getValueSetOid(vocab.getValueSet(), decor); ValueSet vsc = TerminologyUtil.getValueSetById(decor.getTerminology(), vv); if (vsc != null && vsc.getConceptList() != null && ValueSetConceptListUtil.getConcepts(vsc.getConceptList()) != null) { List<ValueSetConcept&gt; lvsc = ValueSetConceptListUtil.getConcepts(vsc.getConceptList()); for (ValueSetConcept valueSetConcept : lvsc) { if (valueSetConcept.getCode() != null) { if (!UMLLoader.checkIfEnumerationContainsValue(type, valueSetConcept.getCode())) { return false; } } } } } } } } return true; JAVA if (vocab != null && vocab.getCode() != null) { if (vocab.get__parent() instanceof Attribute) { Attribute par = (Attribute)vocab.get__parent(); String type = AttributeUtil.getUMLTypeName(par, null); if (!UMLLoader.isEnumeration(type)){ return true; } if (!UMLLoader.checkIfEnumerationContainsValue(type, vocab.getCode())) { return false; } } } return true; JAVA if (vocab != null && ( vocab.getCode() != null || vocab.getCodeSystem() != null || vocab.getValueSet() != null )) { if (vocab.get__parent() instanceof RuleDefinition) { RuleDefinition par = (RuleDefinition)vocab.get__parent(); if (par.getAttribute() != null && par.getAttribute().size()&gt;0) { Attribute codeAttr = RuleDefinitionUtil.getAttributeByName(par, "code"); if (codeAttr != null && AttributeUtil.getAttributeValue(codeAttr, "code") != null) { String value = AttributeUtil.getAttributeValue(codeAttr, "code"); boolean vocabIsConformToCodeAttribute = vocab.getCode() == null || vocab.getCode().equals(value); if (!vocabIsConformToCodeAttribute) { return false; } boolean vocabHasConformValueSetToCodeAttribtue = vocab.getValueSet() == null || valueSetContainsCode(vocab.getValueSet(), RuleDefinitionUtil.getParentTemplateDefinition(par).get__parent().get__parent(), value); if (!vocabHasConformValueSetToCodeAttribtue) { return false; } } Attribute codeSystemAttr = RuleDefinitionUtil.getAttributeByName(par, "codeSystem"); if (codeSystemAttr != null && AttributeUtil.getAttributeValue(codeSystemAttr, "codeSystem") != null) { String value = AttributeUtil.getAttributeValue(codeSystemAttr, "codeSystem"); boolean vocabIsConformToCodeSystemAttribute = vocab.getCodeSystem() == null || vocab.getCodeSystem().equals(value); if (!vocabIsConformToCodeSystemAttribute) { return false; } boolean vocabHasConformValueSetToCodeSystemAttribtue = vocab.getValueSet() == null || valueSetContainsCodesystem(vocab.getValueSet(), RuleDefinitionUtil.getParentTemplateDefinition(par).get__parent().get__parent(), value); if (!vocabHasConformValueSetToCodeSystemAttribtue) { return false; } } } } } return true; JAVA if (vsr != null) { Decor decor = vsr.get__parent().get__parent().get__parent().get__parent(); Map<String, Set<String&gt;&gt; aa = VSChecker.findCircularValueSets(decor); if (aa != null && aa.size()&gt;0) { String val = vsr.getRef(); String parent = vsr.get__parent().get__parent().getId(); if (aa.containsKey(parent)) { if (aa.get(parent).contains(val)) { return false; } } } } return true; JAVA if (attribute != null) { if (attribute.get__parent() instanceof RuleDefinition) { return AttributeUtil.getUMLTypeName(attribute, null) != null; } return true; } return false; JAVA if (attribute != null) { return AttributeUtil.getBetterMatchingName(attribute) != null; } return false; JAVA if (attribute != null && attribute.getDatatype()!=null && attribute.getDatatype().getLocalPart()!= null && attribute.getDatatype().getLocalPart().equals("set_cs")) { String type = AttributeUtil.getUMLTypeName(attribute, null); if (type != null) { Integer max = AttributeUtil.getUMLMaxAttribute(attribute); return max == -1; } } return true; JAVA if (attribute != null && attribute.getVocabulary().size()&gt;0) { String type = AttributeUtil.getUMLTypeName(attribute, null); return type!=null && !type.equals("Boolean"); } return true; JAVA String type = AttributeUtil.getUMLTypeName(attribute, null); if (type != null && attribute.get__parent() instanceof RuleDefinition && attribute.getName() != null && (attribute.isIsOptional()!=null && attribute.isIsOptional()) ) { String parentElementType = RuleDefinitionUtil.getConstrainedUMLTypeName((RuleDefinition)attribute.get__parent()); int min = UMLLoader.getMinAttribute(parentElementType, attribute.getName()); return min == 0; } return true; JAVA String type = AttributeUtil.getUMLTypeName(attribute, null); if (type != null && attribute.get__parent() instanceof RuleDefinition && attribute.getName() != null && (attribute.isIsOptional()==null || !attribute.isIsOptional()) ) { String parentElementType = RuleDefinitionUtil.getConstrainedUMLTypeName((RuleDefinition)attribute.get__parent()); String defVal = UMLLoader.getDefaultValue(parentElementType, attribute.getName()); if (defVal != null) { return attribute.getValue() == null || !attribute.getValue().equals(defVal); } } return true; JAVA String type = AttributeUtil.getUMLTypeName(attribute, null); if (type != null && attribute.get__parent() instanceof RuleDefinition && attribute.getName() != null && (attribute.getDatatype()!=null) ) { AttDatatype dt = AttDatatype.getAttDatatypeByName(attribute.getDatatype().getLocalPart()); if (dt == null) { return false; } } return true; JAVA String type = AttributeUtil.getUMLTypeName(attribute, null); if (type != null && attribute.get__parent() instanceof RuleDefinition && attribute.getName() != null && (attribute.getDatatype()!=null) ) { AttDatatype dt = AttDatatype.getAttDatatypeByName(attribute.getDatatype().getLocalPart()); if (dt != null) { return AttributeCheckerUtil.verifyThatDatatypeIsSupported(attribute, dt); } } return true; JAVA String type = AttributeUtil.getUMLTypeName(attribute, null); if (type != null && attribute.get__parent() instanceof RuleDefinition && attribute.getName() != null && (attribute.isProhibited()!=null) && attribute.isProhibited()) { String parentElementType = RuleDefinitionUtil.getConstrainedUMLTypeName((RuleDefinition)attribute.get__parent()); int min = UMLLoader.getMinAttribute(parentElementType, attribute.getName()); return min == 0; } return true; JAVA String type = AttributeUtil.getUMLTypeName(attribute, null); if (type != null && attribute.get__parent() instanceof RuleDefinition && attribute.getName() != null && (attribute.getValue()!=null) && attribute.getName() != null) { PackageableElement cdaenum = UMLLoader.lookForPackageableElementFromName(type); if (cdaenum instanceof Enumeration) { return UMLLoader.checkIfEnumerationContainsValue(type, attribute.getValue()); } else if (type.equals(UMLPrimitiveType.Boolean.getValue())) { return validateBoolean(attribute.getValue()); } else if (type.equals(UMLPrimitiveType.Integer.getValue())) { return validateInteger(attribute.getValue()); } else if (type.equals(UMLPrimitiveType.Double.getValue())) { return validateDouble(attribute.getValue()); } } return true; JAVA if (attribute.get__parent() instanceof RuleDefinition && attribute.getName() != null) { String type = RuleDefinitionUtil.getUMLTypeName((RuleDefinition)attribute.get__parent()); if (type != null) { return AttributeUtil.getUMLTypeName(attribute, null) != null; } } return true; JAVA if (rules != null && RulesUtil.getTemplates(rules) != null) { List<TemplateDefinition&gt; aa = TemplateDefinitionUtil.extractListCDATemplate(RulesUtil.getTemplates(rules)); if (aa != null && aa.size()&gt;0) { return true; } } return false; JAVA if (property != null && PropertyUtil.isMinIncludeAttributePresent(property) && PropertyUtil.isMaxIncludeAttributePresent(property)) { try { return Double.valueOf(property.getMinInclude())<=Double.valueOf(property.getMaxInclude()); } catch(Exception e) { return false; } } return true; JAVA if (property != null && property.getMinInclude() != null) { try { Double.valueOf(property.getMinInclude()); return true; } catch(Exception e) { return false; } } return true; JAVA if (property != null && property.getMaxInclude() != null) { try { Double.valueOf(property.getMaxInclude()); return true; } catch(Exception e) { return false; } } return true; JAVA if (property != null && property.getMinLength() != null && property.getMaxLength() != null) { return property.getMinLength()<=property.getMaxLength(); } return true; JAVA if (property != null && property.getFractionDigits() != null) { return property.getFractionDigits().matches("(\\d+)!?"); } return true; JAVA // TODO !! return true; JAVA String allCurencyes = "AED;AFN;ALL;AMD;ANG;AOA;ARS;AUD;AWG;AZN;BAM;BBD;BDT;BGN;BHD;BIF;BMD;BND;BOB;BOV;BRL;BSD;BTN;BWP;BYR;BZD;CAD;CDF;" + "CHE;CHF;CHW;CLF;CLP;CNY;COP;COU;CRC;CUC;CUP;CVE;CZK;DJF;DKK;DOP;DZD;EGP;ERN;ETB;EUR;FJD;FKP;GBP;GEL;GHS;GIP;GMD;GNF;GTQ;GYD;" + "HKD;HNL;HRK;HTG;HUF;IDR;ILS;INR;IQD;IRR;ISK;JMD;JOD;JPY;KES;KGS;KHR;KMF;KPW;KRW;KWD;KYD;KZT;LAK;LBP;LKR;LRD;LSL;LTL;LYD;MAD;" + "MDL;MGA;MKD;MMK;MNT;MOP;MRO;MUR;MVR;MWK;MXN;MXV;MYR;MZN;NAD;NGN;NIO;NOK;NPR;NZD;OMR;PAB;PEN;PGK;PHP;PKR;PLN;PYG;QAR;RON;RSD;" + "RUB;RWF;SAR;SBD;SCR;SDG;SEK;SGD;SHP;SLL;SOS;SRD;SSP;STD;SVC;SYP;SZL;THB;TJS;TMT;TND;TOP;TRY;TTD;TWD;TZS;UAH;UGX;USD;USN;UYI;" + "UYU;UZS;VEF;VND;VUV;WST;XAF;XAG;XAU;XBA;XBB;XBC;XBD;XCD;XDR;XOF;XPD;XPF;XPT;XSU;XTS;XUA;XXX;YER;ZAR;ZMW;ZWL"; if (property != null && property.getCurrency() != null) { if (!Arrays.asList(allCurencyes.split(";")).contains(property.getCurrency())) { return false; } } return true; JAVA if (property != null && property.getUnit() != null && property.get__parent() != null) { RuleDefinition rd = (RuleDefinition)property.get__parent(); String type = RuleDefinitionUtil.getConstrainedUMLTypeName(rd); if (type != null) { return UMLLoader.getPropertyTypeName(type + ".unit") != null; } } return true; JAVA if (property != null && property.getCurrency() != null && property.get__parent() != null) { RuleDefinition rd = (RuleDefinition)property.get__parent(); String type = RuleDefinitionUtil.getConstrainedUMLTypeName(rd); if (type != null) { return UMLLoader.getPropertyTypeName(type + ".currency") != null; } } return true; JAVA if (property != null && property.getUnit() != null && property.get__parent() != null) { RuleDefinition rd = (RuleDefinition)property.get__parent(); String type = RuleDefinitionUtil.getConstrainedUMLTypeName(rd); if (type != null) { PackageableElement pe = UMLLoader.lookForPackageableElementFromName(type); if (pe != null) { boolean datatypeContainsMixedContent = UmlServices.hasStereotype(pe, "EClass") && UmlServices.getStereotypeValue(pe, "EClass", "xmlContentKind") != null && UmlServices.getStereotypeValue(pe, "EClass", "xmlContentKind").equals("Mixed"); if (!datatypeContainsMixedContent) { return false; } } } } return true; JAVA if (property != null && property.getValue() != null && property.get__parent() != null) { RuleDefinition rd = (RuleDefinition)property.get__parent(); String type = RuleDefinitionUtil.getConstrainedUMLTypeName(rd); if (type != null) { return UMLLoader.getPropertyTypeName(type + ".value") != null; } } return true; JAVA if (report != null) { Pattern pat = Pattern.compile("[^(a-zA-Z)](\\w+):(\\w+)"); Matcher mat = pat.matcher(report.getTest()); while (mat.find()) { if (mapNamespaces == null || !mapNamespaces.containsKey(mat.group(1))) { return false; } } } return true; JAVA if (report != null) { Pattern pat = Pattern.compile("[^\\w]$(\\w+)"); Matcher mat = pat.matcher(report.getTest()); if (mat.find()) { return false; } } return true; JAVA if (RuleDefinitionProblemUtil.verifyThatRuleDefinitionIsUnique(ruleDefinition) || RuleDefinitionProblemUtil.verifyThatRuleDefinitionHasUniqueDistinguisher(ruleDefinition) || RuleDefinitionProblemUtil.verifyThatRuleDefinitionCanHaveNegativeDistinguisher(ruleDefinition)){ return true; } return false; JAVA if (RuleDefinitionProblemUtil.ruleDefinitionNameIsTreatable(ruleDefinition) && RuleDefinitionProblemUtil.ruleDefinitionHasKnownType(ruleDefinition)) { return true; } return false; JAVA if (ruleDefinition != null && ruleDefinition.getMinimumMultiplicity() != null) { String typeName = extractTypeNameOfTheParent(ruleDefinition); if (typeName != null) { String attrName = RuleDefinitionUtil.getRealNameOfRuleDefinition(ruleDefinition); int realElementMin = UMLLoader.getMinAttribute(typeName, attrName); if (ruleDefinition.getMinimumMultiplicity()< realElementMin) { return false; } } } return true; JAVA if (ruleDefinition != null && ruleDefinition.getMaximumMultiplicity() != null) { String typeName = extractTypeNameOfTheParent(ruleDefinition); if (typeName != null) { String attrName = RuleDefinitionUtil.getRealNameOfRuleDefinition(ruleDefinition); int realElementMax = UMLLoader.getMaxAttribute(typeName, attrName); int max = Integer.valueOf(ruleDefinition.getMaximumMultiplicity().equals("*")?"100000":ruleDefinition.getMaximumMultiplicity()); if (max &gt; realElementMax) { return false; } } } return true; JAVA if (ruleDefinition != null && !ruleDefinition.isIsMandatory()) { if (verifyDElementISForCustodianId(ruleDefinition)) { return false; } } return true; JAVA if (ruleDefinition.getDatatype() != null) { String dt = ruleDefinition.getDatatype().getLocalPart(); if (dt == null) { return false; } if (!DTUtils.datatypesContainDT(dt)) { return false; } } return true; JAVA if (ruleDefinition.getDatatype() != null) { String typeRD = RuleDefinitionUtil.getUMLTypeName(ruleDefinition); String dt = ruleDefinition.getDatatype().getLocalPart(); if (dt == null) { return true; } if (!DTUtils.datatypesContainDT(dt)) { return true; // this is handled by CDATEM-007 } String realDTConstrained = DTUtils.getUMLDatatype(dt); if (!realDTConstrained.equals(typeRD) && !DTUtils.ignoreDTExtensionError(dt)){ return false; } } return true; JAVA if (ruleDefinition != null && ruleDefinition.getMaximumMultiplicity() != null) { String typeName = extractTypeNameOfTheParent(ruleDefinition); if (typeName != null) { return ruleDefinition.getMaximumMultiplicity().equals("*") || ruleDefinition.getMaximumMultiplicity().matches("\\d+"); } } return true; JAVA if (templateDefinition != null) { if (templateDefinition.getContext() == null || templateDefinition.getContext().getPath() == null || !templateDefinition.getContext().getPath().equals("/")) { return true; } List<RuleDefinition&gt; aa = TemplateDefinitionUtil.getElementsByName(templateDefinition, "ClinicalDocument"); List<RuleDefinition&gt; bb = TemplateDefinitionUtil.getElements(templateDefinition); return aa!=null && aa.size()==1 && bb != null && bb.size()==1; } return false;
JAVA if (ruleDefinition != null && ruleDefinition.getText().size()&gt;0) { for (String text : ruleDefinition.getText()) { if (text.equals("")) { return false; } } } return true; JAVA if (ruleDefinition != null && ruleDefinition.getText().size()&gt;0) { String type = RuleDefinitionUtil.getConstrainedUMLTypeName(ruleDefinition); PackageableElement pe = UMLLoader.lookForPackageableElementFromName(type); if (pe != null) { boolean datatypeContainsMixedContent = UmlServices.hasStereotype(pe, "EClass") && UmlServices.getStereotypeValue(pe, "EClass", "xmlContentKind") != null && UmlServices.getStereotypeValue(pe, "EClass", "xmlContentKind").equals("Mixed"); if (!datatypeContainsMixedContent) { return false; } } } return true; JAVA if (includeDefinition != null && includeDefinition.getRef() != null) { Decor decor = extractDecorFromIncludeDefinition(includeDefinition); String incRef = includeDefinition.getRef(); String incParentTemplateIdentifier = extractParentTemplateIdentifierFromIncludeDefinition(includeDefinition); Map<String, Set<String&gt;&gt; mapCirc = IncludeChecker.mapCircularIncludes(decor); if (incRef != null && incParentTemplateIdentifier != null && mapCirc != null) { if (mapCirc.containsKey(incParentTemplateIdentifier)) { return !mapCirc.get(incParentTemplateIdentifier).contains(incRef); } } } return true; JAVA if (let != null) { Pattern pat = Pattern.compile("[^(a-zA-Z)](\\w+):(\\w+)"); Matcher mat = pat.matcher(let.getValue()); while (mat.find()) { if (mapNamespaces == null || !mapNamespaces.containsKey(mat.group(1))) { return false; } } } return true; JAVA if (let != null) { List<Let&gt; llets = null; if (let.get__parent() instanceof RuleDefinition) { llets = RuleDefinitionUtil.getLets((RuleDefinition)let.get__parent()); } else if (let.get__parent() instanceof TemplateDefinition) { llets = TemplateDefinitionUtil.getLets((TemplateDefinition)let.get__parent()); } if (llets != null) { int i = 0; while (i++<20 && letsStillContainsReferences(llets)) { for (Let let2 : llets) { for (Let letToReplace : llets) { let2.setValue(let2.getValue().replace("$" + letToReplace.getName(), letToReplace.getValue())); } } } if (let.getValue().matches(".*\\$\\w+.*")) { return false; } } } return true; JAVA if (valueSetConceptList != null && valueSetConceptList.getException().size()&gt;0) { for (ValueSetConcept vsc : valueSetConceptList.getException()) { if (vsc.getCode() == null) { return false; } return UMLLoader.checkIfEnumerationContainsValue("NullFlavor", vsc.getCode()); } } return true; JAVA if (asser != null) { Pattern pat = Pattern.compile("[^(a-zA-Z)](\\w+):(\\w+)"); Matcher mat = pat.matcher(asser.getTest()); while (mat.find()) { if (mapNamespaces == null || !mapNamespaces.containsKey(mat.group(1))) { return false; } } } return true; JAVA if (asser != null) { Pattern pat = Pattern.compile("[^\\w]$(\\w+)"); Matcher mat = pat.matcher(asser.getTest()); if (mat.find()) { return false; } } return true;