Package com.impetus.kundera.metadata.model.type

Examples of com.impetus.kundera.metadata.model.type.AbstractManagedType


        }

        Map<Class<?>, AbstractManagedType<?>> managedTypes = getManagedTypes();
        Assert.assertNotNull(managedTypes);
        Assert.assertEquals(1, managedTypes.size());
        AbstractManagedType managedType = managedTypes.get(IDClassOwnerEntity.class);
        Assert.assertNotNull(managedType);
        Assert.assertEquals(2, managedType.getAttributes().size());
        Attribute idAttribute = managedType.getAttribute("id");

        SingularAttribute idAttrib = null;
        try
        {
            idAttrib = ((IdentifiableType) managedType).getId(IDClassEntity.class);
View Full Code Here


        }

        Map<Class<?>, AbstractManagedType<?>> managedTypes = getManagedTypes();
        Assert.assertNotNull(managedTypes);
        Assert.assertEquals(1, managedTypes.size());
        AbstractManagedType managedType = managedTypes.get(clazz);
        Assert.assertNotNull(managedType);
        Assert.assertEquals(2, managedType.getAttributes().size());
        Attribute idAttribute = managedType.getAttribute("id");

        SingularAttribute idAttrib = null;
        try
        {
            idAttrib = ((IdentifiableType) managedType).getId(EmbeddableEntity.class);
View Full Code Here

        Assert.assertEquals(2, managedTypes.size());

        Assert.assertEquals(1, builder.getMappedSuperClassTypes().size());

        // on subClass A
        AbstractManagedType managedType = managedTypes.get(SubClassA.class);
        Assert.assertNotNull(managedType);
        Assert.assertEquals(5, managedType.getAttributes().size());
        Assert.assertNotNull(managedType.getAttribute("mappedInt"));
        Assert.assertNotNull(managedType.getSingularAttribute("mappedInt", int.class));

        // on subClass A
        managedType = managedTypes.get(SubClassB.class);
        Assert.assertNotNull(managedType);
        Assert.assertEquals(5, managedType.getAttributes().size());
        Assert.assertNotNull(managedType.getAttribute("mappedInt"));
        Assert.assertNotNull(managedType.getSingularAttribute("mappedInt", int.class));
    }
View Full Code Here

        Assert.assertEquals(2, managedTypes.size());

        Assert.assertEquals(1, builder.getMappedSuperClassTypes().size());

        // on class CarPart
        AbstractManagedType managedType = managedTypes.get(CarPart.class);
        Assert.assertNotNull(managedType);
        Assert.assertEquals(2, managedType.getAttributes().size());
   

        // on class CarPartResource
        managedType = managedTypes.get(CarPartResource.class);
        Assert.assertNotNull(managedType);
        Assert.assertEquals(5, managedType.getAttributes().size());
      
    }
