Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Oct 13, 2021
2 parents 80e3ec3 + 215c5d6 commit 10f61df
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class OpResult implements Serializable, Visitable {

// we assume there is at most one background task created (TODO revisit this assumption)
private String backgroundTaskOid;
private Boolean backgroundTaskVisible; // available on root opResult only
private Boolean backgroundTaskVisible; // available on root opResult only

private String caseOid;
private Boolean caseVisible;
Expand Down Expand Up @@ -121,49 +121,33 @@ public static OpResult getOpResult(PageBase page, OperationResult result) {
opResult.exceptionsStackTrace = writer.toString();
}

if (result.getParams() != null) {
for (Map.Entry<String, Collection<String>> entry : result.getParams().entrySet()) {
String paramValue = null;
Collection<String> values = entry.getValue();
if (values != null) {
paramValue = values.toString();
}

opResult.getParams().add(new Param(entry.getKey(), paramValue));
for (Map.Entry<String, Collection<String>> entry : result.getParams().entrySet()) {
String paramValue = null;
Collection<String> values = entry.getValue();
if (values != null) {
paramValue = values.toString();
}
opResult.getParams().add(new Param(entry.getKey(), paramValue));
}

if (result.getContext() != null) {
for (Map.Entry<String, Collection<String>> entry : result.getContext().entrySet()) {
String contextValue = null;
Collection<String> values = entry.getValue();
if (values != null) {
contextValue = values.toString();
}

opResult.getContexts().add(new Context(entry.getKey(), contextValue));
for (Map.Entry<String, Collection<String>> entry : result.getContext().entrySet()) {
String contextValue = null;
Collection<String> values = entry.getValue();
if (values != null) {
contextValue = values.toString();
}
opResult.getContexts().add(new Context(entry.getKey(), contextValue));
}

if (result.getSubresults() != null) {
for (OperationResult subresult : result.getSubresults()) {
OpResult subOpResult = OpResult.getOpResult(page, subresult);
opResult.getSubresults().add(subOpResult);
subOpResult.parent = opResult;
if (subOpResult.getBackgroundTaskOid() != null) {
opResult.backgroundTaskOid = subOpResult.getBackgroundTaskOid();
}
}
}

if (result.getBackgroundTaskOid() != null) {
opResult.backgroundTaskOid = result.getBackgroundTaskOid();
for (OperationResult subresult : result.getSubresults()) {
OpResult subOpResult = OpResult.getOpResult(page, subresult);
opResult.getSubresults().add(subOpResult);
subOpResult.parent = opResult;
}

String caseOid = OperationResult.referenceToCaseOid(result.findAsynchronousOperationReference());
if (caseOid != null) {
opResult.caseOid = caseOid;
}
String asynchronousOperationReference = result.findAsynchronousOperationReference();
opResult.backgroundTaskOid = OperationResult.referenceToTaskOid(asynchronousOperationReference);
opResult.caseOid = OperationResult.referenceToCaseOid(asynchronousOperationReference);

if (opResult.parent == null) {
opResult.xml = createXmlModel(result, page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4041,18 +4041,16 @@ public static <O extends ObjectType> IconType getIconForActivationStatus(O obj)
}

ActivationStatusType status = activation.getEffectiveStatus();
if (ActivationStatusType.ENABLED == status) {
return null;
}

IconType icon = new IconType();
if (LockoutStatusType.LOCKED == activation.getLockoutStatus()) {
icon.setCssClass(GuiStyleConstants.CLASS_LOCK_STATUS);
} else if (ActivationStatusType.ENABLED == status) {
return null;
} else if (ActivationStatusType.DISABLED == status) {
icon.setCssClass(GuiStyleConstants.CLASS_BAN);
} else if (ActivationStatusType.ARCHIVED == status) {
icon.setCssClass(GuiStyleConstants.CLASS_ICON_NO_OBJECTS);
} else if (ActivationStatusType.ENABLED != status) {
} else {
icon.setCssClass(GuiStyleConstants.CLASS_TEST_CONNECTION_MENU_ITEM);
}
if (icon.getCssClass() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class InducedEntitlementsValidator implements MidpointFormValidator {
public class InducedEntitlementsValidator implements MidpointFormValidator, Serializable {

@Override
public Collection<SimpleValidationError> validateObject(PrismObject<? extends ObjectType> object, Collection<ObjectDelta<? extends ObjectType>> deltas) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1988,9 +1988,11 @@ th.composited-icon {
//background-color: #ffffff;
margin: 10px;
text-align: center;
line-height: 30px;
line-height: 20px;
font-size: 16px;
width: 115px;
overflow: hidden;
text-overflow: ellipsis;
}
.compositedButton > .compositedButtonIcon {
//background-color: #f1f1f1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public class OperationResult
public static final String PARAM_LANGUAGE = "language";

public static final String RETURN_COUNT = "count";
public static final String RETURN_BACKGROUND_TASK_OID = "backgroundTaskOid";
public static final String RETURN_COMMENT = "comment";
public static final String DEFAULT = "";

Expand Down Expand Up @@ -1271,7 +1270,7 @@ public OperationResult addArbitraryObjectCollectionAsParam(String name, Collecti
return this;
}

public Map<String, Collection<String>> getContext() {
public @NotNull Map<String, Collection<String>> getContext() {
if (context == null) {
context = new HashMap<>();
}
Expand Down Expand Up @@ -2256,19 +2255,12 @@ public String toString() {

public void setBackgroundTaskOid(String oid) {
setAsynchronousOperationReference(TASK_OID_PREFIX + oid);
addReturn(RETURN_BACKGROUND_TASK_OID, oid); // deprecated
}

public void setCaseOid(String oid) {
setAsynchronousOperationReference(CASE_OID_PREFIX + oid);
}

// use asynchronous operation reference
@Deprecated // TODO remove in 4.2
public String getBackgroundTaskOid() {
return getReturnSingle(RETURN_BACKGROUND_TASK_OID);
}

@Override
public OperationResult operationKind(OperationKindType value) {
this.operationKind = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ public static <O extends ObjectType> XMLGregorianCalendar getLastTouchTimestamp(
//noinspection unchecked
def = prismContext.getSchemaRegistry().findItemDefinitionByElementName(entry.getKey()); // a bit of hack here
if (def == null) {
throw new SchemaException("No definition of " + entry.getKey() + " in task extension");
throw new SchemaException("No definition of " + entry.getKey() + " in the extension");
}
}
Item<PrismValue, ItemDefinition> extensionItem = def.instantiate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class SqaleRepoBaseTest extends AbstractSpringTest
public static final String AUDIT_OP_PREFIX = SqaleAuditService.class.getSimpleName() + '.';

private static final int QUERY_BUFFER_SIZE = 1000;
public static final String SYSTEM_PROPERTY_SKIP_DB_CLEAR = "skipDbClear";

private static boolean cacheTablesCleared = false;

Expand All @@ -79,6 +80,12 @@ public void initDatabase() throws Exception {
queryRecorder = new SqlRecorder(QUERY_BUFFER_SIZE);
sqlRepoContext.setQuerydslSqlListener(queryRecorder);

if (System.getProperty(SYSTEM_PROPERTY_SKIP_DB_CLEAR) == null) {
clearDatabase();
}
}

private void clearDatabase() {
try (JdbcSession jdbcSession = startTransaction()) {
// object delete cascades to sub-rows of the "object aggregate"

Expand Down Expand Up @@ -529,6 +536,13 @@ protected <C extends Containerable> String serializeFullObject(C containerable)
.serialize(containerable.asPrismContainerValue());
}

protected void compactOperationResult(OperationResult operationResult) {
operationResult.computeStatus();
operationResult.cleanupResultDeeply();
operationResult.setSummarizeSuccesses(true);
operationResult.summarize();
}

/**
* Helper to make setting shadow attributes easier.
*
Expand Down

0 comments on commit 10f61df

Please sign in to comment.