|
|
@@ -0,0 +1,245 @@
|
|
|
+package com.x.teamwork.assemble.control.jaxrs.global;
|
|
|
+
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.ws.rs.Consumes;
|
|
|
+import javax.ws.rs.DELETE;
|
|
|
+import javax.ws.rs.GET;
|
|
|
+import javax.ws.rs.POST;
|
|
|
+import javax.ws.rs.PUT;
|
|
|
+import javax.ws.rs.Path;
|
|
|
+import javax.ws.rs.PathParam;
|
|
|
+import javax.ws.rs.Produces;
|
|
|
+import javax.ws.rs.container.AsyncResponse;
|
|
|
+import javax.ws.rs.container.Suspended;
|
|
|
+import javax.ws.rs.core.Context;
|
|
|
+import javax.ws.rs.core.MediaType;
|
|
|
+
|
|
|
+import com.google.gson.JsonElement;
|
|
|
+import com.x.base.core.project.annotation.JaxrsDescribe;
|
|
|
+import com.x.base.core.project.annotation.JaxrsMethodDescribe;
|
|
|
+import com.x.base.core.project.annotation.JaxrsParameterDescribe;
|
|
|
+import com.x.base.core.project.http.ActionResult;
|
|
|
+import com.x.base.core.project.http.EffectivePerson;
|
|
|
+import com.x.base.core.project.http.HttpMediaType;
|
|
|
+import com.x.base.core.project.jaxrs.ResponseFactory;
|
|
|
+import com.x.base.core.project.jaxrs.StandardJaxrsAction;
|
|
|
+import com.x.base.core.project.logger.Logger;
|
|
|
+import com.x.base.core.project.logger.LoggerFactory;
|
|
|
+import com.x.teamwork.assemble.control.jaxrs.project.ActionListNextWithFilter;
|
|
|
+
|
|
|
+@Path("global")
|
|
|
+@JaxrsDescribe("全局信息管理")
|
|
|
+public class GlobalAction extends StandardJaxrsAction {
|
|
|
+
|
|
|
+ private Logger logger = LoggerFactory.getLogger(GlobalAction.class);
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "查询当前用户是否具有管理员权限.", action = ActionIsManager.class)
|
|
|
+ @GET
|
|
|
+ @Path("isManager")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void isManager(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request ) {
|
|
|
+ ActionResult<String> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionIsManager().execute( request, effectivePerson );
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "根据ID查询优先级信息.", action = ActionPriorityGet.class)
|
|
|
+ @GET
|
|
|
+ @Path("priority/{id}")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void priorityGet(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("优先级ID") @PathParam("id") String id ) {
|
|
|
+ ActionResult<ActionPriorityGet.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionPriorityGet().execute( request, effectivePerson, id );
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "查询所有优先级信息列表.", action = ActionPriorityList.class)
|
|
|
+ @GET
|
|
|
+ @Path("priority/list")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void priorityList(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request ) {
|
|
|
+ ActionResult<List<ActionPriorityList.Wo>> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionPriorityList().execute( request, effectivePerson );
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "创建或者更新一个优先级信息.", action = ActionPrioritySave.class)
|
|
|
+ @POST
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void prioritySave(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("需要保存的优先级信息") JsonElement jsonElement ) {
|
|
|
+ ActionResult<ActionPrioritySave.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionPrioritySave().execute(request, effectivePerson, jsonElement);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "根据标识删除优先级信息.", action = ActionPriorityDelete.class)
|
|
|
+ @DELETE
|
|
|
+ @Path("priority/{id}")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void priorityDelete(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("标识") @PathParam("id") String id ) {
|
|
|
+ ActionResult<ActionPriorityDelete.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionPriorityDelete().execute(request, effectivePerson, id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "根据ID查询项目配置信息.", action = ActionProjectConfigGet.class)
|
|
|
+ @GET
|
|
|
+ @Path("projectConfig/{id}")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void projectConfigGet(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("项目配置ID") @PathParam("id") String id ) {
|
|
|
+ ActionResult<ActionProjectConfigGet.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionProjectConfigGet().execute( request, effectivePerson, id );
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "创建或者更新一个项目配置信息.", action = ActionProjectConfigSave.class)
|
|
|
+ @POST
|
|
|
+ @Path("projectConfig")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void projectConfigSave(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("需要保存的优先级信息") JsonElement jsonElement ) {
|
|
|
+ ActionResult<ActionProjectConfigSave.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionProjectConfigSave().execute(request, effectivePerson, jsonElement);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "根据标识删除项目配置信息.", action = ActionProjectConfigDelete.class)
|
|
|
+ @DELETE
|
|
|
+ @Path("projectConfig/{id}")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void projectConfigDelete(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("标识") @PathParam("id") String id ) {
|
|
|
+ ActionResult<ActionProjectConfigDelete.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionProjectConfigDelete().execute(request, effectivePerson, id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "列示项目配置信息,下一页.", action = ActionListProjectConfigNextWithFilter.class)
|
|
|
+ @PUT
|
|
|
+ @Path("listProjectConfig/{id}/next/{count}")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void listProjectConfigNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id,
|
|
|
+ @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count,
|
|
|
+ @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) {
|
|
|
+ ActionResult<List<ActionListProjectConfigNextWithFilter.Wo>> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionListProjectConfigNextWithFilter().execute(request, effectivePerson, id, count, jsonElement);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "根据ID查询项目配置信息.", action = ActionProjectConfigGetByProject.class)
|
|
|
+ @GET
|
|
|
+ @Path("projectConfig/project/{id}")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void projectConfigGetByProject(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("项目ID") @PathParam("id") String id ) {
|
|
|
+ ActionResult<ActionProjectConfigGetByProject.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionProjectConfigGetByProject().execute( request, effectivePerson, id );
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "初始化优先级信息.", action = ActionInitConfig.class)
|
|
|
+ @GET
|
|
|
+ @Path("initConfig")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void initConfig(@Suspended final AsyncResponse asyncResponse,
|
|
|
+ @Context HttpServletRequest request) {
|
|
|
+ ActionResult<ActionInitConfig.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionInitConfig().execute(request, effectivePerson);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|