Package org.apache.commons.collections.map

Examples of org.apache.commons.collections.map.LinkedMap$LinkedMapList


         * Add the given instance to the dirty cache.
         */
        public void addDirty(StateManagerImpl sm) {
            if (_dirty == null) {
                if (_orderDirty)
                    _dirty = MapBackedSet.decorate(new LinkedMap());
                else
                    _dirty = new HashSet<StateManagerImpl>();
            }
            if (_dirty.add(sm))
                removeCleanInternal(sm);
View Full Code Here


                    ("savepoint-flush-not-supported"));

            OpenJPASavepoint save = _spm.newSavepoint(name, this);
            if (_savepoints == null || _savepoints.isEmpty()) {
                save.save(getTransactionalStates());
                _savepoints = new LinkedMap();
            } else {
                if (_savepointCache == null)
                    save.save(Collections.EMPTY_SET);
                else {
                    save.save(_savepointCache);
View Full Code Here

                logEntriesQ.setTimestamp("cutoff", new java.sql.Timestamp(cutoff.getTime()));
                logEntries = logEntriesQ.iterate();
            }
           
            List wgLogs = new ArrayList();
            LinkedMap wgLogsByTarget = new LinkedMap();
            Map conflictTargets = new HashMap();

            LogEntry entry;
           
            // First pass: Create update logs
            while (logEntries.hasNext()) {
                entry = (LogEntry) logEntries.next();
                WGUpdateLog newLog = null;
                WGUpdateLog oldLog = null;
                Date currentTime = null;
                if (entry.getTarget() != null && !entry.getTarget().equals("#UNKNOWN#")) {
                    newLog = new WGUpdateLog(entry.getType(), entry.getLogtime(), entry.getLoguser(), entry.getTarget());
                    wgLogs.add(newLog);
                   
                    List logsList = (List) wgLogsByTarget.get(entry.getTarget());
                    if (logsList == null) {
                        logsList = new ArrayList();
                        wgLogsByTarget.put(entry.getTarget(), logsList);
                    }
                    logsList.add(newLog);
                }
            }
           
            // Second pass for CS version < 5 to workaround some weaknesses of the CS3/4 history log
            if (_ddlVersion < WGDatabase.CSVERSION_WGA5) {
               
                // Determine conflicting log entries, where update and delete is done on the same time and the same document
                Iterator wgLogsByTargetIt = wgLogsByTarget.values().iterator();
                while (wgLogsByTargetIt.hasNext()) {
                    List logs = (List) wgLogsByTargetIt.next();
                    WGUtils.sortByProperty(logs, "date");
                    Iterator logsIt = logs.iterator();
                    Date lastTime = null;
View Full Code Here

     */
    private List findEventsOfName(String name, Long index) throws WGAPIException {

        List foundEvents = new ArrayList();
        HttpSession session = getPageContext().getSession();
        LinkedMap events = TMLPortlet.getFiredEventsQueue(session);
       
        if (events.size() == 0) {
            return foundEvents;
        }
       
        // Find the start index. This is either the index after the last processed index, or - if the last processed
        // index is not available in the queue - the first index in the queue.
        if (events.containsKey(index)) {
            index = (Long) events.nextKey(index);
        }
        else {
            index = (Long) events.firstKey();
        }
       
       
        synchronized (events) {
            PortletEvent event;
            while (index != null) {
                event = (PortletEvent) events.get(index);
                String targetPortletKey = event.getTargetPortletKey();
                if (targetPortletKey == null || targetPortletKey.equals(getTMLContext().getportlet().getportletkey())) {
                    if (event.getName().equalsIgnoreCase(name)) {
                        foundEvents.add(event);
                    }
                }
                index = (Long) events.nextKey(index);
               
            }
        }
       
        return foundEvents;
View Full Code Here

   * @see java.util.List#subList(int, int)
   */
  public List subList(int arg0, int arg1) {
   
    Iterator keys = _keys.subList(arg0, arg1).iterator();
    Map subMap = new LinkedMap();
    Object key;
    while (keys.hasNext()) {
      key = keys.next();
      subMap.put(key, _contents.get(key));
    }
   
    return new LazyBeanList(_db, _folder, subMap);
  }
View Full Code Here

  public Map find(String type, String query, Map parameters) throws WGAPIException {
    List results = find(query);
    if (results == null) {
      return null;
    }
    LinkedMap resultMap = new LinkedMap();
    int keyNr = 0;
    Iterator resultsIt = results.iterator();
    Object result;
    while (resultsIt.hasNext()) {
      result = resultsIt.next();
      resultMap.put(new QueryableSourceKey(++keyNr), result);
    }
    return resultMap;
   
  }
View Full Code Here

    }
   
    return stmt;
  }
  private Map extractRowResults(ResultSet resultSet, String tableHint) throws SQLException {
    Map results = new LinkedMap();
   
    startResultSet(resultSet);
   
    while (resultSet.next()) {
      Map row = extractRowData(resultSet);
      Map key = null;
      if (tableHint != null) {
        key = extractRowKey(resultSet, tableHint);
      }
      else {
        key =  new TemporaryKeyMap(resultSet);
      }
      results.put(key, row);
    }
    return results;
  }
View Full Code Here

        SessionContext context = (SessionContext) contexts.get( completeKey );
            if (context == null) {
                context = new SessionContext();
               
                // Set event index to current last index, so events fired before creation of this context are not executed for it
                LinkedMap list = TMLPortlet.getFiredEventsQueue(session);
                if (!list.isEmpty()) {
                    PortletEvent event = (PortletEvent) list.get(list.lastKey());
                    context.setLastProcessedEventIndex(event.getIndex());
                }
                               
                contexts.put(completeKey, context);
            }
View Full Code Here

       
        synchronized (session) {
            TransientObjectWrapper<LinkedMap> eventWrapper = (TransientObjectWrapper<LinkedMap>) session.getAttribute(WGACore.SESSION_FIREDPORTLETEVENTS);
            if (eventWrapper == null || eventWrapper.get() == null) {
                eventWrapper = new TransientObjectWrapper<LinkedMap>();
                eventWrapper.set(new LinkedMap());
                session.setAttribute(WGACore.SESSION_FIREDPORTLETEVENTS, eventWrapper);
            }
            return eventWrapper.get();
        }
       
View Full Code Here

       
    }
   
    protected static void addEventToQueue(PortletEvent event, HttpSession session) {
       
        LinkedMap events = getFiredEventsQueue(session);
       
        synchronized (events) {
            event.retrieveIndex();
            events.put(new Long(event.getIndex()), event);
            while (events.size() > EVENTQUEUE_MAX_SIZE) {
                events.remove(events.firstKey());
            }
        }
       
       
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.map.LinkedMap$LinkedMapList

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.