Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,46 +1,41 @@
package ch.cern.cmms.eamlightweb.workorders.activity.autocomplete;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.interceptor.Interceptors;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

import ch.cern.cmms.eamlightweb.tools.EAMLightController;
import ch.cern.cmms.eamlightweb.tools.interceptors.RESTLoggingInterceptor;
import ch.cern.eam.wshub.core.services.grids.entities.GridRequest;
import ch.cern.eam.wshub.core.services.grids.entities.GridRequestFilter;

import javax.enterprise.context.ApplicationScoped;
import javax.interceptor.Interceptors;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;

@Path("/autocomplete")
@ApplicationScoped
@Interceptors({ RESTLoggingInterceptor.class })
@Interceptors({RESTLoggingInterceptor.class})
public class AutocompleteBOOEmployee extends EAMLightController {

@GET
@Path("/boo/employee/{code}")
@Produces("application/json")
@Consumes("application/json")
public Response complete(@PathParam("code") String code) {
GridRequest gridRequest = new GridRequest("146", "LVEMP", "151");
gridRequest.setGridType(GridRequest.GRIDTYPE.LOV);
gridRequest.addParam("param.date", null);
gridRequest.addParam("parameter.per_type", null);
gridRequest.addParam("param.trade", "KPL");
gridRequest.addParam("param.act", "5");
gridRequest.addParam("param.booplan", "true");
gridRequest.addParam("param.event", "555555");
gridRequest.addParam("param.octype", "N");

gridRequest.getGridRequestFilters().add(new GridRequestFilter("personcode", code.toUpperCase(), "BEGINS", GridRequestFilter.JOINER.OR ));
gridRequest.getGridRequestFilters().add(new GridRequestFilter("description", code.toUpperCase(), "CONTAINS" ));

gridRequest.sortBy("description");

return getPairListResponse(gridRequest, "personcode", "description");
}
@GET
@Path("/boo/event/{event}/activity/{act}/trade/{trade}/octype/{octype}/employee/{code}")
@Produces("application/json")
@Consumes("application/json")
public Response complete(@PathParam("event") String event, @PathParam("act") String act, @PathParam("trade") String trade, @PathParam("octype") String octype, @PathParam("code") String code) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not very semantic. I would suggest either adding the information of each parameter in the path or changing it to a POST with a body.

/boo/employee/{employeeCode}/trade/{trade}/type/{type} as an example

GridRequest gridRequest = new GridRequest("146", "LVEMP", "151");
gridRequest.setGridType(GridRequest.GRIDTYPE.LOV);
gridRequest.addParam("param.date", null);
gridRequest.addParam("parameter.per_type", null);
gridRequest.addParam("param.trade", trade);
gridRequest.addParam("param.act", act);
gridRequest.addParam("param.booplan", "true");
gridRequest.addParam("param.event", event);
gridRequest.addParam("param.octype", octype);

gridRequest.getGridRequestFilters().add(new GridRequestFilter("personcode", code.toUpperCase(), "BEGINS", GridRequestFilter.JOINER.OR));
gridRequest.getGridRequestFilters().add(new GridRequestFilter("description", code.toUpperCase(), "CONTAINS"));

gridRequest.sortBy("description");

return getPairListResponse(gridRequest, "personcode", "description");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public Response complete(@QueryParam("transaction") String transaction, @QueryPa
@QueryParam("part") String part, @QueryParam("code") String code) {

GridRequest gridRequest = new GridRequest("OSOBJA", GridRequest.GRIDTYPE.LIST, ApplicationData.AUTOCOMPLETE_RESULT_SIZE);
gridRequest.setUserFunctionName("OSOBJA");
gridRequest.addFilter("equipmentno", code.toUpperCase(), "CONTAINS", GridRequestFilter.JOINER.AND);

if (!part.isEmpty()) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<properties>
<artifact.filename>${project.build.finalName}-${project.version}</artifact.filename>
<ch.cern.eam.eam-wshub-core.version>12.1.4-8</ch.cern.eam.eam-wshub-core.version>
<ch.cern.eam.eam-wshub-core.version>12.1.6-8</ch.cern.eam.eam-wshub-core.version>
<ch.cern.cmms.eamtools.version>2.4.0</ch.cern.cmms.eamtools.version>
<ch.cern.cmms.ldaptools.version>0.3.1</ch.cern.cmms.ldaptools.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down