本文整理汇总了Java中org.apache.olingo.commons.api.ex.ODataException类的典型用法代码示例。如果您正苦于以下问题:Java ODataException类的具体用法?Java ODataException怎么用?Java ODataException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ODataException类属于org.apache.olingo.commons.api.ex包,在下文中一共展示了ODataException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getEntityType
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public CsdlEntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException {
String nameSpace = edmFQName.getNamespace();
try {
for (CsdlSchema schema : this.rdfEdmModelProvider.getEdmMetadata().getSchemas()) {
if (nameSpace.equals(schema.getNamespace())) {
String entityTypeName = edmFQName.getName();
for (CsdlEntityType entityType : schema.getEntityTypes()) {
if (entityTypeName.equals(entityType.getName())) {
return entityType;
}
}
}
}
} catch (NullPointerException e) {
log.error("NullPointerException getEntityType " + edmFQName);
throw new ODataException("NullPointerException getEntityType " + edmFQName);
}
return null;
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:22,代码来源:RdfEdmProvider.java
示例2: getComplexType
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public CsdlComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException {
String nameSpace = edmFQName.getNamespace();
try {
for (CsdlSchema schema : this.rdfEdmModelProvider.getEdmMetadata().getSchemas()) {
if (nameSpace.equals(schema.getNamespace())) {
String complexTypeName = edmFQName.getName();
for (CsdlComplexType complexType : schema.getComplexTypes()) {
if (complexTypeName.equals(complexType.getName())) {
return complexType;
}
}
}
}
} catch (NullPointerException e) {
log.error("NullPointerException getComplexType " + edmFQName);
throw new ODataException("NullPointerException getComplexType " + edmFQName);
}
return null;
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:22,代码来源:RdfEdmProvider.java
示例3: getEntitySet
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, final String name) throws ODataException {
try {
//for (CsdlSchema schema : this.rdfEdmModelProvider.getEdmMetadata().getSchemas()) {
CsdlEntityContainer schemaEntityContainer = this.rdfEdmModelProvider.getEdmMetadata().getSchema(entityContainer.getNamespace()).getEntityContainer();
//if (entityContainer.equals(schemaEntityContainer.getName())) {
for (CsdlEntitySet entitySet : schemaEntityContainer.getEntitySets()) {
if (name.equals(entitySet.getName())) {
return entitySet;
}
}
//}
// }
} catch (NullPointerException e) {
log.error("NullPointerException getEntitySet " + entityContainer + " " + name);
throw new ODataException("NullPointerException getEntitySet " + entityContainer + " " + name);
}
return null;
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:22,代码来源:RdfEdmProvider.java
示例4: getFunctionImport
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public CsdlFunctionImport getFunctionImport(FullQualifiedName entityContainer, final String name)
throws ODataException {
try {
//for (CsdlSchema schema : this.rdfEdmModelProvider.getEdmMetadata().getSchemas()) {
CsdlEntityContainer schemaEntityContainer = this.rdfEdmModelProvider.getEdmMetadata().getSchema(entityContainer.getNamespace()).getEntityContainer();
//if (entityContainer.equals(schemaEntityContainer.getName())) {
for (CsdlFunctionImport functionImport : schemaEntityContainer.getFunctionImports()) {
if (name.equals(functionImport.getName())) {
return functionImport;
}
}
//}
//}
} catch (NullPointerException e) {
log.error("NullPointerException getFunctionImport " + entityContainer + " " + name);
throw new ODataException("NullPointerException getFunctionImport " + entityContainer + " " + name);
}
return null;
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:25,代码来源:RdfEdmProvider.java
示例5: getEntityContainerInfo
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainer) throws ODataException {
if (entityContainer == null) {
// Assume request for null container means default container
return new CsdlEntityContainerInfo().setContainerName(new FullQualifiedName(RdfConstants.ENTITYCONTAINERNAMESPACE,RdfConstants.ENTITYCONTAINER));
} else {
try {
for (CsdlSchema schema : this.rdfEdmModelProvider.getEdmMetadata().getSchemas()) {
CsdlEntityContainer schemaEntityContainer = schema.getEntityContainer();
if (entityContainer.equals(schemaEntityContainer.getName())) {
return new CsdlEntityContainerInfo().setContainerName(entityContainer);
}
}
} catch (NullPointerException e) {
log.error("NullPointerException getEntityContainerInfo " + entityContainer);
throw new ODataException("NullPointerException getEntityContainerInfo " + entityContainer);
}
}
return null;
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:21,代码来源:RdfEdmProvider.java
示例6: getEntityType
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public ElasticCsdlEntityType getEntityType(FullQualifiedName entityTypeName)
throws ODataException {
String esIndex = namespaceToIndex(entityTypeName.getNamespace());
// If there is no index mapping for provided namespace - return null, no
// entity type is found.
if (esIndex != null) {
List<ElasticCsdlEntityType> entityTypes = getEntityTypes(esIndex);
for (ElasticCsdlEntityType entityType : entityTypes) {
if (entityType.getESType().equals(entityTypeName.getName())) {
return entityType;
}
}
}
return null;
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:17,代码来源:ElasticCsdlEdmProvider.java
示例7: getEntityContainer
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public CsdlEntityContainer getEntityContainer() throws ODataException {
// create EntityContainer
CsdlEntityContainer entityContainer = new CsdlEntityContainer();
entityContainer.setName(getContainerName().getName());
List<CsdlSchema> schemas = getSchemas();
for (CsdlSchema schema : schemas) {
for (CsdlEntitySet entitySet : schema.getEntityContainer().getEntitySets()) {
if (entitySet.isIncludeInServiceDocument()) {
entityContainer.getEntitySets().add(entitySet);
}
}
}
return entityContainer;
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:17,代码来源:ElasticCsdlEdmProvider.java
示例8: getComplexTypes
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
/**
* Get's complex types for specific Elasticsearch index.
*
* @param index
* index name
* @return list of complex types
* @throws ODataException
* if any error occurred
*/
public List<ElasticCsdlComplexType> getComplexTypes(String index) throws ODataException {
Map<ElasticCsdlComplexType, Set<CsdlProperty>> complexMappings = new HashMap<>();
for (ObjectCursor<String> key : mappingMetaDataProvider.getAllMappings(index).keys()) {
String type = key.value;
ParsedMapWrapper typeProperties = getTypeProperties(index, type);
for (String field : typeProperties.getMap().keySet()) {
ParsedMapWrapper fieldMap = typeProperties.mapValue(field);
if (isNested(fieldMap.stringValue(FIELD_DATATYPE_PROPERTY))) {
ParsedMapWrapper properties = fieldMap.mapValue(PROPERTIES_PROPERTY);
createComplexTypes(index, type, field, properties).entrySet().stream()
.forEach(e -> getAndPut(complexMappings, e.getKey(), e.getValue()));
}
}
}
List<ElasticCsdlComplexType> complexTypes = new ArrayList<>();
for (Entry<ElasticCsdlComplexType, Set<CsdlProperty>> entry : complexMappings.entrySet()) {
ElasticCsdlComplexType complexType = entry.getKey();
complexType.setProperties(new ArrayList<>(entry.getValue()));
complexTypes.add(complexType);
}
return complexTypes;
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:32,代码来源:AbstractNestedTypeMapper.java
示例9: getProperties_TypeNameAndCorrectMetaData_ListOfCsdlPropertiesRetrieved
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Test
public void getProperties_TypeNameAndCorrectMetaData_ListOfCsdlPropertiesRetrieved()
throws IOException, ODataException {
MultyElasticIndexCsdlEdmProvider edmProvider = new MultyElasticIndexCsdlEdmProvider(
metaDataProvider, indices, nestedTypeMapper);
List<CsdlProperty> csdlProperties = edmProvider.getProperties(AUTHORS_INDEX, AUTHOR_TYPE,
getStubProperties());
assertEquals(2, csdlProperties.size());
for (CsdlProperty property : csdlProperties) {
assertTrue(property instanceof ElasticCsdlProperty);
assertEquals(AUTHORS_INDEX, ((ElasticCsdlProperty) property).getESIndex());
assertEquals(AUTHOR_TYPE, ((ElasticCsdlProperty) property).getESType());
assertEquals(property.getName(), ((ElasticCsdlProperty) property).getESField());
assertNotNull(property.getTypeAsFQNObject());
}
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:17,代码来源:MultyElasticIndexCsdlEdmProviderTest.java
示例10: createEntityType_IndexAndTypeWithCustomIdProperty_EntityTypeRetrived
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Test
public void createEntityType_IndexAndTypeWithCustomIdProperty_EntityTypeRetrived()
throws ODataException, IOException {
MultyElasticIndexCsdlEdmProvider edmProvider = spy(
new MultyElasticIndexCsdlEdmProvider(metaDataProvider, indices));
MappingMetaData metaData = mock(MappingMetaData.class);
when(metaDataProvider.getMappingForType(AUTHORS_INDEX, AUTHOR_TYPE)).thenReturn(metaData);
doReturn(new ArrayList<>()).when(edmProvider).getProperties(AUTHORS_INDEX, AUTHOR_TYPE,
metaData);
doReturn(new ArrayList<>()).when(edmProvider).getNavigationProperties(AUTHORS_INDEX,
AUTHOR_TYPE);
ElasticCsdlEntityType entityType = edmProvider.createEntityType(AUTHORS_INDEX, AUTHOR_TYPE);
assertTrue(entityType instanceof ElasticCsdlEntityType);
assertEquals(AUTHORS_INDEX, ((ElasticCsdlEntityType) entityType).getESIndex());
assertEquals(AUTHOR_TYPE, ((ElasticCsdlEntityType) entityType).getESType());
List<CsdlProperty> properties = entityType.getProperties();
assertEquals(1, properties.size());
CsdlProperty idProperty = properties.get(0);
assertEquals(ElasticConstants.ID_FIELD_NAME, idProperty.getName());
List<CsdlPropertyRef> keys = entityType.getKey();
assertEquals(1, keys.size());
CsdlPropertyRef idRef = keys.get(0);
assertEquals(ElasticConstants.ID_FIELD_NAME, idRef.getName());
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:25,代码来源:MultyElasticIndexCsdlEdmProviderTest.java
示例11: getEnityTypes_IndexWithMappings_ListEntityTypesRetrieved
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Test
public void getEnityTypes_IndexWithMappings_ListEntityTypesRetrieved()
throws ODataException, IOException {
MultyElasticIndexCsdlEdmProvider edmProvider = spy(
new MultyElasticIndexCsdlEdmProvider(metaDataProvider, indices));
Builder<String, MappingMetaData> mappingsBuilder = ImmutableOpenMap.builder();
mappingsBuilder.put(BOOK_TYPE, null);
when(metaDataProvider.getAllMappings(AUTHORS_INDEX)).thenReturn(mappingsBuilder.build());
doAnswer(answer -> new ElasticCsdlEntityType().setESIndex(answer.getArgument(0))
.setName(answer.getArgument(1))).when(edmProvider).createEntityType(AUTHORS_INDEX,
BOOK_TYPE);
List<ElasticCsdlEntityType> enityTypes = edmProvider.getEntityTypes(AUTHORS_INDEX);
assertEquals(1, enityTypes.size());
ElasticCsdlEntityType entityType = enityTypes.get(0);
assertEquals(AUTHORS_INDEX, entityType.getESIndex());
assertEquals(BOOK_TYPE, entityType.getESType());
assertEquals(BOOK_TYPE, entityType.getName());
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:19,代码来源:MultyElasticIndexCsdlEdmProviderTest.java
示例12: getEntityContainerForSchema_Namespace_EntityContainerWithEntitySetsRetrieved
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Test
public void getEntityContainerForSchema_Namespace_EntityContainerWithEntitySetsRetrieved()
throws ODataException {
MultyElasticIndexCsdlEdmProvider edmProvider = spy(
new MultyElasticIndexCsdlEdmProvider(metaDataProvider, indices));
Builder<String, MappingMetaData> mappingsBuilder = ImmutableOpenMap.builder();
mappingsBuilder.put(AUTHOR_TYPE, null);
mappingsBuilder.put(BOOK_TYPE, null);
when(metaDataProvider.getAllMappings(AUTHORS_INDEX)).thenReturn(mappingsBuilder.build());
doReturn(new ArrayList<>()).when(edmProvider).getNavigationProperties(AUTHORS_INDEX,
AUTHOR_TYPE);
doReturn(new ArrayList<>()).when(edmProvider).getNavigationProperties(AUTHORS_INDEX,
BOOK_TYPE);
CsdlEntityContainer entityContainer = edmProvider
.getEntityContainerForSchema(AUTHORS_INDEX);
assertEquals(edmProvider.getContainerName().getName(), entityContainer.getName());
assertEquals(2, entityContainer.getEntitySets().size());
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:19,代码来源:MultyElasticIndexCsdlEdmProviderTest.java
示例13: getEntityContainer_ContainerWithEntitySetsRetrieved
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Test
public void getEntityContainer_ContainerWithEntitySetsRetrieved() throws ODataException {
MultyElasticIndexCsdlEdmProvider edmProvider = spy(
new MultyElasticIndexCsdlEdmProvider(metaDataProvider, indices));
List<CsdlSchema> schemas = new ArrayList<>();
CsdlSchema schema1 = mock(CsdlSchema.class);
CsdlEntityContainer container = mock(CsdlEntityContainer.class);
List<CsdlEntitySet> entitySets = new ArrayList<>();
CsdlEntitySet set1 = mock(CsdlEntitySet.class);
when(set1.isIncludeInServiceDocument()).thenReturn(true);
entitySets.add(set1);
entitySets.add(mock(CsdlEntitySet.class));
when(container.getEntitySets()).thenReturn(entitySets);
when(schema1.getEntityContainer()).thenReturn(container);
schemas.add(schema1);
CsdlSchema schema2 = mock(CsdlSchema.class);
when(schema2.getEntityContainer()).thenReturn(mock(CsdlEntityContainer.class));
schemas.add(schema2);
doReturn(schemas).when(edmProvider).getSchemas();
CsdlEntityContainer entityContainer = edmProvider.getEntityContainer();
assertEquals(edmProvider.getContainerName().getName(), entityContainer.getName());
assertEquals(1, entityContainer.getEntitySets().size());
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:24,代码来源:MultyElasticIndexCsdlEdmProviderTest.java
示例14: getComplexType_DifferenetNames_ExpectedValuesRetrieved
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Test
public void getComplexType_DifferenetNames_ExpectedValuesRetrieved() throws ODataException {
MultyElasticIndexCsdlEdmProvider edmProvider = spy(
new MultyElasticIndexCsdlEdmProvider(metaDataProvider, indices));
List<CsdlSchema> schemas = new ArrayList<>();
CsdlSchema schema = mock(CsdlSchema.class);
String namespace = "OData";
when(schema.getNamespace()).thenReturn(namespace);
ElasticCsdlComplexType expectedComplexType = mock(ElasticCsdlComplexType.class);
String complexTypeName = "dimension";
when(schema.getComplexType(complexTypeName)).thenReturn(expectedComplexType);
schemas.add(schema);
doReturn(schemas).when(edmProvider).getSchemas();
ElasticCsdlComplexType actualComplexType = edmProvider
.getComplexType(new FullQualifiedName(namespace, complexTypeName));
assertEquals(expectedComplexType, actualComplexType);
assertNull(edmProvider.getComplexType(new FullQualifiedName("Test", "complex")));
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:19,代码来源:MultyElasticIndexCsdlEdmProviderTest.java
示例15: getActions
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public List<CsdlAction> getActions(FullQualifiedName actionName) throws ODataException {
List<CsdlAction> list = null;
/**
* todo change this lookup to a map.get();
*/
for (RedHxEdmActionProvider edmProvider : EDM_ACTION_PROVIDER_LIST) {
list = edmProvider.getActionList(actionName);
if (!list.isEmpty()) {
break;
}
}
if (list == null) {
list = EMPTY_ACTION_LIST;
}
return list;
}
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:22,代码来源:RedHxServiceEdmProvider.java
示例16: getBoundActionsForEntityType
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
public static List<CsdlAction> getBoundActionsForEntityType(FullQualifiedName entityType) throws ODataException {
FullQualifiedName[] actionNames = {nameBAESAllPrimRTETAllPrim,
nameBAESTwoKeyNavRTESTwoKeyNav, nameBAESTwoKeyNavRTESKeyNav, nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav,
nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav, nameBA_RTETTwoKeyNav,nameBAESAllPrimRT,
nameBAETAllPrimRT, nameBAETTwoPrimRTString, nameBAETTwoPrimRTCollString, nameBAETTwoPrimRTCTAllPrim,
nameBAETTwoPrimRTCollCTAllPrim, nameBAETCompAllPrimRTETCompAllPrim, nameBAETTwoKeyNavRTETTwoKeyNavParam,
nameBAETBaseETTwoBaseRTETTwoBase, nameBAETMixPrimCollCompRTCTTwoPrim, name_A_RTTimeOfDay_ };
List<CsdlAction> actions = new ArrayList<CsdlAction>();
for (FullQualifiedName fqn:actionNames) {
List<CsdlAction> entityActions = getActions(fqn);
for (CsdlAction action:entityActions) {
CsdlParameter parameter = action.getParameters().get(0);
if (parameter.getTypeFQN().equals(entityType)) {
actions.add(action);
}
}
}
return actions;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:21,代码来源:ActionProvider.java
示例17: testComplexType
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Test
public void testComplexType() throws ODataException {
// Test Complex Type
CsdlComplexType ct = provider.getComplexType(new FullQualifiedName(NS, "City"));
assertNotNull(ct);
assertEquals(3, ct.getProperties().size());
CsdlProperty p = ct.getProperties().get(0);
assertEquals("CountryRegion", p.getName());
assertEquals("Edm.String", p.getType());
assertFalse(p.isNullable());
ct = provider.getComplexType(new FullQualifiedName(NS, "Location"));
assertNotNull(ct);
ct = provider.getComplexType(new FullQualifiedName(NS, "EventLocation"));
assertNotNull(ct);
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:MetadataParserTest.java
示例18: getSingleton
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public CsdlSingleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
throws ODataException {
if (singletonName.equals("SI")) {
return new CsdlSingleton()
.setName("SI")
.setType(nameETAbstractBase);
}
if (singletonName.equals("SIBinding")) {
return new CsdlSingleton()
.setName("SIBinding")
.setType(nameET)
.setNavigationPropertyBindings(Collections.singletonList(new CsdlNavigationPropertyBinding()
.setPath("NavPropertyETOne")
.setTarget("ESOne")));
}
return null;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:MetadataDocumentJsonSerializerTest.java
示例19: getFunctions
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public List<CsdlFunction> getFunctions(FullQualifiedName fqn) throws ODataException {
ArrayList<CsdlFunction> foundFuncs = new ArrayList<CsdlFunction>();
CsdlSchema schema = getSchema(fqn.getNamespace());
if (schema != null) {
List<CsdlFunction> functions = schema.getFunctions();
if (functions != null) {
for (CsdlFunction func : functions) {
if (func.getName().equals(fqn.getName())) {
foundFuncs.add(func);
}
}
}
}
return foundFuncs;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:SchemaBasedEdmProvider.java
示例20: getEnumType
import org.apache.olingo.commons.api.ex.ODataException; //导入依赖的package包/类
@Override
public CsdlEnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
if (nameENString.equals(enumTypeName)) {
CsdlAnnotation memberAnnotation = new CsdlAnnotation()
.setTerm("Core.Description")
.setQualifier("Target")
.setExpression(new CsdlConstantExpression(ConstantExpressionType.String, "Description of Enum Member"));
return new CsdlEnumType()
.setName(nameENString.getName())
.setFlags(true)
.setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
.setMembers(Collections.singletonList(
new CsdlEnumMember().setName("String1").setValue("1").setAnnotations(Arrays.asList(memberAnnotation))));
}
return null;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:MetadataDocumentJsonSerializerTest.java
注:本文中的org.apache.olingo.commons.api.ex.ODataException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论