Examples of ValueMap


Examples of com.addthis.bundle.value.ValueMap

                    Bytes.writeLength(classID, out);
                }
                encodeValue(custom.asMap(), out, classIndex);
                break;
            case MAP:
                ValueMap map = val.asMap();
                out.write(TYPE.MAP.val);
                Bytes.writeLength(map.size(), out);
                for (ValueMapEntry e : map) {
                    encodeValue(ValueFactory.create(e.getKey()), out, classIndex);
                    encodeValue(e.getValue(), out, classIndex);
                }
                break;
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.document.utils.ValueMap

    public void howToPutItems() {
        Table table = dynamo.getTable(TABLE_NAME);
        Item item = new Item()
            .withPrimaryKey(HASH_KEY_NAME, "B_PutItemJsonTest", RANGE_KEY_NAME, 1)
            // Store document as a map
            .withMap("document", new ValueMap()
                .withString("last_name", "Bar")
                .withString("first_name", "Jeff")
                .withString("current_city", "Tokyo")
                .withMap("next_haircut",
                    new ValueMap()
                        .withInt("year", 2014)
                        .withInt("month", 10)
                        .withInt("day", 30))
                .withList("children", "SJB", "ASB", "CGB", "BGB", "GTB")
            );
        table.putItem(item);
        // Retrieve the entire document and the entire document only
        Item documentItem = table.getItem(new GetItemSpec()
            .withPrimaryKey(HASH_KEY_NAME, "B_PutItemJsonTest", RANGE_KEY_NAME, 1)
            .withAttributesToGet("document"));
        System.out.println(documentItem.get("document"));
        // Output: {last_name=Bar, children=[SJB, ASB, CGB, BGB, GTB], first_name=Jeff, current_city=Tokyo, next_haircut={month=10, year=2014, day=30}}
        // Retrieve part of a document. Perhaps I need the next_haircut and nothing else
        Item partialDocItem = table.getItem(new GetItemSpec()
            .withPrimaryKey(HASH_KEY_NAME, "B_PutItemJsonTest", RANGE_KEY_NAME, 1)
            .withProjectionExpression("document.next_haircut"))
            ;
        System.out.println(partialDocItem);
        // Output: { Item: {document={next_haircut={month=10, year=2014, day=30}}} }
        // I can update part of a document. Here's how I would change my current_city back to Seattle:
        table.updateItem(new UpdateItemSpec()
            .withPrimaryKey(HASH_KEY_NAME, "B_PutItemJsonTest", RANGE_KEY_NAME, 1)
            .withUpdateExpression("SET document.current_city = :city")
            .withValueMap(new ValueMap().withString(":city", "Seattle"))
        );
        // Retrieve the entire item
        Item itemUpdated = table.getItem(HASH_KEY_NAME, "B_PutItemJsonTest", RANGE_KEY_NAME, 1);
        System.out.println(itemUpdated);
        // Output: { Item: {document={last_name=Bar, children=[SJB, ASB, CGB, BGB, GTB], first_name=Jeff, current_city=Seattle, next_haircut={month=10, year=2014, day=30}}, myRangeKey=1, myHashKey=B_PutItemJsonTest} }
View Full Code Here

Examples of com.vaadin.client.ValueMap

                    "<em>Expand this node to show problems that may be dependent on this problem.</em>");
            errorDetails.add(l);
            JsArray<ValueMap> suberrors = valueMap
                    .getJSValueMapArray("subErrors");
            for (int i = 0; i < suberrors.length(); i++) {
                ValueMap value = suberrors.get(i);
                printLayoutError(ac, value, errorNode);
            }

        }
        root.add(errorNode);
View Full Code Here

