Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Oct 30, 2019
2 parents 448024e + e250b7a commit 8012dd2
Show file tree
Hide file tree
Showing 44 changed files with 2,870 additions and 1,854 deletions.
Expand Up @@ -8,11 +8,13 @@
package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

import java.util.List;
Expand Down Expand Up @@ -81,6 +83,16 @@ public StatisticsPanel(String id, IModel<StatisticsDto> model) {
initLayout();
}

private Label createFailureLabel(String id, IModel<Integer> text) {
Label label = new Label(id, text);
label.add(AttributeAppender.append("class", () -> {
Integer value = text != null ? text.getObject() : null;

return value != null && value != 0 ? "text-danger" : null;
}));
return label;
}

protected void initLayout() {
contentsPanel = new WebMarkupContainer(ID_CONTENTS_PANEL);
contentsPanel.setOutputMarkupId(true);
Expand All @@ -90,22 +102,22 @@ protected void initLayout() {
protected void populateItem(final ListItem<ProvisioningStatisticsLineDto> item) {
item.add(new Label(ID_PROVISIONING_RESOURCE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_RESOURCE)));
item.add(new Label(ID_PROVISIONING_OBJECT_CLASS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_OBJECT_CLASS)));
item.add(new Label(ID_PROVISIONING_GET_SUCCESS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_GET_SUCCESS)));
item.add(new Label(ID_PROVISIONING_GET_FAILURE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_GET_FAILURE)));
item.add(new Label(ID_PROVISIONING_SEARCH_SUCCESS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_SEARCH_SUCCESS)));
item.add(new Label(ID_PROVISIONING_SEARCH_FAILURE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_SEARCH_FAILURE)));
item.add(new Label(ID_PROVISIONING_CREATE_SUCCESS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_CREATE_SUCCESS)));
item.add(new Label(ID_PROVISIONING_CREATE_FAILURE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_CREATE_FAILURE)));
item.add(new Label(ID_PROVISIONING_UPDATE_SUCCESS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_UPDATE_SUCCESS)));
item.add(new Label(ID_PROVISIONING_UPDATE_FAILURE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_UPDATE_FAILURE)));
item.add(new Label(ID_PROVISIONING_DELETE_SUCCESS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_DELETE_SUCCESS)));
item.add(new Label(ID_PROVISIONING_DELETE_FAILURE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_DELETE_FAILURE)));
item.add(new Label(ID_PROVISIONING_SYNC_SUCCESS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_SYNC_SUCCESS)));
item.add(new Label(ID_PROVISIONING_SYNC_FAILURE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_SYNC_FAILURE)));
item.add(new Label(ID_PROVISIONING_SCRIPT_SUCCESS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_SCRIPT_SUCCESS)));
item.add(new Label(ID_PROVISIONING_SCRIPT_FAILURE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_SCRIPT_FAILURE)));
item.add(new Label(ID_PROVISIONING_OTHER_SUCCESS, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_OTHER_SUCCESS)));
item.add(new Label(ID_PROVISIONING_OTHER_FAILURE, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_OTHER_FAILURE)));
item.add(new Label(ID_PROVISIONING_GET_SUCCESS, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_GET_SUCCESS)));
item.add(createFailureLabel(ID_PROVISIONING_GET_FAILURE, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_GET_FAILURE)));
item.add(new Label(ID_PROVISIONING_SEARCH_SUCCESS, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_SEARCH_SUCCESS)));
item.add(createFailureLabel(ID_PROVISIONING_SEARCH_FAILURE, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_SEARCH_FAILURE)));
item.add(new Label(ID_PROVISIONING_CREATE_SUCCESS, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_CREATE_SUCCESS)));
item.add(createFailureLabel(ID_PROVISIONING_CREATE_FAILURE, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_CREATE_FAILURE)));
item.add(new Label(ID_PROVISIONING_UPDATE_SUCCESS, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_UPDATE_SUCCESS)));
item.add(createFailureLabel(ID_PROVISIONING_UPDATE_FAILURE, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_UPDATE_FAILURE)));
item.add(new Label(ID_PROVISIONING_DELETE_SUCCESS, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_DELETE_SUCCESS)));
item.add(createFailureLabel(ID_PROVISIONING_DELETE_FAILURE, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_DELETE_FAILURE)));
item.add(new Label(ID_PROVISIONING_SYNC_SUCCESS, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_SYNC_SUCCESS)));
item.add(createFailureLabel(ID_PROVISIONING_SYNC_FAILURE, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_SYNC_FAILURE)));
item.add(new Label(ID_PROVISIONING_SCRIPT_SUCCESS, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_SCRIPT_SUCCESS)));
item.add(createFailureLabel(ID_PROVISIONING_SCRIPT_FAILURE, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_SCRIPT_FAILURE)));
item.add(new Label(ID_PROVISIONING_OTHER_SUCCESS, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_OTHER_SUCCESS)));
item.add(createFailureLabel(ID_PROVISIONING_OTHER_FAILURE, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_OTHER_FAILURE)));
item.add(new Label(ID_PROVISIONING_TOTAL_OPERATIONS_COUNT, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_TOTAL_OPERATIONS_COUNT)));
item.add(new Label(ID_PROVISIONING_AVERAGE_TIME, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_AVERAGE_TIME)));
item.add(new Label(ID_PROVISIONING_MIN_TIME, new PropertyModel<String>(item.getModel(), ProvisioningStatisticsLineDto.F_MIN_TIME)));
Expand Down
Expand Up @@ -248,11 +248,12 @@ private void addAttributeValue(String attrName, Set<Object> currentValues, Objec
}
}

