use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class ExportAction method executeSearch.
private void executeSearch(ModelPortType port, Writer writer) throws FaultMessage, IOException, JAXBException, SAXException {
SelectorQualifiedGetOptionsType options = createOptions();
QName type = ObjectType.getType(getParams().getType());
if (type == null) {
type = ObjectType.OBJECT.getType();
}
int count = 0;
int currentSize = 1;
Holder<ObjectListType> list = new Holder<>();
Holder<OperationResultType> result = new Holder<>();
while (currentSize > 0) {
QueryType query = createQuery(count);
port.searchObjects(type, query, options, list, result);
OperationResultType res = result.value;
if (!OperationResultStatusType.SUCCESS.equals(res.getStatus()) && !getParams().isIgnore()) {
printInfoMessage("Search returned {}, reason: ", res.getStatus(), res.getMessage());
if (getParams().isVerbose()) {
printInfoMessage("Operation result:\n{}", ToolsUtils.serializeObject(res));
}
break;
}
ObjectListType objList = list.value;
if (getParams().isVerbose()) {
printInfoMessage("Search returned {}, status: {}/{}", res.getStatus(), count, objList.getCount());
}
List<com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> objects = objList.getObject();
currentSize = objects.size();
for (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType object : objects) {
ToolsUtils.serializeObject(object, writer);
writer.write('\n');
}
count += currentSize;
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class ExportAction method executeGet.
private void executeGet(ModelPortType port, Writer writer) throws FaultMessage, IOException, JAXBException {
SelectorQualifiedGetOptionsType options = createOptions();
QName type = ObjectType.getType(getParams().getType());
if (type == null) {
type = ObjectType.OBJECT.getType();
}
Holder<com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> object = new Holder<>();
Holder<OperationResultType> result = new Holder<>();
port.getObject(type, getParams().getOid(), options, object, result);
ToolsUtils.serializeObject(object.value, writer);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class ImportAction method executeAction.
@Override
protected void executeAction() {
ModelPortType port = createModelPort();
ModelExecuteOptionsType options = new ModelExecuteOptionsType();
options.setRaw(getParams().isRaw());
com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType object = readObject();
ObjectDeltaType delta = createAddDelta(object);
ObjectDeltaListType deltas = createDeltaList(delta);
OperationResultType resultType;
try {
ObjectDeltaOperationListType result = port.executeChanges(deltas, options);
List<ObjectDeltaOperationType> operations = result.getDeltaOperation();
ObjectDeltaOperationType operation = operations.get(0);
resultType = operation.getExecutionResult();
} catch (FaultMessage ex) {
//todo error handling
FaultType fault = ex.getFaultInfo();
resultType = fault.getOperationResult();
}
STD_OUT.info("Status: {}", resultType.getStatus());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class ResourceContentPanel method getResultLabel.
private String getResultLabel(IModel<SelectableBean<ShadowType>> model) {
OperationResultType result = getResult(model);
if (result == null) {
return "";
}
StringBuilder b = new StringBuilder(createStringResource("FailedOperationTypeType." + getShadow(model).getFailedOperationType()).getObject());
b.append(":");
b.append(createStringResource("OperationResultStatusType." + result.getStatus()).getObject());
return b.toString();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class TestUtil method assertSuccess.
public static void assertSuccess(String message, OperationResultType result) {
if (!checkResults) {
return;
}
assertNotNull(message + ": null result", result);
// Ignore top-level if the operation name is not set
if (result.getOperation() != null) {
if (result.getStatus() == null || result.getStatus() == OperationResultStatusType.UNKNOWN) {
fail(message + ": undefined status (" + result.getStatus() + ") on operation " + result.getOperation());
}
if (result.getStatus() != OperationResultStatusType.SUCCESS && result.getStatus() != OperationResultStatusType.NOT_APPLICABLE && result.getStatus() != OperationResultStatusType.HANDLED_ERROR) {
fail(message + ": " + result.getMessage() + " (" + result.getStatus() + ")");
}
}
List<OperationResultType> partialResults = result.getPartialResults();
for (OperationResultType subResult : partialResults) {
if (subResult == null) {
fail(message + ": null subresult under operation " + result.getOperation());
}
if (subResult.getOperation() == null) {
fail(message + ": null subresult operation under operation " + result.getOperation());
}
assertSuccess(message, subResult);
}
}
Aggregations