Search in sources :

Example 6 with Relation

use of org.kie.dmn.model.v1_1.Relation in project kie-wb-common by kiegroup.

the class RelationPropertyConverter method wbFromDMN.

public static Relation wbFromDMN(final org.kie.dmn.model.v1_1.Relation dmn) {
    Id id = new Id(dmn.getId());
    Description description = new Description(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    List<org.kie.dmn.model.v1_1.InformationItem> column = dmn.getColumn();
    List<org.kie.dmn.model.v1_1.List> row = dmn.getRow();
    List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList());
    List<org.kie.workbench.common.dmn.api.definition.v1_1.List> convertedRow = row.stream().map(ListPropertyConverter::wbFromDMN).collect(Collectors.toList());
    Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow);
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation) List(java.util.List) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 7 with Relation

use of org.kie.dmn.model.v1_1.Relation in project webcert by sklintyg.

the class IntygRelationHelperImpl method decorateIntygListWithRelations.

@Override
public void decorateIntygListWithRelations(List<ListIntygEntry> fullIntygItemList) {
    ListRelationsForCertificateResponseType response = getRelationsFromIntygstjanst(fullIntygItemList.stream().map(ListIntygEntry::getIntygId).collect(Collectors.toList()));
    if (response != null) {
        // Very ugly, iterate over both lists, find matches and create relation(s) on the ListIntygEntries.
        for (IntygRelations ir : response.getIntygRelation()) {
            for (ListIntygEntry lie : fullIntygItemList) {
                if (lie.getIntygId().equals(ir.getIntygsId().getExtension())) {
                    // Create a Relations instance to hold relations.
                    lie.setRelations(new Relations());
                    // Iterate over all relations for this particular intyg
                    for (Relation r : ir.getRelation()) {
                        applyRelation(lie.getIntygId(), lie.getRelations(), r);
                    }
                }
            }
        }
    }
    // account.
    for (ListIntygEntry lie : fullIntygItemList) {
        Relations relations = certificateRelationService.getRelations(lie.getIntygId());
        mergeRelations(lie.getRelations(), relations);
    }
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) WebcertCertificateRelation(se.inera.intyg.webcert.common.model.WebcertCertificateRelation) Relation(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) ListIntygEntry(se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations)

Example 8 with Relation

use of org.kie.dmn.model.v1_1.Relation in project webcert by sklintyg.

the class IntygRelationHelperImpl method getRelationsForIntyg.

@Override
public Relations getRelationsForIntyg(String intygId) {
    Relations certificateRelations = new Relations();
    ListRelationsForCertificateResponseType response = getRelationsFromIntygstjanst(intygId);
    // Iterate over all relations fetched from IT, split them up into parent and child relation(s)
    response.getIntygRelation().stream().flatMap(ir -> ir.getRelation().stream()).forEach(r -> applyRelation(intygId, certificateRelations, r));
    // Enrich with any relations present only in Webcert (e.g. for utkast etc.)
    Relations webcertRelations = certificateRelationService.getRelations(intygId);
    mergeRelations(certificateRelations, webcertRelations);
    return certificateRelations;
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType) CertificateRelationService(se.inera.intyg.webcert.web.service.relation.CertificateRelationService) Autowired(org.springframework.beans.factory.annotation.Autowired) ListRelationsForCertificateResponderInterface(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponderInterface) Collectors(java.util.stream.Collectors) Value(org.springframework.beans.factory.annotation.Value) List(java.util.List) WebcertCertificateRelation(se.inera.intyg.webcert.common.model.WebcertCertificateRelation) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) UtkastStatus(se.inera.intyg.webcert.common.model.UtkastStatus) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) Service(org.springframework.stereotype.Service) RelationKod(se.inera.intyg.common.support.common.enumerations.RelationKod) ListIntygEntry(se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry) Collections(java.util.Collections) Relation(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation) ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations)

Example 9 with Relation

use of org.kie.dmn.model.v1_1.Relation in project drools by kiegroup.

the class RelationConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    Relation r = (Relation) parent;
    for (InformationItem c : r.getColumn()) {
        writeChildrenNode(writer, context, c, COLUMN);
    }
    for (org.kie.dmn.model.api.List row : r.getRow()) {
        writeChildrenNode(writer, context, row, ROW);
    }
}
Also used : TRelation(org.kie.dmn.model.v1_1.TRelation) Relation(org.kie.dmn.model.api.Relation) InformationItem(org.kie.dmn.model.api.InformationItem)

Aggregations

InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)3 Relation (org.kie.workbench.common.dmn.api.definition.v1_1.Relation)3 Relation (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation)3 WebcertCertificateRelation (se.inera.intyg.webcert.common.model.WebcertCertificateRelation)3 List (java.util.List)2 IntygRelations (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations)2 ListRelationsForCertificateResponseType (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType)2 ListIntygEntry (se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry)2 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)2 XStream (com.thoughtworks.xstream.XStream)1 TypeHierarchyPermission (com.thoughtworks.xstream.security.TypeHierarchyPermission)1 IOException (java.io.IOException)1 Collections (java.util.Collections)1 Collectors (java.util.stream.Collectors)1 QName (javax.xml.namespace.QName)1 DMNExtensionRegister (org.kie.dmn.api.marshalling.DMNExtensionRegister)1 DMNXStream (org.kie.dmn.backend.marshalling.v1x.DMNXStream)1 Definitions (org.kie.dmn.model.api.Definitions)1 InformationItem (org.kie.dmn.model.api.InformationItem)1 Relation (org.kie.dmn.model.api.Relation)1