Set<Object> valuesToCheck = new HashSet<>();
valuesToCheck.addAll(currentValues);
valuesToCheck.add(valueToAdd);
checkSchema(attrName, valuesToCheck, "add");

// an optimization: let's avoid attribute manipulation if we don't want to check the schema anyway
if (resource != null && resource.isEnforceSchema()) {
Set<Object> valuesToCheck = new HashSet<>(currentValues);
valuesToCheck.add(valueToAdd);
checkSchema(attrName, valuesToCheck, "add");
}
currentValues.add(valueToAdd);
}

Expand Down
Expand Up @@ -272,12 +272,20 @@ public interface Item<V extends PrismValue, D extends ItemDefinition> extends It

/**
* Adds given values, with the same semantics as repeated add(..) calls.
* For equality testing uses give strategy.
* For equality testing uses given strategy.
*
* @return true if this item changed as a result of the call (i.e. if at least one value was really added)
*/
boolean addAll(Collection<V> newValues, EquivalenceStrategy strategy) throws SchemaException;

/**
* Adds given values, with the same semantics as repeated add(..) calls.
* For equality testing uses given strategy.
*
* @return true if this item changed as a result of the call (i.e. if at least one value was really added)
*/
boolean addAll(Collection<V> newValues, boolean checkUniqueness, EquivalenceStrategy strategy) throws SchemaException;

