Walk all available statistics elements with the passed statistics visitor.

@param aCallback
The visitor to use. May not be <code>null</code>.
327915
public static void visitStatistics (@Nonnull final IStatisticsVisitorCallback aCallback)
  {
    ValueEnforcer.notNull (aCallback, "Callback");

    // For all cache handler
    ICommonsList <String> aHandlers = StatisticsManager.getAllCacheHandler ().getSorted (Comparator.naturalOrder ());
    for (final String sName : aHandlers)
    {
      final IStatisticsHandlerCache aHandler = StatisticsManager.getCacheHandler (sName);
      aCallback.onCache (sName, aHandler);
    }

    // For all timer handler
    aHandlers = StatisticsManager.getAllTimerHandler ().getSorted (Comparator.naturalOrder ());
    for (final String sName : aHandlers)
    {
      final IStatisticsHandlerTimer aHandler = StatisticsManager.getTimerHandler (sName);
      aCallback.onTimer (sName, aHandler);
    }

    // For all keyed timer handler
    aHandlers = StatisticsManager.getAllKeyedTimerHandler ().getSorted (Comparator.naturalOrder ());
    for (final String sName : aHandlers)
    {
      final IStatisticsHandlerKeyedTimer aHandler = StatisticsManager.getKeyedTimerHandler (sName);
      aCallback.onKeyedTimer (sName, aHandler);
    }

    // For all size handler
    aHandlers = StatisticsManager.getAllSizeHandler ().getSorted (Comparator.naturalOrder ());
    for (final String sName : aHandlers)
    {
      final IStatisticsHandlerSize aHandler = StatisticsManager.getSizeHandler (sName);
      aCallback.onSize (sName, aHandler);
    }

    // For all keyed size handler
    aHandlers = StatisticsManager.getAllKeyedSizeHandler ().getSorted (Comparator.naturalOrder ());
    for (final String sName : aHandlers)
    {
      final IStatisticsHandlerKeyedSize aHandler = StatisticsManager.getKeyedSizeHandler (sName);
      aCallback.onKeyedSize (sName, aHandler);
    }

    // For all counter handler
    aHandlers = StatisticsManager.getAllCounterHandler ().getSorted (Comparator.naturalOrder ());
    for (final String sName : aHandlers)
    {
      final IStatisticsHandlerCounter aHandler = StatisticsManager.getCounterHandler (sName);
      aCallback.onCounter (sName, aHandler);
    }

    // For all keyed counter handler
    aHandlers = StatisticsManager.getAllKeyedCounterHandler ().getSorted (Comparator.naturalOrder ());
    for (final String sName : aHandlers)
    {
      final IStatisticsHandlerKeyedCounter aHandler = StatisticsManager.getKeyedCounterHandler (sName);
      aCallback.onKeyedCounter (sName, aHandler);
    }
  }
1344872
public static void visitAllNodes(Node node, NodeVisitor<? super Node, VisitDirective> visitor) {
    ArrayDeque<Node> queue = new ArrayDeque<>();
    queue.add(node);
    Node current;
    while ((current = queue.poll()) != null) {
      switch (visitor.exec(current)) {
        case ABORT:
          return;
        case CONTINUE:
          if (current instanceof ParentNode<?>) {
            queue.addAll(((ParentNode<?>) current).getChildren());
          }
          if (current instanceof ExprHolderNode) {
            queue.addAll(((ExprHolderNode) current).getExprList());
          }
          continue;
        case SKIP_CHILDREN:
          continue;
      }
    }
  }
264059
public void iterateAllRegisteredMicroTypeConverters (@Nonnull final IMicroTypeConverterCallback aCallback)
  {
    // Create a static copy of the map (HashMap not weak!)
    final ICommonsMap <Class <?>, IMicroTypeConverter <?>> aCopy = m_aRWLock.readLocked (m_aMap::getClone);

    // And iterate the copy
    for (final Map.Entry <Class <?>, IMicroTypeConverter <?>> aEntry : aCopy.entrySet ())
      if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ())
        break;
  }
