public class ThriftDataModelConversion {
private final static Logger logger = LoggerFactory.getLogger(ThriftDataModelConversion.class);
public static Project getProject (ProjectResource pr) throws RegistryException {
if (pr != null) {
Project project = new Project();
project.setProjectID(pr.getId());
project.setName(pr.getName());
if (pr.getCreationTime()!=null) {
project.setCreationTime(pr.getCreationTime().getTime());
}
project.setDescription(pr.getDescription());
project.setOwner(pr.getWorker().getUser());
List<ProjectUserResource> projectUserList = pr.getProjectUserList();
List<String> sharedUsers = new ArrayList<String>();
if (projectUserList != null && !projectUserList.isEmpty()){
for (ProjectUserResource resource : projectUserList){
sharedUsers.add(resource.getUserName());
}
}
project.setSharedUsers(sharedUsers);
return project;
}
return null;
}