当前位置: 首页>>代码示例>>Java>>正文


Java StringValue.toOptionalLong方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:22,代码来源:RecordingResourceReference.java

示例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();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:19,代码来源:HistoricProjectPage.java

示例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();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:19,代码来源:BaseTreePage.java

示例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();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:19,代码来源:QMBaseTreePage.java

示例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;
			}
		}
	};
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:48,代码来源:GroupLogoResourceReference.java


注:本文中的org.apache.wicket.util.string.StringValue.toOptionalLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。