204442
@Override
    public boolean addAll(int location, Collection<? extends E> collection) {
        // int totalNeededSize = size() + collection.size();
        // int overhead = totalNeededSize - maxSize;
        // if(overhead > 0) {
        // removeRange(0, overhead);
        // }
        // return super.addAll(location, collection);
        if(location == size()){
            return super.addAll(location, collection);
        }
        throw new UnsupportedOperationException();
    }
602647
@Override
  public MethodVisitor visitMethod(int access,
                                   String name,
                                   String description,
                                   String signature,
                                   String[] exceptions) {
    assert (currentClass != null);
    if (signature == null)
      signature = name + description;
    return currentClass.visitMethod(access, name, description,
        signature, exceptions);
  }
1357383
private void handleGetAllMMetricsName(final HttpServletRequest req,
      final Map<String, Object> ret) {
    if (MetricReportManager.isAvailable()) {
      final MetricReportManager metricManager = MetricReportManager.getInstance();
      final List<IMetric<?>> result = metricManager.getAllMetrics();
      if (result.size() == 0) {
        ret.put(RESPONSE_ERROR, "No Metric being tracked");
      } else {
        final List<String> metricNames = new LinkedList<>();
        for (final IMetric<?> metric : result) {
          metricNames.add(metric.getName());
        }
        ret.put("data", metricNames);
      }
    } else {
      ret.put(RESPONSE_ERROR, "MetricReportManager is not available");
    }
  }
932306
@Nonnull
  public EChange add (@Nonnull final CALLBACKTYPE aCallback)
  {
    ValueEnforcer.notNull (aCallback, "Callback");

    return m_aRWLock.writeLocked ( () -> m_aCallbacks.addObject (aCallback));
  }
