Package com.cumulocity.me.lang

Examples of com.cumulocity.me.lang.List


    private String findQueryURI(List uriTemplates, Set parameters) {
        Iterator i = uriTemplates.iterator();
        while (i.hasNext()) {
            String uri = (String) i.next();
            List queryParams = getQueryParams(uri);

            List queryDelta = findDelta(parameters, queryParams);
            List paramDelta = findDelta(queryParams, parameters);

            // if no extra parameters found then both are matching
            if (queryDelta.isEmpty() && paramDelta.isEmpty()) {
                return uri;
            }

            // if more parameters then definitely not matching
            if (!paramDelta.isEmpty()) {
                continue;
            }

            // if query has more parameters and the delta is optional we can use this uri.
            if (queryDelta.size() == getOptionalCount(queryDelta)) {
View Full Code Here


        }
        return uri;
    }

    private List findDelta(Collection in, Collection from) {
        List delta = new ArrayList();
        Iterator fromIterator = from.iterator();
        while (fromIterator.hasNext()) {
            String p = (String) fromIterator.next();
            boolean found = false;
           
            Iterator inIterator = in.iterator();
            while (!found && inIterator.hasNext()) {
                found = p.equals((String) inIterator.next());
            }
           
            if (!found) {
                delta.add(p);
            }
        }
        return delta;
    }
View Full Code Here

    }

    private List getQueryParams(String queryUri) {
        String tUri = queryUri.substring(queryUri.indexOf('?') + 1);
        String[] uriParams = StringUtils.split(tUri, "&");
        List queryParams = new ArrayList();
        for (int i = 0; i < uriParams.length; i++) {
            String up = uriParams[i];
            String[] params = StringUtils.split(up, "=");
            queryParams.add(params[0]);
        }
        return queryParams;
    }
View Full Code Here

    public void setAlarmsForSourceAndStatusAndTime(String alarmsForSourceAndStatusAndTime) {
        this.alarmsForSourceAndStatusAndTime = alarmsForSourceAndStatusAndTime;
    }

    public List getURITemplates() {
        List uriTemplates = new ArrayList();
        uriTemplates.add(getAlarmsForSource());
        uriTemplates.add(getAlarmsForSourceAndStatus());
        uriTemplates.add(getAlarmsForSourceAndStatusAndTime());
        uriTemplates.add(getAlarmsForSourceAndTime());
        uriTemplates.add(getAlarmsForStatus());
        uriTemplates.add(getAlarmsForStatusAndTime());
        uriTemplates.add(getAlarmsForTime());
        return uriTemplates;
    }
View Full Code Here

        this.eventsForSourceAndDateAndFragmentTypeAndType = eventsForSourceAndDateAndFragmentTypeAndType;
    }

//    @JSONProperty(ignore = true)
    public List getURITemplates() {
        List uriTemplates = new ArrayList();
        uriTemplates.add(this.getEventsForDateAndFragmentType());
        uriTemplates.add(this.getEventsForDateAndFragmentTypeAndType());
        uriTemplates.add(this.getEventsForFragmentType());
        uriTemplates.add(this.getEventsForFragmentTypeAndType());
        uriTemplates.add(this.getEventsForSource());
        uriTemplates.add(this.getEventsForSourceAndDateAndFragmentType());
        uriTemplates.add(this.getEventsForSourceAndDateAndFragmentTypeAndType());
        uriTemplates.add(this.getEventsForSourceAndFragmentType());
        uriTemplates.add(this.getEventsForSourceAndFragmentTypeAndType());
        uriTemplates.add(this.getEventsForSourceAndTime());
        uriTemplates.add(this.getEventsForSourceAndTimeAndType());
        uriTemplates.add(this.getEventsForSourceAndType());
        uriTemplates.add(this.getEventsForTime());
        uriTemplates.add(this.getEventsForTimeAndType());
        uriTemplates.add(this.getEventsForType());
        return uriTemplates;
    }
View Full Code Here

    public BaseRepresentationConverter getManagedObjectConverter() {
        return converter;
    }
   
    private List getListOfReferences() {
        List list = new ArrayList();
        list.add(getMinimalManagedObjectReferenceRepresentation());
        list.add(getMinimalManagedObjectReferenceRepresentation());
        return list;
    }
View Full Code Here

    public void shouldBuildUrlForOneParameter() throws Exception {
        // given
        Map filters = new HashMap();
        filters.put("a", "b");

        List uriTemplates = new ArrayList();
        uriTemplates.add("http://something?a={a}");

        String[] optionalParameters = new String[] {};

        QueryURLBuilder urlBuilder = new QueryURLBuilder(new TemplateUrlParser(), filters, uriTemplates, optionalParameters);
View Full Code Here

        // given
        Map filters = new HashMap();
        filters.put("a", "b");
        filters.put("c", "d");

        List uriTemplates = new ArrayList();
        uriTemplates.add("http://something?a={a}&c={c}");

        String[] optionalParameters = new String[] {};

        QueryURLBuilder urlBuilder = new QueryURLBuilder(new TemplateUrlParser(), filters, uriTemplates, optionalParameters);
View Full Code Here

                .withPropertyBuilder(getSampleJsonManagedObjectRepresentation()).build();
        return jsonArray;
    }

    private List getListOfManagedObjects() {
        List list = new ArrayList();
        list.add(getSampleManagedObjectRepresentation());
        list.add(getSampleManagedObjectRepresentation());
        return list;
    }
View Full Code Here

        // given
        Map filters = new HashMap();
        filters.put("s", "b");
        filters.put("f", "d");

        List uriTemplates = new ArrayList();
        uriTemplates.add("http://something?a={a}&c={c}");

        String[] optionalParameters = new String[] {};

        QueryURLBuilder urlBuilder = new QueryURLBuilder(new TemplateUrlParser(), filters, uriTemplates, optionalParameters);
View Full Code Here

TOP

Related Classes of com.cumulocity.me.lang.List

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.