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);
}
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);
}
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);
}
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);
}
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);
}
}
Aggregations