Package epcglobal.epcis_query.xsd._1

Examples of epcglobal.epcis_query.xsd._1.QueryResults


  }

  @Override
  public String getName() {
    String result = null;
    MetadataType md = gpx.getMetadata();
    if( null != md ) {
      result = md.getName();
    }
    return result;
  }
View Full Code Here


  }

  @Override
  public String getDescription() {
    String result = null;
    MetadataType md = gpx.getMetadata();
    if( null != md ) {
      result = md.getDesc();
    }
    return result;
  }
View Full Code Here

  /**
   * the servcie.
   */
  public void testEPCISService() throws Exception {
    EPCISServicePortTypeImpl service = new EPCISServicePortTypeImpl();
    ArrayOfString queryNames = service.getQueryNames(new EmptyParms());
    TreeSet<String> names = new TreeSet<String>();
    assertNotNull(queryNames.getString());
    names.addAll(queryNames.getString());
    assertTrue(names.remove("hello"));
    assertTrue(names.remove("how"));
View Full Code Here

  /**
   * the servcie.
   */
  public void testEPCISService() throws Exception {
    EPCISServicePortTypeImpl service = new EPCISServicePortTypeImpl();
    ArrayOfString queryNames = service.getQueryNames(new EmptyParms());
    TreeSet<String> names = new TreeSet<String>();
    assertNotNull(queryNames.getString());
    names.addAll(queryNames.getString());
    assertTrue(names.remove("hello"));
    assertTrue(names.remove("how"));
    assertTrue(names.remove("are"));
    assertTrue(names.remove("you?"));
    assertTrue(names.isEmpty());
View Full Code Here

  /**
   * the servcie.
   */
  public void testEPCISService() throws Exception {
    EPCISServicePortTypeImpl service = new EPCISServicePortTypeImpl();
    ArrayOfString queryNames = service.getQueryNames(new EmptyParms());
    TreeSet<String> names = new TreeSet<String>();
    assertNotNull(queryNames.getString());
    names.addAll(queryNames.getString());
    assertTrue(names.remove("hello"));
    assertTrue(names.remove("how"));
View Full Code Here

  /**
   * tests serializing query results as json
   */
  public void testQueryResultsAsJson() throws Exception {
    QueryResults results = new QueryResults();
    QueryResultsBody body = new QueryResultsBody();
    VocabularyListType vl = new VocabularyListType();
    VocabularyType vt = new VocabularyType();
    VocabularyElementListType elementListType = new VocabularyElementListType();

    VocabularyElementType elementType = new VocabularyElementType();
    AttributeType at = new AttributeType();
    at.setId("someid");
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document document = builder.parse(new ByteArrayInputStream("<mynode>value</mynode>".getBytes("utf-8")));
    document.normalizeDocument();
    at.getAny().add(document.getDocumentElement());

    document = builder.newDocument();
    Element el = document.createElement("myelement");
    el.setTextContent("howdy");
    document.appendChild(el);
    elementType.getAttribute().add(at);
    elementListType.getVocabularyElement().add(document.getDocumentElement());
    vt.setVocabularyElementList(elementListType);
    vl.getVocabulary().add(vt);
    body.setVocabularyList(vl);
    results.setResultsBody(body);

    ObjectMapper resultsMapper = new DomElementJacksonObjectMapperResolver().getContext(null);

    StringWriter out = new StringWriter();
    resultsMapper.writeValue(out, results);
View Full Code Here

  /**
   * tests serialization of attributetype...
   */
  public void testSerializationOfAttributeType() throws Exception {
    QueryResults results = new QueryResults();
    QueryResultsBody body = new QueryResultsBody();
    VocabularyListType vl = new VocabularyListType();
    VocabularyType vt = new VocabularyType();
    VocabularyElementListType elementListType = new VocabularyElementListType();

    VocabularyElementType elementType = new VocabularyElementType();
    AttributeType at = new AttributeType();
    at.setId("someid");
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document document = builder.parse(new ByteArrayInputStream("<mynode>value</mynode>".getBytes("utf-8")));
    document.normalizeDocument();
    at.getAny().add(document.getDocumentElement());

    document = builder.newDocument();
    Element el = document.createElement("myelement");
    el.setTextContent("howdy");
    document.appendChild(el);
    elementType.getAttribute().add(at);
    elementListType.getVocabularyElement().add(document.getDocumentElement());
    vt.setVocabularyElementList(elementListType);
    vl.getVocabulary().add(vt);
    body.setVocabularyList(vl);
    results.setResultsBody(body);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    JAXBContext.newInstance(QueryResults.class).createMarshaller().marshal(new JAXBElement(new QName("urn:hi", "hi"), QueryResults.class, results), out);
//    System.out.println(new String(out.toByteArray()));
  }
View Full Code Here

@Path ("/qr")
public class QueryResultsEndpoint {

  @GET
  public QueryResultsWrapper getQueryResults() {
    QueryResults results = new QueryResults();
    QueryResultsBody body = new QueryResultsBody();
    VocabularyListType vl = new VocabularyListType();
    VocabularyType vt = new VocabularyType();
    VocabularyElementListType elementListType = new VocabularyElementListType();

    VocabularyElementType elementType = new VocabularyElementType();
    AttributeType at = new AttributeType();
    at.setId("someid");
    DocumentBuilder builder;
    Document document;
    try {
      builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      document = builder.parse(new ByteArrayInputStream("<mynode>value</mynode>".getBytes("utf-8")));
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }

    document.normalizeDocument();
    at.getAny().add(document.getDocumentElement());

    document = builder.newDocument();
    Element el = document.createElement("myelement");
    el.setTextContent("howdy");
    document.appendChild(el);
    elementType.getAttribute().add(at);
    elementListType.getVocabularyElement().add(document.getDocumentElement());
    vt.setVocabularyElementList(elementListType);
    vl.getVocabulary().add(vt);
    body.setVocabularyList(vl);
    results.setResultsBody(body);

    QueryResultsWrapper wrapper = new QueryResultsWrapper();
    wrapper.setResults(results);
    return wrapper;
  }
View Full Code Here

  /**
   * tests serializing query results as json
   */
  public void testQueryResultsAsJson() throws Exception {
    QueryResults results = new QueryResults();
    QueryResultsBody body = new QueryResultsBody();
    VocabularyListType vl = new VocabularyListType();
    VocabularyType vt = new VocabularyType();
    VocabularyElementListType elementListType = new VocabularyElementListType();

    VocabularyElementType elementType = new VocabularyElementType();
    AttributeType at = new AttributeType();
    at.setId("someid");
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document document = builder.parse(new ByteArrayInputStream("<mynode>value</mynode>".getBytes("utf-8")));
    document.normalizeDocument();
    at.getAny().add(document.getDocumentElement());

    document = builder.newDocument();
    Element el = document.createElement("myelement");
    el.setTextContent("howdy");
    document.appendChild(el);
    elementType.getAttribute().add(at);
    elementListType.getVocabularyElement().add(document.getDocumentElement());
    vt.setVocabularyElementList(elementListType);
    vl.getVocabulary().add(vt);
    body.setVocabularyList(vl);
    results.setResultsBody(body);

    ObjectMapper resultsMapper = new DomElementJacksonObjectMapperResolver().getContext(null);

    StringWriter out = new StringWriter();
View Full Code Here

  /**
   * tests serialization of attributetype...
   */
  public void testSerializationOfAttributeType() throws Exception {
    QueryResults results = new QueryResults();
    QueryResultsBody body = new QueryResultsBody();
    VocabularyListType vl = new VocabularyListType();
    VocabularyType vt = new VocabularyType();
    VocabularyElementListType elementListType = new VocabularyElementListType();

    VocabularyElementType elementType = new VocabularyElementType();
    AttributeType at = new AttributeType();
    at.setId("someid");
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document document = builder.parse(new ByteArrayInputStream("<mynode>value</mynode>".getBytes("utf-8")));
    document.normalizeDocument();
    at.getAny().add(document.getDocumentElement());

    document = builder.newDocument();
    Element el = document.createElement("myelement");
    el.setTextContent("howdy");
    document.appendChild(el);
    elementType.getAttribute().add(at);
    elementListType.getVocabularyElement().add(document.getDocumentElement());
    vt.setVocabularyElementList(elementListType);
    vl.getVocabulary().add(vt);
    body.setVocabularyList(vl);
    results.setResultsBody(body);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    JAXBContext.newInstance(QueryResults.class).createMarshaller().marshal(new JAXBElement(new QName("urn:hi", "hi"), QueryResults.class, results), out);
//    System.out.println(new String(out.toByteArray()));
View Full Code Here

TOP

Related Classes of epcglobal.epcis_query.xsd._1.QueryResults

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.