Example usage for java.util Collection remove

List of usage examples for java.util Collection remove

Introduction

In this page you can find the example usage for java.util Collection remove.

Prototype

boolean remove(Object o);

Source Link

Document

Removes a single instance of the specified element from this collection, if it is present (optional operation).

Usage

From source file:org.kitodo.dataaccess.storage.memory.MemoryNode.java

@Override
public boolean removeLastOccurrence(Object object) {
    Pair<Long, Long> range = range();
    if (range == null) {
        return false;
    }//from  w  w  w. ja v  a  2 s.  c  om
    for (long i = range.getValue(); i >= range.getKey(); i--) {
        String current = RDF.toURL(i);
        Collection<ObjectType> objects = edges.get(current);
        if (objects.remove(object)) {
            if (objects.isEmpty()) {
                edges.remove(current);
                long pos = i;
                String next;
                while (edges.containsKey(next = RDF.toURL(++pos))) {
                    edges.put(current, edges.remove(next));
                    current = next;
                }
            }
            return true;
        }
    }
    return false;
}

From source file:org.kuali.kra.award.awardhierarchy.sync.helpers.AwardSyncTermHelper.java

@SuppressWarnings("unchecked")
@Override/*w  w w .ja va  2  s.  c  o  m*/
public void applySyncChange(Award award, AwardSyncChange change)
        throws NoSuchFieldException, IllegalAccessException, InvocationTargetException, ClassNotFoundException,
        NoSuchMethodException, InstantiationException {
    Collection awardTerms = award.getAwardSponsorTerms();
    AwardSponsorTerm term = (AwardSponsorTerm) getAwardSyncUtilityService().findMatchingBo(awardTerms,
            change.getXmlExport().getKeys());
    if (StringUtils.equals(change.getSyncType(), AwardSyncType.ADD_SYNC.getSyncValue())) {
        if (term != null) {
            this.setValuesOnSyncable(term, change.getXmlExport().getValues(), change);
        } else {
            term = new AwardSponsorTerm();
            setValuesOnSyncable(term, change.getXmlExport().getKeys(), change);
            setValuesOnSyncable(term, change.getXmlExport().getValues(), change);
            award.add(term);
        }
        //sponsorTerm might be null otherwise and this will generate an error during validation
        term.refreshReferenceObject("sponsorTerm");
    } else {
        if (term != null) {
            awardTerms.remove(term);
        }
    }
}

From source file:ubic.gemma.loader.genome.gene.ncbi.homology.HomologeneServiceImpl.java

@Override
public Collection<Gene> getHomologues(Gene gene) {

    Collection<Gene> genes = new HashSet<Gene>();

    if (!this.ready.get()) {
        return genes;
    }/* w ww  .  ja v  a2 s. co m*/

    Long groupId = null;

    Integer ncbiGeneId = gene.getNcbiGeneId();
    if (ncbiGeneId == null)
        return genes;
    try {
        groupId = this.getHomologeneGroup(ncbiGeneId.longValue());
    } catch (NumberFormatException e) {
        return genes;
    }

    if (groupId == null) {
        return genes;
    }

    genes = this.getGenesInGroup(groupId);

    if (genes != null)
        genes.remove(gene); // remove the given gene from the list

    return genes;

}

From source file:com.evolveum.midpoint.task.quartzimpl.work.workers.WorkersManager.java

/**
 * Going through the groups and renaming wrongly-named tasks to the correct names.
 *//*from w ww  . j  ava 2s.c  o  m*/
private int renameWorkers(List<Task> currentWorkers, MultiValuedMap<String, WorkerKey> shouldBeWorkers,
        OperationResult result) throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException {
    int count = 0;
    for (String shouldBeGroup : shouldBeWorkers.keySet()) {
        Collection<WorkerKey> shouldBeWorkersInGroup = shouldBeWorkers.get(shouldBeGroup);
        for (Task currentWorker : new ArrayList<>(currentWorkers)) {
            if (Objects.equals(shouldBeGroup, currentWorker.getGroup())) {
                if (!shouldBeWorkersInGroup.isEmpty()) {
                    WorkerKey nextWorker = shouldBeWorkersInGroup.iterator().next();
                    renameWorker(currentWorker, nextWorker.name, result);
                    currentWorkers.remove(currentWorker);
                    shouldBeWorkersInGroup.remove(nextWorker);
                    count++;
                } else {
                    break; // no more workers for this group
                }
            }
        }
    }
    LOGGER.trace("After renameWorkers (result: {}):\nCurrent workers: {}\nShould be workers: {}", count,
            currentWorkers, shouldBeWorkers);
    return count;
}

