use of org.mx.service.rest.vo.DataVO in project main by JohnPeng739.
the class AccreditManageResource method newAccredit.
@Path("accredits/new")
@POST
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<AccreditVO> newAccredit(@QueryParam("userCode") String userCode, AccreditInfoVO accreditInfoVO) {
sessionDataStore.setCurrentUserCode(userCode);
try {
Accredit accredit = accreditManageService.accredit(accreditInfoVO.getAccreditInfo());
AccreditVO vo = AccreditVO.transform(accredit, true);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(vo);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Create accredit fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.service.rest.vo.DataVO in project main by JohnPeng739.
the class DepartmentManageResource method deleteDepartment.
@Path("departments/{id}")
@DELETE
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<DepartmentVO> deleteDepartment(@QueryParam("userCode") String userCode, @PathParam("id") String id) {
sessionDataStore.setCurrentUserCode(userCode);
try {
Department department = accessor.remove(id, Department.class);
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("Delete department fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.service.rest.vo.DataVO 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.service.rest.vo.DataVO 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.service.rest.vo.DataVO 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