use of org.mx.comps.jwt.AuthenticateAround in project main by JohnPeng739.
the class PrivilegeManageResource method savePrivilege.
@Path("privilege/{id}")
@DELETE
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<PrivilegeVO> savePrivilege(@QueryParam("userCode") String userCode, @PathParam("id") String id) {
sessionDataStore.setCurrentUserCode(userCode);
try {
Privilege privilege = accessor.remove(id, Privilege.class);
PrivilegeVO vo = PrivilegeVO.transform(privilege, true);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(vo);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Save privilege fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.comps.jwt.AuthenticateAround in project main by JohnPeng739.
the class PrivilegeManageResource method privileges.
@Path("privileges")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<PrivilegeVO>> privileges(Pagination pagination) {
if (pagination == null) {
pagination = new Pagination();
}
try {
List<Privilege> privileges = accessor.list(pagination, Privilege.class);
List<PrivilegeVO> vos = PrivilegeVO.transform(privileges);
return new PaginationDataVO<>(pagination, vos);
} catch (UserInterfaceException ex) {
return new PaginationDataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("List privileges fail.", ex);
}
return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.comps.jwt.AuthenticateAround in project main by JohnPeng739.
the class RoleManageResource method saveRole.
@Path("roles/new")
@POST
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<RoleVO> saveRole(@QueryParam("userCode") String userCode, RoleInfoVO roleInfoVO) {
sessionDataStore.setCurrentUserCode(userCode);
try {
roleInfoVO.setId(null);
Role role = roleManageService.saveRole(roleInfoVO.getRoleInfo());
RoleVO vo = RoleVO.transform(role, true);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(vo);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Save role fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.comps.jwt.AuthenticateAround in project main by JohnPeng739.
the class RoleManageResource method roles.
@Path("roles")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<RoleVO>> roles(Pagination pagination) {
if (pagination == null) {
pagination = new Pagination();
}
try {
List<Role> roles = accessor.list(pagination, Role.class);
List<RoleVO> vos = RoleVO.transform(roles);
return new PaginationDataVO<>(pagination, vos);
} catch (UserInterfaceException ex) {
return new PaginationDataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("List roles fail.", ex);
}
return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.comps.jwt.AuthenticateAround in project main by JohnPeng739.
the class UserManageResource method listUsersPagination.
@Path("users")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<UserVO>> listUsersPagination(Pagination pagination) {
if (pagination == null) {
pagination = new Pagination();
}
try {
List<User> users = accessor.list(pagination, User.class);
List<UserVO> userVOs = UserVO.transform(users);
return new PaginationDataVO<>(pagination, userVOs);
} catch (UserInterfaceException ex) {
return new PaginationDataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("List users fail.", ex);
}
return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
Aggregations