Search in sources :

Example 1 with DataObjectChangeEvent

use of org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent in project kie-wb-common by kiegroup.

the class DataModelChangeNotifier method notifyObjectChange.

public void notifyObjectChange(ChangeType changeType, DataModelerContext context, String source, DataObject dataObject, String annotationClassName, String memberName, Object oldValue, Object newValue) {
    DataObjectChangeEvent changeEvent = new DataObjectChangeEvent(changeType, context.getContextId(), source, dataObject, memberName, oldValue, newValue);
    changeEvent.withAnnotationClassName(annotationClassName);
    dataModelerEvent.fire(changeEvent);
}
Also used : DataObjectChangeEvent(org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent)

Example 2 with DataObjectChangeEvent

use of org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent in project kie-wb-common by kiegroup.

the class DataObjectAddNestedClassCommand method execute.

@Override
public void execute() {
    dataObject.addNestedClass(nestedClass);
    DataModelerEvent event = new DataObjectChangeEvent().withChangeType(ChangeType.NESTED_CLASS_ADD_CHANGE).withOldValue(null).withNewValue(nestedClass).withContextId(getContext().getContextId()).withSource(getSource()).withCurrentDataObject(getDataObject());
    notifyChange(event);
}
Also used : DataModelerEvent(org.kie.workbench.common.screens.datamodeller.events.DataModelerEvent) DataObjectChangeEvent(org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent)

Example 3 with DataObjectChangeEvent

use of org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent in project kie-wb-common by kiegroup.

the class DataObjectRemoveNestedClassCommand method execute.

@Override
public void execute() {
    dataObject.removeNestedClass(nestedClass);
    DataModelerEvent event = new DataObjectChangeEvent().withChangeType(ChangeType.NESTED_CLASS_REMOVE_CHANGE).withOldValue(nestedClass).withNewValue(null).withContextId(getContext().getContextId()).withSource(getSource()).withCurrentDataObject(getDataObject());
    notifyChange(event);
}
Also used : DataModelerEvent(org.kie.workbench.common.screens.datamodeller.events.DataModelerEvent) DataObjectChangeEvent(org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent)

Example 4 with DataObjectChangeEvent

use of org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent in project kie-wb-common by kiegroup.

the class MethodAddAnnotationCommand method execute.

@Override
public void execute() {
    if (annotation == null) {
        annotation = new AnnotationImpl(context.getAnnotationDefinition(annotationClassName));
        if (valuePairs != null) {
            for (ValuePair valuePair : valuePairs) {
                annotation.setValue(valuePair.getName(), valuePair.getValue());
            }
        }
    }
    Annotation existingAnnotation = method.getAnnotation(annotation.getClassName());
    if (existingAnnotation != null) {
        method.removeAnnotation(annotation.getClassName());
    }
    method.addAnnotation(annotation);
    DataModelerEvent event = new DataObjectChangeEvent().withChangeType(ChangeType.METHOD_ANNOTATION_ADD_CHANGE).withOldValue(null).withNewValue(this.annotation).withContextId(getContext().getContextId()).withSource(getSource()).withCurrentDataObject(getDataObject()).withCurrentMethod(method);
    notifyChange(event);
}
Also used : DataModelerEvent(org.kie.workbench.common.screens.datamodeller.events.DataModelerEvent) DataObjectChangeEvent(org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent) AnnotationImpl(org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation)

Example 5 with DataObjectChangeEvent

use of org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent in project kie-wb-common by kiegroup.

the class RemoveMethodCommand method execute.

@Override
public void execute() {
    if (method != null) {
        dataObject.removeMethod(method);
        DataModelerEvent event = new DataObjectChangeEvent().withChangeType(ChangeType.METHOD_REMOVE_CHANGE).withOldValue(method).withNewValue(null).withContextId(getContext().getContextId()).withSource(getSource()).withCurrentDataObject(getDataObject()).withCurrentMethod(method);
        notifyChange(event);
    }
}
Also used : DataModelerEvent(org.kie.workbench.common.screens.datamodeller.events.DataModelerEvent) DataObjectChangeEvent(org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent)

Aggregations

DataObjectChangeEvent (org.kie.workbench.common.screens.datamodeller.events.DataObjectChangeEvent)9 DataModelerEvent (org.kie.workbench.common.screens.datamodeller.events.DataModelerEvent)5 Annotation (org.kie.workbench.common.services.datamodeller.core.Annotation)1 AnnotationImpl (org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl)1