本文整理汇总了Java中org.apache.wicket.util.string.StringValue.toOptionalLong方法的典型用法代码示例。如果您正苦于以下问题:Java StringValue.toOptionalLong方法的具体用法?Java StringValue.toOptionalLong怎么用?Java StringValue.toOptionalLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.util.string.StringValue
的用法示例。
在下文中一共展示了StringValue.toOptionalLong方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileItem
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
@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;
}
示例2: getRequestedNodeId
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
protected Long getRequestedNodeId() {
StringValue id = getPageParameters().get("id");
if (id.isEmpty()) {
String key = getPageParameters().get("project-key")
.toOptionalString();
if (key != null) {
ITreeNode<String> node = treeNodeService
.getTreeNodeByKey(key);
if (node != null) {
id = StringValue.valueOf(node.getId());
} else {
// TODO give translated message for the 404 reason
throw new AbortWithHttpErrorCodeException(404);
}
}
}
return id.toOptionalLong();
}
示例3: getRequestedNodeId
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
private Long getRequestedNodeId() {
StringValue id = getPageParameters().get("id");
if (id.isEmpty()) {
String key = getPageParameters().get("project-key")
.toOptionalString();
if (key != null) {
ITreeNode<String> node = treeNodeService
.getTreeNodeByKey(key);
if (node != null) {
id = StringValue.valueOf(node.getId());
} else {
// TODO give translated message for the 404 reason
throw new AbortWithHttpErrorCodeException(404);
}
}
}
return id.toOptionalLong();
}
示例4: getRequestedNodeId
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
private Long getRequestedNodeId() {
StringValue id = getPageParameters().get("id");
if (id.isEmpty()) {
String key = getPageParameters().get("qmodel-key")
.toOptionalString();
if (key != null) {
IQMTreeNode<String> node = qmtreeNodeService
.getTreeNodeByKey(key);
if (node != null) {
id = StringValue.valueOf(node.getId());
} else {
// TODO give translated message for the 404 reason
throw new AbortWithHttpErrorCodeException(404);
}
}
}
return id.toOptionalLong();
}
示例5: getResource
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
@Override
public IResource getResource() {
return new FileSystemResource() {
private static final long serialVersionUID = 1L;
@Override
protected String getMimeType() throws IOException {
return PNG_MIME_TYPE;
}
@Override
protected ResourceResponse newResourceResponse(Attributes attrs) {
Long id = null;
boolean allowed = false;
WebSession ws = WebSession.get();
if (ws.isSignedIn()) {
PageParameters params = attrs.getParameters();
StringValue _id = params.get("id");
try {
id = _id.toOptionalLong();
} catch (Exception e) {
//no-op expected
}
allowed = id == null || hasAdminLevel(getRights()) || null != getBean(GroupUserDao.class).getByGroupAndUser(id, getUserId());
if (!allowed && ws.getInvitation() != null) {
Room r = ws.getInvitation().getRoom() == null ? null : getBean(RoomDao.class).get(ws.getInvitation().getRoom().getId());
if (r != null && r.getGroups() != null) {
for (RoomGroup rg : r.getGroups()) {
if (id.equals(rg.getGroup().getId())) {
allowed = true;
break;
}
}
}
}
}
if (allowed) {
return createResourceResponse(attrs, getGroupLogo(id, true).toPath());
} else {
log.debug("Not authorized");
ResourceResponse rr = new ResourceResponse();
rr.setError(HttpServletResponse.SC_FORBIDDEN);
return rr;
}
}
};
}