Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.OperationAllowedId


public class OperationAllowedRepositoryTest extends AbstractOperationsAllowedTest {

    @Test
    public void testSaveById() {
        OperationAllowed unsaved = new OperationAllowed(new OperationAllowedId(_md1.getId(), _allGroup.getId(), _viewOp.getId()));
        OperationAllowed newOp = _opAllowRepo.save(unsaved);

        assertEquals(_md1.getId(), newOp.getId().getMetadataId());
        assertEquals(_allGroup.getId(), newOp.getId().getGroupId());
        assertEquals(_viewOp.getId(), newOp.getId().getOperationId());
View Full Code Here


                // the new group if not already defined.
                dm.unsetOperation(context, mdId, sourceGrp, opId);

                if (!targetPriv.contains(priv)) {
                    OperationAllowedRepository repository = context.getBean(OperationAllowedRepository.class);
                    OperationAllowedId id = new OperationAllowedId()
                            .setGroupId(targetGrp)
                            .setMetadataId(mdId)
                            .setOperationId(opId);
                    OperationAllowed operationAllowed = new OperationAllowed(id );
                    repository.save(operationAllowed);
View Full Code Here

            OperationAllowedRepository operationAllowedRepository = _applicationContext.getBean(OperationAllowedRepository.class);
            GroupRepository groupRepository = _applicationContext.getBean(GroupRepository.class);
            List<OperationAllowed> operationsAllowed = operationAllowedRepository.findAllById_MetadataId(id$);

            for (OperationAllowed operationAllowed : operationsAllowed) {
                OperationAllowedId operationAllowedId = operationAllowed.getId();
                int groupId = operationAllowedId.getGroupId();
                int operationId = operationAllowedId.getOperationId();

                moreFields.add(SearchManager.makeField("_op" + operationId, String.valueOf(groupId), true, true));
                if(operationId == ReservedOperation.view.getId()) {
                    Group g = groupRepository.findOne(groupId);
                    if (g != null) {
View Full Code Here

                }
            }
        }

        if (operationAllowed == null) {
            return Optional.of(new OperationAllowed(new OperationAllowedId().setGroupId(grpId).setMetadataId(mdId).setOperationId(opId)));
        } else {
            return Optional.absent();
        }
    }
View Full Code Here

     * @param groupId group id
     * @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

            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()));
        }
        return operationsPerMetadata;
    }
View Full Code Here

        assertEquals(3, _metadataValidationRepo.count());
        _metadataValidationRepo.saveAndFlush(MetadataValidationRepositoryTest.newValidation(_inc, _mdRepo));
        assertEquals(6, _operationRepo.count());
        Operation operation = _operationRepo.saveAndFlush(OperationRepositoryTest.newOperation(_inc));
        assertEquals(72, _opAllowedRepo.count());
        _opAllowedRepo.saveAndFlush(new OperationAllowed(new OperationAllowedId(metadata.getId(), group.getId(), operation.getId())));
        assertEquals(2, _ratingRepo.count());
        final MetadataRatingByIp ratingByIp = MetadataRatingByIpRepositoryTest.newMetadataRatingByIp(_inc);
        ratingByIp.getId().setMetadataId(metadata.getId());
        _ratingRepo.saveAndFlush(ratingByIp);
        assertEquals(0, _relationRepo.count());
View Full Code Here

TOP

Related Classes of org.fao.geonet.domain.OperationAllowedId

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.