From source file:edu.uci.ics.jung.io.CustomPajekNetWriter.java

/**
 * Writes <code>graph</code> to <code>w</code>. Labels for vertices may be
 * supplied by <code>vs</code> (defaults to no labels if null), edge weights
 * may be specified by <code>nev</code> (defaults to weights of 1.0 if
 * null), and vertex locations may be specified by <code>vld</code>
 * (defaults to no locations if null).//w ww  .j  av a  2 s  .  c o  m
 */
public void save(MyGraph<V, E> graph, Writer w, Transformer<V, String> vs, Transformer<E, Number> nev,
        Transformer<V, Point2D> vld) throws IOException {
    /*
     * TODO: Changes we might want to make:
     * - optionally writing out in list form
     */

    BufferedWriter writer = new BufferedWriter(w);
    if (nev == null) {
        nev = new Transformer<E, Number>() {
            public Number transform(E e) {
                return 1;
            }
        };
    }
    writer.write("*Colors " + graph.getLayoutParameters().getBackgroundColorRgb() + ","
            + graph.getLayoutParameters().getEdgeColorRgb());
    writer.newLine();
    writer.write(
            "*Vertices " + graph.getVertexCount() + "," + graph.getLayoutParameters().areNodeIconsAllowed());
    writer.newLine();

    List<V> id = new ArrayList<V>(graph.getVertices());//Indexer.getIndexer(graph);
    for (V currentVertex : graph.getVertices()) {
        // convert from 0-based to 1-based index
        int v_id = id.indexOf(currentVertex) + 1;
        writer.write("" + v_id);
        if (vs != null) {
            String label = vs.transform(currentVertex);
            if (label != null) {
                writer.write(" \"" + label + "\"");
            }
        }
        if (vld != null) {
            Point2D location = vld.transform(currentVertex);
            if (location != null) {
                writer.write(" " + location.getX() + " " + location.getY() + " 0.0");
            }
        }
        writer.newLine();
    }

    Collection<E> d_set = new HashSet<E>();
    Collection<E> u_set = new HashSet<E>();

    boolean directed = graph instanceof DirectedGraph;

    boolean undirected = graph instanceof UndirectedGraph;

    // if it's strictly one or the other, no need to create extra sets
    if (directed) {
        d_set.addAll(graph.getEdges());
    }
    if (undirected) {
        u_set.addAll(graph.getEdges());
    }
    if (!directed && !undirected) // mixed-mode graph
    {
        u_set.addAll(graph.getEdges());
        d_set.addAll(graph.getEdges());
        for (E e : graph.getEdges()) {
            if (graph.getEdgeType(e) == EdgeType.UNDIRECTED) {
                d_set.remove(e);
            } else {
                u_set.remove(e);
            }
        }
    }

    // write out directed edges
    if (!d_set.isEmpty()) {
        writer.write("*Arcs");
        writer.newLine();
    }
    for (E e : d_set) {
        int source_id = id.indexOf(graph.getEndpoints(e).getFirst()) + 1;
        int target_id = id.indexOf(graph.getEndpoints(e).getSecond()) + 1;
        float weight = nev.transform(e).floatValue();
        writer.write(source_id + " " + target_id + " " + weight);
        writer.newLine();
    }

    // write out undirected edges
    if (!u_set.isEmpty()) {
        writer.write("*Edges");
        writer.newLine();
    }
    for (E e : u_set) {
        Pair<V> endpoints = graph.getEndpoints(e);
        int v1_id = id.indexOf(endpoints.getFirst()) + 1;
        int v2_id = id.indexOf(endpoints.getSecond()) + 1;
        float weight = nev.transform(e).floatValue();
        writer.write(v1_id + " " + v2_id + " " + weight);
        writer.newLine();
    }
    writer.close();
}

From source file:edu.byu.softwareDist.manager.impl.FileSetManagerImpl.java