609471
protected void init(boolean showAll) {

        m_menu = new CmsContextMenu();
        m_menu.setAsTableContextMenu(this);

        m_container = new IndexedContainer();

        for (TableProperty prop : TableProperty.values()) {
            m_container.addContainerProperty(prop, prop.getType(), prop.getDefault());
            setColumnHeader(prop, prop.getName());
        }
        m_app.addUserContainerProperties(m_container);
        setContainerDataSource(m_container);
        setItemIconPropertyId(TableProperty.Icon);
        setRowHeaderMode(RowHeaderMode.ICON_ONLY);

        setColumnWidth(null, 40);
        setColumnWidth(TableProperty.STATUS, 100);
        setSelectable(true);
        setMultiSelect(true);

        setVisibleColumns(TableProperty.Name, TableProperty.OU);

        fillContainer(showAll);

        addItemClickListener(new ItemClickListener() {

            private static final long serialVersionUID = 4807195510202231174L;

            @SuppressWarnings("unchecked")
            public void itemClick(ItemClickEvent event) {

                changeValueIfNotMultiSelect(event.getItemId());

                if (event.getButton().equals(MouseButton.RIGHT) || (event.getPropertyId() == null)) {
                    Set<String> userIds = new HashSet<String>();
                    for (CmsUser user : (Set<CmsUser>)getValue()) {
                        userIds.add(user.getId().getStringValue());
                    }

                    m_menu.setEntries(getMenuEntries(), userIds);
                    m_menu.openForTable(event, event.getItemId(), event.getPropertyId(), CmsUserTable.this);
                } else if (event.getButton().equals(MouseButton.LEFT)
                    && TableProperty.Name.equals(event.getPropertyId())) {
                    CmsUser user = ((Set<CmsUser>)getValue()).iterator().next();
                    try {
                        openInfoDialog(user.getId());
                    } catch (CmsException e) {
                        LOG.error("Error on opening user info dialog", e);
                    }
                }

            }

        });
        setCellStyleGenerator(new CellStyleGenerator() {

            private static final long serialVersionUID = 4685652851810828147L;

            public String getStyle(Table source, Object itemId, Object propertyId) {

                if (TableProperty.STATUS.equals(propertyId)) {
                    return getStatusStyleForItem(source.getItem(itemId), (CmsUser)itemId);

                }
                String css = " ";

                if (((Boolean)(source.getItem(itemId).getItemProperty(
                    TableProperty.FROMOTHEROU).getValue())).booleanValue()) {
                    css += OpenCmsTheme.EXPIRED;
                }

                if (TableProperty.Name.equals(propertyId)) {
                    css += " " + OpenCmsTheme.HOVER_COLUMN;
                }

                if (((Boolean)source.getItem(itemId).getItemProperty(
                    TableProperty.INDIRECT).getValue()).booleanValue()) {
                    return css + " " + OpenCmsTheme.TABLE_CELL_DISABLED;
                }
                return css.length() == 1 ? null : css;
            }

            private String getStatusStyleForItem(Item item, CmsUser user) {

                if (((Boolean)item.getItemProperty(TableProperty.DISABLED).getValue()).booleanValue()) {
                    return OpenCmsTheme.TABLE_COLUMN_BOX_GRAY;
                }

                if (((Boolean)item.getItemProperty(TableProperty.NEWUSER).getValue()).booleanValue()) {
                    return OpenCmsTheme.TABLE_COLUMN_BOX_BLUE;
                }

                if (OpenCms.getLoginManager().isUserTempDisabled(user.getName())) {
                    return OpenCmsTheme.TABLE_COLUMN_BOX_RED;
                }

                if (isUserPasswordReset(user)) {
                    return OpenCmsTheme.TABLE_COLUMN_BOX_ORANGE;
                }

                return OpenCmsTheme.TABLE_COLUMN_BOX_GREEN;
            }
        });
        addGeneratedColumn(TableProperty.STATUS, new ColumnGenerator() {

            private static final long serialVersionUID = -2144476865774782965L;

            public Object generateCell(Table source, Object itemId, Object columnId) {

                return getStatus(
                    (CmsUser)itemId,
                    ((Boolean)source.getItem(itemId).getItemProperty(TableProperty.DISABLED).getValue()).booleanValue(),
                    ((Boolean)source.getItem(itemId).getItemProperty(TableProperty.NEWUSER).getValue()).booleanValue());

            }

        });
        addGeneratedColumn(TableProperty.LastLogin, new ColumnGenerator() {

            private static final long serialVersionUID = -6781906011584975559L;

            public Object generateCell(Table source, Object itemId, Object columnId) {

                long lastLogin = ((Long)source.getItem(itemId).getItemProperty(
                    TableProperty.LastLogin).getValue()).longValue();
                return lastLogin == 0L
                ? CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_NEVER_LOGGED_IN_0)
                : CmsDateUtil.getDateTime(new Date(lastLogin), DateFormat.SHORT, A_CmsUI.get().getLocale());

            }

        });

        addGeneratedColumn(TableProperty.Created, new ColumnGenerator() {

            private static final long serialVersionUID = -6781906011584975559L;

            public Object generateCell(Table source, Object itemId, Object columnId) {

                long created = ((Long)source.getItem(itemId).getItemProperty(
                    TableProperty.Created).getValue()).longValue();
                return created == 0L
                ? ""
                : CmsDateUtil.getDateTime(new Date(created), DateFormat.SHORT, A_CmsUI.get().getLocale());

            }

        });

        setItemDescriptionGenerator(new ItemDescriptionGenerator() {

            private static final long serialVersionUID = 7367011213487089661L;

            public String generateDescription(Component source, Object itemId, Object propertyId) {

                if (TableProperty.STATUS.equals(propertyId)) {

                    return getStatusHelp(
                        (CmsUser)itemId,
                        ((Boolean)((Table)source).getItem(itemId).getItemProperty(
                            TableProperty.DISABLED).getValue()).booleanValue(),
                        ((Boolean)((Table)source).getItem(itemId).getItemProperty(
                            TableProperty.NEWUSER).getValue()).booleanValue());
                }
                return null;
            }
        });
        setVisibleColumns(
            TableProperty.STATUS,
            TableProperty.Name,
            TableProperty.FullName,
            TableProperty.OU,
            TableProperty.LastLogin,
            TableProperty.Created);
    }
