Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.IMHandle


    public IMHandle decode(JsonReader reader, IMHandle defaultValue) {
        String address = reader.readProperty("address");
        String protocol = reader.readProperty("protocol");
        if(address != null && protocol != null){
            try{
                return new IMHandle(
                    Scheme.valueOf(protocol)
                    , address);
            } catch(IllegalArgumentException e){
            }
            try{
                return new IMHandle(
                    new URL(protocol)
                    , address);
            } catch(MalformedURLException e){
            }
        }
View Full Code Here


            new Category("partOfSpeech"),
            new Category("kind")));
        m.setGeoPtListAttr(Arrays.asList(new GeoPt(1.0f, 2.0f), new GeoPt(
            3.0f,
            4.0f)));
        m.setImHandleListAttr(Arrays.asList(new IMHandle(
            IMHandle.Scheme.xmpp,
            "address"), new IMHandle(new URL("http://test"), "address")));
        m.setKeyListAttr(Arrays.asList(
            KeyFactory.createKey("kind", "name"),
            KeyFactory.createKey("kind", 1)));
        m
            .setLinkListAttr(Arrays.asList(new Link("link"), new Link(
View Full Code Here

                .asList(new GeoPt(1.0f, 2.0f), new GeoPt(3.0f, 4.0f))
                .toArray(),
            m.getGeoPtListAttr().toArray());
        Assert.assertArrayEquals(
            Arrays.asList(
                new IMHandle(IMHandle.Scheme.xmpp, "address"),
                new IMHandle(new URL("http://test"), "address")).toArray(),
            m.getImHandleListAttr().toArray());
        Assert.assertArrayEquals(
            Arrays.asList(
                KeyFactory.createKey("kind", "name"),
                KeyFactory.createKey("kind", 1)).toArray(),
View Full Code Here

        m.setBlobKeyAttr(new BlobKey("Q3PqkweYlb4iWpp0BVw"));
        m.setCategoryAttr(new Category("partOfSpeech"));
        m.setEmailAttr(new Email("takawitter@test.com"));
        m.setBlobAttr(new Blob("hello".getBytes()));
        m.setGeoPtAttr(new GeoPt(10, 10));
        m.setImHandleAttr1(new IMHandle(IMHandle.Scheme.xmpp, "handle"));
        m.setImHandleAttr2(new IMHandle(new URL("http://aim.com"), "network"));
        m.setLinkAttr(new Link("link"));
        m.setPhoneNumberAttr(new PhoneNumber("000-0000-0000"));
        m.setPostalAddressAttr(new PostalAddress("address"));
        m.setRatingAttr(new Rating(70));
        m.setShortBlobAttr(new ShortBlob("hello".getBytes()));
View Full Code Here

            fail();
        } catch (NullPointerException e) {
        }
        // GeoPt
        try {
            new IMHandle((URL) null, null);
            fail();
        } catch (NullPointerException e) {
        }
        try {
            new IMHandle((IMHandle.Scheme) null, null);
            fail();
        } catch (NullPointerException e) {
        }
        try {
            new PhoneNumber(null);
View Full Code Here

        }
    }

    @Test
    public void imHandle() throws Exception {
        IMHandle h1 = new IMHandle(IMHandle.Scheme.xmpp, "handle");
        IMHandle h2 = new IMHandle(new URL("http://aim.com"), "network");
        IMHandle[] hs = { h1, h2 };
        for (IMHandle h : hs) {
            Assert.assertNotNull(h.getProtocol());
            Assert.assertNotNull(h.getAddress());
            System.out.println("{\"protocol\":\""
View Full Code Here

                "{"
                    + "\"imHandleAttr1\":{\"address\":\"handle\",\"protocol\":\"xmpp\"}"
                    + ",\"imHandleAttr2\":{\"address\":\"network\",\"protocol\":\"http://aim.com\"}"
                    + "}");
        JSONObject h = j.getJSONObject("imHandleAttr1");
        IMHandle i = null;
        IMHandle.Scheme s = null;
        URL u = null;
        try {
            s = IMHandle.Scheme.valueOf(h.getString("protocol"));
        } catch (IllegalArgumentException e) {
            try {
                u = new URL(h.getString("protocol"));
            } catch (MalformedURLException ex) {
            }
        }
        if (s != null) {
            i = new IMHandle(s, h.getString("address"));
        } else if (u != null) {
            i = new IMHandle(u, h.getString("address"));
        }
        Assert.assertEquals("handle", i.getAddress());
        Assert.assertEquals(IMHandle.Scheme.xmpp.name(), i.getProtocol());
    }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testIMHandle() throws Exception {
    IMHandle expected = new IMHandle(Scheme.sip, "address1");
    assertEquals(expected, parser("imhandle('sip', 'address1')").bool_exp().e.evaluate(null).getPayload());
  }
View Full Code Here

      val = new PostalAddress((String) value);
    } else if (valueType.equals(EMAIL)) {
      val = new Email((String) value);
    } else if (valueType.equals(IMHANDLE)) {
      String[] split = ((String) value).split(" ");
      val = new IMHandle(Scheme.valueOf(split[0]), split[1]);
    } else if (valueType.equals(BLOB_KEY)) {
      val = new BlobKey((String) value);
    } else {
      val = value;
    }
View Full Code Here

        testInequalityQueries(new Category("aaa"), new Category("bbb"), new Category("ccc"));
    }

    @Test
    public void testIMHandleProperty() {
        testEqualityQueries(new IMHandle(IMHandle.Scheme.xmpp, "foo@foo.com"), new IMHandle(IMHandle.Scheme.xmpp, "bar@bar.com"));
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.IMHandle

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.