/*
*
* LegendShop 多用户商城系统
*
* 版权所有,并保留所有权利。
*
*/
package com.legendshop.permission.service.impl;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.legendshop.command.framework.ClientException;
import com.legendshop.command.framework.JCFException;
import com.legendshop.command.framework.Request;
import com.legendshop.command.framework.Response;
import com.legendshop.command.framework.State;
import com.legendshop.command.framework.facade.AbstractBizDelegate;
import com.legendshop.command.framework.facade.DelegateUtil;
import com.legendshop.core.dao.support.CriteriaQuery;
import com.legendshop.core.dao.support.HqlQuery;
import com.legendshop.core.dao.support.PageSupport;
import com.legendshop.model.entity.Function;
import com.legendshop.model.entity.LoginHistory;
import com.legendshop.model.entity.Permission;
import com.legendshop.model.entity.Role;
import com.legendshop.model.entity.User;
import com.legendshop.model.entity.UserRole;
import com.legendshop.permission.common.ErrorCode;
import com.legendshop.permission.common.ServiceConsts;
import com.legendshop.permission.service.RightDelegate;
import com.legendshop.util.AppUtils;
/**
*
* 权限管理代理
*/
public class RightDelegateImpl extends AbstractBizDelegate implements RightDelegate {
/**
* Instantiates a new right delegate impl.
*/
public RightDelegateImpl() {
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#findWorkflow(com.legendshop.command
* .framework.State)
*/
public boolean findWorkflow(State state) {
Request req = new Request();
req.setServiceName("RunByResultProcessor");
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setState(state, resp);
return true;
} catch (Exception e) {
DelegateUtil.handleException(e, "workflow", state);
}
return false;
}
/**
* 从数据库中查找该角色Role所拥有的Function.
*
* @param authority
* the authority
* @param state
* the state
* @return the role
*/
public Role findgrantedAuthorityFromDataBase(String authority, State state) {
try {
return (Role) getDelegate().execute("authority", authority, ServiceConsts.FindgrantedAuthorityFromDataBaseProcessor,
"resultObject", state);
} catch (Exception e) {
DelegateUtil.handleException(e, "findgrantedAuthorityFromDataBase", state);
return null;
}
}
/**
* 从数据库中查找名为protectFunction的Function以及拥有这个function的角色.
*
* @param protectfunction
* the protectfunction
* @param state
* the state
* @return the function
*/
public Function findFunctionFromDataBase(String protectfunction, State state) {
try {
return (Function) getDelegate().execute("protectfunction", protectfunction,
ServiceConsts.FindFunctionFromDataBaseProcessor, "resultObject", state);
} catch (Exception e) {
DelegateUtil.handleException(e, "findFunctionFromDataBase", state);
return null;
}
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#findRoleByFunction(java.lang.
* String, com.legendshop.command.framework.State)
*/
public List findRoleByFunction(String functionId, State state) {
try {
return (List) getDelegate()
.execute("functionId", functionId, ServiceConsts.FindRoleByFunctionProcessor, "roles", state);
} catch (Exception e) {
throw new ClientException(e, "findRoleByFunction error");
}
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#findRoleByUser(java.lang.String,
* com.legendshop.command.framework.State)
*/
public List findRoleByUser(String userId, State state) {
try {
return (List) getDelegate().execute("userId", userId, ServiceConsts.FindRoleByUserProcessor, "roles", state);
} catch (Exception e) {
DelegateUtil.handleException(e, "findRoleByUser", state);
return null;
}
}
/**
* 从数据库中查找该用户User以及所拥有的role.
*
* @param name
* the name
* @param state
* the state
* @return the user
*/
public User findUserByNameFromDataBase(String name, State state) {
try {
return (User) getDelegate().execute("name", name, ServiceConsts.FindUserByNameFromDataBaseProcessor, "resultObject",
state);
} catch (Exception e) {
DelegateUtil.handleException(e, "findUserByNameFromDataBase", state);
return null;
}
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#saveFunction(com.legendshop.model
* .entity.Function, com.legendshop.command.framework.State)
*/
public String saveFunction(Function function, State state) {
try {
return (String) getDelegate().execute("function", function, ServiceConsts.SaveFunctionProcessor, "id", state);
} catch (Exception e) {
DelegateUtil.handleException(e, "saveFunction", state);
return null;
}
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#saveFunctionToRole(com.legendshop
* .model.entity.Permission, com.legendshop.command.framework.State)
*/
public boolean saveFunctionToRole(Permission permission, State state) {
try {
getDelegate().execute("permission", permission, ServiceConsts.SaveFunctionToRoleProcessor, "id", state);
return true;
} catch (Exception e) {
DelegateUtil.handleException(e, "saveFunctionToRole", state);
return false;
}
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#saveFunctionsToRole(java.util
* .List, com.legendshop.command.framework.State)
*/
public void saveFunctionsToRole(List permissions, State state) {
if (DelegateUtil.isNullParam(permissions, "permissions", state)) {
return;
}
Request req = new Request();
req.setServiceName(ServiceConsts.SaveFunctionsToRoleProcessor);
req.setValue("permissions", permissions);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setState(state, resp);
} catch (Exception e) {
DelegateUtil.handleException(e, "saveFunctionsToRole", state);
}
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#updateFunction(com.legendshop
* .model.entity.Function, com.legendshop.command.framework.State)
*/
public void updateFunction(Function function, State state) {
if (DelegateUtil.isNullParam(function, "function", state)) {
return;
}
Request req = new Request();
req.setServiceName(ServiceConsts.UpdateFunctionProcessor);
req.setValue("function", function);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setState(state, resp);
} catch (Exception e) {
DelegateUtil.handleException(e, "updateFunction", state);
}
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#isUserExist(java.lang.String,
* com.legendshop.command.framework.State)
*/
public boolean isUserExist(String name, State state) {
if (DelegateUtil.isNullParam(name, "name", state)) {
return false;
}
Request req = new Request();
req.setServiceName(ServiceConsts.IsUserExistProcessor);
req.setValue("name", name);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setState(state, resp);
return ((Boolean) resp.getValue("resultBoolean")).booleanValue();
} catch (Exception e) {
DelegateUtil.handleException(e, "isUserExist", state);
return false;
}
}
/*
* (non-Javadoc)
*
* @see
* com.legendshop.permission.RightDelegate#saveUser(com.legendshop.model
* .entity.User, com.legendshop.command.framework.State)
*/
public String saveUser(User user, State state) {
try {
return (
没有合适的资源?快使用搜索试试~ 我知道了~
LegendShop3.0.3.6黄金版源代码

共3345个文件
java:649个
jpg:538个
gif:443个


温馨提示
LegendShop是基于JAVA编程语言开发的开源电子商务软件,采用Hibernate、Spring/Spring MVC等开源技术和自主框架技术开发。 1、Legend Shop采用HTML伪静态生成技术和多级缓存技术,使得系统的响应速度和负载能力得到极大的提升。 2、Legend Shop是采用MVC架构开发的电子商务平台,使得用户在系统风格修改方面也能得心应手。 3、采用AJAX、Jquery等技术,在系统的易用性和实用性方面都得到了空前的突破,真正达到了只要会打字就能够建设专业水准的电子商务平台。 4、支持多操作系统(如: Windows、Linux、Solaris等),有利于网店系统的部署与迁移。 5、支持SEO优化,帮助您顺利进行搜索引擎营销,以达到提升产品销量和品牌形象的目的。 6、LegendShop通过与支付宝等多家网银支付公司合作为用户实现最佳无接缝支付功能。 7、支持产品的动态属性动态参数,适合各种商品销售。 8、支持动态属性,能在运行是改变商城的运行模式。 a 9、支持国际化功能,支持多国语言,适合做外贸性生意。 10、支持全文搜索,用户可以查询所有的商城的商品信息。 11、支持多个地域协同销售,是个类似淘宝商城的微型商城系统。 开发环境说明: 开发环境: Myeclipse 10 JDK :JDK1.6 + 服务器 : Tomcat6 数据库 : MySQL 5.6 数据库脚本位于/legendshop/doc/db script/legendshop_db_script3.6.sql
资源推荐
资源详情
资源评论















收起资源包目录





































































































共 3345 条
- 1
- 2
- 3
- 4
- 5
- 6
- 34

Newway321
- 粉丝: 8
- 资源: 2
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


会员权益专享
安全验证
文档复制为VIP权益,开通VIP直接复制

- 1
- 2
- 3
- 4
- 5
- 6
前往页