org.apache.olingo.odata2.api.edm.EdmException Java Examples
The following examples show how to use
org.apache.olingo.odata2.api.edm.EdmException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ODataExpressionParser.java From olingo-odata2 with Apache License 2.0 | 6 votes |
public static String parseKeyPropertiesToJPAOrderByExpression( final List<EdmProperty> edmPropertylist, final String tableAlias) throws ODataJPARuntimeException { String propertyName = null; String orderExpression = ""; if (edmPropertylist == null) { return orderExpression; } for (EdmProperty edmProperty : edmPropertylist) { try { EdmMapping mapping = edmProperty.getMapping(); if (mapping != null && mapping.getInternalName() != null) { propertyName = mapping.getInternalName();// For embedded/complex keys } else { propertyName = edmProperty.getName(); } } catch (EdmException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } orderExpression += tableAlias + JPQLStatement.DELIMITER.PERIOD + propertyName + " , "; } return normalizeOrderByExpression(orderExpression); }
Example #2
Source File: ExpandSelectTreeCreator.java From olingo-odata2 with Apache License 2.0 | 6 votes |
public ExpandSelectTreeNodeImpl create() throws EdmException { // Initial node ExpandSelectTreeNodeImpl root = new ExpandSelectTreeNodeImpl(); if (!initialSelect.isEmpty()) { // Create a full expand tree createSelectTree(root); } else { // If no select is given the root node is explicitly selected for all expand clauses root.setExplicitlySelected(); } // Merge in the expand tree mergeExpandTree(root); // consolidate the tree consolidate(root); return root; }
Example #3
Source File: JsonEntryEntityProducer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * @param entityInfo * @param data * @param omitComma * @param propertyName * @return * @throws IOException * @throws EdmException * @throws EntityProviderException */ private boolean appendPropertyNameValue(final EntityInfoAggregator entityInfo, final Map<String, Object> data, boolean omitComma, String propertyName) throws IOException, EdmException, EntityProviderException { if (omitComma) { omitComma = false; } else { jsonStreamWriter.separator(); } jsonStreamWriter.name(propertyName); JsonPropertyEntityProducer.appendPropertyValue(jsonStreamWriter, entityInfo.getPropertyInfo(propertyName), data.get(propertyName), properties.isValidatingFacets(), properties.isDataBasedPropertySerialization()); return omitComma; }
Example #4
Source File: EdmURIBuilderImpl.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public EdmURIBuilder appendFunctionImportParameters(Map<EdmParameter, Object> functionImportParams) { try { if (functionImportParams != null) { for (Map.Entry<EdmParameter, Object> param : functionImportParams.entrySet()) { EdmParameter edmParam = param.getKey(); EdmSimpleType edmType = (EdmSimpleType) edmParam.getType(); Object value = param.getValue(); if (value instanceof String) { value = value.toString(); } value = edmType.valueToString(value, EdmLiteralKind.URI, edmParam.getFacets()); functionImportParameters.put(edmParam.getName(), value); } } } catch (EdmException e) { throw new RuntimeException("Unexpected EDM Exception: ", e);//NOSONAR } return this; }
Example #5
Source File: JsonEntryEntitySerializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void writeNavigationProperties(final Writer writer, final EntityInfoAggregator entityInfo, final Map<String, Object> data, final EdmEntityType type, boolean emptyData) throws EdmException, EntityProviderException, IOException { for (final String navigationPropertyName : type.getNavigationPropertyNames()) { if (data.containsKey(navigationPropertyName)) { if (data.get(navigationPropertyName) == null) { throw new EntityProviderException(EntityProviderException.NULL_VALUE); } if (data.get(navigationPropertyName) instanceof Entity || data.get(navigationPropertyName) instanceof EntityCollection) { if( !emptyData){ jsonStreamWriter.separator(); } emptyData=false; jsonStreamWriter.name(navigationPropertyName); writeExpandedNavigationProperty(writer, entityInfo, data, type, navigationPropertyName); } else if (data.get(navigationPropertyName) instanceof Map<?,?>){ writeNavigationLinks(entityInfo, data); } else { throw new EntityProviderException(EntityProviderException.INCORRECT_NAVIGATION_TYPE); } } } }
Example #6
Source File: ListsProcessor.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private Map<String, Object> parseLinkUri(final EdmEntitySet targetEntitySet, final String uriString) throws EdmException { ODataContext context = getContext(); final int timingHandle = context.startRuntimeMeasurement("UriParser", "getKeyPredicatesFromEntityLink"); List<KeyPredicate> key = null; try { key = UriParser.getKeyPredicatesFromEntityLink(targetEntitySet, uriString, context.getPathInfo().getServiceRoot()); } catch (ODataException e) { // We don't understand the link target. This could also be seen as an error. } context.stopRuntimeMeasurement(timingHandle); return key == null ? null : mapKey(key); }
Example #7
Source File: EdmTypedImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public EdmType getType() throws EdmException { if (edmType == null) { final String namespace = typeName.getNamespace(); if (EdmSimpleType.EDM_NAMESPACE.equals(typeName.getNamespace())) { edmType = EdmSimpleTypeFacadeImpl.getEdmSimpleType(EdmSimpleTypeKind.valueOf(typeName.getName())); } else { edmType = edm.getComplexType(namespace, typeName.getName()); } if (edmType == null) { edmType = edm.getEntityType(namespace, typeName.getName()); } if (edmType == null) { throw new EdmException(EdmException.COMMON); } } return edmType; }
Example #8
Source File: JPAEntityParserTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private EdmProperty getEdmProperty() { EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class); JPAEdmMappingImpl edmMapping = EasyMock.createMock(JPAEdmMappingImpl.class); EasyMock.expect(edmMapping.getInternalName()).andStubReturn("Field1"); EasyMock.expect(((JPAEdmMappingImpl) edmMapping).isVirtualAccess()).andStubReturn(false); EasyMock.replay(edmMapping); EdmType edmType = EasyMock.createMock(EdmType.class); try { EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE); EasyMock.expect(edmType.getName()).andStubReturn("identifier"); EasyMock.expect(edmTyped.getName()).andStubReturn("SalesOrderHeader"); EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping); EasyMock.expect(edmTyped.getType()).andStubReturn(edmType); EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping); } catch (EdmException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } EasyMock.replay(edmType); EasyMock.replay(edmTyped); return edmTyped; }
Example #9
Source File: JPATombstoneCallBackTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void Test() { EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class); try { EasyMock.expect(edmEntitySet.getName()).andReturn("SalesOrder"); EasyMock.replay(edmEntitySet); } catch (EdmException e) { fail("Not Expected"); } GetEntitySetUriInfo resultsView = EasyMock.createMock(GetEntitySetUriInfo.class); EasyMock.expect(resultsView.getTargetEntitySet()).andReturn(edmEntitySet); EasyMock.replay(resultsView); JPATombstoneCallBack tombStoneCallBack = new JPATombstoneCallBack("/sample/", resultsView, "1"); TombstoneCallbackResult result = tombStoneCallBack.getTombstoneCallbackResult(); assertEquals("/sample/SalesOrder?!deltatoken=1", result.getDeltaLink()); }
Example #10
Source File: AtomEntityProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public Object readFunctionImport(final EdmFunctionImport functionImport, InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { try { if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) { return new XmlEntityConsumer().readEntry(functionImport.getEntitySet(), content, properties); } else { final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new XmlEntityConsumer().readCollection(info, content, properties) : new XmlEntityConsumer().readProperty(info, content, properties).get(info.getName()); } } catch (final EdmException e) { throw new EntityProviderException(e.getMessageReference(), e); } }
Example #11
Source File: EdmStructuralTypeImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public List<String> getPropertyNames() throws EdmException { if (edmPropertyNames == null) { final List<String> temp = new ArrayList<String>(); if (edmBaseType != null) { temp.addAll(edmBaseType.getPropertyNames()); } if (structuralType.getProperties() != null) { for (final Property property : structuralType.getProperties()) { temp.add(property.getName()); } } edmPropertyNames = temp; } return edmPropertyNames; }
Example #12
Source File: JsonEntryConsumer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void handleName(final String name) throws IOException, EdmException, EntityProviderException { if (FormatJson.METADATA.equals(name)) { ensureODataEntryExists(); readMetadata(); validateMetadata(); } else if (FormatJson.ODATA_CONTEXT.equals(name)) { readODataContext(); } else { ensureODataEntryExists(); EntityPropertyInfo propertyInfo = eia.getPropertyInfo(name); if (propertyInfo != null) { Object propertyValue = new JsonPropertyConsumer() .readPropertyValue(reader, propertyInfo, typeMappings.get(name), readProperties); if (properties.containsKey(name)) { throw new EntityProviderException(EntityProviderException.DOUBLE_PROPERTY.addContent(name)); } properties.put(name, propertyValue); } else { readNavigationProperty(name); } } }
Example #13
Source File: JPAQueryBuilderTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private UriInfo mockURIInfoWithListener(boolean isNavigationEnabled) throws EdmException { UriInfo uriInfo = EasyMock.createMock(UriInfo.class); if (isNavigationEnabled) { List<NavigationSegment> navSegments = new ArrayList<NavigationSegment>(); navSegments.add(null); EasyMock.expect(uriInfo.getNavigationSegments()).andStubReturn(navSegments); EasyMock.replay(uriInfo); return uriInfo; } EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class); EasyMock.expect(edmEntityType.getMapping()).andStubReturn((EdmMapping) mockEdmMapping()); EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class); EasyMock.expect(edmEntitySet.getEntityType()).andStubReturn(edmEntityType); EasyMock.expect(uriInfo.getTargetEntitySet()).andStubReturn(edmEntitySet); EasyMock.expect(uriInfo.getNavigationSegments()).andReturn(null); EasyMock.expect(uriInfo.getKeyPredicates()).andStubReturn(null); EasyMock.expect(uriInfo.getStartEntitySet()).andStubReturn(edmEntitySet); EasyMock.expect(uriInfo.getOrderBy()).andStubReturn(null); EasyMock.expect(uriInfo.getFilter()).andStubReturn(null); EasyMock.expect(uriInfo.getTop()).andStubReturn(null); EasyMock.expect(uriInfo.getSkip()).andStubReturn(null); EasyMock.replay(edmEntityType, edmEntitySet, uriInfo); return uriInfo; }
Example #14
Source File: JPAExpandCallBack.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private List<EdmNavigationProperty> getNextNavigationProperty(final EdmEntityType sourceEntityType, final EdmNavigationProperty navigationProperty) throws EdmException { final List<EdmNavigationProperty> edmNavigationPropertyList = new ArrayList<EdmNavigationProperty>(); for (ArrayList<NavigationPropertySegment> navPropSegments : expandList) { int size = navPropSegments.size(); for (int i = 0; i < size; i++) { EdmNavigationProperty navProperty = navPropSegments.get(i).getNavigationProperty(); if (testNavPropertySegment(navProperty, sourceEntityType, navigationProperty)) { if (i < size - 1) { edmNavigationPropertyList.add(navPropSegments.get(i + 1).getNavigationProperty()); } } } } return edmNavigationPropertyList; }
Example #15
Source File: JsonEntryDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * * @throws EdmException * @throws EntityProviderException */ private void validateMetadata() throws EdmException, EntityProviderException { if (eia.getEntityType().hasStream()) { if (mediaMetadata.getSourceLink() == null) { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.MEDIA_SRC) .addContent(FormatJson.METADATA)); } if (mediaMetadata.getContentType() == null) { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.CONTENT_TYPE) .addContent(FormatJson.METADATA)); } } else { if (mediaMetadata.getContentType() != null || mediaMetadata.getEditLink() != null || mediaMetadata.getEtag() != null || mediaMetadata.getSourceLink() != null) { throw new EntityProviderException(EntityProviderException.MEDIA_DATA_NOT_INITIAL); } } }
Example #16
Source File: JPQLBuilderFactoryTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private GetEntityUriInfo getEntityUriInfo() throws EdmException { GetEntityUriInfo getEntityView = EasyMock.createMock(GetEntityUriInfo.class); EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class); EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class); EasyMock.expect(edmEntityType.getKeyProperties()).andStubReturn(new ArrayList<EdmProperty>()); EasyMock.expect(edmEntityType.getMapping()).andStubReturn(null); EasyMock.expect(edmEntityType.getName()).andStubReturn(""); EasyMock.expect(edmEntitySet.getEntityType()).andStubReturn(edmEntityType); EasyMock.expect(getEntityView.getSelect()).andStubReturn(null); EasyMock.expect(getEntityView.getTargetEntitySet()).andStubReturn(edmEntitySet); EdmEntitySet startEdmEntitySet = EasyMock.createMock(EdmEntitySet.class); EdmEntityType startEdmEntityType = EasyMock.createMock(EdmEntityType.class); EasyMock.expect(startEdmEntityType.getMapping()).andStubReturn(null); EasyMock.expect(startEdmEntityType.getName()).andStubReturn("SOHeader"); EasyMock.expect(startEdmEntitySet.getEntityType()).andStubReturn(startEdmEntityType); EasyMock.expect(getEntityView.getStartEntitySet()).andStubReturn(startEdmEntitySet); EasyMock.replay(startEdmEntityType, startEdmEntitySet); EasyMock.replay(edmEntityType, edmEntitySet); EasyMock.expect(getEntityView.getKeyPredicates()).andStubReturn(new ArrayList<KeyPredicate>()); List<NavigationSegment> navigationSegments = new ArrayList<NavigationSegment>(); EasyMock.expect(getEntityView.getNavigationSegments()).andStubReturn(navigationSegments); EasyMock.replay(getEntityView); return getEntityView; }
Example #17
Source File: JPQLJoinSelectSingleStatementBuilderTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private List<KeyPredicate> createKeyPredicates() throws EdmException { KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class); EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1"); EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class); EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class); EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soid"); EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping); EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class); EasyMock.expect(edmProperty.getType()).andStubReturn(edmType); EasyMock.expect(keyPredicate.getProperty()).andStubReturn(edmProperty); EasyMock.replay(edmType, edmMapping, edmProperty, keyPredicate); List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>(); keyPredicates.add(keyPredicate); return keyPredicates; }
Example #18
Source File: EdmEntityImplTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void entityContainerTest() throws EdmException { EdmEntityContainerImpl cont = new EdmEntityContainerImpl(edm); cont.setAnnotations(annotations); cont.setDefaultContainer(true); cont.setDocumentation(documentation); cont.setEdm(edm); cont.setEdmAssociationSets(new ArrayList<EdmAssociationSet>()); List<EdmEntitySet> entitySets = new ArrayList<EdmEntitySet>(); cont.setEdmEntitySets(entitySets); cont.setEdmExtendedEntityContainer(new EdmEntityContainerImpl(edm)); cont.setEdmFunctionImports(new ArrayList<EdmFunctionImport>()); cont.setEntityContainerHierachy(new ArrayList<EdmEntityContainer>()); cont.setExtendz(name); cont.setName(name); assertNotNull(cont); EdmEntitySet entitySet = new EdmEntitySetImpl(); ((EdmEntitySetImpl) entitySet).setName(name); EdmNavigationProperty nav = new EdmNavigationPropertyImpl(); ((EdmNavigationPropertyImpl) nav).setEdm(edm); ((EdmNavigationPropertyImpl) nav).setRelationshipName(entityTypeName); entitySets.add(entitySet); assertNotNull(cont.getAssociationSets()); assertNotNull(cont.getDocumentation()); assertNotNull(cont.getEdm()); assertNotNull(cont.getEdmAssociationSets()); assertNotNull(cont.getEdmEntitySets()); assertNotNull(cont.getEdmExtendedEntityContainer()); assertNotNull(cont.getEdmFunctionImports()); assertNotNull(cont.getEntitySet(name)); assertNotNull(cont.getEntitySets()); assertNotNull(cont.getExtendz()); assertNull(cont.getFunctionImport(name)); assertNotNull(cont.getName()); }
Example #19
Source File: ODataJPAResponseBuilderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private EdmProperty getEdmPropertyForSelect() { EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class); EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE); Facets facets = new Facets().setNullable(false); try { EasyMock.expect(edmType.valueToString(new Integer(2), EdmLiteralKind.URI, facets)).andStubReturn("2"); EasyMock.expect(edmType.valueToString(new Integer(2), EdmLiteralKind.DEFAULT, facets)).andStubReturn("2"); } catch (EdmSimpleTypeException e1) { fail("There is an exception in mocking EdmType object " + e1.getMessage()); } EasyMock.replay(edmType); EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class); JPAEdmMappingImpl edmMapping = EasyMock.createMock(JPAEdmMappingImpl.class); EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soId"); EasyMock.expect(edmMapping.getMediaResourceMimeTypeKey()).andReturn(null); EasyMock.expect(((JPAEdmMappingImpl) edmMapping).isVirtualAccess()).andStubReturn(false); EasyMock.replay(edmMapping); try { EasyMock.expect(edmProperty.getName()).andStubReturn("ID"); EasyMock.expect(edmProperty.getType()).andStubReturn(edmType); EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping); EasyMock.expect(edmProperty.getFacets()).andStubReturn(facets); EasyMock.expect(edmProperty.getCustomizableFeedMappings()).andStubReturn(null); EasyMock.expect(edmProperty.getMimeType()).andStubReturn(null); EasyMock.replay(edmProperty); } catch (EdmException e) { fail("There is an exception in mocking some object " + e.getMessage()); } return edmProperty; }
Example #20
Source File: BeanPropertyAccessTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private EdmProperty mockProperty(final String name, final boolean isBoolean) throws EdmException { EdmProperty property = Mockito.mock(EdmProperty.class); Mockito.when(property.getName()).thenReturn(name); Mockito.when(property.isSimple()).thenReturn(Boolean.TRUE); if (isBoolean) { Mockito.when(property.getType()).thenReturn(EdmSimpleTypeKind.Boolean.getEdmSimpleTypeInstance()); } return property; }
Example #21
Source File: AnnotationInMemoryDs.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public void deleteData(final EdmEntitySet entitySet, final Map<String, Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException { DataStore<Object> dataStore = getDataStore(entitySet); Object keyInstance = dataStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, keys); dataStore.delete(keyInstance); }
Example #22
Source File: EdmUriBuilderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testSimpleESWithKeyUri() throws EdmException { EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Employees"); URI uri = new EdmURIBuilderImpl(SERVICE_ROOT_URI). appendEntitySetSegment(entitySet). appendKeySegment((EdmProperty) entitySet.getEntityType().getProperty("EmployeeId"), "1"). build(); assertNotNull(uri); assertEquals("http://host:80/service/Employees('1')", uri.toASCIIString()); }
Example #23
Source File: UriBuilderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testFunctionImportWithNullParams() throws EdmException { URI uri = new URIBuilderImpl(SERVICE_ROOT_URI). appendFunctionImportSegment("AllLocations").appendFunctionImportParameters(null).build(); assertNotNull(uri); assertEquals("http://host:80/service/AllLocations", uri.toASCIIString()); }
Example #24
Source File: JsonServiceDocumentConsumer.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private void readContent(final JsonReader reader) throws IOException, EdmException, EntityProviderException { currentHandledObjectName = reader.nextName(); if (FormatJson.ENTITY_SETS.equals(currentHandledObjectName)) { reader.beginArray(); readEntitySets(reader); reader.endArray(); } }
Example #25
Source File: ODataJPAResponseBuilderDefault.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private static List<EdmProperty> getEdmProperties(final EdmStructuralType structuralType) throws ODataJPARuntimeException { List<EdmProperty> edmProperties = new ArrayList<EdmProperty>(); try { for (String propertyName : structuralType.getPropertyNames()) { edmProperties.add((EdmProperty) structuralType.getProperty(propertyName)); } } catch (EdmException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); } return edmProperties; }
Example #26
Source File: EntityInfoAggregator.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private EntityPropertyInfo createEntityPropertyInfo(final EdmProperty property) throws EdmException, EntityProviderException { EdmType type = property.getType(); if (type instanceof EdmSimpleType) { return EntityPropertyInfo.create(property); } else if (type instanceof EdmComplexType) { EdmComplexType complex = (EdmComplexType) type; Map<String, EntityPropertyInfo> recursiveInfos = createPropertyInfoObjects(complex, complex.getPropertyNames()); return EntityComplexPropertyInfo.create(property, complex.getPropertyNames(), recursiveInfos); } else { throw new EntityProviderException(EntityProviderException.UNSUPPORTED_PROPERTY_TYPE); } }
Example #27
Source File: EdmAssociationImpl.java From olingo-odata2 with Apache License 2.0 | 5 votes |
public EdmMultiplicity getEndMultiplicity(final String role) throws EdmException { EdmMetadataAssociationEnd end = getEnd1(); if (end!=null && role.equals(end.getRole())) { return end.getMultiplicity(); } end = getEnd2(); if (end!=null && role.equals(end.getRole())) { return end.getMultiplicity(); } return null; }
Example #28
Source File: EdmUriBuilderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test(expected=RuntimeException.class) public void duplicateKeyForNavPropertyInUri() throws EdmException { EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Managers"); EdmEntitySet empEntitySet = edm.getDefaultEntityContainer().getEntitySet("Employees"); new EdmURIBuilderImpl(SERVICE_ROOT_URI). appendEntitySetSegment(entitySet). appendKeySegment((EdmProperty)entitySet.getEntityType().getProperty("EmployeeId"), "1"). appendNavigationSegment((EdmNavigationProperty)entitySet.getEntityType().getProperty("nm_Employees")). appendKeySegment((EdmProperty)empEntitySet.getEntityType().getProperty("EmployeeId"), "1"). appendKeySegment((EdmProperty)empEntitySet.getEntityType().getProperty("EmployeeId"), "1"). build(); }
Example #29
Source File: JPAExpandCallBack.java From olingo-odata2 with Apache License 2.0 | 5 votes |
public static Map<String, ODataCallback> getCallbacks(final URI baseUri, final ExpandSelectTreeNode expandSelectTreeNode, final List<ArrayList<NavigationPropertySegment>> expandList) throws EdmException { Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>(); for (String navigationPropertyName : expandSelectTreeNode.getLinks().keySet()) { callbacks.put(navigationPropertyName, new JPAExpandCallBack(baseUri, expandList)); } return callbacks; }
Example #30
Source File: JPAEntityParser.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private List<EdmProperty> getEdmProperties(final EdmStructuralType structuralType) throws ODataJPARuntimeException { List<EdmProperty> edmProperties = new ArrayList<EdmProperty>(); try { for (String propertyName : structuralType.getPropertyNames()) { edmProperties.add((EdmProperty) structuralType.getProperty(propertyName)); } } catch (EdmException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); } return edmProperties; }