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

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


        final String contentHeader = ContentType.create(BATCH_CONTENT_TYPE, BOUNDARY_PARAMETER, boundary).toString();
        return ODataResponse.entity(batchRequest).contentHeader(contentHeader).build();
    }

    private void addChangeSetParts(ArrayList<BatchPart> parts, ArrayList<BatchChangeSetPart> changeSetParts) {
        final BatchChangeSet changeSet = BatchChangeSet.newBuilder().build();
        for (BatchChangeSetPart changeSetPart : changeSetParts) {
            changeSet.add(changeSetPart);
        }
        parts.add(changeSet);
    }
View Full Code Here


   * EDM Entity Type Name - RULES
   * ************************************************************************
   */
  public static void build(final JPAEdmEntityTypeView view) {

    EntityType edmEntityType = view.getEdmEntityType();
    String jpaEntityName = view.getJPAEntityType().getName();
    JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess();
    String edmEntityTypeName = null;
    if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
      edmEntityTypeName = mappingModelAccess.mapJPAEntityType(jpaEntityName);
    }

    JPAEdmMapping mapping = new JPAEdmMappingImpl();
    mapping.setJPAType(view.getJPAEntityType().getJavaType());

    if (edmEntityTypeName == null) {
      edmEntityTypeName = jpaEntityName;
    }
    // Setting the mapping object
    edmEntityType.setMapping(((Mapping) mapping).setInternalName(jpaEntityName));

    edmEntityType.setName(edmEntityTypeName);

  }
View Full Code Here

    return PUNIT_NAME;
  }

  @Override
  public EntityType getEdmEntityType() {
    EntityType entityType = new EntityType();
    entityType.setName(SimpleTypeA.NAME);
    return entityType;
  }
View Full Code Here

        return "salesorderprocessing";
      }

      @Override
      public EntityType getEdmEntityType() {
        EntityType entityType = new EntityType();
        entityType.setName("SalesOrderHeader");
        return entityType;
      }

      @SuppressWarnings("hiding")
      class AttributeMock<Object, String> extends JPAAttributeMock<Object, String> {
View Full Code Here

        return "salesorderprocessing";
      }

      @Override
      public EntityType getEdmEntityType() {
        EntityType entityType = new EntityType();
        entityType.setName("SalesOrderHeader");
        return entityType;
      }
View Full Code Here

  }

  @Override
  public EntityType searchEdmEntityType(final String arg0) {

    EntityType entityType = new EntityType();

    JPAEdmMappingImpl mapping = new JPAEdmMappingImpl();
    mapping.setJPAColumnName("SOID");

    List<Property> propList = new ArrayList<Property>();

    Property property = new Property() {};
    property.setMapping((Mapping) mapping);
    property.setName("SOID");
    propList.add(property);

    entityType.setProperties(propList);

    return entityType;
  }
View Full Code Here

  }

  @Test
  public void testBuildNegatives() {// Bad content type
    try {
      EntityType entity = new EntityType();
      entity.setName("SalesOrderHeader");
      try {
        assertNotNull(responseBuilder.build(getLocalGetURIInfo(), getEntity(), "xml"));
      } catch (ODataNotFoundException e) {
        assertTrue(true);
      }
View Full Code Here

  public void defaultNamespaceGeneration() throws ODataException {
    Collection<Class<?>> localAnnotatedClasses = new ArrayList<Class<?>>();
    localAnnotatedClasses.add(GeneratedNamesTestClass.class);
    AnnotationEdmProvider localAep = new AnnotationEdmProvider(localAnnotatedClasses);
    // validate
    EntityType testType = localAep.getEntityType(new FullQualifiedName(
        GeneratedNamesTestClass.class.getPackage().getName(),
        GeneratedNamesTestClass.class.getSimpleName()));
    assertNotNull("Requested entity not found.", testType);
    assertEquals("GeneratedNamesTestClass", testType.getName());
    assertNull("This should not have a base type", testType.getBaseType());
  }
View Full Code Here

  public void defaultNamespaceDefined() throws ODataException {
    Collection<Class<?>> localAnnotatedClasses = new ArrayList<Class<?>>();
    localAnnotatedClasses.add(DefinedNamesTestClass.class);
    AnnotationEdmProvider localAep = new AnnotationEdmProvider(localAnnotatedClasses);
    // validate
    EntityType testClass = localAep.getEntityType(new FullQualifiedName("MyTestNamespace",
        DefinedNamesTestClass.class.getSimpleName()));
    assertNotNull("Requested entity not found.", testClass);
    assertEquals("DefinedNamesTestClass", testClass.getName());
    assertNull("This should not have a base type", testClass.getBaseType());
  }
View Full Code Here

  @Test
  public void loadAnnotatedClassesFromPackage() throws Exception {
    AnnotationEdmProvider localAep = new AnnotationEdmProvider(TEST_MODEL_PACKAGE);

    // validate employee
    EntityType employee = localAep.getEntityType(new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "Employee"));
    assertEquals("Employee", employee.getName());
    final List<PropertyRef> employeeKeys = employee.getKey().getKeys();
    assertEquals(1, employeeKeys.size());
    assertEquals("EmployeeId", employeeKeys.get(0).getName());
    assertEquals(6, employee.getProperties().size());
    assertEquals(3, employee.getNavigationProperties().size());

    List<Schema> schemas = localAep.getSchemas();
    assertEquals(1, schemas.size());
    EntityContainerInfo info = localAep.getEntityContainerInfo(ModelSharedConstants.CONTAINER_1);
    assertTrue(info.isDefaultEntityContainer());
View Full Code Here

TOP

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

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.