@Override public void updateStatus(String jobId, JobResults<S> status) { JobDetails details = jobDetails.get(jobId); if (details == null) { throw new NotFoundException(jobId); } else { details.results = status; } }
@Override public JobData<T> fetchJob(String jobId) { JobDetails details = jobDetails.get(jobId); if (details == null) { throw new NotFoundException(jobId); } else { return details.data; } }
public static int convertIdToJForumId(String id) { try { return Integer.parseInt(id); } catch (NumberFormatException e) { throw new NotFoundException(id); } }
@Override public Future<Void> getJobFuture(String jobId) { if (!jobDetails.containsKey(jobId)) { throw new NotFoundException(jobId); } return jobDetails.get(jobId).jobFuture; }
@Override public JobResults<S> getJobResults(String jobId) { if (!jobDetails.containsKey(jobId)) { throw new NotFoundException(jobId); } return jobDetails.get(jobId).results; }
@Override public void registerJobFuture(String jobId, Future<Void> future) { if (!jobDetails.containsKey(jobId)) { throw new NotFoundException(jobId); } jobDetails.get(jobId).jobFuture = future; }
@Override public MailMessage loadMailMessageWithExternalIdInDomain(String externalId, String domainName) throws NotFoundException { List<MailMessage> result = loadMailMessagesWithExtIdInDomain(externalId, domainName, HistoryMode.ONLY_CURRENT); if (result != null && result.size() > 0) { return result.get(0); } else { throw new NotFoundException(externalId); } }
private void checkElementCollection(String collectionId) { ElementCollection record = mongoTemplate.findById(collectionId, ElementCollection.class, mongoCollectionName); if (record == null ) { throw new NotFoundException(collectionId); } } protected void reportEvent(String collectionId, String contentId, CollectionDocumentType contentType, boolean wasDeleted) {
protected MailboxType parseMailboxType(String mailboxTypeUrl) { MailboxType currentMboxType; try { currentMboxType = MailboxType.valueOfUrlName(mailboxTypeUrl); } catch (IllegalArgumentException iae) { throw new NotFoundException(mailboxTypeUrl, iae); } return currentMboxType; }
@Override public PersonData fetchPersonData(String personId) { try { FetchPersonDataResult result = index.performSearch(new FetchPersonDataByIdentityQuery(personId)); if (result == null) { throw new NotFoundException(personId); } return result.getPersonData(); } catch (SearchException e) { throw new NotFoundException(personId, e); } }
private void verifyAnnDataModeExistence(String mailMessageId, HistoryMode mode, AnnotationData msgAnnData) { if (msgAnnData == null || !msgAnnData.getAnnotation().getType().equals(AnnotationTypeConstants.MAIL_MESSAGE)) { throw new NotFoundException(mailMessageId); } String annState = msgAnnData.getAnnotation().getState(); if (annState.equals(DELETED) && mode.onlyCurrent()) { throw new NotFoundException(mailMessageId); } if (!annState.equals(DELETED) && mode.fromHistory()) { throw new NotFoundException(mailMessageId); } }
private String getMailIdWithGlobalIdMboxId(String globalId, String mailboxId) throws NotFoundException { if (mailMessageStorage.mailboxExists(mailboxId)) { return mailMessageStorage.getMailMessageFromMboxWithGlobalId(globalId, mailboxId); } else { throw new NotFoundException(mailboxId); } }
private YElement getYElement(final String id) { ElementMetadata metadata = repositoryFacade.fetchElementMetadata(id); if ((metadata == null) || (metadata.getContent() == null)) { throw new NotFoundException(id); } else { if (metadata.getContent() instanceof YElement) { return (YElement) metadata.getContent(); } throw new NotFoundException(id); } }
public static Integer getContributorId(YContributor contributor) { Integer contributorId = BwmetaContributorUtils.getContributorId(contributor); if (contributorId == null) { throw new NotFoundException(contributor.toString()); } return contributorId; }
private YElement readYElement(final String id) { ElementMetadata elementMetadata = repositoryFacade.fetchElementMetadata(id); if (elementMetadata == null) { throw new NotFoundException(id); } return (YElement) elementMetadata.getContent(); }
protected void exposePersonDetails(String personId, Model model) { pl.edu.icm.synat.api.neo4j.people.model.PersonData person = beingFinder.fetchPersonData(personId); if (person == null) { throw new NotFoundException(personId); } model.addAttribute("resourceId", personId); model.addAttribute("searchURL", "/person/" + personId + "/tab/publications");// FIXME model.addAttribute(MAIN_TITLE, UserProfileUtils.prepareName(person.getNames())); model.addAttribute(COMP_THUMBNAIL, thumbnailService.resolveThumbnailUrl(new PersonData())); }
public static YContributor getContributor(YElement element, final String requestPersonId) { for(YContributor contributor:element.getContributors()){ String personId = BwmetaContributorUtils.buildContributorId(element.getId(), contributor); if(personId.equals(requestPersonId)){ return contributor; } } throw new NotFoundException(requestPersonId); }
@Override public String findByContribution(String contributionId) { try { FetchPersonDataResult result = index.performSearch(new FetchPersonDataQuery(contributionId, false, false)); if(result != null && result.getPersonData() != null){ return result.getPersonData().getId(); } throw new NotFoundException(contributionId); } catch (SearchException e) { throw new NotFoundException(contributionId, e); } }
private void checkGroupExistence(Forum forum, int forumId) { if (forum == null) { throw new NotFoundException(String.valueOf(forumId)); } if (!ForumRepository.isCategoryAccessible(forum.getCategoryId())) { throw new DiscussionServiceException("category [id:{}] is not accessible", forum.getCategoryId()); } }
@Override public String getMailMessageThreadRootId(String mailMessageId, HistoryMode mode) { AnnotationData msgAnnData = annotationService.getNewestAnnotationVersion(mailMessageId); if (msgAnnData == null || !msgAnnData.getAnnotation().getType().equals(AnnotationTypeConstants.MAIL_MESSAGE)) { throw new NotFoundException(mailMessageId); } AnnotationData rootAnnData = annotationService.getNewestAnnotationVersion(msgAnnData.getTopParentId()); if (msgAnnDataNotFound(mode, rootAnnData)) { throw new NotFoundException(msgAnnData.getTopParentId()); } return msgAnnData.getTopParentId(); }