}
@POST
public ReturnCodeBean changeView(@Context HttpServletRequest request, @FormParam("owner") String owner, @FormParam("view_vid") String oldVid, @FormParam("view_name") String name) {
try {
ViewStore vs;
if(oldVid!=null) {
vs = new ViewStore(owner, oldVid);
} else {
vs = new ViewStore(null, "default");
}
ViewBean view = vs.get();
view.setOwner(request.getRemoteUser());
view.setName(name);
view.setDescription(name);
if(oldVid==null) {
view.setPermissionType("private");
}
vs = new ViewStore(request.getRemoteUser(), name);
vs.set(view);
} catch (Exception e) {
log.error(ExceptionUtil.getStackTrace(e));
throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity("View save failed.").build());
}