Examples of com.vaadin.terminal.gwt.client.ValueMap

            }
        }

        // Set zoom levels visible
        if (uidl.hasAttribute("zoomLevels")) {
            ValueMap levelMap = uidl.getMapAttribute("zoomLevels");

            if (zoomBar != null) {
                for (Anchor lvl : zoomLevels.keySet()) {
                    zoomBar.remove(lvl);
                }
            }
            zoomLevels.clear();

            for (String caption : levelMap.getKeySet()) {
                Long time = Long.parseLong(levelMap.getString(caption));
                addZoomLevel(caption, time);
            }
        }

        // Set the chart mode
        if (uidl.hasAttribute("chartMode")) {
            initPlotMode = PlotMode.valueOf(uidl
                    .getStringAttribute("chartMode"));
            if (initStage1Done && initPlotMode != null) {
                display.setChartMode(initPlotMode, initDone);
            }
        }

        // Set the graph grid color
        if(uidl.hasAttribute("gridColor")) {
            String color = uidl.getStringAttribute("gridColor");
            if (color == null || color.equals("")) {
                initGridColor = null;
            } else {
                String[] rgba = color.split(";");
                initGridColor = "rgba(" + rgba[0] + "," + rgba[1] + ","
                + rgba[2] + "," + rgba[3] + ")";
            }

            if (initStage1Done) {
                display.setGridColor(initGridColor);
            }
        }

        // Initialization stage 1
        if(!initStage1Done){
            init();
            initStage1Done = true;

            // Initialization done
        } else if(!initDone){
            initDone = true;

            if (initStartDate != null && initEndDate != null) {

                // Request given init date
                display.setRange(initStartDate, initEndDate, true, true, false);
                browser.setRange(initStartDate, initEndDate);
            } else {
                // Request the default range
                display.setRange(getStartDate(), getEndDate(), true, true, false);
                browser.setRange(getStartDate(), getEndDate());
            }

            fireDateRangeChangedEvent();
        }

        // Data received
        if (uidl.hasAttribute("data")) {
            ValueMap map = uidl.getMapAttribute("data");
            ValueMap changedDensitiesMap = uidl.getMapAttribute("cdensities");

            List<Long> removableRequests = new LinkedList<Long>();

            //Check waiting data list
            for (Long req : waitingForData.keySet()) {
                for (String req2 : map.getKeySet()) {
                    if (req2.equals(req.toString())) {
                        VDataListener comp = waitingForData.get(req);

                        // Get the values.
                        List<String> values = new ArrayList<String>();
                        String valuesString = map.getString(req2);
                        if (valuesString != null && !valuesString.equals("")) {
                            for (String val : map.getString(req2).split(";")) {
                                values.add(val);
                            }
                        }

                        List<Float> fvalues = new ArrayList<Float>();
                        List<Date> dvalues = new ArrayList<Date>();
                        Integer density = densityMap.get(req);

                        if (changedDensitiesMap != null) {
                            /*
                             * Note: This might throw an exception when using
                             * hosted mode for an unknown reason. If that
                             * happens then continue to use the last known
                             * density which will work as expected.
                             */
                            try {
                                Integer newDensity = changedDensitiesMap
                                .getInt(req2);
                                if (newDensity != null) {
                                    density = newDensity;
                                }
                            } catch (Exception e) {
View Full Code Here

Examples of org.apache.myfaces.trinidad.bean.util.ValueMap

    FacesBean newBean = createFacesBean(rendererType);;

    if (oldBean != null)
      newBean.addAll(oldBean);

    _attributes = new ValueMap(newBean);

    _facesBean = newBean;

    // determine whether it is ok to store the attributes locally.  We cache the result since
    // this can be a little involved
View Full Code Here

Examples of org.apache.sling.api.resource.ValueMap

    public void testSimpleProperties() throws IOException {
        Resource resource1 = this.resourceResolver.getResource(getTestRootResource().getPath() + "/node1");
        assertNotNull(resource1);
        assertEquals("node1", resource1.getName());

        ValueMap props = ResourceUtil.getValueMap(resource1);
        assertEquals(STRING_VALUE, props.get("stringProp", String.class));
        assertArrayEquals(STRING_ARRAY_VALUE, props.get("stringArrayProp", String[].class));
        assertEquals((Integer) INTEGER_VALUE, props.get("integerProp", Integer.class));
        assertEquals(DOUBLE_VALUE, props.get("doubleProp", Double.class), 0.0001);
        assertEquals(BOOLEAN_VALUE, props.get("booleanProp", Boolean.class));
    }
View Full Code Here

Examples of org.apache.sling.api.resource.ValueMap

    }

    @Test
    public void testDateProperty() throws IOException {
        Resource resource1 = this.resourceResolver.getResource(getTestRootResource().getPath() + "/node1");
        ValueMap props = ResourceUtil.getValueMap(resource1);
        // TODO: enable this test when JCR resource implementation supports
        // writing Date objects (SLING-3846)
        if (getResourceResolverType() != ResourceResolverType.JCR_MOCK
                && getResourceResolverType() != ResourceResolverType.JCR_JACKRABBIT) {
            assertEquals(DATE_VALUE, props.get("dateProp", Date.class));
        }
    }
View Full Code Here

Examples of org.apache.sling.api.resource.ValueMap

    }

    @Test
    public void testDatePropertyToCalendar() throws IOException {
        Resource resource1 = this.resourceResolver.getResource(getTestRootResource().getPath() + "/node1");
        ValueMap props = ResourceUtil.getValueMap(resource1);
        // TODO: enable this test when JCR resource implementation supports
        // writing Date objects (SLING-3846)
        if (getResourceResolverType() != ResourceResolverType.JCR_MOCK
                && getResourceResolverType() != ResourceResolverType.JCR_JACKRABBIT) {
            Calendar calendarValue = props.get("dateProp", Calendar.class);
            assertNotNull(calendarValue);
            assertEquals(DATE_VALUE, calendarValue.getTime());
        }
    }
View Full Code Here

Examples of org.apache.sling.api.resource.ValueMap

    }

    @Test
    public void testCalendarProperty() throws IOException {
        Resource resource1 = this.resourceResolver.getResource(getTestRootResource().getPath() + "/node1");
        ValueMap props = ResourceUtil.getValueMap(resource1);
        assertEquals(CALENDAR_VALUE.getTime(), props.get("calendarProp", Calendar.class).getTime());
    }
View Full Code Here

Examples of org.apache.sling.api.resource.ValueMap

    }

    @Test
    public void testCalendarPropertyToDate() throws IOException {
        Resource resource1 = this.resourceResolver.getResource(getTestRootResource().getPath() + "/node1");
        ValueMap props = ResourceUtil.getValueMap(resource1);
        Date dateValue = props.get("calendarProp", Date.class);
        assertNotNull(dateValue);
        assertEquals(CALENDAR_VALUE.getTime(), dateValue);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.