String scientificName = j.getString("scientificName");
DateFormat df = new SimpleDateFormat("dd/mm/yyyy");
String type = j.getString("sampleType");
String locationBarcode = j.getString("locationBarcode");
Sample news = new SampleImpl();
news.setProject(p);
news.setAlias(alias);
news.setDescription(descr);
news.setScientificName(scientificName);
news.setSecurityProfile(sp);
news.setSampleType(type);
news.setLocationBarcode(locationBarcode);
if (j.has("receivedDate") && !"".equals(j.getString("receivedDate"))) {
Date date = df.parse(j.getString("receivedDate"));
news.setReceivedDate(date);
}
if (!j.getString("note").equals("")) {
Note note = new Note();
note.setOwner(sp.getOwner());
note.setText(j.getString("note"));
note.setInternalOnly(true);
if (j.has("receivedDate") && !"".equals(j.getString("receivedDate"))) {
Date date = df.parse(j.getString("receivedDate"));
note.setCreationDate(date);
}
else {
note.setCreationDate(new Date());
}
news.setNotes(Arrays.asList(note));
}
saveSet.add(news);
}
else {