use of org.collectiveone.modules.model.dto.ModelViewDto in project CollectiveOneWebapp by CollectiveOne.
the class ModelService method getView.
@Transactional
public GetResult<ModelViewDto> getView(UUID viewId, UUID requestById, Integer level, UUID requestByUserId) {
ModelView view = modelViewRepository.findById(viewId);
ModelViewDto viewDto = view.toDto();
viewDto = addViewSubElements(viewDto, view.getId(), level, requestByUserId);
return new GetResult<ModelViewDto>("success", "view retrieved", viewDto);
}
use of org.collectiveone.modules.model.dto.ModelViewDto in project CollectiveOneWebapp by CollectiveOne.
the class ModelView method toDto.
public ModelViewDto toDto() {
ModelViewDto viewDto = new ModelViewDto();
viewDto.setId(id.toString());
viewDto.setInitiativeId(initiative.getId().toString());
viewDto.setTitle(title);
viewDto.setDescription(description);
viewDto.setnSections(sections.size());
if (initiative != null)
viewDto.setInitiativeId(initiative.getId().toString());
return viewDto;
}
use of org.collectiveone.modules.model.dto.ModelViewDto in project CollectiveOneWebapp by CollectiveOne.
the class InitiativeService method initializeModel.
@Transactional
private PostResult initializeModel(UUID initiativeId, UUID creatorId) {
ModelViewDto viewDto = new ModelViewDto();
viewDto.setTitle("General View");
viewDto.setDescription("Initial auto-generated sample view. You can edit or delete it at will.");
PostResult result = modelService.createView(initiativeId, viewDto, creatorId, false);
ModelSectionDto sectionDto = new ModelSectionDto();
sectionDto.setTitle("Section");
sectionDto.setDescription("Initial auto-generated sample section. You can edit or delete it at will.");
PostResult result2 = modelService.createSection(sectionDto, null, UUID.fromString(result.getElementId()), creatorId, false);
return result2;
}
use of org.collectiveone.modules.model.dto.ModelViewDto 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