| Line 20... |
Line 20... |
| 20 |
|
20 |
|
| 21 |
import io.swagger.annotations.ApiImplicitParam;
|
21 |
import io.swagger.annotations.ApiImplicitParam;
|
| 22 |
import io.swagger.annotations.ApiImplicitParams;
|
22 |
import io.swagger.annotations.ApiImplicitParams;
|
| 23 |
import io.swagger.annotations.ApiOperation;
|
23 |
import io.swagger.annotations.ApiOperation;
|
| 24 |
|
24 |
|
| - |
|
25 |
import java.util.ArrayList;
|
| - |
|
26 |
import java.util.Arrays;
|
| - |
|
27 |
import java.util.List;
|
| - |
|
28 |
|
| 25 |
@Controller
|
29 |
@Controller
|
| 26 |
public class EntityController {
|
30 |
public class EntityController {
|
| 27 |
|
31 |
|
| 28 |
private static final Logger logger = LogManager.getLogger(EntityController.class);
|
32 |
private static final Logger logger = LogManager.getLogger(EntityController.class);
|
| 29 |
|
33 |
|
| Line 34... |
Line 38... |
| 34 |
private ResponseSender<?> responseSender;
|
38 |
private ResponseSender<?> responseSender;
|
| 35 |
|
39 |
|
| 36 |
@RequestMapping(value = ProfitMandiConstants.URL_ENTITY, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
40 |
@RequestMapping(value = ProfitMandiConstants.URL_ENTITY, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 37 |
@ApiImplicitParams({
|
41 |
@ApiImplicitParams({
|
| 38 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
42 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 39 |
|
- |
|
| 40 |
@ApiOperation(value = "Get entity content")
|
43 |
@ApiOperation(value = "Get entity content")
|
| 41 |
public ResponseEntity<?> getEntity(HttpServletRequest request, @PathVariable(value = "entityId") long entityId)
|
44 |
public ResponseEntity<?> getEntity(HttpServletRequest request, @PathVariable(value = "entityId") long entityId)
|
| 42 |
throws Exception {
|
45 |
throws Exception {
|
| 43 |
logger.info("Entity Id " + entityId);
|
46 |
logger.info("Entity Id " + entityId);
|
| 44 |
ContentPojo cp = mongo.getEntityById(entityId);
|
47 |
ContentPojo cp = mongo.getEntityById(entityId);
|
| 45 |
EntityResponse er = new EntityResponse();
|
48 |
EntityResponse er = new EntityResponse();
|
| 46 |
er.setEntity(cp);
|
49 |
er.setEntity(cp);
|
| 47 |
return responseSender.ok(er);
|
50 |
return responseSender.ok(er);
|
| 48 |
}
|
51 |
}
|
| - |
|
52 |
|
| - |
|
53 |
@RequestMapping(value = ProfitMandiConstants.URL_SHOPIFY, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
54 |
@ApiOperation(value = "Get entity content")
|
| - |
|
55 |
public ResponseEntity<?> getShopifyUrl(HttpServletRequest request) throws Exception {
|
| - |
|
56 |
|
| - |
|
57 |
List<Integer> catalogIds = Arrays.asList(1024931, 1024930, 1024868, 1024855, 1024796, 1024793, 1024652, 1024617, 1024616, 1024615, 1024614);
|
| - |
|
58 |
|
| - |
|
59 |
List<ContentPojo> entityList = new ArrayList<>();
|
| - |
|
60 |
|
| - |
|
61 |
for (Integer catalogId : catalogIds) {
|
| - |
|
62 |
ContentPojo cp = mongo.getEntityById(catalogId);
|
| - |
|
63 |
if (cp != null) {
|
| - |
|
64 |
entityList.add(cp);
|
| - |
|
65 |
}
|
| - |
|
66 |
}
|
| - |
|
67 |
|
| - |
|
68 |
EntityResponse er = new EntityResponse();
|
| - |
|
69 |
er.setEntities(entityList);
|
| - |
|
70 |
|
| - |
|
71 |
return responseSender.ok(er);
|
| - |
|
72 |
}
|
| - |
|
73 |
|
| 49 |
}
|
74 |
}
|