@Override
@Transactional(readOnly = false, isolation = DEFAULT, propagation = REQUIRED)
public FileSet saveFileSet(FileSet fileSet, Collection<String> files, Collection<LicenseSet> licenseSets) {
    FileSet savedFileSet;/*  ww  w  .  j  av a  2 s .c  om*/
    if (fileSet.getFileSetId() == null) {
        savedFileSet = createNewFileSet(fileSet, loadFilesFromNames(files)).getFileSet();
    } else {
        savedFileSet = fsdao.update(fileSet);
        files = new TreeSet<String>(files);
        //go through all the old files in this file set
        //if the incoming list of files does not include it, delete it
        List<Files> oldFiles = fdao.findAllByFileSet(fileSet);
        for (Files file : oldFiles) {
            String diskLocation = file.getDiskLocation();
            if (files.contains(diskLocation)) {
                files.remove(diskLocation);
            } else {
                fdao.delete(file);
            }
        }
        //save all the new files
        for (String diskLocation : files) {
            Files file = findFiles(diskLocation);
            FileSetFiles fsf = new FileSetFiles();
            fsf.setFileId(file.getFileId());
            fsf.setFileSetId(fileSet.getFileSetId());
            fsfdao.save(fsf);
        }
    }
    verifyKeyAssociations(savedFileSet.getFileSetId(), extractLicenseSetIds(licenseSets));
    return savedFileSet;
}

From source file:org.jactr.eclipse.runtime.launching.ACTRLaunchConfigurationUtils.java

@SuppressWarnings("unchecked")
static public void computeBundleDependencies(ILaunchConfigurationWorkingCopy configuration,
        Set<String> workspaceBundles, Set<String> targetBundles) throws CoreException {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    String projectName = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
    IProject sourceProject = null;//from   w  ww .j  a  v a2s .co  m

    if (projectName.length() != 0)
        sourceProject = root.getProject(projectName);

    // IProject project = root.getProject(configuration.getAttribute(
    // LaunchConfigurationConstants.ACTR_PROJECT, ""));

    Collection<String> appDependencies = null;

    if (configuration.getAttribute(ACTRLaunchConstants.ATTR_ITERATIONS, 0) == 0)
        appDependencies = BundleUtilities.getDependencies(ACTRLaunchConstants.DEFAULT_APPLICATION_BUNDLE);
    else
        appDependencies = BundleUtilities.getDependencies(ACTRLaunchConstants.ITERATIVE_APPLICATION_BUNDLE);

    Collection<String> currentDependencies = Collections.EMPTY_SET;

    if (sourceProject != null && sourceProject.exists())
        currentDependencies = BundleUtilities.getDependencies(sourceProject);

    Collection<String> uniqueDependencies = new TreeSet<String>();
    for (String bundleId : appDependencies)
        uniqueDependencies.add(bundleId);

    for (String bundleId : currentDependencies)
        uniqueDependencies.add(bundleId);

    /*
     * now for the sensors
     */
    for (SensorDescriptor sensor : getRequiredSensors(configuration))
        for (String bundleId : BundleUtilities.getDependencies(sensor.getContributor()))
            uniqueDependencies.add(bundleId);

    /*
     * and instruments
     */
    for (InstrumentDescriptor instrument : getRequiredInstruments(configuration))
        for (String bundleId : BundleUtilities.getDependencies(instrument.getContributor()))
            uniqueDependencies.add(bundleId);

    /*
     * now we determine where they are coming from, we preference workspace
     * plugins over installed ones so that you can self-host
     */
    for (IPluginModelBase modelBase : PluginRegistry.getWorkspaceModels()) {
        String pluginId = modelBase.getPluginBase(true).getId();

        // not entirely clear how to get the project from the model..
        // this matters because if the project is closed, we shouldn't use it
        // IProject requiredProject = root.getProject();
        // if (requiredProject.isAccessible())
        if (pluginId != null && uniqueDependencies.remove(pluginId))
            workspaceBundles.add(pluginId);
    }

    /*
     * and the rest we assume are targets
     */
    targetBundles.addAll(uniqueDependencies);

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("workspace : " + workspaceBundles.toString());
        LOGGER.debug("target : " + targetBundles.toString());
    }
}

From source file:org.jboss.errai.ioc.rebind.ioc.graph.impl.DependencyGraphBuilderImpl.java

