use of org.c4sg.dto.ProjectDTO in project c4sg-services by Code4SocialGood.
the class ProjectMapper method getProjectDtoFromEntity.
public ProjectDTO getProjectDtoFromEntity(UserProject userProject) {
Type projectTypeDTO = new TypeToken<ProjectDTO>() {
}.getType();
ProjectDTO projectDTO = map(userProject.getProject(), projectTypeDTO);
return projectDTO;
}
use of org.c4sg.dto.ProjectDTO in project c4sg-services by Code4SocialGood.
the class ProjectController method createProject.
@CrossOrigin
@RequestMapping(method = RequestMethod.POST)
@ApiOperation(value = "Add a new project")
public Map<String, Object> createProject(@ApiParam(value = "Project object to return", required = true) @RequestBody @Valid CreateProjectDTO createProjectDTO) {
System.out.println("************** Add **************");
Map<String, Object> responseData = null;
try {
ProjectDTO createProject = projectService.createProject(createProjectDTO);
responseData = Collections.synchronizedMap(new HashMap<>());
responseData.put("project", createProject);
} catch (Exception e) {
System.out.println(e);
}
return responseData;
}
use of org.c4sg.dto.ProjectDTO in project c4sg-services by Code4SocialGood.
the class ProjectController method updateProject.
@CrossOrigin
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ApiOperation(value = "Update an existing project")
public Map<String, Object> updateProject(@ApiParam(value = "Updated project object", required = true) @RequestBody @Valid ProjectDTO project) {
System.out.println("**************Update : id=" + project.getId() + "**************");
Map<String, Object> responseData = null;
try {
ProjectDTO updateProject = projectService.updateProject(project);
responseData = Collections.synchronizedMap(new HashMap<>());
responseData.put("project", updateProject);
} catch (Exception e) {
System.out.println(e);
}
return responseData;
}
use of org.c4sg.dto.ProjectDTO in project c4sg-services by Code4SocialGood.
the class OrganizationServiceImpl method deleteOrganization.
public void deleteOrganization(int id) {
Organization organization = organizationDAO.findOne(id);
if (organization != null) {
organization.setStatus(Constants.ORGANIZATION_STATUS_CLOSED);
organization.setLogoUrl(null);
organizationDAO.save(organization);
List<ProjectDTO> projects = projectService.findByOrganization(id);
for (ProjectDTO project : projects) {
projectService.deleteProject(project.getId());
}
organizationDAO.deleteUserOrganizations(id);
//TODO: Local or Timezone?
//TODO: Format date
//organization.setDeleteTime(LocalDateTime.now().toString());
//organization.setDeleteBy(user.getUsername());
}
}
use of org.c4sg.dto.ProjectDTO in project c4sg-services by Code4SocialGood.
the class ProjectMapper method getProjectDtoFromEntity.
public ProjectDTO getProjectDtoFromEntity(Project project) {
getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
ProjectDTO projectDTO = map(project, ProjectDTO.class);
projectDTO.setOrganizationId(project.getOrganization().getId().toString());
projectDTO.setOrganizationName(project.getOrganization().getName());
return projectDTO;
}
Aggregations