Search in sources :

Example 1 with AddPropertyCommand

use of org.kie.workbench.common.screens.datamodeller.client.command.AddPropertyCommand in project kie-wb-common by kiegroup.

the class DataObjectBrowser method addNewProperty.

private void addNewProperty(DataObject dataObject, final String propertyName, final String propertyLabel, final String propertyType, final Boolean isMultiple) {
    AddPropertyCommand command = commandBuilder.buildAddPropertyCommand(getContext(), DataModelerEvent.DATA_OBJECT_BROWSER, dataObject, propertyName, propertyLabel, propertyType, isMultiple);
    command.execute();
    ObjectProperty property = command.getProperty();
    adjustTableSize(dataProvider.getList().size() + 1);
    dataProvider.getList().add(property);
    view.setSelectedRow(property, true);
    executePostCommandProcessing(command);
}
Also used : ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) AddPropertyCommand(org.kie.workbench.common.screens.datamodeller.client.command.AddPropertyCommand)

Example 2 with AddPropertyCommand

use of org.kie.workbench.common.screens.datamodeller.client.command.AddPropertyCommand in project kie-wb-common by kiegroup.

the class JPADomainHandler method postCommandProcessing.

@Override
public void postCommandProcessing(DataModelCommand command) {
    if (command instanceof FieldTypeChangeCommand && (isPersistable(((FieldTypeChangeCommand) command).getDataObject()) || isRelationConfigured(((FieldTypeChangeCommand) command).getField()))) {
        AdjustFieldDefaultRelationsCommand postCommand = commandBuilder.buildAdjustFieldDefaultRelationsCommand((FieldTypeChangeCommand) command, getName(), ((FieldTypeChangeCommand) command).getField());
        postCommand.execute();
    } else if (command instanceof AddPropertyCommand && isPersistable(((AddPropertyCommand) command).getDataObject())) {
        AdjustFieldDefaultRelationsCommand postCommand = commandBuilder.buildAdjustFieldDefaultRelationsCommand((AddPropertyCommand) command, getName(), ((AddPropertyCommand) command).getProperty());
        postCommand.execute();
    }
}
Also used : AdjustFieldDefaultRelationsCommand(org.kie.workbench.common.screens.datamodeller.client.handlers.jpadomain.command.AdjustFieldDefaultRelationsCommand) FieldTypeChangeCommand(org.kie.workbench.common.screens.datamodeller.client.command.FieldTypeChangeCommand) AddPropertyCommand(org.kie.workbench.common.screens.datamodeller.client.command.AddPropertyCommand)

Aggregations

AddPropertyCommand (org.kie.workbench.common.screens.datamodeller.client.command.AddPropertyCommand)2 FieldTypeChangeCommand (org.kie.workbench.common.screens.datamodeller.client.command.FieldTypeChangeCommand)1 AdjustFieldDefaultRelationsCommand (org.kie.workbench.common.screens.datamodeller.client.handlers.jpadomain.command.AdjustFieldDefaultRelationsCommand)1 ObjectProperty (org.kie.workbench.common.services.datamodeller.core.ObjectProperty)1