private String getArchetypeKey(ArchetypeBinding archetypeBinding) { return archetypeBinding.getDomain() + "|" + archetypeBinding.getArchetypeId() + archetypeBinding.getTemplateId(); }
private void generateGTCodeMapForElementBinding( ArchetypeBinding archetypeBinding, ArchetypeInstantiationRuleLine airl, ElementBinding elementBinding) { ArchetypeElementInstantiationRuleLine aeirl = new ArchetypeElementInstantiationRuleLine(airl); aeirl.setReadableGuide(readableGuide); aeirl.setGTCode(elementBinding.getId()); if ("/event/time".equals(elementBinding.getPath())) { elementBinding.setPath(OpenEHRRMUtil.EVENT_TIME_PATH); } String elementId = archetypeBinding.getArchetypeId() + elementBinding.getPath(); ArchetypeElementVO archetypeElementVO = archetypeManager.getArchetypeElements().getArchetypeElement( archetypeBinding.getTemplateId(), elementId); if (archetypeElementVO == null) { throw new RuntimeException( "Element '" + elementId + (archetypeBinding.getTemplateId() != null ? " (" + archetypeBinding.getTemplateId() + ")" : "") + "' not found!"); } aeirl.setArchetypeElementVO(archetypeElementVO); gtCodeElementMap.put(elementBinding.getId(), aeirl); } }
private void generateGtCodeMapForArchetypeBinding(ArchetypeBinding archetypeBinding) throws InternalErrorException { ArchetypeInstantiationRuleLine airl = new ArchetypeInstantiationRuleLine(); airl.setReadableGuide(readableGuide); airl.setGTCode(archetypeBinding.getId()); ArchetypeReference ar = new ArchetypeReference( archetypeBinding.getDomain(), archetypeBinding.getArchetypeId(), archetypeBinding.getTemplateId()); airl.setArchetypeReference(ar); gtCodeElementMap.put(archetypeBinding.getId(), airl); if (archetypeBinding.getElements() != null) { for (ElementBinding elementBinding : archetypeBinding.getElements().values()) { generateGTCodeMapForElementBinding(archetypeBinding, airl, elementBinding); } } }
private static GeneratedArchetypeReference getGeneratedArchetypeReference( ArchetypeBinding archetypeBinding, String guideId, Guide guide, DateTime dateTime, boolean resolvePredicates) { GeneratedArchetypeReference ar = new GeneratedArchetypeReference( archetypeBinding.getDomain(), archetypeBinding.getArchetypeId(), archetypeBinding.getTemplateId()); if (archetypeBinding.getElements() != null) { for (ElementBinding elementBinding : archetypeBinding.getElements().values()) { String idElement = archetypeBinding.getArchetypeId() + elementBinding.getPath(); GeneratedElementInstance gei = new GeneratedElementInstance( idElement, null, ar, null, NULL_FLAVOUR_CODE_NO_INFO); gei.getRuleReferences().add(new RuleReference(guideId, elementBinding.getId())); } } generatePredicateElements(archetypeBinding, ar, guideId, guide, dateTime, resolvePredicates); return ar; }
ArchetypeElementVO archetypeElementVO = airl.getArchetypeManager().getArchetypeElements().getArchetypeElement( archetypeBinding.getTemplateId(), archetypeBinding.getArchetypeId() + path); if (archetypeElementVO == null) { throw new RuntimeException( "Element '" + archetypeBinding.getArchetypeId() + path + (archetypeBinding.getTemplateId() != null ? " (" + archetypeBinding.getTemplateId() + ")" : "") + "' not found!"); ArchetypeElementVO archetypeElementVO = airl.getArchetypeManager().getArchetypeElements().getArchetypeElement( archetypeBinding.getTemplateId(), archetypeBinding.getArchetypeId() + path); if (archetypeElementVO == null) { throw new RuntimeException( "Element '" + archetypeBinding.getArchetypeId() + path + (archetypeBinding.getTemplateId() != null ? " (" + archetypeBinding.getTemplateId() + ")" : "") + "' not found!"); ArchetypeElementVO archetypeElementVO = airl.getArchetypeManager().getArchetypeElements().getArchetypeElement( archetypeBinding.getTemplateId(), archetypeBinding.getArchetypeId() + path); if (archetypeElementVO == null) { throw new RuntimeException( "Element '" + archetypeBinding.getArchetypeId() + path + (archetypeBinding.getTemplateId() != null ? " (" + archetypeBinding.getTemplateId() + ")" : "") + "' not found!");