use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class DepartmentManageResource method departments.
@Path("departments")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<DepartmentVO>> departments(Pagination pagination) {
if (pagination == null) {
pagination = new Pagination();
}
try {
List<Department> departments = accessor.list(pagination, Department.class);
List<DepartmentVO> vos = DepartmentVO.transform(departments);
return new PaginationDataVO<>(pagination, vos);
} catch (UserInterfaceException ex) {
return new PaginationDataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("List departments fail.", ex);
}
return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class DepartmentManageResource method saveDepartment.
private DataVO<DepartmentVO> saveDepartment(DepartmentInfoVO departmentInfoVO) {
try {
Department department = departmentManageService.saveDepartment(departmentInfoVO.getDepartInfo());
DepartmentVO vo = DepartmentVO.transform(department, true);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(vo);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Save department fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.error.UserInterfaceSystemErrorException 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.error.UserInterfaceSystemErrorException 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.error.UserInterfaceSystemErrorException in project main by JohnPeng739.
the class PrivilegeManageResource method savePrivilegeInfo.
private DataVO<PrivilegeVO> savePrivilegeInfo(PrivilegeVO privilegeVO) {
try {
Privilege privilege = EntityFactory.createEntity(Privilege.class);
PrivilegeVO.transform(privilegeVO, privilege);
privilege = accessor.save(privilege);
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));
}
}
Aggregations