text: package com.x.processplatform.assemble.surface.jaxrs.serialnumber;
  
  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.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;
  
  @Path("serialnumber")
  @JaxrsDescribe("流水号操作")
  public class SerialNumberAction extends StandardJaxrsAction {
  
  	private static Logger logger = LoggerFactory.getLogger(SerialNumberAction.class);
  
  	@JaxrsMethodDescribe(value = "列示指定应用的所有SerialNumber对象.", action = ActionList.class)
  	@GET
  	@Path("list/application/{applicationFlag}")
  	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
  	@Consumes(MediaType.APPLICATION_JSON)
  	public void list(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
  			@JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
  		ActionResult<List<ActionList.Wo>> result = new ActionResult<>();
  		EffectivePerson effectivePerson = this.effectivePerson(request);
  		try {
  			result = new ActionList().execute(effectivePerson, applicationFlag);
  		} catch (Exception e) {
  			logger.error(e, effectivePerson, request, null);
  			result.error(e);
  		}
  		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
  	}
  
  	@JaxrsMethodDescribe(value = "获取SerialNumber内容,", action = ActionGet.class)
  	@GET
  	@Path("{id}")
  	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
  	@Consumes(MediaType.APPLICATION_JSON)
  	public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
  			@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
  		ActionResult<ActionGet.Wo> result = new ActionResult<>();
  		EffectivePerson effectivePerson = this.effectivePerson(request);
  		try {
  			result = new ActionGet().execute(effectivePerson, id);
  		} catch (Exception e) {
  			logger.error(e, effectivePerson, request, null);
  			result.error(e);
  		}
  		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
  	}
  
  	@JaxrsMethodDescribe(value = "更新SerialNumber内容.", action = ActionUpdate.class)
  	@PUT
  	@Path("{id}")
  	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
  	@Consumes(MediaType.APPLICATION_JSON)
  	public void update(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
  			@JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
  		ActionResult<ActionUpdate.Wo> result = new ActionResult<>();
  		EffectivePerson effectivePerson = this.effectivePerson(request);
  		try {
  			result = new ActionUpdate().execute(effectivePerson, id, jsonElement);
  		} catch (Exception e) {
  			logger.error(e, effectivePerson, request, null);
  			result.error(e);
  		}
  		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
  	}
  
  	@JaxrsMethodDescribe(value = "删除SerialNumber内容.", action = ActionRemove.class)
  	@DELETE
  	@Path("{id}")
  	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
  	@Consumes(MediaType.APPLICATION_JSON)
  	public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
  			@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
  		ActionResult<ActionRemove.Wo> result = new ActionResult<>();
  		EffectivePerson effectivePerson = this.effectivePerson(request);
  		try {
  			result = new ActionRemove().execute(effectivePerson, id);
  		} catch (Exception e) {
  			logger.error(e, effectivePerson, request, null);
  			result.error(e);
  		}
  		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
  	}
  
  }