View Full Code Here

      
   

        // on class CarPartResource
        AbstractManagedType managedType = managedTypes.get(CarPartResource.class);
        Assert.assertNotNull(managedType);
      
       
      
       
        try
        {
            embeddableField = builder.getClass().getDeclaredField("embeddables");
        
            if (!embeddableField.isAccessible())
            {
                embeddableField.setAccessible(true);
            }
            Map<Class<?>, AbstractManagedType<?>> embeddables = ((Map<Class<?>, AbstractManagedType<?>>) embeddableField
                    .get(builder));
            Assert.assertEquals(2, embeddables.size());

            Field managedTypeField = builder.getClass().getDeclaredField("managedType");
            if (!managedTypeField.isAccessible())
            {
                managedTypeField.setAccessible(true);
            }

        

            // assert on embeddable first attribute
            SingularAttribute embeddableAttrib = managedType.getSingularAttribute("engine");
            assertOnEmbeddable(embeddableAttrib, CarEngine.class);
            EmbeddableType<X> embeddableType = (EmbeddableType<X>) embeddableAttrib.getType();
            Attribute<X, String> attribute = (Attribute<X, String>) embeddableType.getAttribute("engineId");
            assertOnEmbeddableType(CarEngine.class, attribute, embeddableType, "engineId", String.class);
View Full Code Here

        Assert.assertEquals(2, managedTypes.size());

        Assert.assertEquals(1, builder.getMappedSuperClassTypes().size());

        // on subClass EntityWithAttributeOverrides
        AbstractManagedType managedType = managedTypes.get(EntityWithAttributeOverrides.class);
        Assert.assertNotNull(managedType);
        Assert.assertEquals(5, managedType.getAttributes().size());
        Assert.assertNotNull(managedType.getAttribute("mappedInt"));

        String jpaName1 = ((AbstractAttribute<X, T>) managedType.getAttribute("mappedInt")).getJPAColumnName();

        String jpaName2 = ((AbstractAttribute<X, T>) managedType.getAttribute("mappedFloat")).getJPAColumnName();

        Assert.assertEquals("MAPPED_INT", jpaName1);
        Assert.assertEquals("MAPPED_FLOAT", jpaName2);

        Assert.assertNotNull(managedType.getSingularAttribute("mappedInt", int.class));

        // on subClass AttributeOverrideSubClass
        managedType = managedTypes.get(AttributeOverrideSubClass.class);

        jpaName1 = ((AbstractAttribute<X, T>) managedType.getAttribute("mappedInt")).getJPAColumnName();

        jpaName2 = ((AbstractAttribute<X, T>) managedType.getAttribute("mappedFloat")).getJPAColumnName();

        Assert.assertEquals("MAPPED_INT", jpaName1);
        Assert.assertEquals("mappedFloat", jpaName2);

        Assert.assertNotNull(managedType);
        Assert.assertEquals(5, managedType.getAttributes().size());
        Assert.assertNotNull(managedType.getAttribute("mappedInt"));
        Assert.assertNotNull(managedType.getSingularAttribute("mappedInt", int.class));

        clazz = (X) EntityWithIdAttributeOverride.class;
        // MetaModelBuilder builder = new MetaModelBuilder<X, T>();
        builder.process(clazz);
        field = clazz.getDeclaredFields();
        for (Field f : field)
        {
            builder.construct(clazz, f);
        }

        managedType = managedTypes.get(EntityWithIdAttributeOverride.class);

        jpaName1 = ((AbstractAttribute<X, T>) managedType.getAttribute("id")).getJPAColumnName();

        jpaName2 = ((AbstractAttribute<X, T>) managedType.getAttribute("mappedFloat")).getJPAColumnName();

        String jpaName3 = ((AbstractAttribute<X, T>) managedType.getAttribute("mappedInt")).getJPAColumnName();

        Assert.assertEquals("ID_ATTRIB", jpaName1);
        Assert.assertEquals("MAPPED_FLOAT", jpaName2);
        Assert.assertEquals("mappedInt", jpaName3);
View Full Code Here

        EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());

        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());

        AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(m.getEntityClazz());

        // For secondary tables.
        List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
                .getSecondaryTablesName();
        secondaryTables.add(m.getTableName());

        for (String tableName : secondaryTables)
        {
View Full Code Here

     * @return
     */
    private void populateSecondaryTableData(Object rowId, Object entity, MetamodelImpl metaModel,
            EntityMetadata metadata)
    {
        AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(metadata.getEntityClazz());
        List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
                .getSecondaryTablesName();

        for (String tableName : secondaryTables)
        {
            StringBuilder builder = createSelectQuery(rowId, metadata, tableName);
View Full Code Here

        BasicDBObject query = new BasicDBObject();

        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                entityMetadata.getPersistenceUnit());

        AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(entityMetadata.getEntityClazz());

        if (metaModel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType()))
        {
            MongoDBUtils.populateCompoundKey(query, entityMetadata, metaModel, key);
        }
        else
        {
            query.put("_id", MongoDBUtils.populateValue(key, key.getClass()));
        }

        // For secondary tables.
        List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
                .getSecondaryTablesName();
        secondaryTables.add(entityMetadata.getTableName());

        Object enhancedEntity = null;
        Map<String, Object> relationValue = null;
View Full Code Here

        {

            query.put("_id", MongoDBUtils.populateValue(pKey, pKey.getClass()));
        }

        AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(entityMetadata.getEntityClazz());
        // For secondary tables.
        List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
                .getSecondaryTablesName();
        secondaryTables.add(entityMetadata.getTableName());

        for (String collectionName : secondaryTables)
        {
View Full Code Here

TOP

Related Classes of com.impetus.kundera.metadata.model.type.AbstractManagedType

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.