Search in sources :

Example 1 with Relation

use of org.kie.dmn.model.v1_1.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 org.kie.dmn.model.v1_1.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 org.kie.dmn.model.v1_1.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 org.kie.dmn.model.v1_1.Relation in project webcert by sklintyg.

the class IntygRelationHelperImplTest method buildRelation.

private Relation buildRelation(String fromIntygId, String toIntygId) {
    Relation r = new Relation();
    IntygId from = new IntygId();
    from.setExtension(fromIntygId);
    IntygId to = new IntygId();
    to.setExtension(toIntygId);
    r.setFranIntygsId(from);
    r.setTillIntygsId(to);
    TypAvRelation typ = new TypAvRelation();
    typ.setCode(RelationKod.ERSATT.value());
    r.setTyp(typ);
    r.setSkapad(LocalDateTime.now());
    return r;
}
Also used : WebcertCertificateRelation(se.inera.intyg.webcert.common.model.WebcertCertificateRelation) TypAvRelation(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvRelation) Relation(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation) TypAvRelation(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvRelation) IntygId(se.riv.clinicalprocess.healthcond.certificate.types.v3.IntygId)

Example 5 with Relation

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

the class XStreamMarshaller method newXStream.

private XStream newXStream() {
    XStream xStream = XStreamUtils.createNonTrustingXStream(staxDriver, Definitions.class.getClassLoader(), DMNXStream::from);
    xStream.addPermission(new TypeHierarchyPermission(QName.class));
    xStream.addPermission(new TypeHierarchyPermission(KieDMNModelInstrumentedBase.class));
    xStream.alias("artifact", TArtifact.class);
    xStream.alias("definitions", TDefinitions.class);
    xStream.alias("inputData", TInputData.class);
    xStream.alias("decision", TDecision.class);
    xStream.alias("variable", TInformationItem.class);
    xStream.alias("informationRequirement", TInformationRequirement.class);
    xStream.alias("requiredInput", TDMNElementReference.class);
    xStream.alias("literalExpression", TLiteralExpression.class);
    // TODO will need to remove dups and find missing element not captured?
    xStream.alias("DMNElement", TDMNElement.class);
    xStream.alias("allowedValues", TUnaryTests.class);
    xStream.alias("artifact", TArtifact.class);
    xStream.alias("association", TAssociation.class);
    xStream.alias("authorityRequirement", TAuthorityRequirement.class);
    xStream.alias("authorityRequirement", TAuthorityRequirement.class);
    xStream.alias("authorityRequirement", TAuthorityRequirement.class);
    xStream.alias("binding", TBinding.class);
    xStream.alias("businessContextElement", TBusinessContextElement.class);
    xStream.alias("businessKnowledgeModel", TBusinessKnowledgeModel.class);
    xStream.alias("column", TInformationItem.class);
    xStream.alias("context", TContext.class);
    xStream.alias("contextEntry", TContextEntry.class);
    xStream.alias("decision", TDecision.class);
    xStream.alias("decisionMade", TDMNElementReference.class);
    xStream.alias("decisionMaker", TDMNElementReference.class);
    xStream.alias("decisionOwned", TDMNElementReference.class);
    xStream.alias("decisionOwner", TDMNElementReference.class);
    xStream.alias("decisionService", TDecisionService.class);
    xStream.alias("decisionTable", TDecisionTable.class);
    xStream.alias("defaultOutputEntry", TLiteralExpression.class);
    xStream.alias("definitions", TDefinitions.class);
    xStream.alias("drgElement", TDMNElementReference.class);
    // xStream.alias("drgElement", DRGElement.class ); ambiguity, also referring to top-level xsd element just under xsd root.
    xStream.alias("elementCollection", TElementCollection.class);
    xStream.alias("elementCollection", TElementCollection.class);
    xStream.alias("encapsulatedDecision", TDMNElementReference.class);
    xStream.alias("encapsulatedLogic", TFunctionDefinition.class);
    xStream.alias("expression", TExpression.class);
    xStream.alias("formalParameter", TInformationItem.class);
    xStream.alias("functionDefinition", TFunctionDefinition.class);
    xStream.alias("impactedPerformanceIndicator", TDMNElementReference.class);
    xStream.alias("impactingDecision", TDMNElementReference.class);
    xStream.alias("import", TImport.class);
    xStream.alias("import", TImport.class);
    // TODO where?
    xStream.alias("importedElement", String.class);
    xStream.alias("importedValues", TImportedValues.class);
    xStream.alias("informationItem", TInformationItem.class);
    xStream.alias("informationRequirement", TInformationRequirement.class);
    xStream.alias("input", TInputClause.class);
    xStream.alias("inputData", TDMNElementReference.class);
    xStream.alias("inputData", TInputData.class);
    xStream.alias("inputDecision", TDMNElementReference.class);
    xStream.alias("inputEntry", TUnaryTests.class);
    xStream.alias("inputExpression", TLiteralExpression.class);
    xStream.alias("inputValues", TUnaryTests.class);
    xStream.alias("invocation", TInvocation.class);
    xStream.alias("itemComponent", TItemDefinition.class);
    xStream.alias("itemDefinition", TItemDefinition.class);
    xStream.alias("itemDefinition", TItemDefinition.class);
    xStream.alias("knowledgeRequirement", TKnowledgeRequirement.class);
    xStream.alias("knowledgeRequirement", TKnowledgeRequirement.class);
    xStream.alias("knowledgeSource", TKnowledgeSource.class);
    xStream.alias("literalExpression", TLiteralExpression.class);
    xStream.alias("namedElement", TNamedElement.class);
    xStream.alias("organizationUnit", TOrganizationUnit.class);
    xStream.alias("output", TOutputClause.class);
    xStream.alias("outputDecision", TDMNElementReference.class);
    xStream.alias("outputEntry", TLiteralExpression.class);
    xStream.alias("outputValues", TUnaryTests.class);
    xStream.alias("owner", TDMNElementReference.class);
    xStream.alias("parameter", TInformationItem.class);
    xStream.alias("performanceIndicator", TPerformanceIndicator.class);
    xStream.alias("relation", TRelation.class);
    xStream.alias("requiredAuthority", TDMNElementReference.class);
    xStream.alias("requiredDecision", TDMNElementReference.class);
    xStream.alias("requiredDecision", TDMNElementReference.class);
    xStream.alias("requiredInput", TDMNElementReference.class);
    xStream.alias("requiredInput", TDMNElementReference.class);
    xStream.alias("requiredKnowledge", TDMNElementReference.class);
    xStream.alias("rule", TDecisionRule.class);
    xStream.alias("sourceRef", TDMNElementReference.class);
    xStream.alias("supportedObjective", TDMNElementReference.class);
    xStream.alias("targetRef", TDMNElementReference.class);
    xStream.alias("textAnnotation", TTextAnnotation.class);
    // TODO where?
    xStream.alias("type", String.class);
    xStream.alias("typeRef", QName.class);
    xStream.alias("usingProcess", TDMNElementReference.class);
    xStream.alias("usingTask", TDMNElementReference.class);
    xStream.alias("variable", TInformationItem.class);
    xStream.alias("variable", TInformationItem.class);
    xStream.alias("variable", TInformationItem.class);
    xStream.alias("variable", TInformationItem.class);
    // xStream.alias("allowedAnswers", xsd:string.class );
    // xStream.alias("description", xsd:string.class );
    // xStream.alias("question", xsd:string.class );
    // xStream.alias("text", xsd:string.class );
    // xStream.alias("text", xsd:string.class );
    // xStream.alias("text", xsd:string.class );
    xStream.alias("row", org.kie.dmn.model.v1_1.TList.class);
    xStream.alias("list", org.kie.dmn.model.v1_1.TList.class);
    xStream.alias("extensionElements", TDMNElement.TExtensionElements.class);
    // Manually imported TEXT = String
    xStream.alias(LiteralExpressionConverter.TEXT, String.class);
    xStream.alias(TextAnnotationConverter.TEXT, String.class);
    xStream.alias(UnaryTestsConverter.TEXT, String.class);
    xStream.alias(DecisionConverter.QUESTION, String.class);
    xStream.alias(DecisionConverter.ALLOWED_ANSWERS, String.class);
    xStream.alias(DMNElementConverter.DESCRIPTION, String.class);
    xStream.registerConverter(new AssociationConverter(xStream));
    xStream.registerConverter(new AuthorityRequirementConverter(xStream));
    xStream.registerConverter(new BindingConverter(xStream));
    xStream.registerConverter(new BusinessKnowledgeModelConverter(xStream));
    xStream.registerConverter(new ContextConverter(xStream));
    xStream.registerConverter(new ContextEntryConverter(xStream));
    xStream.registerConverter(new DecisionConverter(xStream));
    xStream.registerConverter(new DecisionRuleConverter(xStream));
    xStream.registerConverter(new DecisionServiceConverter(xStream));
    xStream.registerConverter(new DecisionTableConverter(xStream));
    xStream.registerConverter(new DefinitionsConverter(xStream));
    xStream.registerConverter(new DMNElementReferenceConverter(xStream));
    xStream.registerConverter(new FunctionDefinitionConverter(xStream));
    xStream.registerConverter(new ImportConverter(xStream));
    xStream.registerConverter(new ImportedValuesConverter(xStream));
    xStream.registerConverter(new InformationItemConverter(xStream));
    xStream.registerConverter(new InformationRequirementConverter(xStream));
    xStream.registerConverter(new InputClauseConverter(xStream));
    xStream.registerConverter(new InputDataConverter(xStream));
    xStream.registerConverter(new InvocationConverter(xStream));
    xStream.registerConverter(new ItemDefinitionConverter(xStream));
    xStream.registerConverter(new KnowledgeRequirementConverter(xStream));
    xStream.registerConverter(new KnowledgeSourceConverter(xStream));
    xStream.registerConverter(new LiteralExpressionConverter(xStream));
    xStream.registerConverter(new OrganizationUnitConverter(xStream));
    xStream.registerConverter(new OutputClauseConverter(xStream));
    xStream.registerConverter(new PerformanceIndicatorConverter(xStream));
    xStream.registerConverter(new RelationConverter(xStream));
    xStream.registerConverter(new TextAnnotationConverter(xStream));
    xStream.registerConverter(new UnaryTestsConverter(xStream));
    xStream.registerConverter(new QNameConverter());
    xStream.registerConverter(new DMNListConverter(xStream));
    xStream.registerConverter(new ElementCollectionConverter(xStream));
    xStream.registerConverter(new ExtensionElementsConverter(xStream, extensionRegisters));
    xStream.ignoreUnknownElements();
    for (DMNExtensionRegister extensionRegister : extensionRegisters) {
        extensionRegister.registerExtensionConverters(xStream);
    }
    return xStream;
}
Also used : KieDMNModelInstrumentedBase(org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase) DMNXStream(org.kie.dmn.backend.marshalling.v1x.DMNXStream) TypeHierarchyPermission(com.thoughtworks.xstream.security.TypeHierarchyPermission) XStream(com.thoughtworks.xstream.XStream) DMNXStream(org.kie.dmn.backend.marshalling.v1x.DMNXStream) QName(javax.xml.namespace.QName) TDefinitions(org.kie.dmn.model.v1_1.TDefinitions) Definitions(org.kie.dmn.model.api.Definitions) TDMNElement(org.kie.dmn.model.v1_1.TDMNElement) DMNExtensionRegister(org.kie.dmn.api.marshalling.DMNExtensionRegister)

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