Package org.fao.geonet.repository

Examples of org.fao.geonet.repository.OperationRepository


  //---
  //--------------------------------------------------------------------------

  public Element serviceSpecificExec(Element params, ServiceContext context) throws Exception
  {
        final OperationRepository operationRepository = context.getBean(OperationRepository.class);

        for (Object o : params.getChildren("operation"))
    {
      Element operationEl = (Element) o;

      String  id    = Util.getAttrib(operationEl, Params.ID);
      final Element label = Util.getChild (operationEl, "label");

            operationRepository.update(Integer.valueOf(id), new Updater<Operation>() {
                @Override
                public void apply(@Nonnull Operation entity) {
                    entity.setLabelTranslations(label.getChildren());
                }
            });
View Full Code Here


    int iId = md.getId();

    OperationAllowedRepository allowedRepository = context.getBean(OperationAllowedRepository.class);
    GroupRepository groupRepository = context.getBean(GroupRepository.class);
    OperationRepository operationRepository = context.getBean(OperationRepository.class);

    allowedRepository.findAllById_MetadataId(iId);

    // Get group Owner ID
    Integer grpOwnerId = md.getSourceInfo().getGroupOwner();
    String grpOwnerName = "";

    HashMap<String, ArrayList<String>> hmPriv = new HashMap<String, ArrayList<String>>();

    // --- retrieve accessible groups

    GeonetContext gc = (GeonetContext) context
        .getHandlerContext(Geonet.CONTEXT_NAME);
    AccessManager am = gc.getBean(AccessManager.class);

    Set<Integer> userGroups = am.getUserGroups(context.getUserSession(), context.getIpAddress(), false);

    // --- scan query result to collect info

        OperationAllowedRepository operationAllowedRepository = context.getBean(OperationAllowedRepository.class);
        List<OperationAllowed> opsAllowed = operationAllowedRepository.findAllById_MetadataId(iId);

        for (OperationAllowed operationAllowed : opsAllowed) {
            int grpId = operationAllowed.getId().getGroupId();
            Group group = groupRepository.findOne(grpId);
            String grpName = group.getName();

            if (!userGroups.contains(grpId)) {
                continue;
            }

            Operation operation = operationRepository.findOne(operationAllowed.getId().getOperationId());
            String operName = operation.getName();

            if (grpOwnerId != null && grpOwnerId == grpId) {
                grpOwnerName = grpName;
            }
View Full Code Here

TOP

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

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.