use of org.entando.entando.aps.system.services.entity.model.EntityTypeShortDto in project entando-core by entando.
the class EntityManagerServiceIntegrationTest method testGetEntityTypes_1.
@Test
public void testGetEntityTypes_1() {
RestListRequest restListRequest = new RestListRequest();
PagedMetadata<EntityTypeShortDto> dtos = this.entityManagerService.getShortEntityTypes(SystemConstants.USER_PROFILE_MANAGER, restListRequest);
assertNotNull(dtos);
assertEquals(1, dtos.getBody().size());
}
use of org.entando.entando.aps.system.services.entity.model.EntityTypeShortDto in project entando-core by entando.
the class DataTypeController method getDataTypes.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getDataTypes(@Valid RestListRequest requestList) throws JsonProcessingException {
this.getDataTypeValidator().validateRestListRequest(requestList);
PagedMetadata<EntityTypeShortDto> result = this.getDataObjectService().getShortDataTypes(requestList);
this.getDataTypeValidator().validateRestListResult(requestList, result);
logger.debug("Main Response -> {}", result);
return new ResponseEntity<>(new RestResponse(result.getBody(), null, result), HttpStatus.OK);
}
use of org.entando.entando.aps.system.services.entity.model.EntityTypeShortDto in project entando-core by entando.
the class ProfileTypeController method getUserProfileTypes.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getUserProfileTypes(RestListRequest requestList) throws JsonProcessingException {
this.getProfileTypeValidator().validateRestListRequest(requestList);
PagedMetadata<EntityTypeShortDto> result = this.getUserProfileTypeService().getShortUserProfileTypes(requestList);
logger.debug("Main Response -> {}", result);
this.getProfileTypeValidator().validateRestListResult(requestList, result);
return new ResponseEntity<>(new RestResponse(result.getBody(), null, result), HttpStatus.OK);
}
use of org.entando.entando.aps.system.services.entity.model.EntityTypeShortDto in project entando-core by entando.
the class AbstractEntityService method getShortEntityTypes.
protected PagedMetadata<EntityTypeShortDto> getShortEntityTypes(String entityManagerCode, RestListRequest requestList) {
IEntityManager entityManager = this.extractEntityManager(entityManagerCode);
List<IApsEntity> entityTypes = new ArrayList<>(entityManager.getEntityPrototypes().values());
Map<String, String> fieldMapping = this.getEntityTypeFieldNameMapping();
entityTypes.stream().filter(i -> this.filterObjects(i, requestList.getFilter(), fieldMapping));
Collections.sort(entityTypes, new BeanComparator(this.getFieldName(requestList.getSort(), fieldMapping)));
if (!RestListRequest.DIRECTION_VALUE_DEFAULT.equals(requestList.getDirection())) {
Collections.reverse(entityTypes);
}
List<IApsEntity> sublist = requestList.getSublist(entityTypes);
SearcherDaoPaginatedResult<IApsEntity> result = new SearcherDaoPaginatedResult(entityTypes.size(), sublist);
PagedMetadata<EntityTypeShortDto> pagedMetadata = new PagedMetadata<>(requestList, result);
List<EntityTypeShortDto> body = this.getEntityTypeShortDtoBuilder().convert(sublist);
for (EntityTypeShortDto entityTypeShortDto : body) {
String code = entityTypeShortDto.getCode();
entityTypeShortDto.setStatus(String.valueOf(entityManager.getStatus(code)));
}
pagedMetadata.setBody(body);
return pagedMetadata;
}
use of org.entando.entando.aps.system.services.entity.model.EntityTypeShortDto in project entando-core by entando.
the class EntityManagerServiceIntegrationTest method testGetEntityTypes_2.
@Test
public void testGetEntityTypes_2() {
RestListRequest restListRequest = new RestListRequest();
PagedMetadata<EntityTypeShortDto> dtos = this.entityManagerService.getShortEntityTypes(JacmsSystemConstants.CONTENT_MANAGER, restListRequest);
assertNotNull(dtos);
assertEquals(4, dtos.getBody().size());
}
Aggregations