/**
* Removes given value from the item.
*
Expand Down
Expand Up @@ -404,10 +404,14 @@ public boolean addAll(Collection<V> newValues) throws SchemaException {
}

public boolean addAll(Collection<V> newValues, EquivalenceStrategy strategy) throws SchemaException {
return addAll(newValues, true, strategy);
}

public boolean addAll(Collection<V> newValues, boolean checkUniqueness, EquivalenceStrategy strategy) throws SchemaException {
checkMutability();
boolean changed = false;
for (V val: newValues) {
if (add(val, strategy)) {
if (add(val, checkUniqueness, strategy)) {
changed = true;
}
}
Expand Down
Expand Up @@ -1270,8 +1270,13 @@ public void applyToMatchingPath(Item item, ParameterizedEquivalenceStrategy stra
throw new SchemaException("Cannot apply delta "+this+" to "+item+" because the deltas is applicable only to "+getItemClass().getSimpleName());
}
if (valuesToReplace != null) {
// FIXME This is a temporary solution (ugly hack). We do this to avoid O(n^2) comparisons when replacing
// a lot of values, like 100K members for a group. But the serious solution is to employ hashing in ItemImpl,
// and resolve this efficiency issue (1) for all cases - i.e. ADD+DELETE+REPLACE, (2) preserving uniqueness checking.
// See MID-5889.
item.clear();
//noinspection unchecked
item.replaceAll(PrismValueCollectionsUtil.cloneCollection(valuesToReplace), strategy);
item.addAll(PrismValueCollectionsUtil.cloneCollection(valuesToReplace), false, strategy);
} else {
if (valuesToDelete != null) {
//noinspection unchecked
Expand Down
Expand Up @@ -399,6 +399,12 @@ public boolean addAll(Collection<PrismContainerValue<C>> newValues, EquivalenceS
return realContainer.addAll(newValues, strategy);
}

@Override
public boolean addAll(Collection<PrismContainerValue<C>> newValues, boolean checkUniqueness, EquivalenceStrategy strategy)
throws SchemaException {
return realContainer.addAll(newValues, checkUniqueness, strategy);
}

public String debugDump(int indent) {
return realContainer.debugDump(indent);
}
Expand Down
Expand Up @@ -297,6 +297,12 @@ public boolean addAll(Collection<PrismPropertyValue<T>> newValues, EquivalenceSt
return realProperty.addAll(newValues, strategy);
}

@Override
public boolean addAll(Collection<PrismPropertyValue<T>> newValues, boolean checkUniqueness, EquivalenceStrategy strategy)
throws SchemaException {
return realProperty.addAll(newValues, checkUniqueness, strategy);
}

public boolean remove(PrismPropertyValue<T> value) {
return realProperty.remove(value);
}
Expand Down
Expand Up @@ -225,6 +225,12 @@ public boolean addAll(Collection<PrismReferenceValue> newValues, EquivalenceStra
return realReference.addAll(newValues, strategy);
}

@Override
public boolean addAll(Collection<PrismReferenceValue> newValues, boolean checkUniqueness, EquivalenceStrategy strategy)
throws SchemaException {
return realReference.addAll(newValues, checkUniqueness, strategy);
}

public boolean remove(PrismReferenceValue value) {
return realReference.remove(value);
}
Expand Down
1 change: 1 addition & 0 deletions infra/schema-pure-jaxb/src/compile/resources/catalog.xml
Expand Up @@ -27,6 +27,7 @@ Used when building via xjc.
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/common-workflows-3" uri="../../../target/midpoint-schema/xml/ns/public/common/common-workflows-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/common-policy-3" uri="../../../target/midpoint-schema/xml/ns/public/common/common-policy-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/common-case-management-3" uri="../../../target/midpoint-schema/xml/ns/public/common/common-case-management-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/common-security-3" uri="../../../target/midpoint-schema/xml/ns/public/common/common-security-3.xsd" />

<!-- WSDLs -->
<public publicId="http://midpoint.evolveum.com/xml/ns/public/model/model-3" uri="../../../target/midpoint-schema/xml/ns/public/model/model-3.wsdl" />
Expand Down
Expand Up @@ -1744,6 +1744,10 @@ public void summarize(boolean alsoSubresults) {
// Already summarized
continue;
}
if (subresult.isTraced()) {
// We don't want to summarize traced subresults.
continue;
}
if (subresult.isError() && summarizeErrors) {
// go on
} else if (subresult.isPartialError() && summarizePartialErrors) {
Expand All @@ -1768,6 +1772,8 @@ public void summarize(boolean alsoSubresults) {
// We implement quite a complex algorithm to ensure "incremental stripping", i.e. calling summarize() repeatedly
// on an OperationResult to which new standard entries are continually added. The requirement is that there must
// be at most one summarization record, and it must be placed after all standard records of given type.
//
// TODO consider tracing here
Map<OperationStatusKey, OperationStatusCounter> recordsCounters = new HashMap<>();
iterator = getSubresults().iterator();
while (iterator.hasNext()) {
Expand Down
Expand Up @@ -44,6 +44,7 @@ Notes:
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/common-workflows-3" uri="../xml/ns/public/common/common-workflows-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/common-policy-3" uri="../xml/ns/public/common/common-policy-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/common-case-management-3" uri="../xml/ns/public/common/common-case-management-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/common-security-3" uri="../xml/ns/public/common/common-security-3.xsd" />

<!-- WSDLs -->
<public publicId="http://midpoint.evolveum.com/xml/ns/public/model/model-3" uri="../xml/ns/public/model/model-3.wsdl" />
Expand Down

0 comments on commit 8012dd2

Please sign in to comment.