Search in sources :

Example 1 with PrismContainer

use of com.evolveum.midpoint.prism.PrismContainer in project midpoint by Evolveum.

the class PageReports method runReportPerformed.

protected void runReportPerformed(AjaxRequestTarget target, ReportType report) {
    RunReportPopupPanel runReportPopupPanel = new RunReportPopupPanel(getMainPopupBodyId(), report) {

        private static final long serialVersionUID = 1L;

        protected void runConfirmPerformed(AjaxRequestTarget target, ReportType reportType, PrismContainer<ReportParameterType> reportParam) {
            OperationResult result = new OperationResult(OPERATION_RUN_REPORT);
            try {
                Task task = createSimpleTask(OPERATION_RUN_REPORT);
                getReportManager().runReport(reportType.asPrismObject(), reportParam, task, result);
            } catch (Exception ex) {
                result.recordFatalError(ex);
            } finally {
                result.computeStatusIfUnknown();
            }
            showResult(result);
            target.add(getFeedbackPanel(), get(createComponentPath(ID_MAIN_FORM)));
            hideMainPopup(target);
        }

        ;
    };
    showMainPopup(runReportPopupPanel, target);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Task(com.evolveum.midpoint.task.api.Task) PrismContainer(com.evolveum.midpoint.prism.PrismContainer) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RunReportPopupPanel(com.evolveum.midpoint.web.page.admin.reports.component.RunReportPopupPanel) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)

Example 2 with PrismContainer

use of com.evolveum.midpoint.prism.PrismContainer in project midpoint by Evolveum.

the class ReportTypeUtil method applyDefinition.

public static void applyDefinition(PrismObject<ReportType> report, PrismContext prismContext) throws SchemaException {
    PrismContainer<ReportConfigurationType> configuration = report.findContainer(ReportType.F_CONFIGURATION);
    if (configuration == null) {
        //nothing to apply definitions on
        return;
    }
    PrismContainer xmlSchema = report.findContainer(ReportType.F_CONFIGURATION_SCHEMA);
    Element xmlSchemaElement = ObjectTypeUtil.findXsdElement(xmlSchema);
    if (xmlSchemaElement == null) {
        //no schema definition available
        throw new SchemaException("Couldn't find schema for configuration in report type " + report + ".");
    }
    PrismSchema schema = ReportTypeUtil.parseReportConfigurationSchema(report, prismContext);
    PrismContainerDefinition<ReportConfigurationType> definition = ReportTypeUtil.findReportConfigurationDefinition(schema);
    if (definition == null) {
        //no definition found for container
        throw new SchemaException("Couldn't find definitions for report type " + report + ".");
    }
    configuration.applyDefinition(definition, true);
}
Also used : PrismSchema(com.evolveum.midpoint.prism.schema.PrismSchema) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Element(org.w3c.dom.Element) PrismContainer(com.evolveum.midpoint.prism.PrismContainer) ReportConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportConfigurationType)

Example 3 with PrismContainer

use of com.evolveum.midpoint.prism.PrismContainer in project midpoint by Evolveum.

the class WebComponentUtil method getContainerValue.

public static <T> T getContainerValue(PrismContainerValue object, QName containerName, Class<T> type) {
    if (object == null) {
        return null;
    }
    PrismContainer container = object.findContainer(containerName);
    if (container == null || container.isEmpty()) {
        return null;
    }
    PrismContainerValue containerValue = container.getValue();
    if (containerValue == null || containerValue.isEmpty()) {
        return null;
    }
    return (T) containerValue.getValue();
}
Also used : PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) PrismContainer(com.evolveum.midpoint.prism.PrismContainer)

Example 4 with PrismContainer

use of com.evolveum.midpoint.prism.PrismContainer in project midpoint by Evolveum.

the class WebComponentUtil method isActivationEnabled.

public static boolean isActivationEnabled(PrismObject object) {
    Validate.notNull(object);
    // this
    PrismContainer activation = object.findContainer(UserType.F_ACTIVATION);
    // activation...
    if (activation == null) {
        return false;
    }
    ActivationStatusType status = (ActivationStatusType) activation.getPropertyRealValue(ActivationType.F_ADMINISTRATIVE_STATUS, ActivationStatusType.class);
    if (status == null) {
        return false;
    }
    // todo imrove with activation dates...
    return ActivationStatusType.ENABLED.equals(status);
}
Also used : PrismContainer(com.evolveum.midpoint.prism.PrismContainer)

Example 5 with PrismContainer

use of com.evolveum.midpoint.prism.PrismContainer in project midpoint by Evolveum.

the class ReportTypeUtil method parseReportConfigurationSchema.

public static PrismSchema parseReportConfigurationSchema(PrismObject<ReportType> report, PrismContext context) throws SchemaException {
    PrismContainer xmlSchema = report.findContainer(ReportType.F_CONFIGURATION_SCHEMA);
    Element xmlSchemaElement = ObjectTypeUtil.findXsdElement(xmlSchema);
    if (xmlSchemaElement == null) {
        //no schema definition available
        return null;
    }
    return PrismSchemaImpl.parse(xmlSchemaElement, true, "schema for " + report, context);
}
Also used : Element(org.w3c.dom.Element) PrismContainer(com.evolveum.midpoint.prism.PrismContainer)

Aggregations

PrismContainer (com.evolveum.midpoint.prism.PrismContainer)28 PrismObject (com.evolveum.midpoint.prism.PrismObject)12 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)9 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)6 PrismProperty (com.evolveum.midpoint.prism.PrismProperty)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)5 RunReportPopupPanel (com.evolveum.midpoint.web.page.admin.reports.component.RunReportPopupPanel)5 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)5 Item (com.evolveum.midpoint.prism.Item)4 PrismReference (com.evolveum.midpoint.prism.PrismReference)4 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)4 ArrayList (java.util.ArrayList)4 Task (com.evolveum.midpoint.task.api.Task)3 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)3 Containerable (com.evolveum.midpoint.prism.Containerable)2 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)2 PrismValue (com.evolveum.midpoint.prism.PrismValue)2 Referencable (com.evolveum.midpoint.prism.Referencable)2