Search in sources :

Example 11 with BaseColumnFieldDiff

use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.

the class AuditLogEntryCellHelper method buildColumnDetailsUpdate.

private void buildColumnDetailsUpdate(final ActionWorkItemSetFieldColumnDetails details, final ActionWorkItemSetFieldColumnDetails originalDetails, final List<BaseColumnFieldDiff> diffs, final SafeHtmlBuilder sb) {
    sb.append(TEMPLATE.commentHeader(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogUpdateAction(details.getColumnHeader())));
    SafeHtmlBuilder sbFields = null;
    // Show changed fields too.
    if (diffs != null && !diffs.isEmpty()) {
        sbFields = new SafeHtmlBuilder();
        for (BaseColumnFieldDiff diff : diffs) {
            String changedFieldName = diff.getFieldName();
            if (changedFieldName.equals(DTColumnConfig52.FIELD_HEADER)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.ColumnHeader(), diff.getOldValue(), diff.getValue(), sbFields);
            } else if (changedFieldName.equals(DTColumnConfig52.FIELD_HIDE_COLUMN)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.HideThisColumn(), diff.getOldValue(), diff.getValue(), sbFields);
            } else if (changedFieldName.equals(ActionSetFieldCol52.FIELD_BOUND_NAME)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Binding(), diff.getOldValue(), diff.getValue(), sbFields);
            } else if (changedFieldName.equals(ActionSetFieldCol52.FIELD_FACT_FIELD)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Field(), diff.getOldValue(), diff.getValue(), sbFields);
            } else if (changedFieldName.equals(ActionSetFieldCol52.FIELD_TYPE)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.FieldType(), diff.getOldValue(), diff.getValue(), sbFields);
            } else if (changedFieldName.equals(ActionSetFieldCol52.FIELD_UPDATE)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.UpdateEngineWithChanges(), diff.getOldValue(), diff.getValue(), sbFields);
            } else if (changedFieldName.equals(ActionWorkItemSetFieldCol52.FIELD_WORK_ITEM_NAME)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogWorkItemName(), diff.getOldValue(), diff.getValue(), sbFields);
            } else if (changedFieldName.equals(ActionWorkItemSetFieldCol52.FIELD_WORK_ITEM_RESULT_PARAM_NAME)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogWorkItemParameterName(), diff.getOldValue(), diff.getValue(), sbFields);
            } else if (changedFieldName.equals(ActionWorkItemSetFieldCol52.FIELD_PARAMETER_CLASSNAME)) {
                buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogWorkItemParameterClassName(), diff.getOldValue(), diff.getValue(), sbFields);
            }
        }
    }
    if (sbFields != null) {
        sb.append(TEMPLATE.updatedFields(sbFields.toSafeHtml(), labelClass));
    }
}
Also used : BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 12 with BaseColumnFieldDiff

use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.

the class AuditLogEntryCellHelperTest method getSafeHtml_ActionWorkItemInsert.

@Test
public void getSafeHtml_ActionWorkItemInsert() {
    ActionWorkItemInsertFactCol52 originalColumn = new ActionWorkItemInsertFactCol52();
    originalColumn.setParameterClassName("ParamClass1");
    originalColumn.setWorkItemName("WI1");
    originalColumn.setWorkItemResultParameterName("param1");
    originalColumn.setBoundName("b1");
    originalColumn.setFactField("field1");
    originalColumn.setInsertLogical(false);
    originalColumn.setHeader("action1");
    originalColumn.setHideColumn(false);
    ActionWorkItemInsertFactCol52 newColumn = new ActionWorkItemInsertFactCol52();
    newColumn.setParameterClassName("ParamClass2");
    newColumn.setWorkItemName("WI2");
    newColumn.setWorkItemResultParameterName("param2");
    newColumn.setBoundName("b2");
    newColumn.setFactField("field2");
    newColumn.setInsertLogical(true);
    newColumn.setHeader("action2");
    newColumn.setHideColumn(true);
    List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn);
    SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs));
    assertEquals(getActionHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString());
}
Also used : ActionWorkItemInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52) UpdateColumnAuditLogEntry(org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) Test(org.junit.Test)

Example 13 with BaseColumnFieldDiff

use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.

the class AuditLogEntryCellHelperTest method getSafeHtml_Metadata.

@Test
public void getSafeHtml_Metadata() {
    MetadataCol52 originalColumn = new MetadataCol52();
    originalColumn.setHideColumn(true);
    originalColumn.setDefaultValue(new DTCellValue52("def1"));
    // header & metadata of a metadata column cannot be updated in the ui
    originalColumn.setMetadata("meta");
    originalColumn.setHeader("meta");
    MetadataCol52 newColumn = new MetadataCol52();
    newColumn.setHideColumn(false);
    newColumn.setDefaultValue(new DTCellValue52("def2"));
    // header & metadata of a metadata column cannot be updated in the ui
    newColumn.setMetadata("meta");
    newColumn.setHeader("meta");
    List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn);
    SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs));
    assertEquals(getHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString());
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) UpdateColumnAuditLogEntry(org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 14 with BaseColumnFieldDiff

use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.

the class AuditLogEntryCellHelperTest method getSafeHtml_ActionRetract.

@Test
public void getSafeHtml_ActionRetract() {
    ActionRetractFactCol52 originalColumn = new ActionRetractFactCol52();
    originalColumn.setHeader("action1");
    originalColumn.setHideColumn(false);
    originalColumn.setDefaultValue(new DTCellValue52("def1"));
    ActionRetractFactCol52 newColumn = new ActionRetractFactCol52();
    newColumn.setHeader("action2");
    newColumn.setHideColumn(true);
    newColumn.setDefaultValue(new DTCellValue52("def2"));
    List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn);
    SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs));
    assertEquals(getHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString());
}
Also used : ActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52) UpdateColumnAuditLogEntry(org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 15 with BaseColumnFieldDiff

use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.

the class AuditLogEntryCellHelperTest method getSafeHtml_ActionInsert.

@Test
public void getSafeHtml_ActionInsert() {
    // hide, insert, value list, default value, field, header
    ActionInsertFactCol52 originalColumn = new ActionInsertFactCol52();
    originalColumn.setFactField("field1");
    originalColumn.setInsertLogical(false);
    originalColumn.setValueList("q,w,e");
    originalColumn.setHeader("action1");
    originalColumn.setHideColumn(false);
    originalColumn.setDefaultValue(new DTCellValue52("def1"));
    ActionInsertFactCol52 newColumn = new ActionInsertFactCol52();
    newColumn.setFactField("field2");
    newColumn.setInsertLogical(true);
    newColumn.setValueList("a,s,d");
    newColumn.setHeader("action2");
    newColumn.setHideColumn(true);
    newColumn.setDefaultValue(new DTCellValue52("def2"));
    List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn);
    SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs));
    assertEquals(getActionHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString());
}
Also used : ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) LimitedEntryActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52) UpdateColumnAuditLogEntry(org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Aggregations

BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)66 Test (org.junit.Test)39 UpdateColumnAuditLogEntry (org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry)15 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)14 StringUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.StringUiColumn)13 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)12 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)12 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)12 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)10 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)8 BRLActionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn)6 BRLConditionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn)6 ActionWorkItemCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52)4 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)4 BRLConditionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)4 BooleanUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn)4 ArrayList (java.util.ArrayList)3 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)3 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)3 ActionWorkItemInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52)3