Package org.apache.commons.collections.map

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


        // now create a second user manager that has auto-expand-tree enabled
        createUserManager(2, true, 1);


        Map<String, String> m = new ListOrderedMap();
        // upon creation of any a new user 'zzzA' an additional intermediate
        // folder would be created if there wasn't the colliding authorizable
        // 'zzz' -> autoexpansion is aborted.
        m.put("zzzA", "/z/zz/zzzA");
        // this is also true for 'zzzzz' and zzzBsl
        m.put("zzzzz", "/z/zz/zzzzz");
        m.put("zzzBsl", "/z/zz/zzzBsl");

        // on other levels the expansion must still work as expected.
        // - zzBsl -> zz is completed -> create zzB -> insert zzBsl user
        // - zzBslrich -> zz, zzB are completed -> create zzBs -> insert zzBslrich user
        m.put("zzBsl", "/z/zz/zzB/zzBsl");
        m.put("zzBslrich", "/z/zz/zzB/zzBs/zzBslrich");

        for (String uid : m.keySet()) {
            u = (UserImpl) uMgr.createUser(uid, uid);
            save(s);

            assertEquals(usersPath + m.get(uid), u.getNode().getPath());
            assertNotNull(uMgr.getAuthorizable(uid));
        }
    }
View Full Code Here


        // remember the z-folder for later removal
        toRemove.add((NodeImpl) u.getNode().getParent().getParent());
        assertEquals(usersPath + "/z/zz/z", u.getNode().getPath());

        Map<String, String> m = new ListOrderedMap();
        // potential conflicting uid
        m.put("zzz", "/z/zz/zzz/zzz");
        // max-size (2) is reached
        m.put("zzzuerich", "/z/zz/zzz/zzzuerich");
        m.put("zzuerich", "/z/zz/zzu/zzuerich");
        // too short for expanded folders
        m.put("zz", "/z/zz/zz");

        for (String uid : m.keySet()) {
            u = (UserImpl) uMgr.createUser(uid, uid);
            save(s);

            assertEquals(usersPath + m.get(uid), u.getNode().getPath());

            User us = (User) uMgr.getAuthorizable(uid);
            assertNotNull(us);
            assertEquals(uid, us.getID());
        }
View Full Code Here

    errorCode = ISequenceDefinition.ACTION_SEQUENCE_DEFINITION_OK;
    // this.sequenceData = sequenceData;

    // get the input parameter definitions
    actionInputDefinitions = new ListOrderedMap();
    actionInputMapping = new ListOrderedMap();
    errorCode =
        SequenceDefinition.parseParameters( actionRootNode, logger,
            "action-inputs/*", actionInputDefinitions, actionInputMapping, true ); //$NON-NLS-1$

    // get the ouput definitions
    actionOutputDefinitions = new ListOrderedMap();
    actionOutputMapping = new ListOrderedMap();
    errorCode =
        SequenceDefinition.parseParameters( actionRootNode, logger,
            "action-outputs/*", actionOutputDefinitions, actionOutputMapping, false ); //$NON-NLS-1$

    // get the resource definitions
    actionResourceMapping = new ListOrderedMap();
    if ( actionRootNode.selectNodes( "action-resources/*" ).size() > 0 ) { //$NON-NLS-1$
      hasActionResources = true;
      errorCode =
          SequenceDefinition.parseActionResourceDefinitions( actionRootNode, logger,
              "action-resources/*", actionResourceMapping ); //$NON-NLS-1$
View Full Code Here

    author = XmlDom4JHelper.getNodeText( "documentation/author", sequenceRootNode ); //$NON-NLS-1$
    resultType = XmlDom4JHelper.getNodeText( "documentation/result-type", sequenceRootNode ); //$NON-NLS-1$
    iconPath = XmlDom4JHelper.getNodeText( "documentation/icon", sequenceRootNode ); //$NON-NLS-1$

    // get the input parameter definitions
    inputDefinitions = new ListOrderedMap();
    errorCode = SequenceDefinition.parseParameters( sequenceRootNode, logger, "inputs/*", inputDefinitions, null, true ); //$NON-NLS-1$

    // get the ouput definitions
    outputDefinitions = new ListOrderedMap();
    errorCode =
        SequenceDefinition.parseParameters( sequenceRootNode, logger, "outputs/*", outputDefinitions, null, false ); //$NON-NLS-1$
    if ( errorCode != ISequenceDefinition.ACTION_SEQUENCE_DEFINITION_OK ) {
      logger.info( Messages.getInstance().getString( "SequenceDefinition.INFO_OUTPUT_PARAMETERS_NOT_DEFINED" ) ); //$NON-NLS-1$     
    }
View Full Code Here

    return ISequenceDefinition.ACTION_SEQUENCE_DEFINITION_INVALID_ACTION_DOC;
  }

  private int parseResourceDefinitions( final Node actionRootNode, final ILogger logger ) {

    resourceDefinitions = new ListOrderedMap();

    try {
      List resources = actionRootNode.selectNodes( "resources/*" ); //$NON-NLS-1$

      // TODO create objects to represent the types
View Full Code Here

    }

  }

  private static Map getMapFromNode( final Node mapNode ) {
    Map rtnMap = new ListOrderedMap();

    if ( mapNode != null ) {
      List nodes = mapNode.selectNodes( "entry" ); //$NON-NLS-1$
      if ( nodes != null ) {
        for ( Iterator it = nodes.iterator(); it.hasNext(); ) {
          Node entryNode = (Node) it.next();
          rtnMap.put( XmlDom4JHelper.getNodeText( "@key", entryNode ), entryNode.getText() ); //$NON-NLS-1$
        }
      }
    }
    return ( rtnMap );
  }
