/** * Creates an Archetyped without a templateId * * @param archetypeId * @param rmVersion * @throws IllegalArgumentException if archetypeId null * or rmVersion empty */ public Archetyped(String archetypeId, String rmVersion) { this(new ArchetypeID(archetypeId), null, rmVersion); }
/** * Return localID * * @return localID */ public String localID() { return getValue(); }
/** * Version of this archetype, extracted from id. * * @return version */ public String version() { return archetypeId.versionID(); }
/** * Checks the validity of the archetype specialisation parent identifier, i.e. * that the archetype identifier stated in the specialise clause is the * identifier of the immediate specialisation parent archetype. * * @param archetype * @param errors */ public void checkSpecializationParentIdentifierValidity(Archetype archetype, List<ValidationError> errors) { if (archetype.getParentArchetypeId() == null) { return; // no specialise clause at all } ArchetypeID atId = archetype.getArchetypeId(); String base = atId.base(); String calculatedBaseForParent = base.substring(0, base.lastIndexOf("-")); if (!calculatedBaseForParent.equals(archetype.getParentArchetypeId().base())) { ValidationError error = new ValidationError( ErrorType.VASID, "NORMAL", archetype.getArchetypeId().toString(), archetype.getParentArchetypeId().toString()); errors.add(error); } if (archetype.getParentArchetypeId().versionID().endsWith("draft")) { ValidationError error = new ValidationError( ErrorType.VASID, "DEPRECATED", archetype.getParentArchetypeId().toString()); errors.add(error); } }
public void loadArchetypeObjects() { String archId = ar.getArchetypeId().getValue(); String rmEntry = ar.getArchetypeId().rmEntity(); processCObject(ar.getDefinition()); Collection<ArchetypeElementVO> rmArchetypeElements = OpenEHRRMUtil.getRMElements(archId, templateId, rmEntry); for (ClusterVO clusterVO : clusterVOs) { if (OpenEHRConst.isEntry(clusterVO.getType()) && !clusterVO.getPath().equals("/")) { rmArchetypeElements.addAll(OpenEHRRMUtil.getRMElements(archId, templateId, clusterVO.getType(), clusterVO.getPath())); } } clusterVOs.addAll(OpenEHRRMUtil.getRMClusters(archId, templateId, rmEntry)); archetypeElementVOs.addAll(rmArchetypeElements); }
/** * Checks the archetype definition typename validity: The topmost typename mentioned * in the archetype definition section must match the type mentioned in the type-name * slot of the first segment of the archetype id. * * @param archetype * @param errors */ public void checkArchetypeDefinitionTypename(Archetype archetype, List<ValidationError> errors) { String conceptType = archetype.getArchetypeId().rmEntity(); String topType = archetype.getDefinition().getRmTypeName(); ValidationError error = null; if (!conceptType.equals(topType)) { error = new ValidationError(ErrorType.VARDT, null, topType, conceptType); errors.add(error); } }
public Archetype copy() { String parentId = parentArchetypeId == null ? null : parentArchetypeId.toString(); Archetype archetype = new Archetype(adlVersion, archetypeId.toString(), parentId, concept, getOriginalLanguage(), getTranslations(), null, getRevisionHistory(), isControlled(), uid, (CComplexObject) definition.copy(), ontology, invariants, null); reloadNodeMaps(); // set c_obj.parent()? return archetype; }
public Archetype copy() { String parentId = parentArchetypeId == null ? null : parentArchetypeId.toString(); Archetype archetype = new Archetype(adlVersion, archetypeId.toString(), parentId, concept, getOriginalLanguage(), getTranslations(), null, getRevisionHistory(), isControlled(), uid, (CComplexObject) definition.copy(), ontology, invariants, null); reloadNodeMaps(); // set c_obj.parent()? return archetype; }
/** * Return localID * * @return localID */ public String localID() { return getValue(); }
/** * Creates an Archetyped without a templateId * * @param archetypeId * @param rmVersion * @throws IllegalArgumentException if archetypeId null * or rmVersion empty */ public Archetyped(String archetypeId, String rmVersion) { this(new ArchetypeID(archetypeId), null, rmVersion); }
/** * Version of this archetype, extracted from id. * * @return version */ public String version() { return archetypeId.versionID(); }
@Override public String getKey() { return archetype.getArchetypeId().getValue(); }
this.archetypeId = new ArchetypeID(id); this.uid = uid; this.concept = concept; this.parentArchetypeId = (parentId == null ? null : new ArchetypeID( parentId)); this.definition = definition;
protected void printHeader(Archetype archetype, Element out) { Element originalLanguage = new Element("original_language", defaultNamespace); out.getChildren().add(originalLanguage); printCodePhrase(archetype.getOriginalLanguage(), originalLanguage); printString("is_controlled", archetype.isControlled() ? "true" : "false", out); printDescription(archetype.getDescription(), out); printTranslations(archetype.getTranslations(), out); if (archetype.getUid() != null) { Element uid = new Element("uid", defaultNamespace); out.getChildren().add(uid); printString("value", archetype.getUid().toString(), uid); } Element archetypeId = new Element("archetype_id", defaultNamespace); out.getChildren().add(archetypeId); printString("value", archetype.getArchetypeId().toString(), archetypeId); printString("adl_version", archetype.getAdlVersion(), out); printString("concept", archetype.getConcept(), out); final ArchetypeID parentID = archetype.getParentArchetypeId(); if(parentID != null) { Element parentArchetypeId = new Element("parent_archetype_id", defaultNamespace); out.getChildren().add(parentArchetypeId); printString("value", parentID.toString(), parentArchetypeId); } }
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 } }
this.archetypeId = new ArchetypeID(id); this.uid = uid; this.concept = concept; this.parentArchetypeId = (parentId == null ? null : new ArchetypeID( parentId)); this.definition = definition;
private Archetype flattenItem(Archetype parentArchetype, ITEM item) throws FlatteningException { String aid = parentArchetype == null ? "null" : parentArchetype.getArchetypeId().toString(); log.debug("flattening item on parentArchetype " + aid + " at path " + item.getPath()); Archetype archetype = retrieveArchetype(item.getArchetypeId()); applyTemplateConstraints(archetype, item); fillArchetypeSlot(parentArchetype, archetype, item.getPath(), item.getName()); return archetype; }
public Collection<ArchetypeTermVO> generateArchetypeTerms() { Collection<ArchetypeTermVO> archetypeTermVOs = new ArrayList<>(); ArchetypeOntology ao = ar.getOntology(); List<OntologyDefinitions> ods = ao.getTermDefinitionsList(); for (OntologyDefinitions od : ods) { String lang = od.getLanguage(); List<ArchetypeTerm> archetypeTerms = od.getDefinitions(); for (ArchetypeTerm archetypeTerm : archetypeTerms) { archetypeTermVOs.add( ArchetypeTermVO.builder() .archetypeId(ar.getArchetypeId().getValue()) .code(archetypeTerm.getCode()) .language(lang) .text(archetypeTerm.getText()) .description(archetypeTerm.getDescription()) .build()); } } return archetypeTermVOs; } }