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

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


  public void writeValidMetadata5() throws Exception {

    List<Schema> schemas = new ArrayList<Schema>();

    List<AnnotationAttribute> attributesElement1 = new ArrayList<AnnotationAttribute>();
    attributesElement1.add(new AnnotationAttribute().setName("rel").setText("self").setPrefix("atom").setNamespace(
        "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));
View Full Code Here


  public void writeValidMetadata6() throws Exception {

    List<Schema> schemas = new ArrayList<Schema>();

    List<AnnotationAttribute> attributesElement1 = new ArrayList<AnnotationAttribute>();
    attributesElement1.add(new AnnotationAttribute().setName("rel").setText("self").setPrefix("atom").setNamespace(
        "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));
View Full Code Here

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

    List<AnnotationAttribute> attributesElement1 = new ArrayList<AnnotationAttribute>();
    attributesElement1.add(new AnnotationAttribute().setName("rel").setText("self").setPrefix("foo").setNamespace(
        "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));
View Full Code Here

  @Before
  public void getEdmEntityContainerImpl() throws Exception {

    List<AnnotationAttribute> annotationAttributes = new ArrayList<AnnotationAttribute>();
    AnnotationAttribute attribute =
        new AnnotationAttribute().setName("attributeName").setNamespace("namespace").setPrefix("prefix")
            .setText("Text");
    annotationAttributes.add(attribute);

    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
    AnnotationElement element =
View Full Code Here

          }
        }
      }
      for (EntityType entityType : schema.getEntityTypes()) {
        assertEquals(1, entityType.getAnnotationAttributes().size());
        AnnotationAttribute attr = entityType.getAnnotationAttributes().get(0);
        assertEquals("href", attr.getName());
        assertEquals("prefix1", attr.getPrefix());
        assertEquals("namespaceForAnno", attr.getNamespace());
        assertEquals("http://foo", attr.getText());
        for (Property property : entityType.getProperties()) {
          if ("EmployeeName".equals(property.getName())) {
            assertEquals(2, property.getAnnotationElements().size());
            for (AnnotationElement anElement : property.getAnnotationElements()) {
              if ("propertyAnnoElement".equals(anElement.getName())) {
View Full Code Here

    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);
View Full Code Here

    for (int i = 0; i < reader.getAttributeCount(); i++) {
      String attributeNamespace = reader.getAttributeNamespace(i);
      if (attributeNamespace != null && !isDefaultNamespace(attributeNamespace)
          && !mandatoryNamespaces.containsValue(attributeNamespace)
          && !edmNamespaces.contains(attributeNamespace)) {
        annotationAttributes.add(new AnnotationAttribute().setName(reader.getAttributeLocalName(i)).
            setPrefix(reader.getAttributePrefix(i)).setNamespace(attributeNamespace).setText(
                reader.getAttributeValue(i)));
      }
    }
    if (annotationAttributes.isEmpty()) {
View Full Code Here

    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>();
View Full Code Here

  public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException {
    if (NAMESPACE_1.equals(edmFQName.getNamespace())) {
      if (ENTITY_TYPE_1_1.getName().equals(edmFQName.getName())) {
        final List<Property> properties = new ArrayList<Property>();
        final ArrayList<AnnotationAttribute> annoList = new ArrayList<AnnotationAttribute>();
        annoList.add(new AnnotationAttribute().setName("annoName").setNamespace("http://annoNamespace").setPrefix(
            "annoPrefix").setText("annoText"));
        annoList.add(new AnnotationAttribute().setName("annoName2").setNamespace("http://annoNamespace").setPrefix(
            "annoPrefix").setText("annoText2"));
        properties.add(new SimpleProperty().setName("EmployeeId").setType(EdmSimpleTypeKind.String)
            .setFacets(new Facets().setNullable(false))
            .setMapping(new Mapping().setInternalName("getId")).setAnnotationAttributes(annoList));
        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);

        properties.add(simpleProp);
        final ArrayList<AnnotationAttribute> annoList3 = new ArrayList<AnnotationAttribute>();
        annoList3.add(new AnnotationAttribute().setName("annoName").setNamespace("http://annoNamespaceNew").setPrefix(
            "annoPrefix").setText("annoTextNew"));
        properties.add(new SimpleProperty().setName("ManagerId").setType(EdmSimpleTypeKind.String)
            .setMapping(new Mapping().setInternalName("getManager.getId")).setAnnotationAttributes(annoList3));
        properties.add(new SimpleProperty().setName("RoomId").setType(EdmSimpleTypeKind.String)
            .setMapping(new Mapping().setInternalName("getRoom.getId")));
View Full Code Here

    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
View Full Code Here

TOP

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

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.