View Full Code Here

  public Map getInputDefinitions() {
    return inputDefinitions;
  }

  public Map getInputDefinitionsForParameterProvider( final String parameterProviderName ) {
    Map rtnMap = new ListOrderedMap();

    Map paramList = getInputDefinitions();
    for ( Iterator it = paramList.values().iterator(); it.hasNext(); ) {
      IActionParameter actionParameter = (IActionParameter) it.next();
      List vars = actionParameter.getVariables();
      for ( int i = 0; i < vars.size(); i++ ) {
        ActionParameterSource source = (ActionParameterSource) ( vars.get( i ) );
        if ( source.getSourceName().equals( parameterProviderName ) ) {
          rtnMap.put( source.getValue(), actionParameter );
        }
      }
    }
    return ( rtnMap );
  }
View Full Code Here

  private static final Log logger = LogFactory.getLog( ParameterManager.class );

  private Map sequenceOutputDefs;

  ParameterManager() {
    allParams = new ListOrderedMap();
    allResources = new ListOrderedMap();

    waitingToDieParams = new ArrayList<IActionParameter>();

    currentInputs = new ListOrderedMap();
    currentResources = new ListOrderedMap();
    currentOutputs = new ListOrderedMap();

    sequenceOutputDefs = new ListOrderedMap();
    sequenceInputNames = ParameterManager.EMPTY_ARRAY;
  }
View Full Code Here

    allParams = resetMap( sequenceInputNames, allParams );
    allResources = resetMap( sequenceResourceNames, allResources );
  }

  private ListOrderedMap resetMap( final String[] names, final ListOrderedMap oldMap ) {
    ListOrderedMap newMap = new ListOrderedMap();
    for ( String element : names ) {
      newMap.put( element, oldMap.get( element ) );
    }
    return ( newMap );
  }
View Full Code Here

   *          The Action Sequence definition to use
   *
   * @return a map with the param name as the key and a ReturnParameter containing the data.
   */
  public Map getReturnParameters() {
    ListOrderedMap returnMap = new ListOrderedMap();

    // Iterate for each output defined
    for ( Iterator it = sequenceOutputDefs.entrySet().iterator(); it.hasNext(); ) {
      Map.Entry entry = (Map.Entry) it.next();
      String outputName = (String) entry.getKey();
      IActionParameter outputParam = (IActionParameter) entry.getValue();

      if ( !outputParam.isOutputParameter() ) {
        continue;
      }

      // The output Action Parameter objects do not have values - they are just the definition
      // Pull the value from allParams
      IActionParameter inputParam = (IActionParameter) allParams.get( outputName );
      if ( inputParam == null ) {
        returnMap.put( outputParam.getName(), null );
      } else {
        for ( Iterator varIt = outputParam.getVariables().iterator(); varIt.hasNext(); ) {
          ActionParameterSource src = (ActionParameterSource) varIt.next();
          returnMap.put( outputParam.getName(), new ReturnParameter( src.getSourceName(), src.getValue(), inputParam
              .getValue() ) );
        }
      }
    }
    return ( returnMap );
View Full Code Here

TOP

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

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.