Search in sources :

Example 6 with DomainObject

use of org.kie.workbench.common.stunner.core.domainobject.DomainObject in project kie-wb-common by kiegroup.

the class UpdateDomainObjectPropertyValueCommand method execute.

@Override
@SuppressWarnings("unchecked")
public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) {
    final DefinitionManager definitionManager = context.getDefinitionManager();
    final Object p = definitionManager.adapters().forDefinition().getProperty(domainObject, field).get();
    final AdapterManager adapterManager = definitionManager.adapters();
    final AdapterRegistry adapterRegistry = adapterManager.registry();
    final PropertyAdapter<Object, Object> adapter = (PropertyAdapter<Object, Object>) adapterRegistry.getPropertyAdapter(p.getClass());
    oldValue = adapter.getValue(p);
    adapter.setValue(p, value);
    return GraphCommandResultBuilder.SUCCESS;
}
Also used : DefinitionManager(org.kie.workbench.common.stunner.core.api.DefinitionManager) AdapterManager(org.kie.workbench.common.stunner.core.definition.adapter.AdapterManager) DomainObject(org.kie.workbench.common.stunner.core.domainobject.DomainObject) PropertyAdapter(org.kie.workbench.common.stunner.core.definition.adapter.PropertyAdapter) AdapterRegistry(org.kie.workbench.common.stunner.core.registry.definition.AdapterRegistry)

Aggregations

DomainObject (org.kie.workbench.common.stunner.core.domainobject.DomainObject)6 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)2 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)2 DomainObjectSelectionEvent (org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 NOPDomainObject (org.kie.workbench.common.dmn.api.definition.NOPDomainObject)1 List (org.kie.workbench.common.dmn.api.definition.model.List)1 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)1 Relation (org.kie.workbench.common.dmn.api.definition.model.Relation)1 DefinitionManager (org.kie.workbench.common.stunner.core.api.DefinitionManager)1 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)1 CanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler)1 AdapterManager (org.kie.workbench.common.stunner.core.definition.adapter.AdapterManager)1 PropertyAdapter (org.kie.workbench.common.stunner.core.definition.adapter.PropertyAdapter)1 AdapterRegistry (org.kie.workbench.common.stunner.core.registry.definition.AdapterRegistry)1