private Injectable resolveDependency(final BaseDependency dep, final Injectable concrete,
        final Collection<String> problems, final Map<String, Injectable> customProvidedInjectables) {
    if (dep.injectable.resolution != null) {
        return dep.injectable.resolution;
    }/*from   w  w w.  ja  v  a2s . c o m*/

    final Multimap<ResolutionPriority, ConcreteInjectable> resolvedByPriority = HashMultimap.create();
    final Queue<AbstractInjectable> resolutionQueue = new LinkedList<AbstractInjectable>();
    resolutionQueue.add(dep.injectable);
    resolutionQueue.add(addMatchingExactTypeInjectables(dep.injectable));

    processResolutionQueue(resolutionQueue, resolvedByPriority);

    // Iterates through priorities from highest to lowest.
    for (final ResolutionPriority priority : ResolutionPriority.values()) {
        if (resolvedByPriority.containsKey(priority)) {
            final Collection<ConcreteInjectable> resolved = resolvedByPriority.get(priority);
            if (resolved.size() > 1) {
                problems.add(
                        ambiguousDependencyMessage(dep, concrete, new ArrayList<ConcreteInjectable>(resolved)));
                return null;
            } else {
                Injectable injectable = resolved.iterator().next();
                if (injectable.isExtension()) {
                    final ExtensionInjectable providedInjectable = (ExtensionInjectable) injectable;
                    final Collection<Injectable> otherResolvedInjectables = new ArrayList<Injectable>(
                            resolvedByPriority.values());
                    otherResolvedInjectables.remove(injectable);

                    final InjectionSite site = new InjectionSite(concrete.getInjectedType(), getAnnotated(dep),
                            otherResolvedInjectables);
                    injectable = providedInjectable.provider.getInjectable(site, nameGenerator);
                    customProvidedInjectables.put(injectable.getFactoryName(), injectable);
                    dep.injectable = copyAbstractInjectable(dep.injectable);
                }
                return (dep.injectable.resolution = injectable);
            }
        }
    }

    problems.add(unsatisfiedDependencyMessage(dep, concrete));
    return null;
}

From source file:com.haulmont.cuba.gui.data.impl.DsContextImpl.java

@SuppressWarnings("unchecked")
protected void repairReferences(Entity entity, Entity contextEntity) {
    MetaClass metaClass = metadata.getClassNN(entity.getClass());
    MetaClass contextEntityMetaClass = metadata.getClassNN(contextEntity.getClass());

    for (MetaProperty property : metaClass.getProperties()) {
        if (!property.getRange().isClass() || !property.getRange().asClass().equals(contextEntityMetaClass)
                || !PersistenceHelper.isLoaded(entity, property.getName()))
            continue;

        Object value = entity.getValue(property.getName());
        if (value != null) {
            if (property.getRange().getCardinality().isMany()) {
                Collection collection = (Collection) value;
                for (Object item : new ArrayList(collection)) {
                    if (contextEntity.equals(item) && contextEntity != item) {
                        if (collection instanceof List) {
                            List list = (List) collection;
                            list.set(list.indexOf(item), contextEntity);
                        } else {
                            collection.remove(item);
                            collection.add(contextEntity);
                        }/*from w  ww  .j a  va2 s.  co  m*/
                    }
                }
            } else {
                if (contextEntity.equals(value) && contextEntity != value) {
                    entity.setValue(property.getName(), contextEntity);
                }
            }
        }
    }
}

