Package com.buschmais.cdo.spi.datastore

Examples of com.buschmais.cdo.spi.datastore.TypeMetadataSet


                    }
                }
            }
        }
        // remove all super types if their sub types are already contained in the type set
        TypeMetadataSet<EntityTypeMetadata<EntityMetadata>> uniqueTypes = new TypeMetadataSet();
        for (EntityTypeMetadata<EntityMetadata> entityTypeMetadata : allEntityTypeMetadatas) {
            AnnotatedType annotatedType = entityTypeMetadata.getAnnotatedType();
            boolean subtype = false;
            for (Iterator<EntityTypeMetadata<EntityMetadata>> subTypeIterator = allEntityTypeMetadatas.iterator(); subTypeIterator.hasNext() && !subtype; ) {
                AnnotatedType otherAnnotatedType = subTypeIterator.next().getAnnotatedType();
                if (!annotatedType.equals(otherAnnotatedType) && annotatedType.getAnnotatedElement().isAssignableFrom(otherAnnotatedType.getAnnotatedElement())) {
                    subtype = true;
                }
            }
            if (!subtype) {
                uniqueTypes.add(entityTypeMetadata);
            }
        }
        return uniqueTypes;
    }
View Full Code Here


        }, cdoTransaction);
    }

    @Override
    public CompositeObject create(Class type, Class<?>... types) {
        TypeMetadataSet effectiveTypes = getEffectiveTypes(type, types);
        Set<Discriminator> discriminators = metadataProvider.getDiscriminators(effectiveTypes);
        Entity entity = datastoreSession.create(effectiveTypes, discriminators);
        CompositeObject instance = instanceManager.getInstance(entity);
        return instance;
    }
View Full Code Here

    @Override
    public <T, M> CompositeObject migrate(T instance, MigrationStrategy<T, M> migrationStrategy, Class<M> targetType, Class<?>... targetTypes) {
        Entity entity = instanceManager.getEntity(instance);
        Set<Discriminator> discriminators = datastoreSession.getDiscriminators(entity);
        TypeMetadataSet types = metadataProvider.getTypes(discriminators);
        TypeMetadataSet effectiveTargetTypes = getEffectiveTypes(targetType, targetTypes);
        Set<Discriminator> targetDiscriminators = metadataProvider.getDiscriminators(effectiveTargetTypes);
        datastoreSession.migrate(entity, types, discriminators, effectiveTargetTypes, targetDiscriminators);
        instanceManager.removeInstance(instance);
        CompositeObject migratedInstance = instanceManager.getInstance(entity);
        if (migrationStrategy != null) {
View Full Code Here

            datastoreSession.flush(entity);
        }
    }

    private TypeMetadataSet<EntityMetadata> getEffectiveTypes(Class<?> type, Class<?>... types) {
        TypeMetadataSet<EntityMetadata> effectiveTypes = new TypeMetadataSet();
        effectiveTypes.add(metadataProvider.getEntityMetadata(type));
        for (Class<?> otherType : types) {
            effectiveTypes.add(metadataProvider.getEntityMetadata(otherType));
        }
        return effectiveTypes;
    }
View Full Code Here

                    }
                }
            }
        }
        // remove all super types if their sub types are already contained in the type set
        TypeMetadataSet<EntityMetadata> uniqueTypes = new TypeMetadataSet();
        for (TypeMetadata<EntityMetadata> typeMetadata : allTypeMetadatas) {
            AnnotatedType annotatedType = typeMetadata.getAnnotatedType();
            boolean subtype = false;
            for (Iterator<TypeMetadata<EntityMetadata>> subTypeIterator = allTypeMetadatas.iterator(); subTypeIterator.hasNext() && !subtype; ) {
                AnnotatedType otherAnnotatedType = subTypeIterator.next().getAnnotatedType();
                if (!annotatedType.equals(otherAnnotatedType) && annotatedType.getAnnotatedElement().isAssignableFrom(otherAnnotatedType.getAnnotatedElement())) {
                    subtype = true;
                }
            }
            if (!subtype) {
                uniqueTypes.add(typeMetadata);
            }
        }
        return uniqueTypes;
    }
View Full Code Here

TOP

Related Classes of com.buschmais.cdo.spi.datastore.TypeMetadataSet

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.