use of com.evolveum.midpoint.web.security.MidPointApplication in project midpoint by Evolveum.
the class ReportCreateHandlerDto method getReportParams.
public String getReportParams() {
PrismObject<TaskType> taskObject = taskDto.getTaskType().asPrismObject();
PrismContainer<ReportParameterType> container = taskObject.findContainer(new ItemPath(TaskType.F_EXTENSION, ReportConstants.REPORT_PARAMS_PROPERTY_NAME));
if (container == null || container.isEmpty()) {
return null;
}
PrismContainerValue<ReportParameterType> pcv = container.getValue();
PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext();
try {
return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serialize(pcv, ReportConstants.REPORT_PARAMS_PROPERTY_NAME));
} catch (SchemaException e) {
throw new SystemException("Couldn't serialize report parameters: " + e.getMessage(), e);
}
}
use of com.evolveum.midpoint.web.security.MidPointApplication in project midpoint by Evolveum.
the class ScriptExecutionHandlerDto method getScript.
public String getScript() {
ExecuteScriptType script = taskDto.getExtensionPropertyRealValue(SchemaConstants.SE_EXECUTE_SCRIPT, ExecuteScriptType.class);
if (script == null) {
return null;
}
PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext();
try {
return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serializeAnyData(script, SchemaConstants.SE_EXECUTE_SCRIPT));
} catch (SchemaException e) {
throw new SystemException("Couldn't serialize script: " + e.getMessage(), e);
}
}
use of com.evolveum.midpoint.web.security.MidPointApplication 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 com.evolveum.midpoint.web.security.MidPointApplication 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 com.evolveum.midpoint.web.security.MidPointApplication in project midpoint by Evolveum.
the class PageDebugView method loadObject.
private ObjectViewDto loadObject() {
StringValue objectOid = getPageParameters().get(PARAM_OBJECT_ID);
if (objectOid == null || StringUtils.isEmpty(objectOid.toString())) {
getSession().error(getString("pageDebugView.message.oidNotDefined"));
throw new RestartResponseException(PageDebugList.class);
}
Task task = createSimpleTask(OPERATION_LOAD_OBJECT);
//todo is this result != null ?
OperationResult result = task.getResult();
ObjectViewDto dto = null;
try {
MidPointApplication application = PageDebugView.this.getMidpointApplication();
GetOperationOptions rootOptions = GetOperationOptions.createRaw();
rootOptions.setResolveNames(true);
rootOptions.setTolerateRawData(true);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(rootOptions);
// FIXME: ObjectType.class will not work well here. We need more specific type.
//todo on page debug list create page params, put there oid and class for object type and send that to this page....read it here
Class type = ObjectType.class;
StringValue objectType = getPageParameters().get(PARAM_OBJECT_TYPE);
if (objectType != null && StringUtils.isNotBlank(objectType.toString())) {
type = getPrismContext().getSchemaRegistry().determineCompileTimeClass(new QName(SchemaConstantsGenerated.NS_COMMON, objectType.toString()));
}
// TODO make this configurable (or at least do not show campaign cases in production)
if (UserType.class.isAssignableFrom(type)) {
options.add(SelectorOptions.create(UserType.F_JPEG_PHOTO, GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE)));
}
if (LookupTableType.class.isAssignableFrom(type)) {
options.add(SelectorOptions.create(LookupTableType.F_ROW, GetOperationOptions.createRetrieve(new RelationalValueSearchQuery(ObjectPaging.createPaging(PrismConstants.T_ID, OrderDirection.ASCENDING)))));
}
if (AccessCertificationCampaignType.class.isAssignableFrom(type)) {
options.add(SelectorOptions.create(AccessCertificationCampaignType.F_CASE, GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE)));
}
PrismObject<ObjectType> object = getModelService().getObject(type, objectOid.toString(), options, task, result);
PrismContext context = application.getPrismContext();
String lex = context.serializerFor(dataLanguage).serialize(object);
dto = new ObjectViewDto(object.getOid(), WebComponentUtil.getName(object), object, lex);
result.recomputeStatus();
} catch (Exception ex) {
result.recordFatalError("Couldn't load object.", ex);
}
if (dto == null) {
showResult(result);
throw new RestartResponseException(PageDebugList.class);
}
showResult(result, false);
if (!WebComponentUtil.isSuccessOrHandledErrorOrWarning(result)) {
showResult(result, false);
throw new RestartResponseException(PageDebugList.class);
}
return dto;
}
Aggregations