use of org.orcid.pojo.ajaxForm.WorkForm in project ORCID-Source by ORCID.
the class WorksController method getWork.
/**
* Returns a blank work
*/
@RequestMapping(value = "/work.json", method = RequestMethod.GET)
@ResponseBody
public WorkForm getWork(HttpServletRequest request) {
WorkForm w = new WorkForm();
initializeFields(w);
return w;
}
use of org.orcid.pojo.ajaxForm.WorkForm in project ORCID-Source by ORCID.
the class WorksController method createWorksIdList.
/**
* created a work id list and sorts a map associated with the list in in the
* session
*
*/
private List<String> createWorksIdList(HttpServletRequest request) {
String orcid = getEffectiveUserOrcid();
List<Work> works = workManager.findWorks(orcid, profileEntityManager.getLastModified(orcid));
HashMap<Long, WorkForm> worksMap = new HashMap<Long, WorkForm>();
List<String> workIds = new ArrayList<String>();
if (works != null) {
for (Work work : works) {
try {
worksMap.put(work.getPutCode(), WorkForm.valueOf(work));
workIds.add(String.valueOf(work.getPutCode()));
} catch (Exception e) {
LOGGER.error("ProfileWork failed to parse as Work. Put code" + work.getPutCode());
}
}
request.getSession().setAttribute(WORKS_MAP, worksMap);
}
return workIds;
}
use of org.orcid.pojo.ajaxForm.WorkForm in project ORCID-Source by ORCID.
the class WorkFormTest method testSerializeWork.
@Test
public void testSerializeWork() throws Exception {
Work work = getWork();
WorkForm workForm = WorkForm.valueOf(work);
MemoryEfficientByteArrayOutputStream.serialize(workForm);
}
use of org.orcid.pojo.ajaxForm.WorkForm in project ORCID-Source by ORCID.
the class WorkFormTest method testValueOfAndBack.
@Test
public void testValueOfAndBack() throws Exception {
Work work = getWork();
WorkForm workForm = WorkForm.valueOf(work);
Work backToWork = workForm.toWork();
assertEquals(work, backToWork);
}
use of org.orcid.pojo.ajaxForm.WorkForm in project ORCID-Source by ORCID.
the class WorksControllerTest method testGetWorkInfoWithContributors.
@Test
public void testGetWorkInfoWithContributors() throws Exception {
WorkForm work = worksController.getWorkInfo(Long.valueOf("5"));
assertNotNull(work);
assertNotNull(work.getContributors());
assertEquals(4, work.getContributors().size());
Contributor contributor = work.getContributors().get(0);
assertNull(contributor.getEmail());
assertEquals("Jaylen Kessler", contributor.getCreditName().getValue());
contributor = work.getContributors().get(1);
assertNull(contributor.getEmail());
assertEquals("John Smith", contributor.getCreditName().getValue());
contributor = work.getContributors().get(2);
assertNull(contributor.getEmail());
assertEquals("Credit Name", contributor.getCreditName().getValue());
// contributor is an ORCID user with private name
contributor = work.getContributors().get(3);
assertNull(contributor.getEmail());
assertNull(contributor.getCreditName().getValue());
}
Aggregations