Package com.infoclinika.mssharing.model

Examples of com.infoclinika.mssharing.model.AccessDenied


    @Override
    public void startMultipartUpload(long actor, long file, String uploadId, String destinationPath) {
        final FileMetaData entity = load(file);
        if (!entity.getOwner().equals(Util.USER_FROM_ID.apply(actor))) {
            throw new AccessDenied("Only owner can set upload ID");
        }
        if (RuleValidatorImpl.IS_UPLOAD_COMPLETE.apply(entity)) {
            throw new AccessDenied("Content already set, cannot set upload ID");
        }
        entity.setUploadId(uploadId);
        entity.setDestinationPath(destinationPath);
        logger.debug("The multipart upload ID = " + file + " for user " + actor + " has been set: " + uploadId);
        fileRepository.save(entity);
View Full Code Here


    @Override
    public void completeMultipartUpload(final long actor, final long file, final String contentId) {
        final FileMetaData entity = load(file);
        if (!entity.getOwner().equals(Util.USER_FROM_ID.apply(actor))) {
            throw new AccessDenied("Only owner can set content");
        }
        if (RuleValidatorImpl.IS_UPLOAD_COMPLETE.apply(entity)) {
            throw new AccessDenied("Content already set");
        }

        final Long id = transactionTemplate.execute(new TransactionCallback<Long>() {
            @Override
            public Long doInTransaction(TransactionStatus status) {
View Full Code Here

    @Override
    public void setContentID(long actor, long file, String contentID) {
        final FileMetaData entity = load(file);
        if (!entity.getOwner().equals(Util.USER_FROM_ID.apply(actor)))
            throw new AccessDenied("Only owner can set content");
        if (RuleValidatorImpl.IS_UPLOAD_COMPLETE.apply(entity))
            throw new AccessDenied("Content already set");
        entity.setContentId(contentID);
        logger.debug("The content for file with ID = " + file + " for user " + actor + " has been set. Path = " + contentID);
        fileRepository.save(entity);
    }
View Full Code Here

    @Override
    public void setLabels(long actor, long file, String newLabels) {
        final FileMetaData entity = load(file);
        if (!entity.getOwner().equals(Util.USER_FROM_ID.apply(actor)))
            throw new AccessDenied("Only owner can edit file");
        if (!RuleValidatorImpl.IS_UPLOAD_COMPLETE.apply(entity))
            throw new AccessDenied("Upload file first");
        entity.setLabels(newLabels);
        fileRepository.save(entity);
    }
View Full Code Here

    }

    @Override
    public void removeFile(long actor, long file) {
        if (!validator.canRemoveFile(actor, file)) {
            throw new AccessDenied("Cannot remove file");
        }
        final FileMetaData fileMetaData = fileRepository.findOne(file);
        final List<RawFile> rawFiles = rawFilesRepository.findByMetaData(fileMetaData);

        for(RawFile rawFile : rawFiles) {
View Full Code Here

    }

    @Override
    public void removeInstrument(long actor, long instrument) {
        if (!validator.canRemoveInstrument(actor, instrument)) {
            throw new AccessDenied("Cannot remove instrument");
        }
        instrumentRepository.delete(instrument);
    }
View Full Code Here

    }

    @Override
    public void metaDataReTranslateAllFiles(long actor) {
        if (!validator.canMetaDataReTranslateAllFiles(actor)){
            throw new AccessDenied("Cannot execute meta data translation");
        }
       
        /*for (Long id : fileRepository.findFileIdsWithoutMetaData()){
            fileMetaDataTranslator.parse(id);
        }*/
 
View Full Code Here

    @Override
    public void metaDataReTranslateSomeFiles(long actor, List<Long> ids) {
        final List<FileMetaData> fileMetaDataList = fileRepository.findAllByIds(ids);

        if (!validator.canMetaDataReTranslateSomeFiles(actor, fileMetaDataList)){
            throw new AccessDenied("Cannot execute meta data translation");
        }

        /*for(FileMetaData file : fileMetaDataList) {
            fileMetaDataTranslator.parse(file.getId());
        }*/
 
View Full Code Here

    @Override
    public void discard(long actor, long file) {
        final FileMetaData entity = load(file);
        if (!entity.getOwner().equals(Util.USER_FROM_ID.apply(actor)))
            throw new AccessDenied("Only owner can discard");
        if (RuleValidatorImpl.IS_UPLOAD_COMPLETE.apply(entity))
            throw new AccessDenied("Content already set");
        fileRepository.delete(entity);
    }
View Full Code Here

    @Override
    public PaginationItems.PagedItem<ExperimentFileItem> pagedFilesInExperiment(long actor, long experimentId, PaginationItems.PagedItemInfo pageInfo) {
        Experiment experiment = checkPresence(experimentRepository.findOne(experimentId));
        if (!ruleValidator.isUserCanReadExperiment(actor).apply(experiment))
            throw new AccessDenied("User hasn't permissions to read experiment");

        Page<RawFile> files = getPagedFiles(experimentId, pageInfo);
        return new PaginationItems.PagedItem<ExperimentFileItem>(files.getTotalPages(), files.getTotalElements(),
                        from(files.getContent())
                        .transform(FILE_ITEM_TRANSFORMER)
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.