Package org.apache.commons.collections.map

Examples of org.apache.commons.collections.map.ListOrderedMap$2


    /**
     * Fill the map and list with OIDs from the configuration file
     */
  private static synchronized void fillExtendedKeyUsageOidsAndTexts() {
      final ListOrderedMap map = new ListOrderedMap();
      final Configuration conf = ConfigurationHolder.instance();
      final String ekuname = "extendedkeyusage.name.";
      final String ekuoid = "extendedkeyusage.oid.";
      for (int i = 0; i < 255; i++) {
        final String oid = conf.getString(ekuoid+i);
        if (oid != null) {
          String name = conf.getString(ekuname+i);
          if (name != null) {
            // A null value in the properties file means that we should not use this value, so set it to null for real
            if (name.equalsIgnoreCase("null")) {
              name = null;
            }
            map.put(oid, name);
          } else {
            log.error("Found extended key usage oid "+oid+", but no name defined. Not adding to list of extended key usages.");
          }
        } else {
          // No eku with that number = no more ekus so break,
          log.debug("Read "+i+" extended key usages.");
          break;
        }
      }
      extendedKeyUsageOids = map.asList();
      if (extendedKeyUsageOids == null) {
        log.error("Extended key usage OIDs is null, there is a serious error with extendedkeyusage.properties");
        extendedKeyUsageOids = new ArrayList<String>();
      }
      extendedKeyUsageOidsAndNames = Collections.synchronizedMap(map);
View Full Code Here


    }

    private List<Diff> compare(JCRNodeWrapper frozenNode, JCRNodeWrapper node, String basePath) throws RepositoryException {
        List<Diff> diffs = new ArrayList<Diff>();

        ListOrderedMap uuids1 = getChildEntries(frozenNode, node.getSession());
        ListOrderedMap uuids2 = getChildEntries(node, node.getSession());

        if (!uuids1.values().equals(uuids2.values())) {
            for (Iterator iterator = uuids2.keySet().iterator(); iterator.hasNext();) {
                String key = (String) iterator.next();
                if (uuids1.containsKey(key) && !uuids1.get(key).equals(uuids2.get(key))) {
                    diffs.add(new ChildRenamedDiff(key, addPath(basePath,(String) uuids1.get(key)),addPath(basePath, (String) uuids2.get(key))));
                }
            }
        }

        if (!uuids1.keyList().equals(uuids2.keyList())) {
            List<String> added = new ArrayList<String>(uuids2.keySet());
            added.removeAll(uuids1.keySet());
            List<String> removed = new ArrayList<String>(uuids1.keySet());
            removed.removeAll(uuids2.keySet());

            // Ordering
            Map<String,String> oldOrdering = getOrdering(uuids1, removed);
            Map<String,String> newOrdering = getOrdering(uuids2, added);
            if (!newOrdering.equals(oldOrdering)) {
                for (Map.Entry<String, String> entry : newOrdering.entrySet()) {
                    diffs.add(new ChildNodeReorderedDiff(entry.getKey(), newOrdering.get(entry.getKey()),
                            addPath(basePath,(String) uuids2.get(entry.getKey())), (String) uuids2.get(newOrdering.get(entry.getKey())),newOrdering));
                }
            }

            // Removed nodes
            for (String s : removed) {
                try {
                    sourceNode.getSession().getNodeByUUID(s);
                    // Item has been moved
                } catch (ItemNotFoundException e) {
                    diffs.add(new ChildRemovedDiff(s,addPath(basePath, (String) uuids1.get(s))));
                }

            }

            // Added nodes
            for (String s : added) {
                if (s.equals(uuids2.lastKey())) {
                    diffs.add(new ChildAddedDiff(s, addPath(basePath, (String) uuids2.get(s)), null));
                } else {
                    diffs.add(new ChildAddedDiff(s, addPath(basePath, (String) uuids2.get(s)), (String) uuids2.get(uuids2.get(uuids2.indexOf(s)+1))));
                }
            }
        }

        PropertyIterator pi1 = frozenNode.getProperties();
View Full Code Here

        return previousMap;
    }

    private ListOrderedMap getChildEntries(JCRNodeWrapper node, JCRSessionWrapper session) throws RepositoryException {
        NodeIterator ni1 = node.getNodes();
        ListOrderedMap childEntries = new ListOrderedMap();
        while (ni1.hasNext()) {
            Node child = (Node) ni1.next();
            try {
                if (child.isNodeType(Constants.NT_VERSIONEDCHILD)) {
                    VersionHistory vh = (VersionHistory) node.getSession().getNodeByIdentifier(child.getProperty("jcr:childVersionHistory").getValue().getString());
                    String uuid = vh.getRootVersion().getFrozenNode().getProperty(Constants.JCR_FROZENUUID).getValue().getString();
                    childEntries.put(uuid, child.getName());
                } else if (child.isNodeType(Constants.NT_FROZENNODE)) {
                    String uuid = child.getProperty(Constants.JCR_FROZENUUID).getValue().getString();
                    childEntries.put(uuid, child.getName());
                } else {
                    session.getNodeByUUID(child.getIdentifier());
                    childEntries.put(child.getIdentifier(), child.getName());
                }
            } catch (ItemNotFoundException e) {
                // item does not exist in this workspace
            }
        }
View Full Code Here

    /**
    * Remove the stamp from stack (when resuming)
    */
    private static void popTransactionStartStamp() {
        ListOrderedMap map = (ListOrderedMap) suspendedTxStartStamps.get();
        if (map.size() > 0) {
            transactionStartStamp.set((Timestamp) map.remove(map.lastKey()));
        } else {
            Debug.logError("Error in transaction handling - no saved start stamp found - using NOW.", module);
            transactionStartStamp.set(UtilDateTime.nowTimestamp());
        }
    }
View Full Code Here

   * @param m
   */
  @SuppressWarnings("static-access")
  public static void  populate(Object bean,HttpRequest request, Map<?, ?> m)
  {
    ListOrderedMap orderedMap = new ListOrderedMap();
    Map<?, ?> map=request.getParameterMap();
    orderedMap.putAll(map);
    PropertyUtils propertyUtils = new PropertyUtils();
    @SuppressWarnings("unchecked")
    List<String> list=orderedMap.asList();
    for (String string : list)
    {
      String[] name = StringUtils.split(string, ".");
     
      if (name.length==1)
View Full Code Here

    private class Entries {

        private final ListOrderedMap principalNamesToEntries;

        private Entries(NodeImpl node, Collection principalNames) throws RepositoryException {
            principalNamesToEntries = new ListOrderedMap();
            for (Iterator it = principalNames.iterator(); it.hasNext();) {
                principalNamesToEntries.put(it.next(), new ArrayList());
            }
            collectEntries(node);
        }
View Full Code Here

     * @param table The table
     * @return The parameters
     */
    public Map getParametersFor(Table table)
    {
        ListOrderedMap result       = new ListOrderedMap();
        Map            globalParams = (Map)_parametersPerTable.get(null);
        Map            tableParams  = (Map)_parametersPerTable.get(table);

        if (globalParams != null)
        {
            result.putAll(globalParams);
        }
        if (tableParams != null)
        {
            result.putAll(tableParams);
        }
        return result;
    }
View Full Code Here

        Map params = (Map)_parametersPerTable.get(table);

        if (params == null)
        {
            // we're using a list orderered map to retain the order
            params = new ListOrderedMap();
            _parametersPerTable.put(table, params);
        }
        params.put(paramName, paramValue);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException
    {
        Map       fks    = new ListOrderedMap();
        ResultSet fkData = null;

        try
        {
            if (getPlatform().isDelimitedIdentifierModeOn())
          {
            // Jaybird has a problem when delimited identifiers are used as
            // it is not able to find the foreign key info for the table
            // So we have to filter manually below
              fkData = metaData.getForeignKeys(getDefaultTablePattern());
              while (fkData.next())
              {
                  Map values = readColumns(fkData, getColumnsForFK());
 
                    if (tableName.equals(values.get("FKTABLE_NAME")))
                    {
                      readForeignKey(metaData, values, fks);
                    }
              }
          }
            else
            {
              fkData = metaData.getForeignKeys(tableName);
              while (fkData.next())
              {
                  Map values = readColumns(fkData, getColumnsForFK());
 
                  readForeignKey(metaData, values, fks);
              }
            }
        }
        finally
        {
            if (fkData != null)
            {
                fkData.close();
            }
        }
        return fks.values();
    }
View Full Code Here

     */
    protected Collection readIndices(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException
    {
        // Jaybird is not able to read indices when delimited identifiers are turned on,
        // so we gather the data manually using Firebird's system tables
        Map          indices = new ListOrderedMap();
        StringBuffer query   = new StringBuffer();
       
        query.append("SELECT a.RDB$INDEX_NAME INDEX_NAME, b.RDB$RELATION_NAME TABLE_NAME, b.RDB$UNIQUE_FLAG NON_UNIQUE,");
        query.append(" a.RDB$FIELD_POSITION ORDINAL_POSITION, a.RDB$FIELD_NAME COLUMN_NAME, 3 INDEX_TYPE");
        query.append(" FROM RDB$INDEX_SEGMENTS a, RDB$INDICES b WHERE a.RDB$INDEX_NAME=b.RDB$INDEX_NAME AND b.RDB$RELATION_NAME = ?");

        PreparedStatement stmt      = getConnection().prepareStatement(query.toString());
        ResultSet         indexData = null;

        stmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? tableName : tableName.toUpperCase());

        try
        {
          indexData = stmt.executeQuery();

            while (indexData.next())
            {
                Map values = readColumns(indexData, getColumnsForIndex());

                // we have to reverse the meaning of the unique flag
                values.put("NON_UNIQUE", Boolean.FALSE.equals(values.get("NON_UNIQUE")) ? Boolean.TRUE : Boolean.FALSE);
                // and trim the names
                values.put("INDEX_NAME"((String)values.get("INDEX_NAME")).trim());
                values.put("TABLE_NAME"((String)values.get("TABLE_NAME")).trim());
                values.put("COLUMN_NAME", ((String)values.get("COLUMN_NAME")).trim());
                readIndex(metaData, values, indices);
            }
        }
        finally
        {
            if (indexData != null)
            {
                indexData.close();
            }
        }
        return indices.values();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.map.ListOrderedMap$2

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.