use of net.minecraft.server.v1_7_R4.Item in project ORCID-Source by ORCID.
the class WorkEntityFactory method create.
@Override
public NotificationWorkEntity create(Object source, MappingContext mappingContext) {
mappingContext.getSourceObjects();
NotificationWorkEntity nwe = new NotificationWorkEntity();
String putCode = ((Item) source).getPutCode();
if (putCode != null) {
WorkEntity work = workDao.find(Long.valueOf(putCode));
nwe.setWork(work);
}
return nwe;
}
use of net.minecraft.server.v1_7_R4.Item in project ORCID-Source by ORCID.
the class WorkManagerImpl method createItem.
private Item createItem(WorkEntity workEntity) {
Item item = new Item();
item.setItemName(workEntity.getTitle());
item.setItemType(ItemType.WORK);
item.setPutCode(String.valueOf(workEntity.getId()));
return item;
}
use of net.minecraft.server.v1_7_R4.Item in project ORCID-Source by ORCID.
the class WorkManagerImpl method checkSourceAndRemoveWork.
@Override
public boolean checkSourceAndRemoveWork(String orcid, Long workId) {
boolean result = true;
WorkEntity workEntity = workDao.getWork(orcid, workId);
orcidSecurityManager.checkSource(workEntity);
try {
Item item = createItem(workEntity);
workDao.removeWork(orcid, workId);
workDao.flush();
notificationManager.sendAmendEmail(orcid, AmendedSection.WORK, item);
} catch (Exception e) {
LOGGER.error("Unable to delete work with ID: " + workId);
result = false;
}
return result;
}
use of net.minecraft.server.v1_7_R4.Item in project ORCID-Source by ORCID.
the class ExternalIDValidatorTest method testEmptyRelationshipOnNotificationItemExternalIds_flagOff.
@Test
public void testEmptyRelationshipOnNotificationItemExternalIds_flagOff() {
Item i = new Item();
Item i2 = new Item();
Items items = new Items();
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("doi");
id1.setValue("value1");
id1.setUrl(new Url("http://value1.com"));
ExternalID id2 = new ExternalID();
id2.setRelationship(null);
id2.setType("source-work-id");
id2.setValue("value2");
id2.setUrl(new Url("http://value1.com"));
i.setExternalIdentifier(id1);
i2.setExternalIdentifier(id2);
items.getItems().add(i);
items.getItems().add(i2);
//both valid
validator.validateNotificationItems(items);
}
use of net.minecraft.server.v1_7_R4.Item in project ORCID-Source by ORCID.
the class NotificationManagerImpl method sendAmendEmail.
@Override
public void sendAmendEmail(String orcid, AmendedSection amendedSection, Item item) {
OrcidProfile amendedProfile = orcidProfileManager.retrieveOrcidProfile(orcid, LoadOptions.BIO_AND_INTERNAL_ONLY);
Collection<Item> items = new ArrayList<Item>(1);
if (item != null) {
items.add(item);
}
sendAmendEmail(amendedProfile, amendedSection, items);
}
Aggregations