Package com.infoclinika.mssharing.model

Examples of com.infoclinika.mssharing.model.AccessDenied


    @Override
    public long copyExperiment(long userId, long experimentId) {
        final Experiment experiment = experimentRepository.findOne(experimentId);
        if (!validator.isUserCanReadExperiment(userId).apply(experiment)){
            throw new AccessDenied("User can't copy experiment: " + experiment.name);
        }
        final String name = createUniqueName(userId, experiment);
        final ExperimentInfo experimentInfo = new ExperimentInfo(name, experiment.getExperimentData().getDescription(), experiment.getWorkflowType().getId(), experiment.getSpecie().getId());
        final InstrumentRestriction inRestriction = experiment.getInstrumentRestriction();
        final Restriction restriction = new Restriction(inRestriction.getInstrumentModel().getId(), Optional.<Long>fromNullable(inRestriction.getInstrument() == null ? null : inRestriction.getInstrument().getId()));
View Full Code Here


    @Override
    public long newExperimentSearch(long creator, String name, String description, long experiment, ExperimentSearchParamsInfo paramsInfo) {
        checkArgument(validator.canUserCreateExperimentSearchWithTitle(creator, experiment, name), "User already has experiment run with this name: \"" + name + "\"");
        if (!validator.checkCreatingExperimentSearchForExperiment(creator, experiment)){
            throw new AccessDenied("User can't create run for experiment");
        }
        final ExperimentSearchData experimentSearchData = createExperimentSearchData(name, description, experiment, paramsInfo);
        final List<RawFile> experimentFiles = experimentRepository.findFilesByExperimentId(experiment);
        final ExperimentSearch experimentSearch = createAndSaveExperimentSearch(experimentSearchData, newHashSet(experimentFiles));
        startSearch(experimentSearch);
View Full Code Here

        return new ExperimentSearchData(name, description, experiment, paramsData);
    }

    @Override
    public void removeExperimentSearch(long actor, long experimentSearchId) {
        if (!validator.canRemoveExperimentSearch(actor, experimentSearchId)) throw new AccessDenied("Couldn't remove experiment search");
        removeExperimentSearch(experimentSearchId);
    }
View Full Code Here

    }

    @Override
    public void runFileTranslation(long actor, long experimentId) {
        if (!validator.userHasEditPermissionsOnExperiment(actor, experimentId)) {
            throw new AccessDenied("User isn't permitted to translate this experiment");
        }
        final Experiment experiment = experimentRepository.findOne(experimentId);
        prepareForTranslation(experiment);
        Long id = experiment.getId();
        translator.translate(id);
View Full Code Here

    }

    @Override
    public void retranslateAllExperiments(long actor) {
        if (!validator.userHasPermissionToRetranslateAllExperiments(actor)) {
            throw new AccessDenied("User isn't permitted to retranslate all experiments");
        }
        final List<Experiment> all = experimentRepository.findAll();
        for (Experiment experiment : all) {
            prepareForTranslation(experiment);
            translator.translate(experiment.getId());
View Full Code Here

    }

    @Override
    public void retranslateExperiments(long actor, List<Long> experiments) {
        if (!validator.userHasPermissionToRetranslateAllExperiments(actor)) {
            throw new AccessDenied("User isn't permitted to retranslate selected experiments");
        }
        if(experiments.isEmpty()){
            throw new IllegalArgumentException("No experiments to retranslate");
        }
        for(long id : experiments){
View Full Code Here

        }
    }

    @Override
    public void setBlogEnabled(long actor, long project, boolean blogEnabled) {
        if (!validator.isProjectOwner(actor, project)) throw new AccessDenied("Couldn't update");
        Project entity = projectRepository.findOne(project);
        entity.setBlogEnabled(blogEnabled);
        projectRepository.save(entity);
    }
View Full Code Here

    }

    @Override
    public void reSearchIdProtein(long actor, List<Long> experimentSearches) {
        if (!validator.userHasPermissionToResearchAllExperiments(actor)) {
            throw new AccessDenied("User isn't permitted to research selected experiments");
        }
        if(experimentSearches.isEmpty()) {
            throw new IllegalArgumentException("No experiment searches to research");
        }
        for(long id : experimentSearches) {
View Full Code Here

    }


    @Override
    public long createLab(long actor, LabInfo labInfo, String contactEmail) {
        if (!validator.canCreateLabs(actor)) throw new AccessDenied("Couldn't create labs");

        final User head = findOrCreateLabHead(labInfo.labHead);
        final Lab lab = new Lab(labInfo.labName, labInfo.institutionUrl, head, contactEmail);
        final Lab savedLab = saveLab(lab);
View Full Code Here

        return savedLab.getId();
    }

    @Override
    public void editLabRequestInfo(long actor, long requestId, LabInfo labInfo) {
        if (!validator.canEditLabCreationRequests(actor)) throw new AccessDenied("Couldn't edit lab creation request");
        final LabCreationRequest request = findLabCreationRequest(requestId);
        request.setInstitutionUrl(labInfo.institutionUrl);
        request.setLabName(labInfo.labName);
        request.setHeadData(personalInfoToData(labInfo.labHead));
        labCreationRequestRepository.save(request);
View Full Code Here

TOP

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

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.