use of net.minecraft.server.v1_9_R2.Item in project ORCID-Source by ORCID.
the class PeerReviewManagerImpl method createItem.
private Item createItem(PeerReviewEntity peerReviewEntity) {
Item item = new Item();
item.setItemName(peerReviewEntity.getSubjectName());
item.setItemType(ItemType.PEER_REVIEW);
item.setPutCode(String.valueOf(peerReviewEntity.getId()));
return item;
}
use of net.minecraft.server.v1_9_R2.Item in project ORCID-Source by ORCID.
the class JpaJaxbNotificationAdapterTest method testToNotificationAmendedEntity.
@Test
public void testToNotificationAmendedEntity() {
NotificationAmended notification = new NotificationAmended();
notification.setNotificationType(NotificationType.AMENDED);
Source source = new Source();
notification.setSource(source);
SourceClientId clientId = new SourceClientId();
source.setSourceClientId(clientId);
clientId.setPath("APP-5555-5555-5555-5555");
Items activities = new Items();
notification.setItems(activities);
Item activity = new Item();
activities.getItems().add(activity);
activity.setItemType(ItemType.WORK);
activity.setItemName("Latest Research Article");
ExternalID extId = new ExternalID();
activity.setExternalIdentifier(extId);
extId.setType("doi");
extId.setValue("1234/abc123");
NotificationEntity notificationEntity = jpaJaxbNotificationAdapter.toNotificationEntity(notification);
assertTrue(notificationEntity instanceof NotificationAmendedEntity);
NotificationAmendedEntity notificationAmendedEntity = (NotificationAmendedEntity) notificationEntity;
assertNotNull(notificationEntity);
assertEquals(NotificationType.AMENDED, notificationEntity.getNotificationType());
// Source
assertNull(notificationAmendedEntity.getSourceId());
assertNull(notificationAmendedEntity.getClientSourceId());
assertNull(notificationAmendedEntity.getElementSourceId());
}
use of net.minecraft.server.v1_9_R2.Item in project ORCID-Source by ORCID.
the class JpaJaxbNotificationAdapterTest method testToNotificationPermissionEntity.
@Test
public void testToNotificationPermissionEntity() {
NotificationPermission notification = new NotificationPermission();
notification.setNotificationType(NotificationType.PERMISSION);
String authorizationUrlString = "https://orcid.org/oauth/authorize?client_id=APP-U4UKCNSSIM1OCVQY&response_type=code&scope=/orcid-works/create&redirect_uri=http://somethirdparty.com";
AuthorizationUrl url = new AuthorizationUrl();
notification.setAuthorizationUrl(url);
notification.setNotificationIntro("This is the intro");
notification.setNotificationSubject("This is the subject");
Source source = new Source();
notification.setSource(source);
SourceClientId clientId = new SourceClientId();
source.setSourceClientId(clientId);
clientId.setPath("APP-5555-5555-5555-5555");
url.setUri(authorizationUrlString);
Items activities = new Items();
notification.setItems(activities);
Item activity = new Item();
activities.getItems().add(activity);
activity.setItemType(ItemType.WORK);
activity.setItemName("Latest Research Article");
ExternalID extId = new ExternalID();
activity.setExternalIdentifier(extId);
extId.setType("doi");
extId.setValue("1234/abc123");
NotificationEntity notificationEntity = jpaJaxbNotificationAdapter.toNotificationEntity(notification);
assertTrue(notificationEntity instanceof NotificationAddItemsEntity);
NotificationAddItemsEntity addActivitiesEntity = (NotificationAddItemsEntity) notificationEntity;
assertNotNull(notificationEntity);
assertEquals(NotificationType.PERMISSION, notificationEntity.getNotificationType());
assertEquals(authorizationUrlString, addActivitiesEntity.getAuthorizationUrl());
assertEquals(notification.getNotificationIntro(), notificationEntity.getNotificationIntro());
assertEquals(notification.getNotificationSubject(), notificationEntity.getNotificationSubject());
// Source
assertNull(notificationEntity.getSourceId());
assertNull(notificationEntity.getClientSourceId());
assertNull(notificationEntity.getElementSourceId());
Set<NotificationItemEntity> activityEntities = addActivitiesEntity.getNotificationItems();
assertNotNull(activityEntities);
assertEquals(1, activityEntities.size());
NotificationItemEntity activityEntity = activityEntities.iterator().next();
assertEquals(ItemType.WORK, activityEntity.getItemType());
assertEquals("Latest Research Article", activityEntity.getItemName());
assertEquals("DOI", activityEntity.getExternalIdType());
assertEquals("1234/abc123", activityEntity.getExternalIdValue());
}
use of net.minecraft.server.v1_9_R2.Item in project ORCID-Source by ORCID.
the class OrcidProfileManagerImpl method addOrcidWorks.
@Override
@Transactional
public void addOrcidWorks(OrcidProfile updatedOrcidProfile) {
String orcid = updatedOrcidProfile.getOrcidIdentifier().getPath();
OrcidProfile existingProfile = null;
List<OrcidWork> updatedOrcidWorksList = null;
try {
synchronized (getLock(orcid)) {
existingProfile = retrieveOrcidProfile(orcid);
if (existingProfile == null) {
throw new IllegalArgumentException("No record found for " + orcid);
}
OrcidWorks existingOrcidWorks = existingProfile.retrieveOrcidWorks();
OrcidWorks updatedOrcidWorks = updatedOrcidProfile.retrieveOrcidWorks();
Visibility workVisibilityDefault = existingProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue();
Boolean claimed = existingProfile.getOrcidHistory().isClaimed();
setWorkPrivacy(updatedOrcidWorks, workVisibilityDefault, claimed == null ? false : claimed);
if (updatedOrcidWorks != null) {
addSourceToWorks(updatedOrcidWorks, getSource());
}
updatedOrcidWorks = dedupeWorks(updatedOrcidWorks);
updatedOrcidWorksList = updatedOrcidWorks.getOrcidWork();
checkUserCanHoldMoreElement(existingProfile.retrieveOrcidWorks(), updatedOrcidProfile.retrieveOrcidWorks());
if (compareWorksUsingScopusWay) {
checkForAlreadyExistingWorks(orcid, existingOrcidWorks, updatedOrcidWorksList);
if (existingOrcidWorks != null)
checkWorkExternalIdentifiersAreNotDuplicated(updatedOrcidWorksList, existingOrcidWorks.getOrcidWork());
else
checkWorkExternalIdentifiersAreNotDuplicated(updatedOrcidWorksList, null);
} else {
checkForAlreadyExistingWorksLegacyMode(existingOrcidWorks, updatedOrcidWorksList);
}
persistAddedWorks(orcid, updatedOrcidWorksList);
profileDao.flush();
}
} finally {
releaseLock(orcid);
}
boolean notificationsEnabled = existingProfile.getOrcidInternal().getPreferences().getNotificationsEnabled();
if (notificationsEnabled && updatedOrcidWorksList != null) {
List<Item> activities = new ArrayList<>();
for (OrcidWork updatedWork : updatedOrcidWorksList) {
Item activity = new Item();
activity.setItemName(updatedWork.getWorkTitle().getTitle().getContent());
activity.setItemType(ItemType.WORK);
activity.setPutCode(updatedWork.getPutCode());
activities.add(activity);
}
notificationManager.sendAmendEmail(orcid, AmendedSection.WORK, activities);
}
}
use of net.minecraft.server.v1_9_R2.Item in project ORCID-Source by ORCID.
the class ProfileFundingManagerImpl method createItemList.
private List<Item> createItemList(ProfileFundingEntity profileFundingEntity) {
Item item = new Item();
item.setItemName(profileFundingEntity.getTitle());
item.setItemType(ItemType.FUNDING);
item.setPutCode(String.valueOf(profileFundingEntity.getId()));
return Arrays.asList(item);
}
Aggregations