当前位置: 首页>>代码示例>>Java>>正文


Java PrefixedNamespace类代码示例

本文整理汇总了Java中org.odata4j.core.PrefixedNamespace的典型用法代码示例。如果您正苦于以下问题:Java PrefixedNamespace类的具体用法?Java PrefixedNamespace怎么用?Java PrefixedNamespace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PrefixedNamespace类属于org.odata4j.core包,在下文中一共展示了PrefixedNamespace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExtensionNamespaces

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
protected List<PrefixedNamespace> getExtensionNamespaces(StartElement2 startElement) {

    try {
      Enumerable<Namespace2> nse = startElement.getNamespaces();
      List<PrefixedNamespace> nsl = new ArrayList<PrefixedNamespace>();
      for (Namespace2 ns : nse) {
        if (this.isExtensionNamespace(ns.getNamespaceURI())) {
          nsl.add(new PrefixedNamespace(ns.getNamespaceURI(), ns.getPrefix()));
        }
      }
      return nsl;
    } catch (Exception ex) {
      // not all of the xml parsing implementations implement getNamespaces() yet.
      return null;
    }
  }
 
开发者ID:teiid,项目名称:oreva,代码行数:17,代码来源:EdmxFormatParser.java

示例2: parseMetadata

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
public EdmDataServices parseMetadata(XMLEventReader2 reader) {
  List<EdmSchema.Builder> schemas = new ArrayList<EdmSchema.Builder>();
  List<PrefixedNamespace> namespaces = null;

  ODataVersion version = null;
  boolean foundDataServices = false;
  while (reader.hasNext()) {
    XMLEvent2 event = reader.nextEvent();

    boolean shouldReturn = false;
    if (event.isStartElement()) {
      if (isElement(event, XmlFormatParser.EDMX_EDMX)) {
        namespaces = getExtensionNamespaces(event.asStartElement());
      }
      else if (isElement(event, EDMX_DATASERVICES)) {
        foundDataServices = true;
        String str = getAttributeValueIfExists(event.asStartElement(), new QName2(NS_METADATA, "DataServiceVersion"));
        version = str != null
            ? ODataVersion.parse(str)
            : null;
      }
      else if (isElement(event, EDM2006_SCHEMA, EDM2007_SCHEMA, EDM2008_1_SCHEMA, EDM2008_9_SCHEMA, EDM2009_8_SCHEMA, EDM2009_11_SCHEMA)) {
        schemas.add(parseEdmSchema(reader, event.asStartElement()));
        if (!foundDataServices) // some dallas services have Schema as the document element!
          shouldReturn = true;
      }
    }

    if (isEndElement(event, EDMX_DATASERVICES))
      shouldReturn = true;

    if (shouldReturn) {
      dataServices.setVersion(version).addSchemas(schemas).addNamespaces(namespaces);
      resolve();
      return dataServices.build();
    }
  }

  throw new UnsupportedOperationException();
}
 
开发者ID:teiid,项目名称:oreva,代码行数:41,代码来源:EdmxFormatParser.java

示例3: writeExtensionNamespaces

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
/**
 * Extensions to CSDL like Annotations appear in an application specific set
 * of namespaces.
 */
private static void writeExtensionNamespaces(EdmDataServices services, XMLWriter2 writer) {
  if (services.getNamespaces() != null) {
    for (PrefixedNamespace ns : services.getNamespaces()) {
      writer.writeNamespace(ns.getPrefix(), ns.getUri());
    }
  }
}
 
开发者ID:teiid,项目名称:oreva,代码行数:12,代码来源:EdmxFormatWriter.java

