Search in sources :

Example 1 with PageTaskAdd

use of com.evolveum.midpoint.web.page.admin.server.PageTaskAdd in project midpoint by Evolveum.

the class ResourceContentPanel method newTaskPerformed.

private void newTaskPerformed(String category, AjaxRequestTarget target) {
    TaskType taskType = new TaskType();
    PrismProperty<ShadowKindType> pKind;
    try {
        pKind = taskType.asPrismObject().findOrCreateProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_KIND));
        pKind.setRealValue(getKind());
    } catch (SchemaException e) {
        getSession().warn("Could not set kind for new task " + e.getMessage());
    }
    PrismProperty<String> pIntent;
    try {
        pIntent = taskType.asPrismObject().findOrCreateProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_INTENT));
        pIntent.setRealValue(getIntent());
    } catch (SchemaException e) {
        getSession().warn("Could not set kind for new task " + e.getMessage());
    }
    PrismObject<ResourceType> resource = getResourceModel().getObject();
    taskType.setObjectRef(ObjectTypeUtil.createObjectRef(resource));
    taskType.setCategory(category);
    setResponsePage(new PageTaskAdd(taskType));
    ;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) ShadowKindType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) PageTaskAdd(com.evolveum.midpoint.web.page.admin.server.PageTaskAdd)

Aggregations

ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 PageTaskAdd (com.evolveum.midpoint.web.page.admin.server.PageTaskAdd)1 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)1 ShadowKindType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType)1 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)1