Package org.apache.olingo.odata2.api.edm.provider

Examples of org.apache.olingo.odata2.api.edm.provider.AnnotationElement


        "http://www.w3.org/2005/Atom"));
    attributesElement1.add(new AnnotationAttribute().setName("href").setText("link").setPrefix("atom").setNamespace(
        "http://www.w3.org/2005/Atom"));

    List<AnnotationElement> schemaElements = new ArrayList<AnnotationElement>();
    schemaElements.add(new AnnotationElement().setName("schemaElementTest1").setPrefix("atom").setNamespace(
        "http://www.w3.org/2005/Atom").setAttributes(attributesElement1));
    schemaElements.add(new AnnotationElement().setName("schemaElementTest2").setPrefix("atom").setNamespace(
        "http://www.w3.org/2005/Atom").setAttributes(attributesElement1));

    Schema schema = new Schema().setAnnotationElements(schemaElements);
    schema.setNamespace("http://namespace.com");
    schemas.add(schema);
View Full Code Here


        "http://www.w3.org/2005/Atom"));
    attributesElement1.add(new AnnotationAttribute().setName("href").setText("link").setPrefix("atom").setNamespace(
        "http://www.w3.org/2005/Atom"));

    List<AnnotationElement> elementElements = new ArrayList<AnnotationElement>();
    elementElements.add(new AnnotationElement().setName("schemaElementTest2").setPrefix("atom").setNamespace(
        "http://www.w3.org/2005/Atom").setAttributes(attributesElement1));
    elementElements.add(new AnnotationElement().setName("schemaElementTest3").setPrefix("atom").setNamespace(
        "http://www.w3.org/2005/Atom").setAttributes(attributesElement1));

    List<AnnotationElement> schemaElements = new ArrayList<AnnotationElement>();
    schemaElements.add(new AnnotationElement().setName("schemaElementTest1").setPrefix("atom").setNamespace(
        "http://www.w3.org/2005/Atom").setAttributes(attributesElement1).setChildElements(elementElements));

    Schema schema = new Schema().setAnnotationElements(schemaElements);
    schema.setNamespace("http://namespace.com");
    schemas.add(schema);
View Full Code Here

  public void writeInvalidMetadata() throws Exception {
    disableLogging(this.getClass());
    List<Schema> schemas = new ArrayList<Schema>();

    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
    annotationElements.add(new AnnotationElement().setText("hallo"));
    Schema schema = new Schema().setAnnotationElements(annotationElements);
    schema.setNamespace("http://namespace.com");
    schemas.add(schema);

    DataServices data = new DataServices().setSchemas(schemas).setDataServiceVersion(ODataServiceVersion.V20);
View Full Code Here

        "http://www.foo.bar/Protocols/Data"));
    attributesElement1.add(new AnnotationAttribute().setName("href").setText("link").setPrefix("foo").setNamespace(
        "http://www.foo.bar/Protocols/Data"));

    List<AnnotationElement> elementElements = new ArrayList<AnnotationElement>();
    elementElements.add(new AnnotationElement().setName("schemaElementTest2").setPrefix("foo").setNamespace(
        "http://www.foo.bar/Protocols/Data").setAttributes(attributesElement1));
    elementElements.add(new AnnotationElement().setName("schemaElementTest3").setPrefix("foo").setNamespace(
        "http://www.foo.bar/Protocols/Data").setAttributes(attributesElement1));

    List<AnnotationElement> schemaElements = new ArrayList<AnnotationElement>();
    schemaElements.add(new AnnotationElement().setName("schemaElementTest1").setPrefix("foo").setNamespace(
        "http://www.foo.bar/Protocols/Data").setAttributes(attributesElement1).setChildElements(elementElements));

    Schema schema = new Schema().setAnnotationElements(schemaElements);
    schema.setNamespace("http://namespace.com");
    schemas.add(schema);
View Full Code Here

        new AnnotationAttribute().setName("attributeName").setNamespace("namespace").setPrefix("prefix")
            .setText("Text");
    annotationAttributes.add(attribute);

    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
    AnnotationElement element =
        new AnnotationElement().setName("elementName").setNamespace("namespace").setPrefix("prefix").setText("xmlData");
    annotationElements.add(element);

    annotationsProvider = new EdmAnnotationsImplProv(annotationAttributes, annotationElements);

    annotationsProviderWithNullEementAndAttributes = new EdmAnnotationsImplProv(null, null);
View Full Code Here

    }
    return associationEnd;
  }

  private AnnotationElement readAnnotationElement(final XMLStreamReader reader) throws XMLStreamException {
    AnnotationElement aElement = new AnnotationElement();
    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
    List<AnnotationAttribute> annotationAttributes = new ArrayList<AnnotationAttribute>();
    aElement.setName(reader.getLocalName());
    String elementNamespace = reader.getNamespaceURI();
    if (!edmNamespaces.contains(elementNamespace)) {
      aElement.setPrefix(reader.getPrefix());
      aElement.setNamespace(elementNamespace);
    }
    for (int i = 0; i < reader.getAttributeCount(); i++) {
      AnnotationAttribute annotationAttribute = new AnnotationAttribute();
      annotationAttribute.setText(reader.getAttributeValue(i));
      annotationAttribute.setName(reader.getAttributeLocalName(i));
      annotationAttribute.setPrefix(reader.getAttributePrefix(i));
      String namespace = reader.getAttributeNamespace(i);
      if (namespace != null && !isDefaultNamespace(namespace)) {
        annotationAttribute.setNamespace(namespace);
      }
      annotationAttributes.add(annotationAttribute);
    }
    if (!annotationAttributes.isEmpty()) {
      aElement.setAttributes(annotationAttributes);
    }
    while (reader.hasNext() && !(reader.isEndElement() && aElement.getName() != null
        && aElement.getName().equals(reader.getLocalName()))) {
      reader.next();
      if (reader.isStartElement()) {
        annotationElements.add(readAnnotationElement(reader));
      } else if (reader.isCharacters()) {
        String elementText = "";
        do {
          elementText = elementText + reader.getText();
          reader.next();
        } while (reader.isCharacters());
        aElement.setText(elementText);
      }
    }
    if (!annotationElements.isEmpty()) {
      aElement.setChildElements(annotationElements);
    }
    return aElement;
  }
