Examples of AnnotationElement


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

    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

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

        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

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

    }
    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

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

    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

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

        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

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

  @Test
  public void writeValidMetadata() throws Exception {
    List<Schema> schemas = new ArrayList<Schema>();

    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
    annotationElements.add(new AnnotationElement().setName("test").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

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

  public void writeValidMetadata2() throws Exception {
    List<Schema> schemas = new ArrayList<Schema>();

    List<AnnotationElement> childElements = new ArrayList<AnnotationElement>();
    childElements
        .add(new AnnotationElement().setName("schemaElementTest2").setText("text2").setNamespace("namespace1"));

    List<AnnotationAttribute> elementAttributes = new ArrayList<AnnotationAttribute>();
    elementAttributes.add(new AnnotationAttribute().setName("rel").setText("self"));
    elementAttributes.add(new AnnotationAttribute().setName("href").setText("http://google.com").setPrefix("pre")
        .setNamespace("namespaceForAnno"));

    List<AnnotationElement> element3List = new ArrayList<AnnotationElement>();
    element3List.add(new AnnotationElement().setName("schemaElementTest4").setText("text4").setAttributes(
        elementAttributes));
    childElements.add(new AnnotationElement().setName("schemaElementTest3").setText("text3").setPrefix("prefix")
        .setNamespace("namespace2").setChildElements(element3List));

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

    schemaElements.add(new AnnotationElement().setName("test"));
    Schema schema = new Schema().setAnnotationElements(schemaElements);
    schema.setNamespace("http://namespace.com");
    schemas.add(schema);

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

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

  @Test
  public void writeValidMetadata3() throws Exception {
    List<Schema> schemas = new ArrayList<Schema>();

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

    List<PropertyRef> keys = new ArrayList<PropertyRef>();
View Full Code Here

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

    List<AnnotationAttribute> attributesElement1 = new ArrayList<AnnotationAttribute>();
    attributesElement1.add(new AnnotationAttribute().setName("rel").setText("self"));
    attributesElement1.add(new AnnotationAttribute().setName("href").setText("link"));

    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

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
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.