use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.SelectorQualifiedGetOptionsType in project midpoint by Evolveum.
the class Main method listResources.
private static Collection<ResourceType> listResources(ModelPortType modelPort) throws SAXException, IOException, FaultMessage {
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
modelPort.searchObjects(ModelClientUtil.getTypeQName(ResourceType.class), null, options, objectListHolder, resultHolder);
ObjectListType objectList = objectListHolder.value;
return (Collection) objectList.getObject();
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.SelectorQualifiedGetOptionsType in project midpoint by Evolveum.
the class Main method searchRoleByName.
private static RoleType searchRoleByName(ModelPortType modelPort, String roleName) throws SAXException, IOException, FaultMessage, JAXBException {
// WARNING: in a real case make sure that the role name is properly escaped before putting it in XML
SearchFilterType filter = ModelClientUtil.parseSearchFilterType("<equal xmlns='http://prism.evolveum.com/xml/ns/public/query-3' xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3' >" + "<path>c:name</path>" + "<value>" + roleName + "</value>" + "</equal>");
QueryType query = new QueryType();
query.setFilter(filter);
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
modelPort.searchObjects(ModelClientUtil.getTypeQName(RoleType.class), query, options, objectListHolder, resultHolder);
ObjectListType objectList = objectListHolder.value;
List<ObjectType> objects = objectList.getObject();
if (objects.isEmpty()) {
return null;
}
if (objects.size() == 1) {
return (RoleType) objects.get(0);
}
throw new IllegalStateException("Expected to find a single role with name '" + roleName + "' but found " + objects.size() + " users instead");
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.SelectorQualifiedGetOptionsType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method getShadowByName.
protected ShadowType getShadowByName(String resourceOid, QName objectClass, String name) throws JAXBException, SAXException, IOException, FaultMessage {
// WARNING: in a real case make sure that the username is properly escaped before putting it in XML
SearchFilterType filter = ModelClientUtil.parseSearchFilterType(" <q:and xmlns:q='http://prism.evolveum.com/xml/ns/public/query-3' xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3'>\n" + " <q:ref>\n" + " <q:path>resourceRef</q:path>\n" + " <q:value>\n" + " <oid>" + resourceOid + "</oid>\n" + " <type>ResourceType</type>\n" + " </q:value>\n" + " </q:ref>\n" + " <q:equal>\n" + " <q:path>objectClass</q:path>\n" + " <q:value xmlns:a=\"" + objectClass.getNamespaceURI() + "\">a:" + objectClass.getLocalPart() + "</q:value>\n" + " </q:equal>\n" + " <q:equal>\n" + " <q:path>attributes/name</q:path>\n" + " <q:value>" + name + "</q:value>\n" + " </q:equal>\n" + " </q:and>\n");
QueryType query = new QueryType();
query.setFilter(filter);
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
Holder<ObjectListType> objectListHolder = new Holder<>();
Holder<OperationResultType> resultHolder = new Holder<>();
modelPort.searchObjects(ModelClientUtil.getTypeQName(ShadowType.class), query, options, objectListHolder, resultHolder);
ObjectListType objectList = objectListHolder.value;
List<ObjectType> objects = objectList.getObject();
if (objects.isEmpty()) {
return null;
}
if (objects.size() == 1) {
return (ShadowType) objects.get(0);
}
throw new IllegalStateException("Expected to find a single shadow with name '" + name + "' but found " + objects.size() + " ones instead");
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.SelectorQualifiedGetOptionsType in project midpoint by Evolveum.
the class ResolveExecutor method execute.
@Override
public PipelineData execute(ActionExpressionType action, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException, SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, SecurityViolationException, ExpressionEvaluationException {
Collection<SelectorOptions<GetOperationOptions>> options;
if (action instanceof ResolveReferenceActionExpressionType) {
SelectorQualifiedGetOptionsType optionsBean = ((ResolveReferenceActionExpressionType) action).getOptions();
options = GetOperationOptionsUtil.optionsBeanToOptions(optionsBean);
} else {
boolean noFetch = expressionHelper.getArgumentAsBoolean(action.getParameter(), PARAM_NO_FETCH, input, context, false, NAME, globalResult);
options = schemaService.getOperationOptionsBuilder().noFetch(noFetch).build();
}
PipelineData output = PipelineData.createEmpty();
iterateOverItems(input, context, globalResult, (value, item, result) -> resolveReference(context, options, output, item, value, result), (value, exception) -> context.println("Couldn't resolve reference: " + value + exceptionSuffix(exception)));
return output;
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.SelectorQualifiedGetOptionsType in project midpoint by Evolveum.
the class GetOperationOptionsUtil method optionsToOptionsBean.
@SuppressWarnings("WeakerAccess")
@NotNull
public static SelectorQualifiedGetOptionsType optionsToOptionsBean(@NotNull Collection<SelectorOptions<GetOperationOptions>> options) {
SelectorQualifiedGetOptionsType optionsType = new SelectorQualifiedGetOptionsType();
List<SelectorQualifiedGetOptionType> retval = new ArrayList<>();
for (SelectorOptions<GetOperationOptions> option : options) {
retval.add(selectorOptionToSelectorQualifiedGetOptionType(option));
}
optionsType.getOption().addAll(retval);
return optionsType;
}
Aggregations