Search in sources :

Example 46 with StringValue

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

the class RecordingResourceReference method getFileItem.

@Override
protected Recording getFileItem(Attributes attributes) {
    PageParameters params = attributes.getParameters();
    StringValue _id = params.get("id");
    String ruid = params.get("ruid").toString();
    String uid = params.get("uid").toString();
    Long id = null;
    try {
        id = _id.toOptionalLong();
    } catch (Exception e) {
    // no-op expected
    }
    WebSession ws = WebSession.get();
    if (id == null && ws.signIn(_id.toString(), true)) {
        id = getRecordingId();
    }
    if (id != null && ws.isSignedIn()) {
        return getRecording(id, ruid, uid);
    }
    return null;
}
Also used : WebSession(org.apache.openmeetings.web.app.WebSession) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) StringValue(org.apache.wicket.util.string.StringValue)

Example 47 with StringValue

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

the class RoomResourceReference method getFileItem.

@Override
protected FileItem getFileItem(Attributes attr) {
    PageParameters params = attr.getParameters();
    StringValue _id = params.get("id");
    String uid = params.get("uid").toString();
    Long id = null;
    try {
        id = _id.toOptionalLong();
    } catch (NumberFormatException e) {
    // no-op expected
    }
    WebSession ws = WebSession.get();
    Client c = cm.get(uid);
    if (id == null || !ws.isSignedIn() || c == null) {
        return null;
    }
    FileItem f = (FileItem) fileDao.getAny(id);
    if (f == null) {
        return null;
    }
    String ruid = params.get("ruid").toString();
    String wuid = params.get("wuid").toString();
    if (c.getRoom() != null) {
        Whiteboards wbs = wbManager.get(c.getRoom().getId());
        if (!Strings.isEmpty(wuid) && !Strings.isEmpty(ruid) && ruid.equals(wbs.getUid())) {
            for (Entry<Long, Whiteboard> e : wbs.getWhiteboards().entrySet()) {
                JSONObject file = e.getValue().get(wuid);
                if (file != null && f.getId().equals(file.optLong(ATTR_FILE_ID))) {
                    // item IS on WB
                    return f;
                }
            }
        }
    }
    if (f.getGroupId() != null && groupUserDao.isUserInGroup(f.getGroupId(), getUserId())) {
        return f;
    }
    return null;
}
Also used : FileItem(org.apache.openmeetings.db.entity.file.FileItem) WebSession(org.apache.openmeetings.web.app.WebSession) Whiteboards(org.apache.openmeetings.db.dto.room.Whiteboards) JSONObject(com.github.openjson.JSONObject) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) StringValue(org.apache.wicket.util.string.StringValue) Client(org.apache.openmeetings.db.entity.basic.Client) Whiteboard(org.apache.openmeetings.db.dto.room.Whiteboard)

Example 48 with StringValue

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

the class ContainerableListPanel method getStorageKey.

protected String getStorageKey() {
    if (isCollectionViewPanelForCompiledView()) {
        StringValue collectionName = getCollectionNameParameterValue();
        String collectionNameValue = collectionName != null ? collectionName.toString() : "";
        return WebComponentUtil.getObjectListPageStorageKey(collectionNameValue);
    } else if (isCollectionViewPanelForWidget()) {
        String widgetName = getWidgetNameOfCollection();
        return WebComponentUtil.getObjectListPageStorageKey(widgetName);
    }
    return WebComponentUtil.getObjectListPageStorageKey(getDefaultType().getSimpleName());
}
Also used : PolyString(com.evolveum.midpoint.prism.polystring.PolyString) StringValue(org.apache.wicket.util.string.StringValue)

Example 49 with StringValue

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

the class AbstractPageObjectDetails method getObjectOidParameter.

protected String getObjectOidParameter() {
    PageParameters parameters = getPageParameters();
    LOGGER.trace("Page parameters: {}", parameters);
    StringValue oidValue = parameters.get(OnePageParameterEncoder.PARAMETER);
    LOGGER.trace("OID parameter: {}", oidValue);
    if (oidValue == null) {
        return null;
    }
    String oid = oidValue.toString();
    if (StringUtils.isBlank(oid)) {
        return null;
    }
    return oid;
}
Also used : PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) StringValue(org.apache.wicket.util.string.StringValue)

Example 50 with StringValue

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

the class PageDebugView method initObjectViewObject.

private LoadableModel<ObjectViewDto<?>> initObjectViewObject() {
    return new LoadableModel<ObjectViewDto<?>>(false) {

        private static final long serialVersionUID = 1L;

        @Override
        protected ObjectViewDto<?> load() {
            ObjectViewDto<?> objectViewDto = new ObjectViewDto<>();
            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();
            try {
                MidPointApplication application = PageDebugView.this.getMidpointApplication();
                Class<? extends ObjectType> type = getTypeFromParameters();
                GetOperationOptionsBuilder optionsBuilder = getSchemaService().getOperationOptionsBuilder().raw().resolveNames().tolerateRawData();
                if (getPageParameters().get(PARAM_SHOW_ALL_ITEMS).toBoolean(true)) {
                    optionsBuilder = optionsBuilder.retrieve();
                }
                PrismObject<? extends ObjectType> object = getModelService().getObject(type, objectOid.toString(), optionsBuilder.build(), task, result);
                PrismContext context = application.getPrismContext();
                String lex = context.serializerFor(dataLanguage).serialize(object);
                objectViewDto = new ObjectViewDto<>(object.getOid(), WebComponentUtil.getName(object), object, lex);
                result.recomputeStatus();
            } catch (Exception ex) {
                result.recordFatalError(getString("WebModelUtils.couldntLoadObject"), ex);
            }
            showResult(result, false);
            if (!WebComponentUtil.isSuccessOrHandledErrorOrWarning(result)) {
                showResult(result, false);
                throw new RestartResponseException(PageDebugList.class);
            }
            return objectViewDto;
        }
    };
}
Also used : Task(com.evolveum.midpoint.task.api.Task) 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) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) StringValue(org.apache.wicket.util.string.StringValue) ObjectViewDto(com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder)

Aggregations

StringValue (org.apache.wicket.util.string.StringValue)57 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)22 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)7 IOException (java.io.IOException)7 Test (org.junit.Test)7 Task (com.evolveum.midpoint.task.api.Task)6 Url (org.apache.wicket.request.Url)5 AnnotationFeature (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature)4 AnnotationLayer (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer)4 WebSession (org.apache.openmeetings.web.app.WebSession)4 RestartResponseException (org.apache.wicket.RestartResponseException)4 IRequestParameters (org.apache.wicket.request.IRequestParameters)4 AnnotationException (de.tudarmstadt.ukp.clarin.webanno.api.annotation.exception.AnnotationException)3 AnnotatorState (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 AnnotationFS (org.apache.uima.cas.text.AnnotationFS)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3