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;
}
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;
}
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());
}
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;
}
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;
}
};
}
Aggregations