Package com.infoclinika.mssharing.model

Examples of com.infoclinika.mssharing.model.ObjectNotFoundException


        if(!instrument.isOperator(Util.USER_FROM_ID.apply(actor))) {
            throw new AccessDenied("User is not an operator of instrument");
        }
        Set<PendingOperator> pendingOperators = instrument.getPending();
        if(pendingOperators.size() == 0) {
            throw new ObjectNotFoundException();
        }
        final PendingOperator pending = find(pendingOperators, new Predicate<PendingOperator>() {
            @Override
            public boolean apply(PendingOperator pendingOperator) {
                return pendingOperator.getUser().equals(user);
View Full Code Here


    }

    @Override
    public ExperimentItem readExperiment(long actor, final long experimentId) {
        final Experiment experiment = experimentRepository.findOne(experimentId);
        if(experiment == null) throw new ObjectNotFoundException("Experiment not found");

        if(!ruleValidator.isUserCanReadExperiment(actor).apply(experiment)) throw new AccessDenied("Can't read experiment");

        final String msChartsLink = transformers.getChartsLink(experiment);
        final InstrumentModel instrumentModel = experiment.getInstrumentRestriction().getInstrumentModel();
View Full Code Here

    }

    @Override
    public ExperimentSearchItem readExperimentSearch(long actor, long experimentSearchId) {
        final ExperimentSearch search = experimentSearchRepository.findOne(experimentSearchId);
        if(search == null) throw new ObjectNotFoundException("Experiment search is not found");

        if(!ruleValidator.isUserCanReadExperimentSearch(actor, experimentSearchId)) throw new AccessDenied("Can't read experiment search");
        final ExperimentSearchParamsItem params = getExperimentSearchItemsParams(search);
        final List<RawFile> rawFiles = experimentSearchRepository.findRawFilesByExperimentSearch(experimentSearchId);
        final List<Long> filesId = transform(rawFiles, new Function<RawFile, Long>() {
View Full Code Here

    }

    @Override
    public ProjectItem readProject(long user, long projectId) {
        final Project project = projectRepository.findOne(projectId);
        if(project == null) throw new ObjectNotFoundException("Project not found");
        if (!ruleValidator.hasReadAccessOnProject(user, projectId)) throw new AccessDenied("Project read restricted");
        return new ProjectItem(project.getId(),
                (project.getLab() == null) ? null : project.getLab().getId(),
                project.getName(),
                project.getCreator().getEmail(),
View Full Code Here

    }

    @Override
    public ExperimentShortInfo readExperimentShortInfo(long actor, final long experimentId) {
        final Experiment experiment = experimentRepository.findOne(experimentId);
        if(experiment == null) throw new ObjectNotFoundException("Experiment not found");

        if(!ruleValidator.isUserCanReadExperiment(actor).apply(experiment)) throw new AccessDenied("Can't read experiment");

        final ImmutableList<ShortExperimentFileItem> files = from(experiment.getRawFiles().data).transform(new Function<RawFile, ShortExperimentFileItem>() {
            @Override
View Full Code Here

    }

    @Override
    public InstrumentItem readInstrument(long actor, long instrumentId) {
        final Instrument instrument = instrumentRepository.findOne(instrumentId);
        if(instrument == null) throw new ObjectNotFoundException("Instrument not found");
        if(!ruleValidator.isUserCanReadInstrument(actor).apply(instrument)) throw new AccessDenied("Can't read instrument");

        final String vendor = instrument.getModel().vendor.getName();
        final String type = instrument.getModel().type.getName();
        final User user = Util.USER_FROM_ID.apply(actor);
View Full Code Here

    @Override
    public GroupItem readGroupDetails(long actor, long group) {
        final Group orig = groupRepository.findOne(group);

        if(orig == null) throw new ObjectNotFoundException("Group not found");
        if (!ruleValidator.canReadGroupDetails(actor, group)) throw new AccessDenied("Can't read group");

        return new GroupItem(orig.getId(), orig.getName(), orig.getLastModification(),
                from(orig.getCollaborators()).transform(MEMBER).toImmutableSortedSet(new Comparator<MemberItem>() {
                    @Override
View Full Code Here

        };
    }

    public static <T> T checkPresence(T reference) {
        if (reference == null) {
            throw new ObjectNotFoundException();
        }
        return reference;
    }
View Full Code Here

        return reference;
    }

    public static <T> T checkPresence(T reference, String comment) {
        if (reference == null) {
            throw new ObjectNotFoundException(comment);
        }
        return reference;
    }
View Full Code Here

TOP

Related Classes of com.infoclinika.mssharing.model.ObjectNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.