Search in sources :

Example 1 with Annotation

use of org.kie.workbench.common.services.datamodeller.core.Annotation in project drools-wb by kiegroup.

the class DecisionTableXLSToDecisionTableGuidedConverter method addAnnotations.

private void addAnnotations(final DataObject dataObject, final List<AnnotationMetaModel> annotationMetaModelList) {
    for (AnnotationMetaModel annotationMetaModel : annotationMetaModelList) {
        final String name = annotationMetaModel.name;
        final Map<String, String> values = annotationMetaModel.values;
        Annotation annotation;
        String key = DroolsDomainAnnotations.VALUE_PARAM;
        String value = "";
        if (values.size() > 0) {
            key = values.keySet().iterator().next();
            value = values.values().iterator().next();
        }
        if ("Role".equals(name)) {
            annotation = new AnnotationImpl(annotationDefinitions.get(DroolsDomainAnnotations.ROLE_ANNOTATION));
            annotation.setValue(key, value);
            dataObject.addAnnotation(annotation);
        } else if ("Position".equals(name)) {
            annotation = new AnnotationImpl(annotationDefinitions.get(DroolsDomainAnnotations.POSITION_ANNOTATION));
            annotation.setValue(key, value);
            dataObject.addAnnotation(annotation);
        } else if ("Equals".equals(name)) {
            annotation = new AnnotationImpl(annotationDefinitions.get(DroolsDomainAnnotations.KEY_ANNOTATION));
            annotation.setValue(key, value);
            dataObject.addAnnotation(annotation);
        }
    }
}
Also used : AnnotationMetaModel(org.drools.workbench.screens.factmodel.model.AnnotationMetaModel) AnnotationImpl(org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation)

Aggregations

AnnotationMetaModel (org.drools.workbench.screens.factmodel.model.AnnotationMetaModel)1 Annotation (org.kie.workbench.common.services.datamodeller.core.Annotation)1 AnnotationImpl (org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl)1