986737
@Override
  protected void visitMsgFallbackGroupNode(MsgFallbackGroupNode node) {

    boolean foundTranslation = false;
    if (msgBundle != null) {
      for (MsgNode msg : node.getChildren()) {
        ImmutableList<SoyMsgPart> translation =
            msgBundle.getMsgParts(MsgUtils.computeMsgIdForDualFormat(msg));
        if (!translation.isEmpty()) {
          renderMsgFromTranslation(msg, translation, msgBundle.getLocale());
          foundTranslation = true;
          break;
        }
      }
    }
    if (!foundTranslation) {
      renderMsgFromSource(node.getChild(0));
    }
  }
584857
public void goBack() {
        String action = "Going back one page";
        String expected = "Previous page from browser history is loaded";
        try {
            driver.navigate().back();
        } catch (Exception e) {
            reporter.fail(action, expected, "Browser was unable to go back one page. " + e.getMessage());
            log.warn(e);
            return;
        }
        reporter.pass(action, expected, expected);
    }
573502
public static <R> AsyncCallback<R> build(final AsyncCallbackOnSuccess<R> pcallbackOnSuccess,
      final AsyncCallbackOnFailure pcallbackOnFailure) {
    return new AsyncCallback<R>() {

      @Override
      public void onFailure(final Throwable pcaught) {
        pcallbackOnFailure.onFailure(pcaught);
      }

      @Override
      public void onSuccess(final R presult) {
        pcallbackOnSuccess.onSuccess(presult);
      }
    };
  }
774476
@Override
	public void walkTree(IResourceVisitor visitor) throws IOException {
		if (!exists()) {
			throw new FileNotFoundException(file.getAbsolutePath());
		}
		if (!file.isDirectory()) {
			return;
		}
		recurse(file, visitor, ""); //$NON-NLS-1$
	}
