use of net.opengis.wfs.v_2_0_0.QueryType in project midpoint by Evolveum.
the class QueryBasedHandlerDto method getObjectQuery.
public String getObjectQuery() {
QueryType query = taskDto.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY, QueryType.class);
if (query == null) {
return null;
}
PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext();
try {
return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serializeAnyData(query, SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY));
} catch (SchemaException e) {
throw new SystemException("Couldn't serialize query: " + e.getMessage(), e);
}
}
use of net.opengis.wfs.v_2_0_0.QueryType in project midpoint by Evolveum.
the class TaskDto method getObjectQuery.
public String getObjectQuery() {
QueryType queryType = getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY, QueryType.class);
PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext();
try {
return prismContext.xmlSerializer().serializeAnyData(queryType, SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY);
} catch (SchemaException e) {
throw new SystemException("Couldn't serialize query: " + e.getMessage(), e);
}
}
use of net.opengis.wfs.v_2_0_0.QueryType in project midpoint by Evolveum.
the class WebComponentUtil method createSingleRecurrenceTask.
public static TaskType createSingleRecurrenceTask(String taskName, QName applicableType, ObjectQuery query, ObjectDelta delta, ModelExecuteOptions options, String category, PageBase pageBase) throws SchemaException {
TaskType task = new TaskType();
MidPointPrincipal owner = SecurityUtils.getPrincipalUser();
ObjectReferenceType ownerRef = new ObjectReferenceType();
ownerRef.setOid(owner.getOid());
ownerRef.setType(owner.getUser().COMPLEX_TYPE);
task.setOwnerRef(ownerRef);
task.setBinding(TaskBindingType.LOOSE);
task.setCategory(category);
task.setExecutionStatus(TaskExecutionStatusType.RUNNABLE);
task.setRecurrence(TaskRecurrenceType.SINGLE);
task.setThreadStopAction(ThreadStopActionType.RESTART);
task.setHandlerUri(pageBase.getTaskService().getHandlerUriForCategory(category));
ScheduleType schedule = new ScheduleType();
schedule.setMisfireAction(MisfireActionType.EXECUTE_IMMEDIATELY);
task.setSchedule(schedule);
task.setName(WebComponentUtil.createPolyFromOrigString(taskName));
PrismObject<TaskType> prismTask = task.asPrismObject();
ItemPath path = new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY);
PrismProperty objectQuery = prismTask.findOrCreateProperty(path);
QueryType queryType = QueryJaxbConvertor.createQueryType(query, pageBase.getPrismContext());
objectQuery.addRealValue(queryType);
path = new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_OBJECT_TYPE);
PrismProperty objectType = prismTask.findOrCreateProperty(path);
objectType.setRealValue(applicableType);
if (delta != null) {
path = new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA);
PrismProperty objectDelta = prismTask.findOrCreateProperty(path);
objectDelta.setRealValue(DeltaConvertor.toObjectDeltaType(delta));
}
if (options != null) {
prismTask.findOrCreateProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_EXECUTE_OPTIONS)).setRealValue(options.toModelExecutionOptionsType());
}
return task;
}
use of net.opengis.wfs.v_2_0_0.QueryType 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 net.opengis.wfs.v_2_0_0.QueryType in project midpoint by Evolveum.
the class ExportAction method createQuery.
private QueryType createQuery(int from) throws IOException, SAXException, JAXBException {
QueryType query = new QueryType();
query.setFilter(loadQuery());
PagingType paging = new PagingType();
paging.setOffset(from);
paging.setMaxSize(SEARCH_PAGE_SIZE);
paging.setOrderBy(ModelClientUtil.createItemPathType("name"));
paging.setOrderDirection(OrderDirectionType.ASCENDING);
query.setPaging(paging);
return query;
}
Aggregations