Search in sources :

Example 1 with StringValue

use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.

the class PageBase method getSelectedTabForConfiguration.

private int getSelectedTabForConfiguration(WebPage page) {
    PageParameters params = page.getPageParameters();
    StringValue val = params.get(PageSystemConfiguration.SELECTED_TAB_INDEX);
    String value = null;
    if (val != null && !val.isNull()) {
        value = val.toString();
    }
    return StringUtils.isNumeric(value) ? Integer.parseInt(value) : PageSystemConfiguration.CONFIGURATION_TAB_BASIC;
}
Also used : PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) StringValue(org.apache.wicket.util.string.StringValue)

Example 2 with StringValue

use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.

the class FocusMainPanel method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    StringValue oidValue = getPage().getPageParameters().get(OnePageParameterEncoder.PARAMETER);
    taskDtoProvider.setQuery(createTaskQuery(oidValue != null ? oidValue.toString() : null, (PageBase) getPage()));
}
Also used : StringValue(org.apache.wicket.util.string.StringValue) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 3 with StringValue

use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.

the class PageReport method loadReport.

private ReportDto loadReport() {
    StringValue reportOid = getPageParameters().get(OnePageParameterEncoder.PARAMETER);
    Task task = createSimpleTask(OPERATION_LOAD_REPORT);
    OperationResult result = task.getResult();
    PrismObject<ReportType> prismReport = WebModelServiceUtils.loadObject(ReportType.class, reportOid.toString(), this, task, result);
    if (prismReport == null) {
        LOGGER.error("Couldn't load report.");
        throw new RestartResponseException(PageReports.class);
    }
    return new ReportDto(prismReport.asObjectable());
//        return prismReport;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) RestartResponseException(org.apache.wicket.RestartResponseException) ReportDto(com.evolveum.midpoint.web.page.admin.reports.dto.ReportDto) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) StringValue(org.apache.wicket.util.string.StringValue) ReportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType)

Example 4 with StringValue

use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.

the class PageTasks method loadTasksSearchDto.

private TasksSearchDto loadTasksSearchDto() {
    TasksStorage storage = getSessionStorage().getTasks();
    TasksSearchDto dto = storage.getTasksSearch();
    if (dto == null) {
        dto = new TasksSearchDto();
        dto.setShowSubtasks(false);
    }
    if (getPageParameters() != null) {
        StringValue category = getPageParameters().get(SELECTED_CATEGORY);
        if (category != null && category.toString() != null && !category.toString().isEmpty()) {
            dto.setCategory(category.toString());
        }
    }
    if (dto.getStatus() == null) {
        dto.setStatus(TaskDtoExecutionStatusFilter.ALL);
    }
    return dto;
}
Also used : TasksStorage(com.evolveum.midpoint.web.session.TasksStorage) StringValue(org.apache.wicket.util.string.StringValue)

Example 5 with StringValue

use of org.apache.wicket.util.string.StringValue 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;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) QName(javax.xml.namespace.QName) PrismContext(com.evolveum.midpoint.prism.PrismContext) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RestartResponseException(org.apache.wicket.RestartResponseException) MidPointApplication(com.evolveum.midpoint.web.security.MidPointApplication) RestartResponseException(org.apache.wicket.RestartResponseException) StringValue(org.apache.wicket.util.string.StringValue) ObjectViewDto(com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto)

Aggregations

StringValue (org.apache.wicket.util.string.StringValue)54 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)22 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)7 Test (org.junit.Test)7 Task (com.evolveum.midpoint.task.api.Task)6 Url (org.apache.wicket.request.Url)5 IOException (java.io.IOException)4 WebSession (org.apache.openmeetings.web.app.WebSession)4 RestartResponseException (org.apache.wicket.RestartResponseException)4 IRequestHandler (org.apache.wicket.request.IRequestHandler)3 AbstractResource (org.apache.wicket.request.resource.AbstractResource)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 ObjectViewDto (com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto)2 MidPointApplication (com.evolveum.midpoint.web.security.MidPointApplication)2 Vertex (com.tinkerpop.blueprints.Vertex)2 OrientGraph (com.tinkerpop.blueprints.impls.orient.OrientGraph)2 Template (eu.esdihumboldt.hale.server.model.Template)2 User (eu.esdihumboldt.hale.server.model.User)2 NonUniqueResultException (eu.esdihumboldt.util.blueprints.entities.NonUniqueResultException)2