Package com.impetus.kundera.metadata.validator

Examples of com.impetus.kundera.metadata.validator.EntityValidatorImpl


        ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata();

        // TODO, FIXME: Refactoring is required.
        for (String persistenceUnit : persistenceUnits)
        {
            EntityValidator validator = new EntityValidatorImpl(KunderaCoreUtils.getExternalProperties(persistenceUnit,
                    externalPropertyMap, persistenceUnits));

            log.info("Configuring schema export for : " + persistenceUnit);
            List<TableInfo> tableInfos = getSchemaInfo(persistenceUnit);

            Map<String, EntityMetadata> entityMetadataMap = getEntityMetadataCol(appMetadata, persistenceUnit);

            PersistenceUnitMetadata puMetadata = appMetadata.getPersistenceUnitMetadata(persistenceUnit);

            // Iterate each entity metadata.
            for (EntityMetadata entityMetadata : entityMetadataMap.values())
            {
                // get entity metadata(table info as well as columns)
                // if table info exists, get it from map.
                boolean found = false;

                Type type = entityMetadata.getType();
                Class idClassName = entityMetadata.getIdAttribute() != null ? entityMetadata.getIdAttribute()
                        .getJavaType() : null;

                String idName = entityMetadata.getIdAttribute() != null ? ((AbstractAttribute) entityMetadata
                        .getIdAttribute()).getJPAColumnName() : null;

                TableInfo tableInfo = new TableInfo(entityMetadata.getTableName(), type.name(), idClassName, idName);

                // check for tableInfos not empty and contains the present
                // tableInfo.
                if (!tableInfos.isEmpty() && tableInfos.contains(tableInfo))
                {
                    found = true;
                    int idx = tableInfos.indexOf(tableInfo);
                    tableInfo = tableInfos.get(idx);
                    addColumnToTableInfo(entityMetadata, type, tableInfo);
                }
                else
                {
                    addColumnToTableInfo(entityMetadata, type, tableInfo);
                }

                List<Relation> relations = entityMetadata.getRelations();

                parseRelations(persistenceUnit, tableInfos, entityMetadata, tableInfo, relations);

                if (!found)
                {
                    tableInfos.add(tableInfo);
                }
                // Add table for GeneratedValue if opted TableStrategy
                addTableGenerator(appMetadata, persistenceUnit, tableInfos, entityMetadata);

                // Validating entity against counter column family.
                validator.validateEntity(entityMetadata.getEntityClazz(), kunderaMetadata);
            }

            puToSchemaMetadata.put(persistenceUnit, tableInfos);

        }
View Full Code Here


     * Instantiates a new many to many relation metadata processor.
     */
    public ManyToManyRelationMetadataProcessor(KunderaMetadata kunderaMetadata)
    {
        super(kunderaMetadata);
        validator = new EntityValidatorImpl();
    }
View Full Code Here

     * Instantiates a new table processor.
     */
    public TableProcessor(Map puProperty, KunderaMetadata kunderaMetadata)
    {
        super(kunderaMetadata);
        validator = new EntityValidatorImpl(puProperty);
        // validator = new EntityValidatorImpl(puProperty);
        ValidationFactoryGenerator generator = new ValidationFactoryGenerator();
        this.factory = generator.getFactory(ValidationFactoryType.BOOT_STRAP_VALIDATION);
        this.puProperties = puProperty;
    }
View Full Code Here

    public MetadataBuilder(String puName, String client, Map puProperties, KunderaMetadata kunderaMetadata)
    {
        this.persistenceUnit = puName;
        this.client = client;
        this.puProperties = puProperties;
        this.validator = new EntityValidatorImpl(puProperties);
        this.metadataProcessors = new ArrayList<MetadataProcessor>();
        this.kunderaMetadata = kunderaMetadata;

        // add processors to chain.
        this.metadataProcessors.add(new TableProcessor(puProperties,kunderaMetadata));
View Full Code Here

     * Instantiates a new one to many relation metadata processor.
     */
    public OneToManyRelationMetadataProcessor(KunderaMetadata kunderaMetadata)
    {
        super(kunderaMetadata);
        validator = new EntityValidatorImpl();
    }
View Full Code Here

     * Instantiates a new many to one relation metadata processor.
     */
    public ManyToOneRelationMetadataProcessor(KunderaMetadata kunderaMetadata)
    {
        super(kunderaMetadata);
        validator = new EntityValidatorImpl();
    }
View Full Code Here

TOP

Related Classes of com.impetus.kundera.metadata.validator.EntityValidatorImpl

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.