use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class ServerManageResource method saveServerInfo.
@Path("server")
@POST
public DataVO<ServerInfoVO> saveServerInfo(@QueryParam("userCode") String userCode, String info) {
sessionDataStore.setCurrentUserCode(userCode);
try {
JSONObject json = serverManageService.saveServerInfo(info);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(new ServerInfoVO(json));
} catch (UserInterfaceErrorException ex) {
return new DataVO<>(ex);
}
}
use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class TopologyManageResource method killTopology.
/**
* 杀死集群中的计算拓扑
*
* @param userCode 操作用户代码
* @param topologyId 拓扑关键字ID
* @return 操作成功后的拓扑对象
*/
@Path("topology/kill")
@GET
public DataVO<TopologyVO> killTopology(@QueryParam("userCode") String userCode, @QueryParam("topologyId") String topologyId) {
sessionDataStore.setCurrentUserCode(userCode);
try {
Topology topology = topologyManageService.kill(topologyId);
TopologyVO topologyVO = new TopologyVO();
TopologyVO.transform(topology, topologyVO);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(topologyVO);
} catch (UserInterfaceErrorException ex) {
return new DataVO<>(ex);
}
}
use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class TopologyManageResource method getTopology.
/**
* 根据拓扑数据库ID获取拓扑信息
*
* @param topologyId 关键字ID,不是集群中的ID
* @return 拓扑值对象
*/
@Path("topology")
@GET
public DataVO<TopologyVO> getTopology(@QueryParam("topologyId") String topologyId) {
try {
Topology topology = accessor.getById(topologyId, Topology.class);
TopologyVO vo = new TopologyVO();
TopologyVO.transform(topology, vo);
return new DataVO<>(vo);
} catch (EntityAccessException ex) {
if (logger.isErrorEnabled()) {
logger.error(ex);
}
return new DataVO<>(new UserInterfaceErrorException(UserInterfaceErrors.DB_OPERATE_FAIL));
}
}
use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class UserManageResource method login.
/**
* 登入系统
*
* @param login 用户认证值对象
* @return 登录成功返回登录用户信息对象,否则返回错误信息。
*/
@Path("login")
@POST
public DataVO<UserVO> login(AuthenticateVO login) {
if (login == null) {
return new DataVO<>();
}
sessionDataStore.setCurrentUserCode(login.getUser());
try {
User user = userManageService.login(login.getUser(), login.getPassword());
UserVO userVO = new UserVO();
UserVO.transform(user, userVO);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(userVO);
} catch (UserInterfaceErrorException ex) {
return new DataVO<>(ex);
}
}
use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class UserManageResource method getUser.
/**
* 获取指定用户代码的用户信息
*
* @param userCode 用户代码
* @return 用户信息对象
*/
@Path("users/{userCode}")
@GET
public DataVO<UserVO> getUser(@PathParam("userCode") String userCode) {
try {
User user = accessor.getByCode(userCode, User.class);
if (user == null) {
return new DataVO<>(new UserInterfaceErrorException(UserInterfaceErrors.USER_NOT_FOUND));
}
UserVO userVO = new UserVO();
UserVO.transform(user, userVO);
return new DataVO<>(userVO);
} catch (EntityAccessException ex) {
if (logger.isErrorEnabled()) {
logger.error(ex);
}
return new DataVO<>(new UserInterfaceErrorException(UserInterfaceErrors.DB_OPERATE_FAIL));
}
}
Aggregations