org.apache.olingo.odata2.api.edm.EdmMultiplicity Java Examples
The following examples show how to use
org.apache.olingo.odata2.api.edm.EdmMultiplicity.
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: JPAEdmFunctionImportTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * Test Case - Function Import test for ReturnType.COMPLEX where Complex type is non JPA Embeddable Type * */ @Test public void testNonJPAReturnTypeComplex() { VARIANT = 18; build(); List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList(); assertEquals(functionImportList.size(), 1); FunctionImport functionImport = functionImportList.get(0); assertEquals(functionImport.getName(), "method18"); assertNotNull(functionImport.getMapping()); ReturnType returnType = functionImport.getReturnType(); assertNotNull(returnType); assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity()); assertEquals(returnType.getTypeName().toString(), ODataJPAContextMock.PERSISTENCE_UNIT_NAME + "." + JPACustomProcessorMock.nonJPAEmbeddableType); }
Example #2
Source File: SynchronizerEntitySet.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
@Override public List<Association> getAssociations () { return Collections.singletonList ( new Association () .setName (ASSO_SYNC_COLLECTION.getName ()) .setEnd1 ( new AssociationEnd () .setType(Model.COLLECTION.getFullQualifiedName()) .setRole (ROLE_SYNC_COLLECTION) .setMultiplicity (EdmMultiplicity.ZERO_TO_ONE)) .setEnd2 ( new AssociationEnd ().setType (getFullQualifiedName ()) .setRole (ROLE_COLLECTION_SYNCS) .setMultiplicity (EdmMultiplicity.MANY)) ); }
Example #3
Source File: AtomSerializerDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public Object readFunctionImport(EdmFunctionImport functionImport, EntityStream content) throws EntityProviderException { try { if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) { return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new XmlEntityDeserializer().readFeed(functionImport.getEntitySet(), content) : new XmlEntityDeserializer().readEntry(functionImport.getEntitySet(), content); } else { final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new XmlEntityDeserializer().readCollection(info, content) : new XmlEntityDeserializer().readProperty(info, content).get(info.getName()); } } catch (final EdmException e) { throw new EntityProviderException(e.getMessageReference(), e); } }
Example #4
Source File: Sparql.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
@Override public FunctionImport getFunctionImport() { // Returns the Result Set of the given query as String. ReturnType rt = new ReturnType() .setMultiplicity(EdmMultiplicity.ZERO_TO_ONE) .setTypeName(EdmSimpleTypeKind.String.getFullQualifiedName()); // One required param: the SPARQL query. List<FunctionImportParameter> params = new ArrayList<>(); params.add(new FunctionImportParameter() .setName("query") .setType(EdmSimpleTypeKind.String) .setFacets(new Facets().setNullable(false))); return new FunctionImport() .setName(NAME) .setHttpMethod("GET") .setParameters(params) .setReturnType(rt); }
Example #5
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private Association mergeAssociations(final Association associationOne, final Association associationTwo) { AssociationEnd oneEnd1 = associationOne.getEnd1(); AssociationEnd oneEnd2 = associationOne.getEnd2(); AssociationEnd twoEnd1 = associationTwo.getEnd1(); AssociationEnd twoEnd2 = associationTwo.getEnd2(); AssociationEnd[] oneEnds = new AssociationEnd[] { oneEnd1, oneEnd2 }; for (AssociationEnd associationEnd : oneEnds) { if (associationEnd.getRole().equals(twoEnd1.getRole())) { if (twoEnd1.getMultiplicity() == EdmMultiplicity.MANY) { associationEnd.setMultiplicity(EdmMultiplicity.MANY); } } else if (associationEnd.getRole().equals(twoEnd2.getRole())) { if (twoEnd2.getMultiplicity() == EdmMultiplicity.MANY) { associationEnd.setMultiplicity(EdmMultiplicity.MANY); } } } return associationOne; }
Example #6
Source File: AnnotationInMemoryDs.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * Extract the <code>result data</code> from the <code>resultData</code> list based on * <code>navigation information</code> and <code>targetKeys</code>. * * @param targetStore * @param targetKeys * @param navInfo * @param resultData * @return * @throws DataStoreException */ private Object extractResultData(final DataStore<?> targetStore, final Map<String, Object> targetKeys, final AnnotatedNavInfo navInfo, final List<Object> resultData) throws DataStoreException { if (navInfo.getToMultiplicity() == EdmMultiplicity.MANY) { if (targetKeys.isEmpty()) { return resultData; } else { Object keyInstance = targetStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, targetKeys); for (Object result : resultData) { if (targetStore.isKeyEqualChecked(result, keyInstance)) { return result; } } return null; } } else { if (resultData.isEmpty()) { return null; } return resultData.get(0); } }
Example #7
Source File: ClassEntitySet.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
@Override public List<Association> getAssociations () { List<Association> associations = new ArrayList<Association> (); associations.add (new Association () .setName (ASSO_CLASS_CLASS.getName ()) .setEnd1 ( new AssociationEnd ().setType (getFullQualifiedName ()) .setRole (ROLE_CLASS_CLASSES) .setMultiplicity (EdmMultiplicity.MANY)) .setEnd2 ( new AssociationEnd ().setType (getFullQualifiedName ()) .setRole (ROLE_CLASS_PARENT) .setMultiplicity (EdmMultiplicity.MANY))); return associations; }
Example #8
Source File: XMLMetadataFunctionImportDeserializerTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * @param functionImport * @throws EdmException */ private void checkParameters1(EdmFunctionImport functionImport) throws EdmException { assertEquals("Employees", functionImport.getEntitySet().getName()); assertEquals("Employee", functionImport.getReturnType().getName()); assertEquals(EdmMultiplicity.MANY, functionImport.getReturnType().getMultiplicity()); assertEquals(NAMESPACE, functionImport.getReturnType().getType().getNamespace()); assertEquals("GET", functionImport.getHttpMethod()); List<String> parameterNames = (List<String>) functionImport.getParameterNames(); assertEquals(2, parameterNames.size()); assertEquals("q1", parameterNames.get(0)); EdmParameter edmParam = functionImport.getParameter(parameterNames.get(0)); assertEquals("String", edmParam.getType().getName()); assertEquals(Boolean.TRUE, edmParam.getFacets().isNullable()); assertEquals("q2", parameterNames.get(1)); edmParam = functionImport.getParameter(parameterNames.get(1)); assertEquals("Int32", edmParam.getType().getName()); assertEquals(Boolean.FALSE, edmParam.getFacets().isNullable()); }
Example #9
Source File: AnnotationEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void validateAssociation(final Association association) { String name = association.getName(); if (name.equals("r_Employees_2_r_Room")) { validateAssociation(association, "r_Room", EdmMultiplicity.ONE, defaultFqn("Room"), "r_Employees", EdmMultiplicity.MANY, defaultFqn("Employee")); } else if (name.equals("BuildingRooms")) { validateAssociation(association, "r_Building", EdmMultiplicity.ONE, defaultFqn("Building"), "r_Rooms", EdmMultiplicity.MANY, defaultFqn("Room")); } else if (name.equals("ManagerEmployees")) { validateAssociation(association, "r_Manager", EdmMultiplicity.ONE, defaultFqn("Manager"), "r_Employees", EdmMultiplicity.MANY, defaultFqn("Employee")); } else if (name.equals("TeamEmployees")) { validateAssociation(association, "r_Team", EdmMultiplicity.ONE, defaultFqn("Team"), "r_Employees", EdmMultiplicity.MANY, defaultFqn("Employee")); } else if (name.equals("Team_2_r_SubTeam")) { validateAssociation(association, "Team", EdmMultiplicity.ONE, defaultFqn("Team"), "r_SubTeam", EdmMultiplicity.ONE, defaultFqn("Team")); } else { fail("Got unknown association to validate with name '" + name + "'."); } }
Example #10
Source File: ConnectionEntitySet.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
@Override public List<Association> getAssociations () { List<Association> associations = new ArrayList<Association> (); if (Security.currentUserHasRole(Role.SYSTEM_MANAGER)) { associations.add (new Association () .setName (ASSO_CONNECTION_USER.getName ()) .setEnd1 ( new AssociationEnd () .setType(Model.USER.getFullQualifiedName()) .setRole (ROLE_CONNECTION_USER) .setMultiplicity (EdmMultiplicity.ONE)) .setEnd2 ( new AssociationEnd ().setType (getFullQualifiedName ()) .setRole (ROLE_USER_CONNECTIONS) .setMultiplicity (EdmMultiplicity.MANY))); } return associations; }
Example #11
Source File: EdmNavigationPropertyImplProvTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@BeforeClass public static void setup() throws Exception { edmProvider = mock(EdmProvider.class); EdmImplProv edmImplProv = new EdmImplProv(edmProvider); FullQualifiedName relationship = new FullQualifiedName("namespace", "associationName"); Association association = new Association().setName("associationName"); when(edmProvider.getAssociation(relationship)).thenReturn(association); AssociationEnd end1 = new AssociationEnd().setRole("fromRole"); FullQualifiedName entityName = new FullQualifiedName("namespace", "entityName"); AssociationEnd end2 = new AssociationEnd().setRole("toRole").setMultiplicity(EdmMultiplicity.ONE).setType(entityName); association.setEnd1(end1).setEnd2(end2); EntityType entityType = new EntityType().setName("entityName"); when(edmProvider.getEntityType(entityName)).thenReturn(entityType); NavigationProperty navProperty = new NavigationProperty().setName("navProperty").setFromRole("fromRole").setToRole("toRole").setRelationship( relationship); navPropertyProvider = new EdmNavigationPropertyImplProv(edmImplProv, navProperty); }
Example #12
Source File: XmlMetadataAssociationTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void testAssociation() throws XMLStreamException, EntityProviderException, EdmException, UnsupportedEncodingException { XmlMetadataDeserializer parser = new XmlMetadataDeserializer(); InputStream reader = createStreamReader(xmlWithAssociation); EdmDataServices result = parser.readMetadata(reader, true); assertEquals("2.0", result.getDataServiceVersion()); for (EdmSchema schema : result.getEdm().getSchemas()) { for (EdmAssociation association : schema.getAssociations()) { EdmAssociationEnd end; assertEquals(ASSOCIATION, association.getName()); if ("Employee".equals(association.getEnd1().getEntityType().getName())) { end = association.getEnd1(); } else { end = association.getEnd2(); } assertEquals(EdmMultiplicity.MANY, end.getMultiplicity()); assertEquals("r_Employees", end.getRole()); } } }
Example #13
Source File: JsonEntityProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public Object readFunctionImport(final EdmFunctionImport functionImport, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { try { if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) { return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new JsonEntityConsumer().readFeed(functionImport.getEntitySet(), content, properties) : new JsonEntityConsumer().readEntry(functionImport.getEntitySet(), content, properties); } else { final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new JsonEntityConsumer().readCollection(info, content, properties) : new JsonEntityConsumer().readProperty(info, content, properties).get(info.getName()); } } catch (final EdmException e) { throw new EntityProviderException(e.getMessageReference(), e); } }
Example #14
Source File: JsonEntityProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public ODataResponse writeFunctionImport(final EdmFunctionImport functionImport, final Object data, final EntityProviderWriteProperties properties) throws EntityProviderException { try { if(functionImport.getReturnType() !=null){ if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) { @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) data; return writeEntry(functionImport.getEntitySet(), map, properties); } final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); if (functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY) { return writeCollection(info, (List<?>) data); } else { return writeSingleTypedElement(info, data); } }else{ return ODataResponse.newBuilder().status(HttpStatusCodes.ACCEPTED).build(); } } catch (final EdmException e) { throw new EntityProviderProducerException(e.getMessageReference(), e); } }
Example #15
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void validateFunctionImport() throws EntityProviderException { for (FunctionImport functionImport : edmFunctionImportList) { ReturnType returnType = functionImport.getReturnType(); if (returnType != null) { String entitySet = functionImport.getEntitySet(); FullQualifiedName fqn = returnType.getTypeName(); if (returnType.getMultiplicity() == EdmMultiplicity.MANY && entitySet == null && entityTypesMap.get( fqn) != null) { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } else if (returnType.getMultiplicity() != EdmMultiplicity.MANY && entitySet != null && entityTypesMap.get( fqn) == null) { throw new EntityProviderException(EntityProviderException.INVALID_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } } } }
Example #16
Source File: JPAEdmNameBuilder.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private static String multiplicityToString(EdmMultiplicity multiplicity) { if(multiplicity == null) { return ""; } switch (multiplicity) { case MANY: return "Many"; case ONE: return "One"; case ZERO_TO_ONE: return "ZeroToOne"; default: return ""; } }
Example #17
Source File: EdmMockUtil.java From olingo-odata2 with Apache License 2.0 | 6 votes |
public static EdmNavigationProperty mockSecondNavigationProperty() { EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class); EdmMapping mapping = EasyMock.createMock(EdmMapping.class); EasyMock.expect(mapping.getInternalName()).andStubReturn("materials"); EasyMock.replay(mapping); try { EasyMock.expect(navigationProperty.getMultiplicity()).andStubReturn(EdmMultiplicity.ONE); EasyMock.expect(navigationProperty.getMapping()).andStubReturn(mapping); EasyMock.expect(navigationProperty.getName()).andStubReturn("MaterialDetails"); EasyMock.expect(navigationProperty.getFromRole()).andStubReturn("SalesOrderLineItem"); } catch (EdmException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } EasyMock.replay(navigationProperty); return navigationProperty; }
Example #18
Source File: EdmMockUtil.java From olingo-odata2 with Apache License 2.0 | 6 votes |
public static EdmNavigationProperty mockNavigationProperty(String fromRoleAppendix) { EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class); EdmMapping mapping = EasyMock.createMock(EdmMapping.class); EasyMock.expect(mapping.getInternalName()).andStubReturn("salesOrderLineItems"); EasyMock.replay(mapping); try { EasyMock.expect(navigationProperty.getMultiplicity()).andStubReturn(EdmMultiplicity.MANY); EasyMock.expect(navigationProperty.getMapping()).andStubReturn(mapping); EasyMock.expect(navigationProperty.getName()).andStubReturn("SalesOrderLineItemDetails"); EasyMock.expect(navigationProperty.getFromRole()).andStubReturn("SalesOrderHeader" + (fromRoleAppendix == null? "": fromRoleAppendix)); } catch (EdmException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } EasyMock.replay(navigationProperty); return navigationProperty; }
Example #19
Source File: AtomEntryEntityProducer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void appendAdditinalLinks(final XMLStreamWriter writer, final EntityInfoAggregator eia, final Map<String, Object> data) throws EntityProviderException, EdmException, URISyntaxException { final Map<String, Map<String, Object>> links = properties.getAdditionalLinks(); if (links != null && !links.isEmpty()) { for (Entry<String, Map<String, Object>> entry : links.entrySet()) { Map<String, Object> navigationKeyMap = entry.getValue(); final boolean isFeed = (eia.getNavigationPropertyInfo(entry.getKey()).getMultiplicity() == EdmMultiplicity.MANY); if (navigationKeyMap != null && !navigationKeyMap.isEmpty()) { final EntityInfoAggregator targetEntityInfo = EntityInfoAggregator.create( eia.getEntitySet().getRelatedEntitySet( (EdmNavigationProperty) eia.getEntityType().getProperty(entry.getKey()))); appendAtomNavigationLink(writer, createSelfLink(targetEntityInfo, navigationKeyMap, null), entry.getKey(), isFeed, eia, data); } } } }
Example #20
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 #21
Source File: AtomEntityProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public ODataResponse writeFunctionImport(final EdmFunctionImport functionImport, final Object data, final EntityProviderWriteProperties properties) throws EntityProviderException { try { if(functionImport.getReturnType() !=null){ final EdmType type = functionImport.getReturnType().getType(); final boolean isCollection = functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY; if (type.getKind() == EdmTypeKind.ENTITY) { @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) data; return writeEntry(functionImport.getEntitySet(), map, properties); } final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); if (isCollection) { return writeCollection(info, (List<?>) data); } else { return writeSingleTypedElement(info, data); } }else{ return ODataResponse.newBuilder().status(HttpStatusCodes.ACCEPTED).build(); } } catch (EdmException e) { throw new EntityProviderProducerException(e.getMessageReference(), e); } }
Example #22
Source File: XmlMetadataDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void validateFunctionImport() throws EntityProviderException, EdmException { for (EdmFunctionImport functionImport : edmFunctionImportList) { EdmTyped returnType = functionImport.getReturnType(); if (returnType != null) { FullQualifiedName fqn = extractFQName(returnType.toString()); String entitySet = ((EdmFunctionImportImpl)functionImport).getEntitySetName(); if (returnType.getMultiplicity() == EdmMultiplicity.MANY && entitySet == null && entityTypesMap.get( fqn) != null) { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } else if (returnType.getMultiplicity() != EdmMultiplicity.MANY && entitySet != null && entityTypesMap.get( fqn) == null) { throw new EntityProviderException(EntityProviderException.INVALID_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } } } }
Example #23
Source File: JPQLJoinContextTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private EdmNavigationProperty createNavigationProperty(final String z) throws EdmException { EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class); EdmAssociation association = EasyMock.createMock(EdmAssociation.class); EdmAssociationEnd associationEnd = EasyMock.createMock(EdmAssociationEnd.class); EasyMock.expect(navigationProperty.getFromRole()).andStubReturn("roleA" + z); EasyMock.expect(navigationProperty.getToRole()).andStubReturn("roleB" + z); EasyMock.expect(navigationProperty.getName()).andStubReturn("navP" + z); EasyMock.expect(navigationProperty.getName()).andStubReturn("navP" + z); EasyMock.expect(navigationProperty.getMultiplicity()).andStubReturn(EdmMultiplicity.ONE); EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class); EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class); EasyMock.expect(edmMapping.getInternalName()).andStubReturn("sItem" + z); EasyMock.expect(edmEntityType.getMapping()).andStubReturn(edmMapping); EasyMock.expect(edmEntityType.getName()).andStubReturn("soItem" + z); EasyMock.expect(associationEnd.getEntityType()).andStubReturn(edmEntityType); EasyMock.expect(association.getEnd("roleA" + z)).andStubReturn(associationEnd); EasyMock.expect(navigationProperty.getRelationship()).andStubReturn(association); EdmMapping edmMapping1 = EasyMock.createMock(EdmMapping.class); EasyMock.expect(edmMapping1.getInternalName()).andStubReturn("s_Item" + z); EasyMock.expect(navigationProperty.getMapping()).andStubReturn(edmMapping1); EasyMock.replay(edmMapping, edmMapping1, edmEntityType, associationEnd, association, navigationProperty); return navigationProperty; }
Example #24
Source File: JPAEdmFunctionImportTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * Test Case - Function Import with no names. Default name is Java method * name. */ @Test public void testFunctionImportNoName() { VARIANT = 3; build(); List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList(); assertEquals(functionImportList.size(), 1); FunctionImport functionImport = functionImportList.get(0); assertEquals(functionImport.getName(), "method3"); assertNotNull(functionImport.getMapping()); ReturnType returnType = functionImport.getReturnType(); assertNotNull(returnType); assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity()); assertEquals(returnType.getTypeName().toString(), EdmSimpleTypeKind.Int32.getFullQualifiedName().toString()); }
Example #25
Source File: JPAEdmFunctionImportTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * Test Case - Function Import that returns a complex Type */ @Test public void testFunctionImportComplexType() { VARIANT = 9; build(); List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList(); assertEquals(functionImportList.size(), 1); FunctionImport functionImport = functionImportList.get(0); assertEquals(functionImport.getName(), "method9"); assertNotNull(functionImport.getMapping()); ReturnType returnType = functionImport.getReturnType(); assertNotNull(returnType); assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity()); assertEquals(returnType.getTypeName().toString(), ODataJPAContextMock.PERSISTENCE_UNIT_NAME + "." + JPACustomProcessorMock.edmName); }
Example #26
Source File: JPAEdmFunctionImportTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * Test Case - Function Import that returns a complex Type with multiplicity * Many */ @Test public void testFunctionImportComplexTypeMany() { VARIANT = 10; build(); List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList(); assertEquals(functionImportList.size(), 1); FunctionImport functionImport = functionImportList.get(0); assertEquals(functionImport.getName(), "method10"); assertNotNull(functionImport.getMapping()); ReturnType returnType = functionImport.getReturnType(); assertNotNull(returnType); assertEquals(EdmMultiplicity.MANY, returnType.getMultiplicity()); assertEquals(returnType.getTypeName().toString(), ODataJPAContextMock.PERSISTENCE_UNIT_NAME + "." + JPACustomProcessorMock.edmName); }
Example #27
Source File: NetworkEntitySet.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
@Override public List<Association> getAssociations () { List<Association> associations = new ArrayList<Association> (); if (Security.currentUserHasRole(Role.STATISTICS)) { associations.add (new Association () .setName (ASSO_NETWORK_NETWORKSTATISTIC.getName ()) .setEnd1 ( new AssociationEnd () .setType(Model.NETWORKSTATISTIC.getFullQualifiedName()) .setRole (ROLE_NETWORK_NETWORKSTATISTIC) .setMultiplicity (EdmMultiplicity.ONE)) .setEnd2 ( new AssociationEnd ().setType (getFullQualifiedName ()) .setRole (ROLE_NETWORKSTATISTIC_NETWORK) .setMultiplicity (EdmMultiplicity.MANY))); } return associations; }
Example #28
Source File: JPAEdmAssociationEndTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testBuildAssociationEndOneToOne() throws Exception { InnerMock mockFirst = new InnerMock(Attribute.PersistentAttributeType.ONE_TO_ONE); InnerMock mockSecond = new InnerMock(Attribute.PersistentAttributeType.ONE_TO_ONE); JPAEdmAssociationEnd associationEnd = new JPAEdmAssociationEnd(mockFirst, mockSecond); associationEnd.getBuilder().build(); assertEquals(EdmMultiplicity.ONE, associationEnd.getEdmAssociationEnd1().getMultiplicity()); assertEquals(EdmMultiplicity.ONE, associationEnd.getEdmAssociationEnd2().getMultiplicity()); assertEquals("SOID", associationEnd.getEdmAssociationEnd1().getType().getName()); assertEquals(new FullQualifiedName("salesorderprocessing", "SOID"), associationEnd.getEdmAssociationEnd1() .getType()); assertTrue(associationEnd.isConsistent()); }
Example #29
Source File: EdmPropertyImplProvTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testPropertySimple() throws Exception { assertNotNull(propertySimpleProvider); assertEquals("PropertyName", propertySimpleProvider.getName()); assertNotNull(propertySimpleProvider.getType()); assertEquals(EdmSimpleTypeFacadeImpl.getEdmSimpleType(EdmSimpleTypeKind.String), propertySimpleProvider.getType()); assertEquals("mimeType", propertySimpleProvider.getMimeType()); assertNotNull(propertySimpleProvider.getMapping()); assertNotNull(propertySimpleProvider.getCustomizableFeedMappings()); assertEquals("value", propertySimpleProvider.getMapping().getInternalName()); assertNull(propertySimpleProvider.getFacets()); assertNotNull(propertySimpleProvider.getMultiplicity()); assertEquals(EdmMultiplicity.ZERO_TO_ONE, propertySimpleProvider.getMultiplicity()); }
Example #30
Source File: CarEdmProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public FunctionImport getFunctionImport(final String entityContainer, final String name) throws ODataException { if (ENTITY_CONTAINER.equals(entityContainer)) { if (FUNCTION_IMPORT.equals(name)) { return new FunctionImport().setName(name) .setReturnType(new ReturnType().setTypeName(ENTITY_TYPE_1_1).setMultiplicity(EdmMultiplicity.MANY)) .setHttpMethod("GET"); } } return null; }