From source file:nl.strohalm.cyclos.controls.groups.EditGroupAction.java

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void prepareForm(final ActionContext context) throws Exception {
    final HttpServletRequest request = context.getRequest();
    final EditGroupForm form = context.getForm();
    final long id = form.getGroupId();
    boolean editable = false;
    boolean canManageFiles = false;

    final Map<Group.Nature, Permission> permissionByNature = ListGroupsAction
            .getManageGroupPermissionByNatureMap();

    final boolean isInsert = id <= 0L;
    if (isInsert) {
        // Prepare for insert
        List<Group.Nature> natures = new ArrayList<Group.Nature>();
        if (context.isAdmin()) {
            // Put in the request the name of permission used to manage a type of group
            request.setAttribute("permissionByNature", permissionByNature);

            for (final Group.Nature nature : permissionByNature.keySet()) {
                final Permission permission = permissionByNature.get(nature);
                if (permissionService.hasPermission(permission)) {
                    natures.add(nature);
                }//from   ww w .java2  s. com
            }
        } else {
            // It's a member inserting an operator group
            final GroupQuery groupQuery = new GroupQuery();
            groupQuery.setMember((Member) context.getElement());
            final List<OperatorGroup> baseGroups = (List<OperatorGroup>) groupService.search(groupQuery);
            request.setAttribute("baseGroups", baseGroups);
            request.setAttribute("isOperatorGroup", true);
            natures = Collections.singletonList(Group.Nature.OPERATOR);
        }
        request.setAttribute("natures", natures);
        RequestHelper.storeEnum(request, Group.Status.class, "status");
        editable = true;
    } else {
        // Prepare for modify
        Group group = groupService.load(id, Group.Relationships.CUSTOMIZED_FILES,
                MemberGroup.Relationships.CHANNELS);
        final boolean isMemberGroup = MemberGroup.class.isAssignableFrom(group.getNature().getGroupClass());
        final boolean isBrokerGroup = BrokerGroup.class.isAssignableFrom(group.getNature().getGroupClass());
        final boolean isOperatorGroup = OperatorGroup.class.isAssignableFrom(group.getNature().getGroupClass());
        if (group.getStatus().isEnabled()) {
            request.setAttribute("deactivationTimePeriodFields",
                    Arrays.asList(Field.SECONDS, Field.MINUTES, Field.HOURS, Field.DAYS));
            request.setAttribute("passwordExpiresAfterFields",
                    Arrays.asList(Field.DAYS, Field.WEEKS, Field.MONTHS, Field.YEARS));
            RequestHelper.storeEnum(request, TransactionPassword.class, "transactionPasswords");
            if (isMemberGroup) {
                final MemberGroup memberGroup = (MemberGroup) group;

                // Check if the group has access to a channel that uses pin
                final boolean usesPin = groupService.usesPin(memberGroup);
                request.setAttribute("usesPin", usesPin);

                // Retrieve the registration agreements
                final List<RegistrationAgreement> registrationAgreements = registrationAgreementService
                        .listAll();
                request.setAttribute("registrationAgreements", registrationAgreements);

                // Retrieve the associated accounts
                request.setAttribute("timePeriodFields",
                        Arrays.asList(Field.DAYS, Field.WEEKS, Field.MONTHS, Field.YEARS));
                final MemberAccountTypeQuery atQuery = new MemberAccountTypeQuery();
                atQuery.setRelatedToGroup(memberGroup);
                request.setAttribute("accountTypes", accountTypeService.search(atQuery));

                // Sort the message types using their messages
                final List<Type> messageTypes = Arrays.asList(Message.Type.values());
                final Comparator cmp = new Comparator() {
                    @Override
                    public int compare(final Object o1, final Object o2) {
                        final String msg1 = context.message("message.type." + o1);
                        final String msg2 = context.message("message.type." + o2);
                        return msg1.compareTo(msg2);
                    }
                };
                Collections.sort(messageTypes, cmp);
                request.setAttribute("messageTypes", messageTypes);

                // we create a wrapper ArrayList because the list must implement the remove method
                final List<Type> smsMessageTypes = new ArrayList<Type>(Arrays.asList(Message.Type.values()));
                CollectionUtils.filter(smsMessageTypes, new Predicate() {
                    @Override
                    public boolean evaluate(final Object object) {
                        final Message.Type type = (Message.Type) object;
                        switch (type) {
                        case FROM_MEMBER:
                        case FROM_ADMIN_TO_MEMBER:
                        case FROM_ADMIN_TO_GROUP:
                            return false;
                        default:
                            return true;
                        }
                    }
                });
                Collections.sort(smsMessageTypes, cmp);
                request.setAttribute("smsMessageTypes", smsMessageTypes);

                // Store the possible groups for expiration
                final GroupQuery query = new GroupQuery();
                query.setNatures(Group.Nature.MEMBER, Group.Nature.BROKER);
                final List<? extends Group> groups = groupService.search(query);
                groups.remove(group);
                request.setAttribute("possibleExpirationGroups", groups);
                request.setAttribute("expirationTimeFields", Arrays.asList(TimePeriod.Field.DAYS,
                        TimePeriod.Field.WEEKS, TimePeriod.Field.MONTHS, TimePeriod.Field.YEARS));

                // Store transfer types for SMS charge
                final TransferTypeQuery ttQuery = new TransferTypeQuery();
                ttQuery.setFromGroups(Collections.singletonList(memberGroup));
                ttQuery.setToNature(AccountType.Nature.SYSTEM);
                final List<TransferType> smsChargeTransferTypes = transferTypeService.search(ttQuery);
                request.setAttribute("smsChargeTransferTypes", smsChargeTransferTypes);

                request.setAttribute("smsAdditionalChargedPeriodFields",
                        Arrays.asList(Field.DAYS, Field.WEEKS, Field.MONTHS));

                // Retrieve the card types
                request.setAttribute("cardTypes", cardTypeService.listAll());
            }
            if (isBrokerGroup) {
                // Retrieve the possible groups for registered members by broker
                final GroupQuery query = new GroupQuery();
                query.setNatures(Group.Nature.MEMBER, Group.Nature.BROKER);
                query.setStatus(Group.Status.NORMAL);
                request.setAttribute("memberGroups", groupService.search(query));
            }
            if (isMemberGroup || isBrokerGroup) {
                RequestHelper.storeEnum(request, MemberGroupSettings.ExternalAdPublication.class,
                        "externalAdPublications");
            }
            if (isOperatorGroup) {
                // Load the associated transaction types for the max amount per day
                group = groupService.load(group.getId(),
                        RelationshipHelper.nested(OperatorGroup.Relationships.MEMBER,
                                Element.Relationships.GROUP),
                        OperatorGroup.Relationships.MAX_AMOUNT_PER_DAY_BY_TRANSFER_TYPE,
                        OperatorGroup.Relationships.MAX_AMOUNT_PER_DAY_BY_TRANSFER_TYPE);
                final OperatorGroup operatorGroup = (OperatorGroup) group;
                request.setAttribute("transferTypes", operatorGroup.getMember().getGroup().getTransferTypes());
            }

            // Retrieve the associated customized files
            final CustomizedFileQuery cfQuery = new CustomizedFileQuery();
            cfQuery.setGroup(group);
            request.setAttribute("customizedFiles", customizedFileService.search(cfQuery));

            // Check whether the login page name will be shown
            request.setAttribute("showLoginPageName",
                    customizationHelper.isAnyFileRelatedToLoginPage(group.getCustomizedFiles()));
        }
        getDataBinder(group.getNature()).writeAsString(form.getGroup(), group);
        request.setAttribute("group", group);
        request.setAttribute("isMemberGroup", isMemberGroup);
        request.setAttribute("isBrokerGroup", isBrokerGroup);
        request.setAttribute("isOperatorGroup", isOperatorGroup);

        if (isMemberGroup) {
            // Show scheduling options when there's a schedulable transfer type
            final TransferTypeQuery ttQuery = new TransferTypeQuery();
            ttQuery.setPageForCount();
            ttQuery.setContext(TransactionContext.PAYMENT);
            ttQuery.setGroup(group);
            ttQuery.setSchedulable(true);
            request.setAttribute("showScheduling",
                    PageHelper.getTotalCount(transferTypeService.search(ttQuery)) > 0);

            // Channels that the group of member have access
            final Collection<Channel> channels = channelService.list();
            // The "web" channel can not be customized by the user, so it should not be sent to the JSP page
            final Channel webChannel = channelService.loadByInternalName(Channel.WEB);
            channels.remove(webChannel);
            request.setAttribute("channels", channels);

            RequestHelper.storeEnum(request, EmailValidation.class, "emailValidations");
        }

        if (context.isAdmin()) {
            AdminGroup adminGroup = context.getGroup();
            adminGroup = groupService.load(adminGroup.getId(), AdminGroup.Relationships.MANAGES_GROUPS);
            if (permissionService.hasPermission(permissionByNature.get(group.getNature()))
                    && (Group.Nature.ADMIN.equals(group.getNature())
                            || adminGroup.getManagesGroups().contains(group))) {
                editable = true;
            }
        } else {
            // It's a member updating an operator group
            editable = permissionService.hasPermission(MemberPermission.OPERATORS_MANAGE);
        }
        canManageFiles = customizedFileService.canViewOrManageInGroup(group);
    }

    request.setAttribute("isInsert", isInsert);
    request.setAttribute("editable", editable);
    request.setAttribute("canManageFiles", canManageFiles);
    RequestHelper.storeEnum(request, PasswordPolicy.class, "passwordPolicies");
}