use of org.collectiveone.modules.activity.dto.ActivityDto in project CollectiveOneWebapp by CollectiveOne.
the class Activity method toDto.
/* Dto */
public ActivityDto toDto() {
ActivityDto dto = new ActivityDto();
dto.setId(id.toString());
dto.setType(type.toString());
if (timestamp != null)
dto.setTimestamp(timestamp.getTime());
if (triggerUser != null)
dto.setTriggerUser(triggerUser.toDtoLight());
if (initiative != null)
dto.setInitiative(initiative.toDto());
if (subInitiative != null)
dto.setSubInitiative(subInitiative.toDto());
dto.setOldName(oldName);
dto.setOldDriver(oldDriver);
if (mint != null)
dto.setMint(mint.toDto());
if (assignation != null)
dto.setAssignation(assignation.toDto());
if (initiativeTransfer != null)
dto.setTransfer(initiativeTransfer.toDto());
if (modelView != null)
dto.setModelView(modelView.toDto());
if (modelSection != null)
dto.setModelSection(modelSection.toDto());
if (modelCardWrapper != null)
dto.setModelCardWrapper(modelCardWrapper.toDto());
if (onSection != null)
dto.setOnSection(onSection.toDto());
if (onView != null)
dto.setOnView(onView.toDto());
if (fromSection != null)
dto.setFromSection(fromSection.toDto());
if (fromView != null)
dto.setFromView(fromView.toDto());
if (message != null)
dto.setMessage(message.toDto());
return dto;
}
use of org.collectiveone.modules.activity.dto.ActivityDto in project CollectiveOneWebapp by CollectiveOne.
the class ModelController method getActivityUnderCard.
@RequestMapping(path = "/activity/model/card/{cardWrapperId}", method = RequestMethod.GET)
public GetResult<Page<ActivityDto>> getActivityUnderCard(@PathVariable("cardWrapperId") String cardWrapperIdStr, @RequestParam("page") Integer page, @RequestParam("size") Integer size, @RequestParam(name = "onlyMessages", defaultValue = "false") Boolean onlyMessages) {
UUID cardWrapperId = UUID.fromString(cardWrapperIdStr);
Initiative initiative = modelService.getCardWrapperInitiative(cardWrapperId);
if (!initiativeService.canAccess(initiative.getId(), getLoggedUserId())) {
return new GetResult<Page<ActivityDto>>("error", "access denied", null);
}
return modelService.getActivityResultUnderCard(cardWrapperId, new PageRequest(page, size), onlyMessages);
}
use of org.collectiveone.modules.activity.dto.ActivityDto in project CollectiveOneWebapp by CollectiveOne.
the class ModelService method getActivityResultUnderView.
@Transactional
public GetResult<Page<ActivityDto>> getActivityResultUnderView(UUID viewId, PageRequest page, Boolean onlyMessages) {
Page<Activity> activities = getActivityUnderView(viewId, page, onlyMessages);
List<ActivityDto> activityDtos = new ArrayList<ActivityDto>();
for (Activity activity : activities.getContent()) {
activityDtos.add(activity.toDto());
}
Page<ActivityDto> dtosPage = new PageImpl<ActivityDto>(activityDtos, page, activities.getNumberOfElements());
return new GetResult<Page<ActivityDto>>("succes", "actvity returned", dtosPage);
}
Aggregations