private void filterIsALocalTerminology( boolean negation, Set<ArchetypeReference> archetypeReferencesToRemove, Set<CodePhrase> codePhrases, ElementInstance elementInstance, CodePhrase codePhrase) { boolean isA = simpleIsACheck(codePhrase, codePhrases); if ((!isA && !negation) || (isA && negation)) { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } }
public void addAll(Collection<ElementInstance> elementInstances) { Set<ArchetypeReference> archetypeReferences = new HashSet<>(); for (ElementInstance elementInstance : elementInstances) { archetypeReferences.add(elementInstance.getArchetypeReference()); } addAll(archetypeReferences, null); }
private void filterIsAExternalTerminology( boolean negation, Set<ArchetypeReference> archetypeReferencesToRemove, Set<CodePhrase> codePhrases, ElementInstance elementInstance, CodePhrase codePhrase) { boolean isA = terminologyService.isSubclassOf(codePhrase, codePhrases); if ((!isA && !negation) || (isA && negation)) { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } }
public void add(ElementInstance elementInstance) { add(elementInstance.getArchetypeReference(), null, null); }
private void filterMaxMin(String elementId, Collection<ArchetypeReference> ehrArchetypeReferences, boolean max) { final Set<ArchetypeReference> archetypeReferencesToRemove = new HashSet<>(); ElementInstance maxElementInstance = null; for (ArchetypeReference archetypeReference : ehrArchetypeReferences) { ElementInstance elementInstance = archetypeReference.getElementInstancesMap().get(elementId); if (elementInstance != null) { if (elementInstance.getDataValue() != null) { if (maxElementInstance == null || isMaxMin(elementInstance, maxElementInstance, max)) { if (maxElementInstance != null) { archetypeReferencesToRemove.add(maxElementInstance.getArchetypeReference()); } maxElementInstance = elementInstance; } else { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } } else { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } } } ehrArchetypeReferences.removeAll(archetypeReferencesToRemove); }
private void filterEquals( PredicateGeneratedElementInstance predicate, Collection<ArchetypeReference> ehrArchetypeReferences, boolean negation) { final Set<ArchetypeReference> archetypeReferencesToRemove = new HashSet<>(); for (ArchetypeReference archetypeReference : ehrArchetypeReferences) { ElementInstance elementInstance = archetypeReference.getElementInstancesMap().get(predicate.getId()); if (elementInstance != null) { DataValue dataValue = elementInstance.getDataValue(); if (dataValue != null) { boolean equals = dataValue.equals(predicate.getDataValue()); if ((!equals && !negation) || (equals && negation)) { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } } else { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } } } ehrArchetypeReferences.removeAll(archetypeReferencesToRemove); }
private void filterGreaterLessThanPredicate( String elementId, DataValue dv, Collection<ArchetypeReference> ehrArchetypeReferences, boolean greaterThan, Calendar date) { if (dv instanceof CurrentTimeExpressionDataValue) { OperatorKind operatorKind = greaterThan ? OperatorKind.GREATER_THAN_OR_EQUAL : OperatorKind.LESS_THAN_OR_EQUAL; dv = ElementInstanceCollectionManager.resolvePredicate(dv, operatorKind, null, date); if (dv == null) { LoggerFactory.getLogger(PredicateFilterManager.class).warn("No Data Value returned after resolving predicate!"); } } final Set<ArchetypeReference> archetypeReferencesToRemove = new HashSet<>(); for (ArchetypeReference archetypeReference : ehrArchetypeReferences) { ElementInstance elementInstance = archetypeReference.getElementInstancesMap().get(elementId); if (elementInstance != null) { if (elementInstance.getDataValue() != null) { int compare = DVUtil.compareDVs(dv, elementInstance.getDataValue()); if (compare != 0 && ((greaterThan && compare > 0) || (!greaterThan && compare < 0))) { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } } else { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } } } ehrArchetypeReferences.removeAll(archetypeReferencesToRemove); }
private void filterIsA( PredicateGeneratedElementInstance predicate, Collection<ArchetypeReference> ehrArchetypeReferences, boolean negation) { final Set<ArchetypeReference> archetypeReferencesToRemove = new HashSet<>(); final Set<CodePhrase> codePhrases = getCodePhrases(predicate); ElementInstance elementInstance; for (ArchetypeReference archetypeReference : ehrArchetypeReferences) { elementInstance = archetypeReference.getElementInstancesMap().get(predicate.getId()); if (elementInstance != null && codePhrases != null) { CodePhrase codePhrase = getCodePhrase(elementInstance); try { if (codePhrase != null) { if ("local".equalsIgnoreCase(codePhrase.getTerminologyId().name())) { filterIsALocalTerminology(negation, archetypeReferencesToRemove, codePhrases, elementInstance, codePhrase); } else { filterIsAExternalTerminology(negation, archetypeReferencesToRemove, codePhrases, elementInstance, codePhrase); } } else { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); } } catch (Exception exception) { archetypeReferencesToRemove.add(elementInstance.getArchetypeReference()); logger.warn("Filter isA ", exception); } } } ehrArchetypeReferences.removeAll(archetypeReferencesToRemove); }
public DVGenericPanel createDVGenericPanel(ElementInstance elementInstance) { if (!Domains.CDS_ID.equals(elementInstance.getArchetypeReference().getIdDomain()) && elementInstance instanceof PredicateGeneratedElementInstance) { elementInstance = new ElementInstance( elementInstance.getId(), null, elementInstance.getArchetypeReference(), null, OpenEHRConstUI.NULL_FLAVOUR_CODE_NO_INFO); } DVGenericPanel dvGenericPanel = getDVGenericForElement(elementInstance); for (JComponent component : dvGenericPanel.getJComponents()) { if (component instanceof JDateChooser) { ((JDateChooser) component).getDateEditor().getUiComponent().addFocusListener(new DVGenericComponentFocusAdapter(dvGenericPanel, elementInstance)); } else { component.addFocusListener(new DVGenericComponentFocusAdapter(dvGenericPanel, elementInstance)); } if (Domains.CDS_ID.equals(elementInstance.getArchetypeReference().getIdDomain()) || elementInstance instanceof PredicateGeneratedElementInstance) { DvSwingManager.disable(component); } } return dvGenericPanel; }
public JLabel createLabelForElement(ElementInstance elementInstance, TermDefinition termDefinition) { ArchetypeElementVO archetypeElement = archetypeManager.getArchetypeElements().getArchetypeElement( elementInstance.getArchetypeReference().getIdTemplate(), elementInstance.getId()); JLabel label; archetypeReferencesManager.getHTMLTooltip( archetypeElement, elementInstance.getArchetypeReference())); Icon dvIcon = OpenEHRDataValuesUI.getIcon(archetypeElement.getType()); Icon domainIcon = DomainsUI.getGroupIconFromArchetypeReference(elementInstance.getArchetypeReference()); label.setIcon(new MultipleIcon(new Icon[]{domainIcon, dvIcon})); return label;
throw new InternalErrorException(new Exception("Element for assignment expression " + guideAssignmentExpression + " not found!")); GeneratedArchetypeReference ar1 = (GeneratedArchetypeReference) conditionElementInstance.getArchetypeReference(); ArchetypeReference ar2 = assignmentElementInstance.getArchetypeReference(); if (!elementInstanceCollectionManager.matches(ar1, ar2, guideMap, cal)) { return false;
private DVGenericPanel getDVGenericForElement(ElementInstance elementInstance) { String idTemplate = elementInstance.getArchetypeReference().getIdTemplate(); String idElement = elementInstance.getId(); ArchetypeElementVO archetypeElement = archetypeManager.getArchetypeElements().getArchetypeElement( idTemplate, idElement); String rmType = archetypeElement.getType(); DVGenericPanel dvGenericPanel = dvPanelFactory.createDVPanel(idElement, idTemplate, rmType, true, true, false); if (dvGenericPanel != null) { dvGenericPanel.setDataValue(elementInstance.getDataValue()); } return dvGenericPanel; }