⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userprofilewebutil.java.svn-base

📁 一个timesheet程序,用来统计开发人员的度量衡web在线程序.用于软件行业
💻 SVN-BASE
字号:
package com.nsi.components.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.nsi.components.userprofile.UserProfile;
import com.nsi.components.userprofile.UserProfileWebInfo;
import com.nsi.components.util.info.RsDropInfo;
import com.nsi.constants.AppConstants;
import com.nsi.control.web.ModelManager;
import com.nsi.control.web.util.ModelManagerWebUtil;

public final class UserProfileWebUtil
{
	/**
	 * private constructor of UserProfileWebUtil, prevent instantiation
	 */
	private UserProfileWebUtil()
	{
	}
	private static class UserProfileWebUtilHolder
	{
		static final UserProfileWebUtil userProfileWebUtil = new UserProfileWebUtil();
	}
	/**
	 * @return an instance of UserProfileWebUtil
	 */
	public static UserProfileWebUtil getInstance()
	{
		return UserProfileWebUtilHolder.userProfileWebUtil;
	}
	public List<RsDropInfo> getResourcelist(HttpServletRequest request)
	{
		ModelManager mm = getModelmanager( request );
		return mm.getResourcelist();
	}
	public Map<String,String> getRolemap( HttpServletRequest request )
	{
		return getRolemap( getUserprofilewebinfo(  request ) );
	}
	public Map<String,String> getRolemap( UserProfileWebInfo uwbinfo )
	{
		Map<String,String> rolemap = new HashMap<String,String>();
		if( uwbinfo != null )
		{
			rolemap = uwbinfo.getRolemap();
		}
		return rolemap;
	}
	public boolean isAdd( HttpServletRequest request )
	{
		return isAdd( getUserprofilewebinfo(  request ) );
	}
	public boolean isAdd( UserProfileWebInfo uwbinfo )
	{
		boolean flag = false;
		String add = "F";
		if( uwbinfo != null )
		{
			add = uwbinfo.getAdd();
		}
		if( ("T").equals(add))
		{
			flag = true;
		}
		return flag;
	}
	public UserProfileWebInfo getUserprofilewebinfo( HttpServletRequest request )
	{
		Object obj = request.getSession().getAttribute( "uwbinfo" );
		if( obj != null )
		{
			return ( UserProfileWebInfo )obj;
		}
		else
		{
			return new UserProfileWebInfo();
		}
	}
	public String getUserid( HttpServletRequest request )
	{
		return getUserid( getUserprofile(request));
	}
	public String getUserid( UserProfile userprofile )
	{
		String userid = AppConstants.EMPTY_STRING;
		if( userprofile != null )
		{
			userid = userprofile.getUserid();
		}
		return userid;
	}
	public String getResourceid( HttpServletRequest request )
	{
		return getResourceid( getUserprofile(request));
	}
	public String getResourceid( UserProfile userprofile )
	{
		String resourceid = AppConstants.EMPTY_STRING;
		if( userprofile != null )
		{
			resourceid = userprofile.getResourceid();
		}
		return resourceid;
	}
	public UserProfile getUserprofile( HttpServletRequest request )
	{
		UserProfile userprofile = null;
		ModelManager mm = getModelmanager( request );
		if( mm != null)
		{
			userprofile = getUserprofile( mm );
		}
		if( userprofile == null )
		{
			userprofile = new UserProfile();
		}
		return userprofile;
	}
	public UserProfile getUserprofile( ModelManager mm )
	{
		return mm.getUserprofile();
	}
	public ModelManager getModelmanager( HttpServletRequest request )
	{
		return ModelManagerWebUtil.getInstance().getModelManager( request );
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -