diff --git a/.travis.yml b/.travis.yml index c0dedbf5af6..4424c9c3fa0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ +sudo: required +dist: trusty language: java -script: "travis_wait 70 mvn clean install" - jdk: - openjdk7 - oraclejdk7 diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/column/ColumnUtils.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/column/ColumnUtils.java index 0e7fc42488f..dbb58d5ab1e 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/column/ColumnUtils.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/column/ColumnUtils.java @@ -45,8 +45,8 @@ public class ColumnUtils { - public static List, String>> createColumns(List columns) { - List, String>> tableColumns = new ArrayList, String>>(); + public static List> createColumns(List columns) { + List> tableColumns = new ArrayList<>(); for (ColumnTypeDto column : columns) { PropertyColumn tableColumn = null; if (column.isSortable()) { @@ -370,7 +370,7 @@ public static List, String>> ge SelectableBean.F_VALUE + ".emailAddress", false) ); - columns.addAll((Collection)createColumns(columnsDefs)); + columns.addAll(ColumnUtils.>createColumns(columnsDefs)); return columns; @@ -440,7 +440,7 @@ public void populateItem(Item>> cellItem, List columnsDefs = Arrays.asList( new ColumnTypeDto("TaskType.executionStatus", TaskType.F_EXECUTION_STATUS.getLocalPart(), SelectableBean.F_VALUE + ".executionStatus", false)); - columns.addAll((Collection)createColumns(columnsDefs)); + columns.addAll(ColumnUtils.>createColumns(columnsDefs)); return columns; @@ -509,7 +509,7 @@ public static List, String>> ge ); - columns.addAll((Collection) createColumns(columnsDefs)); + columns.addAll(ColumnUtils.>createColumns(columnsDefs)); return columns; diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ContainerWrapper.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ContainerWrapper.java index dcd7a31115d..e6e76264d06 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ContainerWrapper.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ContainerWrapper.java @@ -17,13 +17,21 @@ package com.evolveum.midpoint.web.component.prism; import com.evolveum.midpoint.prism.*; +import com.evolveum.midpoint.prism.delta.ContainerDelta; +import com.evolveum.midpoint.prism.delta.ItemDelta; +import com.evolveum.midpoint.prism.delta.ObjectDelta; +import com.evolveum.midpoint.prism.delta.ReferenceDelta; import com.evolveum.midpoint.prism.path.ItemPath; +import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.util.DebugDumpable; import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.util.PrettyPrinter; import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.util.logging.Trace; +import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; import org.apache.commons.lang.math.NumberUtils; @@ -32,17 +40,16 @@ import javax.xml.namespace.QName; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; +import java.util.*; /** * @author lazyman */ public class ContainerWrapper implements ItemWrapper, Serializable, DebugDumpable { - private String displayName; + private static final Trace LOGGER = TraceManager.getTrace(ContainerWrapper.class); + + private String displayName; private ObjectWrapper objectWrapper; private PrismContainer container; private ContainerStatus status; @@ -71,7 +78,7 @@ public ContainerWrapper(ObjectWrapper objectWrapper, PrismContainer container containerDefinition = getItemDefinition(); } - public ContainerWrapper(PrismContainer container, ContainerStatus status, boolean readOnly) { + public ContainerWrapper(PrismContainer container, ContainerStatus status, ItemPath path, boolean readOnly) { Validate.notNull(container, "container must not be null."); Validate.notNull(container.getDefinition(), "container definition must not be null."); Validate.notNull(status, "Container status must not be null."); @@ -79,7 +86,7 @@ public ContainerWrapper(PrismContainer container, ContainerStatus status, boo this.container = container; this.containerDefinition = container.getDefinition(); this.status = status; - this.path = null; + this.path = path; main = path == null; this.readonly = readOnly; showInheritedObjectAttributes = false; @@ -447,4 +454,183 @@ public void setStripe(boolean isStripe) { // Does not make much sense, but it is given by the interface } + public void collectModifications(ObjectDelta delta) throws SchemaException { + if (getItemDefinition().getName().equals(ShadowType.F_ASSOCIATION)) { + //create ContainerDelta for association container + //HACK HACK HACK create correct procession for association container data + //according to its structure + ContainerDelta associationDelta = + ContainerDelta.createDelta(ShadowType.F_ASSOCIATION, + (PrismContainerDefinition) getItemDefinition()); + for (ItemWrapper itemWrapper : getItems()) { + AssociationWrapper associationItemWrapper = (AssociationWrapper) itemWrapper; + List assocValueWrappers = associationItemWrapper.getValues(); + for (ValueWrapper assocValueWrapper : assocValueWrappers) { + PrismContainerValue assocValue = (PrismContainerValue) assocValueWrapper.getValue(); + if (assocValueWrapper.getStatus() == ValueStatus.DELETED) { + associationDelta.addValueToDelete(assocValue.clone()); + } else if (assocValueWrapper.getStatus().equals(ValueStatus.ADDED)) { + associationDelta.addValueToAdd(assocValue.clone()); + } + } + } + delta.addModification(associationDelta); + } else { + if (!hasChanged()) { + return; + } + + for (ItemWrapper itemWrapper : getItems()) { + if (!itemWrapper.hasChanged()) { + continue; + } + ItemPath containerPath = getPath() != null ? getPath() : new ItemPath(); + if (itemWrapper instanceof PropertyWrapper) { + ItemDelta pDelta = computePropertyDeltas((PropertyWrapper) itemWrapper, containerPath); + if (!pDelta.isEmpty()) { + //HACK to remove a password replace delta is to be created + if (getName().equals(CredentialsType.F_PASSWORD)) { + if (pDelta.getValuesToDelete() != null){ + pDelta.resetValuesToDelete(); + pDelta.setValuesToReplace(new ArrayList()); + } + } + delta.addModification(pDelta); + } + } else if (itemWrapper instanceof ReferenceWrapper) { + ReferenceDelta pDelta = computeReferenceDeltas((ReferenceWrapper) itemWrapper, containerPath); + if (!pDelta.isEmpty()) { + delta.addModification(pDelta); + } + } else { + LOGGER.trace("Delta from wrapper: ignoring {}", itemWrapper); + } + } + } + } + + private ItemDelta computePropertyDeltas(PropertyWrapper propertyWrapper, ItemPath containerPath) { + ItemDefinition itemDef = propertyWrapper.getItem().getDefinition(); + ItemDelta pDelta = itemDef.createEmptyDelta(containerPath.subPath(itemDef.getName())); + addItemDelta(propertyWrapper, pDelta, itemDef, containerPath); + return pDelta; + } + + private ReferenceDelta computeReferenceDeltas(ReferenceWrapper referenceWrapper, ItemPath containerPath) { + PrismReferenceDefinition propertyDef = referenceWrapper.getItem().getDefinition(); + ReferenceDelta pDelta = new ReferenceDelta(containerPath, propertyDef.getName(), propertyDef, + propertyDef.getPrismContext()); + addItemDelta(referenceWrapper, pDelta, propertyDef, containerPath.subPath(propertyDef.getName())); + return pDelta; + } + + private void addItemDelta(ItemWrapper itemWrapper, ItemDelta pDelta, ItemDefinition propertyDef, + ItemPath containerPath) { + for (ValueWrapper valueWrapper : itemWrapper.getValues()) { + valueWrapper.normalize(propertyDef.getPrismContext()); + ValueStatus valueStatus = valueWrapper.getStatus(); + if (!valueWrapper.hasValueChanged() + && (ValueStatus.NOT_CHANGED.equals(valueStatus) || ValueStatus.ADDED.equals(valueStatus))) { + continue; + } + + // TODO: need to check if the resource has defined + // capabilities + // todo this is bad hack because now we have not tri-state + // checkbox + if (SchemaConstants.PATH_ACTIVATION.equivalent(containerPath) && getObject() != null) { + + PrismObject object = getObject().getObject(); + if (object.asObjectable() instanceof ShadowType + && (((ShadowType) object.asObjectable()).getActivation() == null || ((ShadowType) object + .asObjectable()).getActivation().getAdministrativeStatus() == null)) { + + if (!getObject().hasResourceCapability(((ShadowType) object.asObjectable()).getResource(), + ActivationCapabilityType.class)) { + continue; + } + } + } + + PrismValue newValCloned = ObjectWrapper.clone(valueWrapper.getValue()); + PrismValue oldValCloned = ObjectWrapper.clone(valueWrapper.getOldValue()); + switch (valueWrapper.getStatus()) { + case ADDED: + if (newValCloned != null) { + if (SchemaConstants.PATH_PASSWORD.equivalent(containerPath)) { + // password change will always look like add, + // therefore we push replace + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (password) ADD -> replace {}", pDelta.getPath(), newValCloned); + } + pDelta.setValuesToReplace(Arrays.asList(newValCloned)); + } else if (propertyDef.isSingleValue()) { + // values for single-valued properties + // should be pushed via replace + // in order to prevent problems e.g. with + // summarizing deltas for + // unreachable resources + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (single,new) ADD -> replace {}", pDelta.getPath(), newValCloned); + } + pDelta.setValueToReplace(newValCloned); + } else { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (multi,new) ADD -> add {}", pDelta.getPath(), newValCloned); + } + pDelta.addValueToAdd(newValCloned); + } + } + break; + case DELETED: + if (newValCloned != null) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (new) DELETE -> delete {}", pDelta.getPath(), newValCloned); + } + pDelta.addValueToDelete(newValCloned); + } + if (oldValCloned != null) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (old) DELETE -> delete {}", pDelta.getPath(), oldValCloned); + } + pDelta.addValueToDelete(oldValCloned); + } + break; + case NOT_CHANGED: + // this is modify... + if (propertyDef.isSingleValue()) { + // newValCloned.isEmpty() + if (newValCloned != null && !newValCloned.isEmpty()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (single,new) NOT_CHANGED -> replace {}", pDelta.getPath(), newValCloned); + } + pDelta.setValuesToReplace(Arrays.asList(newValCloned)); + } else { + if (oldValCloned != null) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (single,old) NOT_CHANGED -> delete {}", pDelta.getPath(), oldValCloned); + } + pDelta.addValueToDelete(oldValCloned); + } + } + } else { + if (newValCloned != null && !newValCloned.isEmpty()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (multi,new) NOT_CHANGED -> add {}", pDelta.getPath(), newValCloned); + } + pDelta.addValueToAdd(newValCloned); + } + if (oldValCloned != null) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Delta from wrapper: {} (multi,old) NOT_CHANGED -> delete {}", pDelta.getPath(), oldValCloned); + } + pDelta.addValueToDelete(oldValCloned); + } + } + break; + } + } + } + + } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ContainerWrapperFactory.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ContainerWrapperFactory.java index ace69b01e2c..caed8a5c6a3 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ContainerWrapperFactory.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ContainerWrapperFactory.java @@ -96,11 +96,11 @@ public ContainerWrapper createContainerWrapper(Object return cWrapper; } - public ContainerWrapper createContainerWrapper(T container, ContainerStatus status, boolean readonly) { + public ContainerWrapper createContainerWrapper(T container, ContainerStatus status, ItemPath path, boolean readonly) { result = new OperationResult(CREATE_PROPERTIES); - ContainerWrapper cWrapper = new ContainerWrapper(container, status, readonly); + ContainerWrapper cWrapper = new ContainerWrapper(container, status, path, readonly); List properties = createProperties(cWrapper, result); cWrapper.setProperties(properties); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java index 8a058b71447..642b2787b15 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java @@ -26,7 +26,6 @@ import com.evolveum.midpoint.prism.polystring.PolyString; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; -import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.schema.util.ResourceTypeUtil; import com.evolveum.midpoint.util.DebugDumpable; @@ -35,7 +34,6 @@ import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; -import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType; import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CapabilityType; import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType; @@ -337,58 +335,8 @@ public ObjectDelta getObjectDelta() throws SchemaException { Collections.sort(containers, new PathSizeComparator()); for (ContainerWrapper containerWrapper : getContainers()) { - //create ContainerDelta for association container - //HACK HACK HACK create correct procession for association container data - //according to its structure - if (containerWrapper.getItemDefinition().getName().equals(ShadowType.F_ASSOCIATION)) { - ContainerDelta associationDelta = ContainerDelta.createDelta(ShadowType.F_ASSOCIATION, containerWrapper.getItemDefinition()); - List associationItemWrappers = (List) containerWrapper.getItems(); - for (AssociationWrapper associationItemWrapper : associationItemWrappers) { - List assocValueWrappers = associationItemWrapper.getValues(); - for (ValueWrapper assocValueWrapper : assocValueWrappers) { - PrismContainerValue assocValue = (PrismContainerValue) assocValueWrapper.getValue(); - if (assocValueWrapper.getStatus() == ValueStatus.DELETED) { - associationDelta.addValueToDelete(assocValue.clone()); - } else if (assocValueWrapper.getStatus().equals(ValueStatus.ADDED)) { - associationDelta.addValueToAdd(assocValue.clone()); - } - } - } - delta.addModification(associationDelta); - } else { - if (!containerWrapper.hasChanged()) { - continue; - } - - for (ItemWrapper itemWrapper : (List) containerWrapper.getItems()) { - if (!itemWrapper.hasChanged()) { - continue; - } - ItemPath containerPath = containerWrapper.getPath() != null ? containerWrapper.getPath() : new ItemPath(); - if (itemWrapper instanceof PropertyWrapper) { - ItemDelta pDelta = computePropertyDeltas((PropertyWrapper) itemWrapper, containerPath); - if (!pDelta.isEmpty()) { - //HACK to remove a password replace delta is to be created - if (containerWrapper.getName().equals(CredentialsType.F_PASSWORD)) { - if (pDelta.getValuesToDelete() != null){ - pDelta.resetValuesToDelete(); - pDelta.setValuesToReplace(new ArrayList()); - } - } - delta.addModification(pDelta); - } - } else if (itemWrapper instanceof ReferenceWrapper) { - ReferenceDelta pDelta = computeReferenceDeltas((ReferenceWrapper) itemWrapper, containerPath); - if (!pDelta.isEmpty()) { - delta.addModification(pDelta); - } - } else { - LOGGER.trace("Delta from wrapper: ignoring {}", itemWrapper); - } - - } - } - } + containerWrapper.collectModifications(delta); + } // returning container to previous order Collections.sort(containers, new ItemWrapperComparator()); @@ -404,130 +352,6 @@ public ObjectDelta getObjectDelta() throws SchemaException { return delta; } - private ItemDelta computePropertyDeltas(PropertyWrapper propertyWrapper, ItemPath containerPath) { - ItemDefinition itemDef = propertyWrapper.getItem().getDefinition(); - ItemDelta pDelta = itemDef.createEmptyDelta(containerPath.subPath(itemDef.getName())); - addItemDelta(propertyWrapper, pDelta, itemDef, containerPath); - return pDelta; - - } - - private ReferenceDelta computeReferenceDeltas(ReferenceWrapper referenceWrapper, ItemPath containerPath) { - PrismReferenceDefinition propertyDef = referenceWrapper.getItem().getDefinition(); - ReferenceDelta pDelta = new ReferenceDelta(containerPath, propertyDef.getName(), propertyDef, - propertyDef.getPrismContext()); - addItemDelta(referenceWrapper, pDelta, propertyDef, containerPath.subPath(propertyDef.getName())); - return pDelta; - - } - - private void addItemDelta(ItemWrapper itemWrapper, ItemDelta pDelta, ItemDefinition propertyDef, - ItemPath containerPath) { - for (ValueWrapper valueWrapper : itemWrapper.getValues()) { - valueWrapper.normalize(propertyDef.getPrismContext()); - ValueStatus valueStatus = valueWrapper.getStatus(); - if (!valueWrapper.hasValueChanged() - && (ValueStatus.NOT_CHANGED.equals(valueStatus) || ValueStatus.ADDED.equals(valueStatus))) { - continue; - } - - // TODO: need to check if the resource has defined - // capabilities - // todo this is bad hack because now we have not tri-state - // checkbox - if (SchemaConstants.PATH_ACTIVATION.equivalent(containerPath)) { - - if (object.asObjectable() instanceof ShadowType - && (((ShadowType) object.asObjectable()).getActivation() == null || ((ShadowType) object - .asObjectable()).getActivation().getAdministrativeStatus() == null)) { - - if (!hasResourceCapability(((ShadowType) object.asObjectable()).getResource(), - ActivationCapabilityType.class)) { - continue; - } - } - } - - PrismValue newValCloned = clone(valueWrapper.getValue()); - PrismValue oldValCloned = clone(valueWrapper.getOldValue()); - switch (valueWrapper.getStatus()) { - case ADDED: - if (newValCloned != null) { - if (SchemaConstants.PATH_PASSWORD.equivalent(containerPath)) { - // password change will always look like add, - // therefore we push replace - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (password) ADD -> replace {}", pDelta.getPath(), newValCloned); - } - pDelta.setValuesToReplace(Arrays.asList(newValCloned)); - } else if (propertyDef.isSingleValue()) { - // values for single-valued properties - // should be pushed via replace - // in order to prevent problems e.g. with - // summarizing deltas for - // unreachable resources - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (single,new) ADD -> replace {}", pDelta.getPath(), newValCloned); - } - pDelta.setValueToReplace(newValCloned); - } else { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (multi,new) ADD -> add {}", pDelta.getPath(), newValCloned); - } - pDelta.addValueToAdd(newValCloned); - } - } - break; - case DELETED: - if (newValCloned != null) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (new) DELETE -> delete {}", pDelta.getPath(), newValCloned); - } - pDelta.addValueToDelete(newValCloned); - } - if (oldValCloned != null) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (old) DELETE -> delete {}", pDelta.getPath(), oldValCloned); - } - pDelta.addValueToDelete(oldValCloned); - } - break; - case NOT_CHANGED: - // this is modify... - if (propertyDef.isSingleValue()) { - // newValCloned.isEmpty() - if (newValCloned != null && !newValCloned.isEmpty()) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (single,new) NOT_CHANGED -> replace {}", pDelta.getPath(), newValCloned); - } - pDelta.setValuesToReplace(Arrays.asList(newValCloned)); - } else { - if (oldValCloned != null) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (single,old) NOT_CHANGED -> delete {}", pDelta.getPath(), oldValCloned); - } - pDelta.addValueToDelete(oldValCloned); - } - } - } else { - if (newValCloned != null && !newValCloned.isEmpty()) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (multi,new) NOT_CHANGED -> add {}", pDelta.getPath(), newValCloned); - } - pDelta.addValueToAdd(newValCloned); - } - if (oldValCloned != null) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Delta from wrapper: {} (multi,old) NOT_CHANGED -> delete {}", pDelta.getPath(), oldValCloned); - } - pDelta.addValueToDelete(oldValCloned); - } - } - break; - } - } - } - // TODO move to appropriate place! public static PrismValue clone(PrismValue value) { if (value == null) { @@ -559,8 +383,8 @@ public static PrismValue clone(PrismValue value) { return cloned; } - private boolean hasResourceCapability(ResourceType resource, - Class capabilityClass) { + protected boolean hasResourceCapability(ResourceType resource, + Class capabilityClass) { if (resource == null) { return false; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismContainerPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismContainerPanel.java index dee97cfbbfb..62bb145717a 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismContainerPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismContainerPanel.java @@ -48,10 +48,6 @@ public class PrismContainerPanel extends Panel { private PageBase pageBase; - public PrismContainerPanel(String id, IModel model, Form form) { - this(id, model, true, form, null); - } - public PrismContainerPanel(String id, final IModel model, boolean showHeader, Form form, PageBase pageBase) { super(id); this.pageBase = pageBase; diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wf/WorkItemsPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wf/WorkItemsPanel.java index 2952d5cba20..a3d81c6eea2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wf/WorkItemsPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wf/WorkItemsPanel.java @@ -85,11 +85,11 @@ private void initLayout(UserProfileStorage.TableId tableId, int pageSize, View v if (view == FULL_LIST) { columns.add(new CheckBoxHeaderColumn()); } + columns.add(createNameColumn()); columns.add(createTypeIconColumn(true)); columns.add(createObjectNameColumn("WorkItemsPanel.object")); columns.add(createTypeIconColumn(false)); columns.add(createTargetNameColumn("WorkItemsPanel.target")); - columns.add(createNameColumn()); if (view == FULL_LIST) { columns.add(new AbstractColumn(createStringResource("WorkItemsPanel.started")) { @Override @@ -120,8 +120,8 @@ public Date getObject() { columns.add(new PropertyColumn(createStringResource("WorkItemsPanel.actors"), WorkItemDto.F_ASSIGNEE_OR_CANDIDATES)); } } else { - columns.add(new PropertyColumn(createStringResource("WorkItemsPanel.actors"), WorkItemDto.F_ASSIGNEE_OR_CANDIDATES)); columns.add(createNameColumn()); + columns.add(new PropertyColumn(createStringResource("WorkItemsPanel.actors"), WorkItemDto.F_ASSIGNEE_OR_CANDIDATES)); columns.add(new PropertyColumn(createStringResource("WorkItemsPanel.created"), WorkItemDto.F_CREATED_FORMATTED)); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/CapabilityStep.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/CapabilityStep.html index 32bdd977de8..939dfbb9348 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/CapabilityStep.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/CapabilityStep.html @@ -20,34 +20,40 @@
-
-
- - - - - - - -
- - -   - - - - -
- -
- +
+
+ +
+
+ + + + + + + +
+ + +   + + + + +
+ +
+ +
+
+ +
-
-
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/ConfigurationStep.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/ConfigurationStep.html index 36eb2f985a4..dab002399a0 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/ConfigurationStep.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/ConfigurationStep.html @@ -18,19 +18,11 @@ -
-
-
-
-
- -
+
+
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/NameStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/NameStep.java index f9487501a01..4a6779af6cd 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/NameStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/NameStep.java @@ -267,14 +267,9 @@ private PrismObject getSelectedConnector() { return connector; } - @SuppressWarnings("unchecked") @Nullable private PrismObject getExistingConnector() { - PrismReference existingConnectorRef = resourceModelRaw.getObject().findReference(ResourceType.F_CONNECTOR_REF); - if (existingConnectorRef == null || existingConnectorRef.isEmpty()) { - return null; - } - return (PrismObject) existingConnectorRef.getValue().getObject(); + return ResourceTypeUtil.getConnectorIfPresent(resourceModelRaw.getObject()); } @Nullable diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.html index 5d71a33a795..73dc3d435aa 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.html @@ -18,6 +18,9 @@ +
+
+
@@ -226,5 +229,8 @@

+
+
+ diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.html index 96d6d1302b7..fe380642c22 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.html @@ -17,6 +17,9 @@ + +
+
@@ -210,7 +213,8 @@

- +
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/home/PageDashboard.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/home/PageDashboard.java index 329f3f630d5..20dce8a70bd 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/home/PageDashboard.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/home/PageDashboard.java @@ -21,7 +21,9 @@ import java.util.Collections; import java.util.List; +import com.evolveum.midpoint.prism.query.builder.QueryBuilder; import com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb; +import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.model.IModel; @@ -71,22 +73,6 @@ import com.evolveum.midpoint.web.page.admin.home.dto.AccountCallableResult; import com.evolveum.midpoint.web.page.admin.home.dto.AssignmentItemDto; import com.evolveum.midpoint.web.page.admin.home.dto.SimpleAccountDto; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.AvailabilityStatusType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskExecutionStatusType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; /** * @author lazyman @@ -290,10 +276,10 @@ private Component createResourceInfoBoxPanel(OperationResult result, Task task) if (totalCount == null) { totalCount = 0; } - - EqualFilter filter = EqualFilter.createEqual(SchemaConstants.PATH_OPERATIONAL_STATE_LAST_AVAILABILITY_STATUS, - ResourceType.class, getPrismContext(), AvailabilityStatusType.UP); - ObjectQuery query = ObjectQuery.createObjectQuery(filter); + + ObjectQuery query = QueryBuilder.queryFor(ResourceType.class, getPrismContext()) + .item(ResourceType.F_OPERATIONAL_STATE, OperationalStateType.F_LAST_AVAILABILITY_STATUS).eq(AvailabilityStatusType.UP) + .build(); Integer activeCount = getModelService().countObjects(ResourceType.class, query, null, task, result); if (activeCount == null) { activeCount = 0; diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResourceWizard.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResourceWizard.java index 1029a6f45c2..9e3389bc1f6 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResourceWizard.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResourceWizard.java @@ -61,7 +61,7 @@ public class PageResourceWizard extends PageAdminResources { // each step should use corresponding model // these models have always non-null content private LoadableModel> modelRaw; // contains resolved connector as well - private LoadableModel> modelNoFetch; + private LoadableModel> modelNoFetch; // contains resolved connector as well private LoadableModel> modelFull; // for new resources: should be set after first save; for others: should be set on page creation @@ -75,7 +75,9 @@ public PageResourceWizard(@NotNull PageParameters parameters) { modelRaw = createResourceModel(Arrays.asList( SelectorOptions.create(ResourceType.F_CONNECTOR_REF, GetOperationOptions.createResolve()), SelectorOptions.create(GetOperationOptions.createRaw()))); - modelNoFetch = createResourceModel(GetOperationOptions.createNoFetchCollection()); + modelNoFetch = createResourceModel(Arrays.asList( + SelectorOptions.create(ResourceType.F_CONNECTOR_REF, GetOperationOptions.createResolve()), + SelectorOptions.create(GetOperationOptions.createNoFetch()))); modelFull = createResourceModel(null); initLayout(); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/handlers/dto/GenericHandlerDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/handlers/dto/GenericHandlerDto.java index 85dcaf4d137..3adfd1a0bbe 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/handlers/dto/GenericHandlerDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/server/handlers/dto/GenericHandlerDto.java @@ -18,6 +18,7 @@ import com.evolveum.midpoint.gui.api.page.PageBase; import com.evolveum.midpoint.prism.*; +import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.util.CloneUtil; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.util.exception.SystemException; @@ -103,7 +104,7 @@ public GenericHandlerDto(TaskDto taskDto, @NotNull List items, PageBase pa } PrismContainerDefinition containerDefinition = new PrismContainerDefinition<>(new QName("test"), ctd, prismContext); container.setDefinition(containerDefinition); - containerWrapper = cwf.createContainerWrapper(container, ContainerStatus.MODIFYING, true); + containerWrapper = cwf.createContainerWrapper(container, ContainerStatus.MODIFYING, ItemPath.EMPTY_PATH, true); } public ContainerWrapper getContainer() { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/ProcessInstancesPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/ProcessInstancesPanel.java index bfe9e537191..92dd41dfafe 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/ProcessInstancesPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/ProcessInstancesPanel.java @@ -101,11 +101,11 @@ private List> initColumns(View view) { if (view == FULL_LIST) { columns.add(new CheckBoxHeaderColumn()); } + columns.add(createNameColumn()); columns.add(createTypeIconColumn(true)); columns.add(createObjectNameColumn("pageProcessInstances.item.object")); columns.add(createTypeIconColumn(false)); columns.add(createTargetNameColumn("pageProcessInstances.item.target")); - columns.add(createNameColumn()); columns.add(createStateColumn()); columns.add(new PropertyColumn(createStringResource("pageProcessInstances.item.started"), F_START_FORMATTED)); columns.add(createOutcomeColumn()); diff --git a/gui/admin-gui/src/main/resources/localization/Midpoint.properties b/gui/admin-gui/src/main/resources/localization/Midpoint.properties index 87a08a82ad3..378ce896b9a 100644 --- a/gui/admin-gui/src/main/resources/localization/Midpoint.properties +++ b/gui/admin-gui/src/main/resources/localization/Midpoint.properties @@ -3301,4 +3301,23 @@ StageDefinitionPanel.stopReviewOnHelp=What outcomes will prevent a case from bei If necessary, you could do that through the XML configuration. StageDefinitionPanel.configurationHelpLabel=For more information about configuring certification campaign stages, please see also StageDefinitionPanel.configurationHelpLink=this document -NameStep.configurationWillBeLost=The selected connector configuration schema is different from the current one. Configuration properties will be lost if you will proceed. \ No newline at end of file +NameStep.configurationWillBeLost=The selected connector configuration schema is different from the current one. Configuration properties will be lost if you will proceed. +resultsHandlerConfiguration=Results handlers +enableFilteredResultsHandler=Enable additional filtering of results +enableFilteredResultsHandlerHelp=This handler filters results retrieved from the resource by the connector, at the level of connector framework. \ + It is used by connector implementations that do not provide complete filtering by themselves. \ + Enabling this handler has some drawbacks e.g. in the area of paging. So it is to be used \ + only if really necessary. If not sure, it is advisable to use filtering in validation mode. Default value for current version of ConnId: enabled. +filteredResultsHandlerInValidationMode=Perform filtering in validation mode only +filteredResultsHandlerInValidationModeHelp=Switches the result filtering into validation mode: all data produced by the connector are checked by the \ + connector framework to see if they are properly filtered. In case of improper filtering, an exception is raised. This mode is to be used for connectors \ + that are expected to provide complete filtering, but their functionality in this area has to be verified. Default value for current version of ConnId: disabled. +enableCaseInsensitiveFilter=Make filtering case insensitive +enableCaseInsensitiveFilterHelp=This option makes filtering case insensitive, for all attributes on the resource. Used for case-insensitive resources. \ + Default value for current version of ConnId: disabled. +enableNormalizingResultsHandler=Enable handler that normalizes returned data +enableNormalizingResultsHandlerHelp=This handler normalizes each attribute that is passed from resource to the system. Usually recommended to be turned off. \ + Default value for current version of ConnId: enabled. +enableAttributesToGetSearchResultsHandler=Enable 'attributes to get' results handler +enableAttributesToGetSearchResultsHandlerHelp=This handler is used to implement 'attributes to get' option. It is advisable to keep the default setting \ + of 'enabled' (in current version of ConnId). diff --git a/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ResourceTypeUtil.java b/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ResourceTypeUtil.java index 9be63fbbad8..ccca7009a0a 100644 --- a/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ResourceTypeUtil.java +++ b/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ResourceTypeUtil.java @@ -18,6 +18,7 @@ import com.evolveum.midpoint.prism.PrismContainer; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.PrismProperty; +import com.evolveum.midpoint.prism.PrismReference; import com.evolveum.midpoint.schema.CapabilityUtil; import com.evolveum.midpoint.schema.constants.MidPointConstants; import com.evolveum.midpoint.schema.constants.SchemaConstants; @@ -106,6 +107,15 @@ public static ConnectorType getConnectorType(ResourceType resource, ObjectResolv } } + @SuppressWarnings("unchecked") + public static PrismObject getConnectorIfPresent(PrismObject resource) { + PrismReference existingConnectorRef = resource.findReference(ResourceType.F_CONNECTOR_REF); + if (existingConnectorRef == null || existingConnectorRef.isEmpty()) { + return null; + } + return (PrismObject) existingConnectorRef.getValue().getObject(); + } + public static Element getResourceXsdSchema(ResourceType resource) { XmlSchemaType xmlSchemaType = resource.getSchema(); if (xmlSchemaType == null) { diff --git a/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/connector-schema-3.xsd b/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/connector-schema-3.xsd index a046baff791..26e3313cf8d 100644 --- a/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/connector-schema-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/connector-schema-3.xsd @@ -55,6 +55,7 @@ 1 + 100 @@ -115,6 +116,7 @@ 1 + 200 @@ -137,7 +139,8 @@ 1 - + 300 + @@ -200,6 +203,10 @@ TODO + + 200 + enableNormalizingResultsHandlerHelp + @@ -207,6 +214,10 @@ TODO + + 100 + enableFilteredResultsHandlerHelp + @@ -214,6 +225,10 @@ TODO + + 110 + filteredResultsHandlerInValidationModeHelp + @@ -221,6 +236,10 @@ TODO + + 120 + enableCaseInsensitiveFilterHelp + @@ -228,6 +247,10 @@ TODO + + 300 + enableAttributesToGetSearchResultsHandlerHelp + @@ -240,6 +263,7 @@ 1 + 400