Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.Group


        assertEquals("Expected to find 3 records", 3, records.size());
    }

    @Test
    public void testExecAsWithGroups() throws Exception {
        final Group group = _groupRepo.save(GroupRepositoryTest.newGroup(inc));
        User user1 = UserRepositoryTest.newUser(inc);
        user1.setProfile(Profile.Editor);
        user1 = _userRepo.save(user1);

        User user2 = UserRepositoryTest.newUser(inc);
View Full Code Here


    GroupRepository _repo;

    @Test
    public void testIsNotReserved() throws Exception {
        for (ReservedGroup reservedGroup : ReservedGroup.values()) {
            Group group = _repo.save(reservedGroup.getGroupEntityTemplate());

            final Field idField = ReflectionUtils.findField(ReservedGroup.class, "_id");
            idField.setAccessible(true);
            ReflectionUtils.setField(idField, reservedGroup, group.getId());
        }

        Group notReserved = _repo.save(GroupRepositoryTest.newGroup(_inc));

        List<Group> found = _repo.findAll(isReserved());

        assertEquals(ReservedGroup.values().length, found.size());
        for (Group group : found) {
View Full Code Here

                    groupName = m.group(1);
                }
            }
           
            GroupRepository groupRepo = this.applicationContext.getBean(GroupRepository.class);
            Group group = groupRepo.findByName(groupName);
           
            if (group == null) {
                group = groupRepo.save(new Group().setName(groupName));
            } else {
                // Update something ?
                // Group description is only defined in catalog, not in LDAP for the time
                // being
            }
View Full Code Here

        int groupId = -1;
        int userId = -1;

        if (groupProvided) {
            GroupRepository groupRepo = context.getBean(GroupRepository.class);
            Group group = groupRepo.findByName(groupName);

            if (group == null) {
                group = groupRepo.save(new Group().setName(groupName));
            }
            groupId = group.getId();
        }
        // --- update user information into the database
        if (username.length() > 256) // only accept the first 256 chars
        {
            username = username.substring(0, 256);
View Full Code Here

    String id = params.getChildText(Params.ID);

    if (id == null) {
      return new Element(Jeeves.Elem.RESPONSE);
        }
        final Group group = context.getBean(GroupRepository.class).findOne(Integer.valueOf(id));

        if (group == null) {
            return new Element(Jeeves.Elem.RESPONSE);
        }


        return new Element(Jeeves.Elem.RESPONSE).addContent(group.asXml());
  }
View Full Code Here

        final Element elRes = new Element(Jeeves.Elem.RESPONSE);

        if (id == null || "".equals(id)) {

            Group group = new Group()
                    .setName(name)
                    .setDescription(description)
                    .setEmail(email)
                    .setLogo(logoUUID)
                    .setWebsite(website);

            final LanguageRepository langRepository = context.getBean(LanguageRepository.class);
            java.util.List<Language> allLanguages = langRepository.findAll();
            for (Language l : allLanguages) {
                group.getLabelTranslations().put(l.getId(), name);
            }

            groupRepository.save(group);

            elRes.addContent(new Element(Jeeves.Elem.OPERATION).setText(Jeeves.Text.ADDED));
View Full Code Here

        if (!accessMan.canEdit(context, id)) {
            throw new OperationNotAllowedEx();
        }

        int iGroupOwner = Integer.parseInt(groupOwner);
        Group group = context.getBean(GroupRepository.class).findOne(iGroupOwner);
        if (group == null) {
            throw new IllegalArgumentException("Group with identifier '" + groupOwner + "' not found.");
        }

        //--- Update groupOwner
View Full Code Here

            return element.addContent(new Element("result").setText("errorEmailAddressAlreadyRegistered"));
        }

        // Add new user to database

        Group group = getGroup(context);
        String passwordHash = PasswordUtil.encode(context, password);
        User user = new User()
                .setKind(kind)
                .setName(name)
                .setOrganisation(organ)
View Full Code Here

                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) {
                        moreFields.add(SearchManager.makeField("_groupPublished", g.getName(), true, true));
                    }
                }
            }

            for (MetadataCategory category : fullMd.getCategories()) {
View Full Code Here

                final GroupRepository groupRepository = context.getBean(GroupRepository.class);

                List<OperationAllowed> opsAllowed = opAllowedRepo.findByMetadataId(id);
               
        for (OperationAllowed opAllowed : opsAllowed) {
                    Group group = groupRepository.findOne(opAllowed.getId().getGroupId());
          String  name  = group.getName();
          String  email = group.getEmail();

          if (email.trim().length() != 0)
          {
              // TODO i18n
            String subject = "File " + fname + " has been downloaded";
View Full Code Here

TOP

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

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.