Package org.fao.geonet.repository

Examples of org.fao.geonet.repository.OperationAllowedRepository


     * @param opId The operation identifier
     *
     * @throws Exception
     */
    public void setOperation(ServiceContext context, int mdId, int grpId, int opId) throws Exception {
        OperationAllowedRepository opAllowedRepo = _applicationContext.getBean(OperationAllowedRepository.class);
        Optional<OperationAllowed> opAllowed = getOperationAllowedToAdd(context, mdId, grpId, opId);

        // Set operation
        if (opAllowed.isPresent()) {
            opAllowedRepo.save(opAllowed.get());
            svnManager.setHistory(mdId + "", context);
        }
    }
View Full Code Here


     * @param grpId
     * @param opId
     * @return
     */
    public Optional<OperationAllowed> getOperationAllowedToAdd(final ServiceContext context, final int mdId, final int grpId, final int opId) {
        OperationAllowedRepository opAllowedRepo = _applicationContext.getBean(OperationAllowedRepository.class);
        UserGroupRepository userGroupRepo = _applicationContext.getBean(UserGroupRepository.class);
        final OperationAllowed operationAllowed = opAllowedRepo
                .findOneById_GroupIdAndId_MetadataIdAndId_OperationId(grpId, mdId, opId);

        if (operationAllowed == null) {
            // Check user privileges
            // Session may not be defined when a harvester is running
View Full Code Here

     * @param operId operation id
     * @throws Exception hmm
     */
    public void unsetOperation(ServiceContext context, int mdId, int groupId, int operId) throws Exception {
        OperationAllowedId id = new OperationAllowedId().setGroupId(groupId).setMetadataId(mdId).setOperationId(operId);
        final OperationAllowedRepository repository = context.getBean(OperationAllowedRepository.class);
        if (repository.exists(id)) {
            repository.delete(id);
            if (svnManager != null) {
                svnManager.setHistory(mdId+"", context);
            }
        }
    }
View Full Code Here

        }
    }

    private SetMultimap<Integer, ReservedOperation> loadOperationsAllowed(ServiceContext context, Specification<OperationAllowed>
            operationAllowedSpec) {
        final OperationAllowedRepository operationAllowedRepo= context.getBean(OperationAllowedRepository.class);
        List<OperationAllowed> operationsAllowed = operationAllowedRepo.findAll(operationAllowedSpec);
        SetMultimap<Integer, ReservedOperation> operationsPerMetadata = HashMultimap.create();
        for (OperationAllowed allowed : operationsAllowed) {
            final OperationAllowedId id = allowed.getId();
            operationsPerMetadata.put(id.getMetadataId(), ReservedOperation.lookup(id.getOperationId()));
        }
View Full Code Here

TOP

Related Classes of org.fao.geonet.repository.OperationAllowedRepository

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.