View Full Code Here

    entityContainer.setFunctionImports(functionImports);

    schema.setEntityContainers(Arrays.asList(entityContainer));

    final List<AnnotationElement> childElements = new ArrayList<AnnotationElement>();
    childElements.add(new AnnotationElement().setName("schemaElementTest2").setText("text2").setNamespace(NAMESPACE_1));
    childElements.add(new AnnotationElement().setName("schemaElementTest3").setText("text3").setPrefix("prefix")
        .setNamespace("namespace"));
    final List<AnnotationAttribute> elementAttributes = new ArrayList<AnnotationAttribute>();
    elementAttributes.add(new AnnotationAttribute().setName("rel").setText("self"));
    elementAttributes.add(new AnnotationAttribute().setName("href").setText("http://foo").setPrefix("pre")
        .setNamespace("namespaceForAnno"));
    childElements.add(new AnnotationElement().setName("schemaElementTest4").setText("text4").setAttributes(
        elementAttributes));

    final List<AnnotationElement> schemaElements = new ArrayList<AnnotationElement>();
    schemaElements.add(new AnnotationElement().setName("schemaElementTest1").setText("text1").setChildElements(
        childElements));

    schema.setAnnotationElements(schemaElements);
    schemas.add(schema);
View Full Code Here

        final ArrayList<AnnotationAttribute> annoList2 = new ArrayList<AnnotationAttribute>();
        annoList2.add(new AnnotationAttribute().setName("annoName").setNamespace("http://annoNamespace").setPrefix(
            "annoPrefix").setText("annoText"));

        final List<AnnotationElement> annoElementsForSimpleProp = new ArrayList<AnnotationElement>();
        annoElementsForSimpleProp.add(new AnnotationElement().setName("propertyAnnoElement").setText("text"));
        annoElementsForSimpleProp.add(new AnnotationElement().setName("propertyAnnoElement2"));
        final SimpleProperty simpleProp =
            new SimpleProperty().setName("EmployeeName").setType(EdmSimpleTypeKind.String)
                .setCustomizableFeedMappings(new CustomizableFeedMappings()
                    .setFcTargetPath(EdmTargetPath.SYNDICATION_TITLE)).setAnnotationAttributes(annoList2)
                .setAnnotationElements(annoElementsForSimpleProp);
View Full Code Here

    associationEnd.setAnnotationElements(annotationElements);
    return associationEnd;
  }

  private AnnotationElement readAnnotationElement(final XMLStreamReader reader) throws XMLStreamException {
    AnnotationElement aElement = new AnnotationElement();
    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
    List<AnnotationAttribute> annotationAttributes = new ArrayList<AnnotationAttribute>();
    aElement.setName(reader.getLocalName());
    String elementNamespace = reader.getNamespaceURI();
    if (!edmNamespaces.contains(elementNamespace)) {
      aElement.setPrefix(reader.getPrefix());
      aElement.setNamespace(elementNamespace);
    }
    for (int i = 0; i < reader.getAttributeCount(); i++) {
      AnnotationAttribute annotationAttribute = new AnnotationAttribute();
      annotationAttribute.setText(reader.getAttributeValue(i));
      annotationAttribute.setName(reader.getAttributeLocalName(i));
      annotationAttribute.setPrefix(reader.getAttributePrefix(i));
      String namespace = reader.getAttributeNamespace(i);
      if (namespace != null && !isDefaultNamespace(namespace)) {
        annotationAttribute.setNamespace(namespace);
      }
      annotationAttributes.add(annotationAttribute);
    }
    aElement.setAttributes(annotationAttributes);
    while (reader.hasNext() && !(reader.isEndElement() && aElement.getName() != null
        && aElement.getName().equals(reader.getLocalName()))) {
      reader.next();
      if (reader.isStartElement()) {
        annotationElements.add(readAnnotationElement(reader));
      } else if (reader.isCharacters()) {
        aElement.setText(reader.getText());
      }
    }
    if (!annotationElements.isEmpty()) {
      aElement.setChildElements(annotationElements);
    }
    return aElement;
  }
View Full Code Here

        new AnnotationAttribute().setName("attributeName").setNamespace("namespace").setPrefix("prefix")
            .setText("Text");
    annotationAttributes.add(attribute);

    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
    AnnotationElement element =
        new AnnotationElement().setName("elementName").setNamespace("namespace").setPrefix("prefix").setText("xmlData");
    annotationElements.add(element);

    annotationsProvider = new EdmAnnotationsImplProv(annotationAttributes, annotationElements);

  }
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.provider.AnnotationElement

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.