Skip to content

Commit

Permalink
Merge branch 'post-3.7-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Feb 26, 2018
2 parents 0ed1035 + 9ec8abd commit 00c31c4
Show file tree
Hide file tree
Showing 22 changed files with 856 additions and 313 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2017 Evolveum
* Copyright (c) 2010-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@
package com.evolveum.midpoint.schema;

import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.ShortDumpable;
import com.evolveum.midpoint.xml.ns._public.common.common_3.GetOperationOptionsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.IterationMethodType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
Expand All @@ -33,7 +34,7 @@
* @author semancik
*
*/
public class GetOperationOptions extends AbstractOptions implements Serializable, Cloneable {
public class GetOperationOptions extends AbstractOptions implements Serializable, Cloneable, ShortDumpable {
private static final long serialVersionUID = 1L;

/**
Expand Down Expand Up @@ -797,6 +798,13 @@ public GetOperationOptions clone() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("GetOperationOptions(");
shortDump(sb);
sb.append(")");
return sb.toString();
}

@Override
public void shortDump(StringBuilder sb) {
appendFlag(sb, "resolve", resolve);
appendFlag(sb, "resolveNames", resolveNames);
appendFlag(sb, "noFetch", noFetch);
Expand All @@ -811,8 +819,6 @@ public String toString() {
appendVal(sb, "relationalValueSearchQuery", relationalValueSearchQuery);
appendVal(sb, "definitionProcessing", definitionProcessing);
removeLastComma(sb);
sb.append(")");
return sb.toString();
}


Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,14 +16,15 @@
package com.evolveum.midpoint.schema;

import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.ShortDumpable;

import java.io.Serializable;

/**
* @author semancik
*
*/
public class ObjectSelector implements Serializable {
public class ObjectSelector implements Serializable, ShortDumpable {

private ItemPath path;

Expand All @@ -41,4 +42,9 @@ public String toString() {
return "ObjectSelector(" + path + ")";
}

@Override
public void shortDump(StringBuilder sb) {
sb.append(path);
}

}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2017 Evolveum
* Copyright (c) 2010-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,7 @@
import com.evolveum.midpoint.prism.path.ItemPathSegment;
import com.evolveum.midpoint.prism.path.NameItemPathSegment;
import com.evolveum.midpoint.util.DebugDumpable;
import com.evolveum.midpoint.util.ShortDumpable;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.collections4.CollectionUtils;
import org.jetbrains.annotations.NotNull;
Expand All @@ -35,7 +36,8 @@
* @author semancik
*
*/
public class SelectorOptions<T> implements Serializable, DebugDumpable {
public class SelectorOptions<T> implements Serializable, DebugDumpable, ShortDumpable {
private static final long serialVersionUID = 1L;

private ObjectSelector selector;
private T options;
Expand Down Expand Up @@ -374,17 +376,32 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return "ObjectOperationOptions(" + selector + ": " + options + ")";
StringBuilder sb = new StringBuilder("ObjectOperationOptions(");
shortDump(sb);
sb.append(")");
return sb.toString();
}

@Override
public String debugDump() {
return debugDump(0);
public String debugDump(int indent) {
return toString();
}

@Override
public String debugDump(int indent) {
return toString();
public void shortDump(StringBuilder sb) {
if (selector == null) {
sb.append("/");
} else {
selector.shortDump(sb);
}
sb.append(":");
if (options == null) {
sb.append("null");
} else if (options instanceof ShortDumpable) {
((ShortDumpable)options).shortDump(sb);
} else {
sb.append(options);
}
}

//endregion
Expand Down
Expand Up @@ -798,6 +798,26 @@ public static String prettyPrint(SynchronizationSituationDescriptionType syncDes
return sb.toString();
}

public static String prettyPrint(ObjectDeltaType deltaType) {
if (deltaType == null) {
return "null";
}
StringBuilder sb = new StringBuilder("ObjectDeltaType(");
sb.append(prettyPrint(deltaType.getObjectType())).append(" ");
sb.append(prettyPrint(deltaType.getOid())).append(" ");
sb.append(deltaType.getChangeType()).append(": ");
com.evolveum.prism.xml.ns._public.types_3.ObjectType objectToAdd = deltaType.getObjectToAdd();
if (objectToAdd != null) {
sb.append(prettyPrint(objectToAdd));
}
List<ItemDeltaType> itemDelta = deltaType.getItemDelta();
if (itemDelta != null && !itemDelta.isEmpty()) {
sb.append(prettyPrint(itemDelta));
}
sb.append(")");
return sb.toString();
}

public static String prettyPrint(ObjectDeltaOperationType deltaOpType) {
if (deltaOpType == null) {
return "null";
Expand Down
Expand Up @@ -107,8 +107,12 @@ public static String debugDump(Collection<?> dumpables) {
}

public static String debugDump(Collection<?> dumpables, int indent) {
return debugDump(dumpables, indent, true);
}

public static String debugDump(Collection<?> dumpables, int indent, boolean openCloseSymbols) {
StringBuilder sb = new StringBuilder();
debugDump(sb, dumpables, indent, true);
debugDump(sb, dumpables, indent, openCloseSymbols);
return sb.toString();
}

Expand Down Expand Up @@ -639,6 +643,40 @@ public String toString() {
}
};
}

public static String shortDump(ShortDumpable sd) {
if (sd == null) {
return null;
} else {
return sd.shortDump();
}
}

public static void shortDump(StringBuilder sb, ShortDumpable sd) {
if (sd != null) {
sd.shortDump(sb);
}
}

public static void shortDump(StringBuilder sb, Collection<? extends ShortDumpable> sds) {
if (sds == null) {
return;
}
sb.append("[");
Iterator<? extends ShortDumpable> iterator = sds.iterator();
while (iterator.hasNext()) {
ShortDumpable sd = iterator.next();
if (sd == null) {
sb.append("null");
} else {
sd.shortDump(sb);
}
if (iterator.hasNext()) {
sb.append(", ");
}
}
sb.append("]");
}

public static Object shortDumpLazily(ShortDumpable dumpable) {
if (dumpable == null) {
Expand Down
Expand Up @@ -916,9 +916,7 @@ private <T extends ObjectType, F extends ObjectType> void executeDelta(ObjectDel

} finally {

LOGGER.info("RRRR1: {}", result);
result.computeStatus();
LOGGER.info("RRRR2: {}", result);
if (objectContext != null) {
if (!objectDelta.hasCompleteDefinition()) {
throw new SchemaException("object delta does not have complete definition");
Expand Down

0 comments on commit 00c31c4

Please sign in to comment.