示例4: getProperty

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
String getProperty(EdmEntitySet entitySet, String key) {
	Iterable<? extends NamespacedAnnotation> annotations = entitySet.getAnnotations();
	for (NamespacedAnnotation annotation:annotations) {
		PrefixedNamespace namespace = annotation.getNamespace();
		if (namespace.getUri().equals(SAPURI)) {
			if (annotation.getName().equalsIgnoreCase(key)) {
				return (String)annotation.getValue();
			}
		}
	}
	return null;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:13,代码来源:SAPMetadataProcessor.java

示例5: parseMetadata

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
/**
     * Edmxの解析.
     * @param reader 解析用EdmxのReaderオブジェクト
     * @return EdmDataServices 解析したEdmxのJAXBオブジェクト
     */
    @Override
    public EdmDataServices parseMetadata(XMLEventReader2 reader) {
        List<EdmSchema.Builder> schemas = new ArrayList<EdmSchema.Builder>();
        List<PrefixedNamespace> namespaces = new ArrayList<PrefixedNamespace>();
        namespaces.add(new PrefixedNamespace(Common.P_NAMESPACE.getUri(), Common.P_NAMESPACE.getPrefix()));

        ODataVersion version = null;
        boolean foundDataServices = false;
        while (reader.hasNext()) {
            XMLEvent2 event = reader.nextEvent();

            boolean shouldReturn = false;

//          if (isStartElement(event, XmlFormatParser.EDMX_EDMX)) {
//              // should extract the declared namespaces here...
//          }

            if (isStartElement(event, EDMX_DATASERVICES)) {
                foundDataServices = true;
                String str = getAttributeValueIfExists(
                        event.asStartElement(), new QName2(NS_METADATA, "DataServiceVersion"));
                if (str != null) {
                    version = ODataVersion.parse(str);
                } else {
                    version = null;
                }
            }

            if (isStartElement(event, EDM2006_SCHEMA, EDM2007_SCHEMA, EDM2008_SCHEMA, EDM2009_SCHEMA)) {
                schemas.add(parseEdmSchema(reader, event.asStartElement()));
                if (!foundDataServices) { // some dallas services have Schema as the document element!
                    shouldReturn = true;
                }
            }

            if (isEndElement(event, EDMX_DATASERVICES)) {
                shouldReturn = true;
            }

            if (shouldReturn) {
                dataServices.setVersion(version).addSchemas(schemas).addNamespaces(namespaces);
                resolve();
                return dataServices.build();
            }
        }

        throw new UnsupportedOperationException();
    }
 
开发者ID:personium,项目名称:personium-core,代码行数:54,代码来源:PersoniumEdmxFormatParser.java

示例6: EdmDataServices

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
protected EdmDataServices(ODataVersion version, ImmutableList<EdmSchema> schemas, ImmutableList<PrefixedNamespace> namespaces) {
  this.version = version;
  this.schemas = schemas;
  this.namespaces = namespaces;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:6,代码来源:EdmDataServices.java

示例7: getNamespaces

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
public ImmutableList<PrefixedNamespace> getNamespaces() {
  return namespaces;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:4,代码来源:EdmDataServices.java

示例8: addNamespaces

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
public Builder addNamespaces(List<PrefixedNamespace> namespaces) {
  if (namespaces != null)
    this.namespaces.addAll(namespaces);
  return this;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:6,代码来源:EdmDataServices.java

示例9: getNamespaces

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
/** Gets custom prefixed namespaces for this EDM. */
List<PrefixedNamespace> getNamespaces();
 
开发者ID:teiid,项目名称:oreva,代码行数:3,代码来源:EdmDecorator.java

示例10: getNamespaces

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
@Override
public ImmutableList<PrefixedNamespace> getNamespaces() {
  return getDelegate().getNamespaces();
}
 
开发者ID:teiid,项目名称:oreva,代码行数:5,代码来源:EdmDataServicesDecorator.java

示例11: testProperty

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
@Test
public void testProperty() throws XpathException, IOException, SAXException {
  List<EdmProperty.Builder> properties = new ArrayList<EdmProperty.Builder>();
  EdmEntityType.Builder product = EdmEntityType.newBuilder().setNamespace(NAMESPACE);
  product = product.setName("Product").addKeys("ProductId");
  EdmProperty.Builder property = EdmProperty.newBuilder("ProductId").setType(EdmSimpleType.INT32).setNullable(false);
  properties.add(property);

  property = EdmProperty.newBuilder("Name").setType(EdmSimpleType.STRING).setFixedLength(true);
  property = property.setUnicode(true).setCollation(COLLATING_SEQUENCE);
  properties.add(property);
  product.addProperties(properties);

  // .........................................................................
  EdmAnnotationElement<String> elem = EdmAnnotation.element("bla", "myns", "myProperty", String.class, "hello");

  EdmAnnotationAttribute attr = EdmAnnotation.attribute("blabla", "myns2", "Name", "hello");
  List<EdmAnnotation<?>> annotationAttributes = new ArrayList<EdmAnnotation<?>>();
  annotationAttributes.add(attr);
  elem.setAnnotations(annotationAttributes);

  List<EdmAnnotation<?>> annotations2 = new ArrayList<EdmAnnotation<?>>();
  annotations2.add(elem);

  product.setAnnotationElements(annotations2);
  // .............................................................................
  productSet.setEntityType(product);
  container.addEntitySets(productSet);
  schema.addEntityTypes(product);
  schema.setAlias("xmlns:myns2=blabla");
  schema.setAnnotations(annotationAttributes);
  schema.addEntityContainers(container);

  List<PrefixedNamespace> pnList = new ArrayList<PrefixedNamespace>();
  pnList.add(new PrefixedNamespace("htp://sample.url", "myns2"));

  EdmDataServices.Builder serviceBuilder = EdmDataServices.newBuilder().addSchemas(schema).addNamespaces(pnList);
  EdmDataServices edmService = serviceBuilder.build();

  StringWriter writer = new StringWriter();
  EdmxFormatWriter.write(edmService, writer);
  String xml = writer.toString();

  assertThat(xml, containsString("FixedLength=\"true\""));
  assertThat(xml, containsString("Unicode=\"true\""));
  assertThat(xml, containsString("Collation=\"DIN 5007-1\""));

  assertXpathExists("//edm:Schema/edm:EntityType/edm:Property/@FixedLength", xml);
  assertXpathExists("//edm:Schema/edm:EntityType/edm:Property/@Unicode", xml);
  assertXpathExists("//edm:Schema/edm:EntityType/edm:Property/@Collation", xml);
}
 
开发者ID:teiid,项目名称:oreva,代码行数:52,代码来源:EdmxFormatWriterTest.java

示例12: MyEdmDecorator

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
public MyEdmDecorator() {
  namespaces.add(new PrefixedNamespace(namespace, prefix));
  this.schemaInfoType = createSchemaInfoType().build();
}
 
开发者ID:teiid,项目名称:oreva,代码行数:5,代码来源:InMemoryProducerExample.java

示例13: getNamespaces

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
@Override
public List<PrefixedNamespace> getNamespaces() {
  return namespaces;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:5,代码来源:InMemoryProducerExample.java

示例14: getNamespaces

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
@Override
public List<PrefixedNamespace> getNamespaces() {
  List<PrefixedNamespace> l = new ArrayList<PrefixedNamespace>();
  l.add(new PrefixedNamespace(namespaceUri, prefix));
  return l;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:7,代码来源:EdmxFormatWriterTest.java

示例15: buildTable

import org.odata4j.core.PrefixedNamespace; //导入依赖的package包/类
@Override
protected Table buildTable(MetadataFactory mf, EdmEntitySet entitySet) {
	boolean creatable = true;
	boolean updatable = true;
	boolean deletable = true;
	boolean pageable = true;
	boolean topable = true;
	
	Table t = mf.addTable(entitySet.getName());
	
	Iterable<? extends NamespacedAnnotation> annotations = entitySet.getAnnotations();
	for (NamespacedAnnotation annotation:annotations) {
		PrefixedNamespace namespace = annotation.getNamespace();
		if (namespace.getUri().equals(SAPURI)) {
			String name = annotation.getName();
			if (name.equalsIgnoreCase("label")) { //$NON-NLS-1$
				t.setAnnotation((String)annotation.getValue());	
			}
			else if (name.equalsIgnoreCase("creatable")) { //$NON-NLS-1$
				creatable = Boolean.parseBoolean((String)annotation.getValue());	
			}
			else if (name.equalsIgnoreCase("updatable")) { //$NON-NLS-1$
				updatable = Boolean.parseBoolean((String)annotation.getValue());
			}
			else if (name.equalsIgnoreCase("pageable")) { //$NON-NLS-1$
				pageable = Boolean.parseBoolean((String)annotation.getValue());
			}
			else if (name.equalsIgnoreCase("topable")) { //$NON-NLS-1$
				topable = Boolean.parseBoolean((String)annotation.getValue());
			}
			else if (name.equalsIgnoreCase("deletable")) { //$NON-NLS-1$
				deletable = Boolean.parseBoolean((String)annotation.getValue());
			}
		}
	}
	
	t.setSupportsUpdate(creatable && updatable && deletable);
	if (!topable || !pageable) {
		// TODO: currently Teiid can not do this in fine grained manner; 
		// will be turned on by default; but user needs to turn off using the 
		// capabilities if any table does not support this feature
	}
	return t;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:45,代码来源:SAPMetadataProcessor.java


注:本文中的org.odata4j.core.PrefixedNamespace类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。