Search in sources :

Example 1 with ValuePair

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

the class JPADataObjectEditor method onAuditedFieldChange.

@Override
public void onAuditedFieldChange(String newValue) {
    if (getDataObject() != null) {
        Boolean doAdd = Boolean.parseBoolean(newValue);
        DataModelCommand command;
        if (doAdd) {
            List<ValuePair> defaultValues = new ArrayList<>();
            defaultValues.add(new ValuePair("targetAuditMode", "NOT_AUDITED"));
            command = commandBuilder.buildDataObjectAddAnnotationCommand(getContext(), getName(), getDataObject(), JPADomainAnnotations.HIBERNATE_ENVERS_AUDITED, defaultValues);
        } else {
            command = commandBuilder.buildDataObjectRemoveAnnotationCommand(getContext(), getName(), getDataObject(), JPADomainAnnotations.HIBERNATE_ENVERS_AUDITED);
        }
        command.execute();
    }
}
Also used : DataModelCommand(org.kie.workbench.common.screens.datamodeller.client.command.DataModelCommand) ValuePair(org.kie.workbench.common.screens.datamodeller.client.command.ValuePair) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 DataModelCommand (org.kie.workbench.common.screens.datamodeller.client.command.DataModelCommand)1 ValuePair (org.kie.workbench.common.screens.datamodeller.client.command.ValuePair)1