Search in sources :

Example 1 with Relation

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation in project voltdb by VoltDB.

the class VoltDBOsmSink method process.

/**
     * {@inheritDoc}
     */
public void process(RelationContainer relationContainer) {
    Relation relation;
    int memberSequenceId;
    relation = relationContainer.getEntity();
    try {
        client.callProcedure(new InsertCallback(), INS_RELATIONS_PROC, relation.getId(), relation.getVersion(), relation.getUser().getId(), relation.getTimestamp(), relation.getChangesetId());
    } catch (NoConnectionsException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    memberSequenceId = 0;
    for (RelationMember member : relation.getMembers()) {
        try {
            client.callProcedure(new InsertCallback(), INS_RELATIONS_MEMBER_PROC, relation.getId(), member.getMemberId(), member.getMemberType().ordinal(), member.getMemberRole(), memberSequenceId);
        } catch (NoConnectionsException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        memberSequenceId++;
    }
    for (Tag tag : relation.getTags()) {
        try {
            client.callProcedure(new InsertCallback(), INS_RELATION_TAGS_PROC, relation.getId(), tag.getKey(), tag.getValue());
        } catch (NoConnectionsException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
Also used : Relation(org.openstreetmap.osmosis.core.domain.v0_6.Relation) NoConnectionsException(org.voltdb.client.NoConnectionsException) RelationMember(org.openstreetmap.osmosis.core.domain.v0_6.RelationMember) IOException(java.io.IOException) Tag(org.openstreetmap.osmosis.core.domain.v0_6.Tag)

Example 2 with Relation

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation in project kie-wb-common by kiegroup.

the class RelationEditorDefinition method getModelClass.

@Override
public Optional<Relation> getModelClass() {
    final Relation relation = new Relation();
    final InformationItem column = new InformationItem();
    final org.kie.workbench.common.dmn.api.definition.v1_1.List row = new org.kie.workbench.common.dmn.api.definition.v1_1.List();
    row.getExpression().add(new LiteralExpression());
    relation.getColumn().add(column);
    relation.getRow().add(row);
    return Optional.of(relation);
}
Also used : LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation)

Example 3 with Relation

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation in project kie-wb-common by kiegroup.

the class RelationPropertyConverter method dmnFromWB.

public static org.kie.dmn.model.v1_1.Relation dmnFromWB(final Relation wb) {
    org.kie.dmn.model.v1_1.Relation result = new org.kie.dmn.model.v1_1.Relation();
    result.setId(wb.getId().getValue());
    result.setDescription(wb.getDescription().getValue());
    QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
    for (InformationItem iitem : wb.getColumn()) {
        org.kie.dmn.model.v1_1.InformationItem iitemConverted = InformationItemPropertyConverter.dmnFromWB(iitem);
        result.getColumn().add(iitemConverted);
    }
    for (org.kie.workbench.common.dmn.api.definition.v1_1.List list : wb.getRow()) {
        org.kie.dmn.model.v1_1.List listConverted = ListPropertyConverter.dmnFromWB(list);
        result.getRow().add(listConverted);
    }
    return result;
}
Also used : InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation)

Example 4 with Relation

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation in project kie-wb-common by kiegroup.

the class RelationUIModelMapperTest method setup.

@Before
public void setup() {
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiRelationColumn1);
    this.uiModel.appendColumn(uiRelationColumn2);
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiRelationColumn1).getIndex();
    doReturn(2).when(uiRelationColumn2).getIndex();
    this.relation = new Relation();
    this.relation.getColumn().add(new InformationItem());
    this.relation.getColumn().add(new InformationItem());
    this.relation.getRow().add(new List() {

        {
            getExpression().add(new LiteralExpression() {

                {
                    setText("le(1,0)");
                }
            });
            getExpression().add(new LiteralExpression() {

                {
                    setText("le(2,0)");
                }
            });
        }
    });
    this.relation.getRow().add(new List() {

        {
            getExpression().add(new LiteralExpression() {

                {
                    setText("le(1,1)");
                }
            });
            getExpression().add(new LiteralExpression() {

                {
                    setText("le(2,1)");
                }
            });
        }
    });
    this.mapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
    this.cellValueSupplier = Optional::empty;
}
Also used : Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation) DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Optional(java.util.Optional) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) List(org.kie.workbench.common.dmn.api.definition.v1_1.List) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 5 with Relation

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation in project kie-wb-common by kiegroup.

the class AddRelationColumnCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.informationItem = new InformationItem();
    this.uiModel = new BaseGridData();
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
    makeCommand(1);
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn).getIndex();
}
Also used : RelationUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper) Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Aggregations

Relation (org.kie.workbench.common.dmn.api.definition.v1_1.Relation)12 Before (org.junit.Before)7 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)6 List (org.kie.workbench.common.dmn.api.definition.v1_1.List)4 RelationUIModelMapper (org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper)4 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)4 WebcertCertificateRelation (se.inera.intyg.webcert.common.model.WebcertCertificateRelation)4 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)3 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)3 IntygRelations (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations)3 Relation (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation)3 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 InformationItem (org.kie.dmn.model.v1_1.InformationItem)2 Relation (org.kie.dmn.model.v1_1.Relation)2 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)2 ListRelationsForCertificateResponseType (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType)2 ListIntygEntry (se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry)2