874222
public void visit(ASTNode[] nodes, final SourceUnit source) {
        if (nodes.length != 2 || !(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof ClassNode)) {
            source.getErrorCollector().addError(
                    new SyntaxErrorMessage(new SyntaxException("@Category can only be added to a ClassNode but got: " + (nodes.length==2?nodes[1]:"nothing"),
                        nodes[0].getLineNumber(), nodes[0].getColumnNumber()), source));
        }

        AnnotationNode annotation = (AnnotationNode) nodes[0];
        ClassNode parent = (ClassNode) nodes[1];

        ClassNode targetClass = getTargetClass(source, annotation);
        thisExpression.setType(targetClass);

        final LinkedList<Set<String>> varStack = new LinkedList<Set<String>>();
        if (!ensureNoInstanceFieldOrProperty(source, parent)) return;

        Set<String> names = new HashSet<String>();
        for (FieldNode field : parent.getFields()) {
            names.add(field.getName());
        }
        for (PropertyNode field : parent.getProperties()) {
            names.add(field.getName());
        }
        varStack.add(names);

        final Reference parameter = new Reference();
        final ClassCodeExpressionTransformer expressionTransformer = new ClassCodeExpressionTransformer() {
            protected SourceUnit getSourceUnit() {
                return source;
            }

            private void addVariablesToStack(Parameter[] params) {
                Set<String> names = new HashSet<String>();
                names.addAll(varStack.getLast());
                for (Parameter param : params) {
                    names.add(param.getName());
                }
                varStack.add(names);
            }

            @Override
            public void visitCatchStatement(CatchStatement statement) {
                varStack.getLast().add(statement.getVariable().getName());
                super.visitCatchStatement(statement);
                varStack.getLast().remove(statement.getVariable().getName());
            }

            @Override
            public void visitMethod(MethodNode node) {
                addVariablesToStack(node.getParameters());
                super.visitMethod(node);
                varStack.removeLast();
            }

            @Override
            public void visitBlockStatement(BlockStatement block) {
                Set<String> names = new HashSet<String>();
                names.addAll(varStack.getLast());
                varStack.add(names);
                super.visitBlockStatement(block);
                varStack.remove(names);
            }

            @Override
            public void visitClosureExpression(ClosureExpression ce) {
                addVariablesToStack(ce.getParameters());
                super.visitClosureExpression(ce);
                varStack.removeLast();
            }

            @Override
            public void visitDeclarationExpression(DeclarationExpression expression) {
                if (expression.isMultipleAssignmentDeclaration()) {
                    TupleExpression te = expression.getTupleExpression();
                    List<Expression> list = te.getExpressions();
                    for (Expression arg : list) {
                        VariableExpression ve = (VariableExpression) arg;
                        varStack.getLast().add(ve.getName());
                    }
                } else {
                    VariableExpression ve = expression.getVariableExpression();
                    varStack.getLast().add(ve.getName());
                }
                super.visitDeclarationExpression(expression);
            }

            @Override
            public void visitForLoop(ForStatement forLoop) {
                Expression exp = forLoop.getCollectionExpression();
                exp.visit(this);
                Parameter loopParam = forLoop.getVariable();
                if (loopParam != null) {
                    varStack.getLast().add(loopParam.getName());
                }
                super.visitForLoop(forLoop);
            }

            @Override
            public void visitExpressionStatement(ExpressionStatement es) {
                // GROOVY-3543: visit the declaration expressions so that declaration variables get added on the varStack
                Expression exp = es.getExpression();
                if (exp instanceof DeclarationExpression) {
                    exp.visit(this);
                }
                super.visitExpressionStatement(es);
            }

            @Override
            public Expression transform(Expression exp) {
                if (exp instanceof VariableExpression) {
                    VariableExpression ve = (VariableExpression) exp;
                    if (ve.getName().equals("this"))
                        return thisExpression;
                    else {
                        if (!varStack.getLast().contains(ve.getName())) {
                            return new PropertyExpression(thisExpression, ve.getName());
                        }
                    }
                } else if (exp instanceof PropertyExpression) {
                    PropertyExpression pe = (PropertyExpression) exp;
                    if (pe.getObjectExpression() instanceof VariableExpression) {
                        VariableExpression vex = (VariableExpression) pe.getObjectExpression();
                        if (vex.isThisExpression()) {
                            pe.setObjectExpression(thisExpression);
                            return pe;
                        }
                    }
                } else if (exp instanceof ClosureExpression) {
                    ClosureExpression ce = (ClosureExpression) exp;
                    ce.getVariableScope().putReferencedLocalVariable((Parameter) parameter.get());
                    Parameter[] params = ce.getParameters();
                    if (params == null) {
                        params = Parameter.EMPTY_ARRAY;
                    } else if (params.length == 0) {
                        params = new Parameter[]{
                                new Parameter(ClassHelper.OBJECT_TYPE, "it")
                        };
                    }
                    addVariablesToStack(params);
                    ce.getCode().visit(this);
                    varStack.removeLast();
                }
                return super.transform(exp);
            }
        };

        for (MethodNode method : parent.getMethods()) {
            if (!method.isStatic()) {
                method.setModifiers(method.getModifiers() | Opcodes.ACC_STATIC);
                final Parameter[] origParams = method.getParameters();
                final Parameter[] newParams = new Parameter[origParams.length + 1];
                Parameter p = new Parameter(targetClass, "$this");
                p.setClosureSharedVariable(true);
                newParams[0] = p;
                parameter.set(p);
                System.arraycopy(origParams, 0, newParams, 1, origParams.length);
                method.setParameters(newParams);

                expressionTransformer.visitMethod(method);
            }
        }
        new VariableScopeVisitor(source, true).visitClass(parent);
    }
890838
public void setStatistics(java.util.Collection<String> statistics) {
        if (statistics == null) {
            this.statistics = null;
            return;
        }

        this.statistics = new java.util.ArrayList<String>(statistics);
    }
1110475
protected void executeQueuedCallbacks() {
        if (VERBOSE)
            Log.i(TAG, String.format("Executing %d queued callbacks", mCallbackQueue.size()));
        for (OAuthCallback cb : mCallbackQueue) {
            cb.onSuccess(getRequestFactoryFromCachedCredentials());
        }
    }
1358879
List<User> getAllUsers(AccessToken accessToken, String... attributes) {
        return super.getAllResources(accessToken, attributes);
    }
1093205
public void setBackingMap(final Map<String, Map<String, List<Object>>> backingMap) {
        if (backingMap == null) {
            this.backingMap = new HashMap<>();
            this.possibleUserAttributeNames = new HashSet<>();
        } else {
            this.backingMap = new LinkedHashMap<>(backingMap);
            this.initializePossibleAttributeNames();
        }
    }