use of org.collectiveone.modules.model.dto.ModelDto in project CollectiveOneWebapp by CollectiveOne.
the class ModelService method getModel.
@Transactional
public GetResult<ModelDto> getModel(UUID initiativeId, Integer level, UUID requestById) {
Initiative initiative = initiativeRepository.findById(initiativeId);
if (initiative == null)
return new GetResult<ModelDto>("error", "initiative not found", null);
List<ModelViewDto> viewsDto = new ArrayList<ModelViewDto>();
List<ModelView> views = initiative.getModelViews();
for (ModelView view : views) {
ModelViewDto viewDto = view.toDto();
viewDto = addViewSubElements(viewDto, view.getId(), level, requestById);
viewsDto.add(viewDto);
}
ModelDto modelDto = new ModelDto();
modelDto.setViews(viewsDto);
return new GetResult<ModelDto>("success", "model found", modelDto);
}
Aggregations