Package org.apache.commons.collections.map

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


    /**
     * Validate that the types of the parameters are correct.
     */
    private void validateParameters() {
        if (_positional != null) {
            LinkedMap types = _query.getParameterTypes();
            for (int i = 0,
                size = Math.min(_positional.size(), types.size());
                i < size; i++)
                validateParameter(String.valueOf(i),
                    (Class) types.getValue(i), _positional.get(i));
        } else if (_named != null) {
            Map types = _query.getParameterTypes();
            for (Iterator i = _named.entrySet().iterator(); i.hasNext();) {
                Map.Entry entry = (Map.Entry) i.next();
                String name = (String) entry.getKey();
                validateParameter(name, (Class) types.get(name),
                    entry.getValue());
            }
        }
    }
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

         * 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

     * Consolidate an event iterator obtained from observation, merging
     * add and remove operations on nodes with the same UUID into a move
     * operation.
     */
    private Iterator consolidateEvents(EventIterator events) {
        LinkedMap eventMap = new LinkedMap();

        while (events.hasNext()) {
            EventImpl event = (EventImpl) events.nextEvent();
            HierarchyEvent he;

            try {
                he = new HierarchyEvent(event.getChildId(),
                        session.getQPath(event.getPath()).getNormalizedPath(),
                        event.getType());
            } catch (MalformedPathException e) {
                log.info("Unable to get event's path: " + e.getMessage());
                continue;
            } catch (RepositoryException e) {
                log.info("Unable to get event's path: " + e.getMessage());
                continue;
            }

            HierarchyEvent heExisting = (HierarchyEvent) eventMap.get(he.id);
            if (heExisting != null) {
                heExisting.merge(he);
            } else {
                eventMap.put(he.id, he);
            }
        }
        return eventMap.values().iterator();
    }
View Full Code Here

    }
   
    public LinkedMap getParameterTypes() {
        lock();
        try {
            LinkedMap wrap = new LinkedMap();
            wrap.putAll(compileForExecutor().getOrderedParameterTypes(_storeQuery));
            return wrap;
        } finally {
            unlock();
        }
    }
View Full Code Here

     * Consolidate an event iterator obtained from observation, merging
     * add and remove operations on nodes with the same UUID into a move
     * operation.
     */
    private Iterator<HierarchyEvent> consolidateEvents(EventIterator events) {
        LinkedMap eventMap = new LinkedMap();

        while (events.hasNext()) {
            EventImpl event = (EventImpl) events.nextEvent();
            HierarchyEvent he;

            try {
                he = new HierarchyEvent(event.getChildId(),
                        sysSession.getQPath(event.getPath()).getNormalizedPath(),
                        event.getType());
            } catch (MalformedPathException e) {
                log.info("Unable to get event's path: " + e.getMessage());
                continue;
            } catch (RepositoryException e) {
                log.info("Unable to get event's path: " + e.getMessage());
                continue;
            }

            HierarchyEvent heExisting = (HierarchyEvent) eventMap.get(he.id);
            if (heExisting != null) {
                heExisting.merge(he);
            } else {
                eventMap.put(he.id, he);
            }
        }
        return eventMap.values().iterator();
    }
View Full Code Here

  public String queryList(QueryParam queryParam) {

    List<T> listTotal = baseDao.getMongoTemplate().findAll(getBeanClass());
    int page = queryParam.getPageNumber();
    int total = listTotal.size();
    Map map = new LinkedMap(3);
    map.put("page", page);
    map.put("total", total);

    Query query = new Query();
    if (!StringUtils.isEmpty(queryParam.getQuery())) {
      query.addCriteria(Criteria.where(queryParam.getQtype()).is(
          queryParam.getQuery()));
    }
    query.skip(queryParam.getSkip()).limit(queryParam.getLimit()).sort()
        .on(queryParam.getSortname(), queryParam.getSortorder());

    List<T> list = baseDao.getMongoTemplate().find(query, getBeanClass());
    List<Map<String, Object>> mapList = new LinkedList<Map<String, Object>>();
    for (T bean : list) {
      mapList.add(bean.toMap());
    }
    map.put("rows", mapList);

    String json = JackJson.fromObjectToJson(map);

    return json;
  }
View Full Code Here

        String[] testCaseName = { TestMapBackedSet2.class.getName()};
        junit.textui.TestRunner.main(testCaseName);
    }

    public Set makeEmptySet() {
        return MapBackedSet.decorate(new LinkedMap());
    }
View Full Code Here

     * Consolidate an event iterator obtained from observation, merging
     * add and remove operations on nodes with the same UUID into a move
     * operation.
     */
    private Iterator consolidateEvents(EventIterator events) {
        LinkedMap eventMap = new LinkedMap();

        while (events.hasNext()) {
            EventImpl event = (EventImpl) events.nextEvent();
            HierarchyEvent he;

            try {
                he = new HierarchyEvent(event.getChildId(),
                        sysSession.getQPath(event.getPath()).getNormalizedPath(),
                        event.getType());
            } catch (MalformedPathException e) {
                log.info("Unable to get event's path: " + e.getMessage());
                continue;
            } catch (RepositoryException e) {
                log.info("Unable to get event's path: " + e.getMessage());
                continue;
            }

            HierarchyEvent heExisting = (HierarchyEvent) eventMap.get(he.id);
            if (heExisting != null) {
                heExisting.merge(he);
            } else {
                eventMap.put(he.id, he);
            }
        }
        return eventMap.values().iterator();
    }
View Full Code Here

        }
        return gwtInfos;
    }

    private OrderedMap convert(PublicationInfo pubInfo, PublicationInfoNode root, List<String> mainPaths, JCRSessionWrapper currentUserSession, String language) {
        OrderedMap gwtInfos = new LinkedMap();
        return convert(pubInfo, root, mainPaths, currentUserSession, language, gwtInfos);
    }
View Full Code Here

TOP

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

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.