@Override public JobData<T> fetchJob(String jobId) { JobDetails details = jobDetails.get(jobId); if (details == null) { throw new NotFoundException(jobId); } else { return details.data; } }
private void checkGroupPermission(Forum forum) { if (!ForumRepository.isForumAccessible(forum.getId())) { throw new AccessViolationException(String.valueOf(forum.getId())); } }
@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; } }
private void validateWriteRights(String id) { UserProfile userProfile = this.userBusinessService.getCurrentUserProfile(); if (userProfile == null || !contentEditorService.hasAccessRights(userProfile.getId(), id)) { throw new AccessViolationException(id); } }
public static int convertIdToJForumId(String id) { try { return Integer.parseInt(id); } catch (NumberFormatException e) { throw new NotFoundException(id); } }
private void checkGroupModerationPermission(Forum forum) { if (!SessionFacade.getUserSession().isModerator(forum.getId())) { throw new AccessViolationException(String.valueOf(forum.getId())); } }
@Override public JobResults<S> getJobResults(String jobId) { if (!jobDetails.containsKey(jobId)) { throw new NotFoundException(jobId); } return jobDetails.get(jobId).results; }
@Override public CollectionData getCollection(final String collectionId) { UserProfile userProfile = userBusinessService.getCurrentUserProfile(); String userId = null; if (userProfile != null) { userId = userProfile.getId(); } if (!collectionService.validateHasRights(collectionId, userId)) { throw new AccessViolationException(collectionId); } return collectionService.fetchCollection(collectionId); }
@Override public Future<Void> getJobFuture(String jobId) { if (!jobDetails.containsKey(jobId)) { throw new NotFoundException(jobId); } return jobDetails.get(jobId).jobFuture; }
@Override public void registerJobFuture(String jobId, Future<Void> future) { if (!jobDetails.containsKey(jobId)) { throw new NotFoundException(jobId); } jobDetails.get(jobId).jobFuture = future; }
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 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 String getMailIdWithGlobalIdMboxId(String globalId, String mailboxId) throws NotFoundException { if (mailMessageStorage.mailboxExists(mailboxId)) { return mailMessageStorage.getMailMessageFromMboxWithGlobalId(globalId, mailboxId); } else { throw new NotFoundException(mailboxId); } }
@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 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(); }
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); } }
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); }