Examples of EntityMeta


Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

    public void addInterceptorsToEntityMetas(List<Interceptor<?>> interceptors, Map<Class<?>,
            EntityMeta> entityMetaMap) {
        for (Interceptor<?> interceptor : interceptors) {
            Class<?> entityClass = propertyParser.inferEntityClassFromInterceptor(interceptor);
            EntityMeta entityMeta = entityMetaMap.get(entityClass);
            Validator.validateBeanMappingTrue(entityMeta != null, "The entity class '%s' is not found",
                    entityClass.getCanonicalName());
            entityMeta.forInterception().addInterceptor(interceptor);
        }
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

        return counterDelta;
    }

    public void deleteRelatedCounters(EntityOperations context) {
        log.trace("Deleting counter values related to entity using PersistenceContext {}", context);
        EntityMeta entityMeta = context.getEntityMeta();

        for (PropertyMeta pm : entityMeta.getAllCounterMetas()) {
            context.bindForSimpleCounterDeletion(pm);
        }
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

    public void update(EntityOperations context, Object entity) {
        log.debug("Merging entity of class {} with primary key {}", context.getEntityClass().getCanonicalName(),
                context.getPrimaryKey());

        EntityMeta entityMeta = context.getEntityMeta();

        Validator.validateNotNull(entity, "Proxy object should not be null for update");
        Validator.validateNotNull(entityMeta, "entityMeta should not be null for update");

        log.debug("Checking for dirty fields before merging");

        Object realObject = proxifier.getRealObject(entity);
        context.setEntity(realObject);

        ProxyInterceptor<Object> interceptor = proxifier.getInterceptor(entity);
        Map<Method, DirtyChecker> dirtyMap = interceptor.getDirtyMap();
        List<DirtyChecker> dirtyCheckers = new ArrayList<>(dirtyMap.values());

        if (dirtyCheckers.size() > 0) {
            pushDirtySimpleFields(context, dirtyCheckers);
            pushCollectionAndMapUpdates(context, dirtyCheckers);
            dirtyMap.clear();
        }

        if (context.isClusteredCounter()) {
            counterPersister.persistClusteredCounters(context);
        } else {
            counterPersister.persistCounters(context, entityMeta.getAllCounterMetas());
        }
        interceptor.setEntityOperations(context);
        interceptor.setTarget(realObject);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

        Class<?> proxyClass = factory.createProxyClass(entity.getClass(), context.getConfigContext());

        @SuppressWarnings("unchecked")
        T instance = (T) instantiator.instantiate(proxyClass);

        EntityMeta meta = context.getEntityMeta();
        for (PropertyMeta pm : meta.getAllMetasExceptCounters()) {
            Object value = pm.forValues().getValueFromField(entity);
            pm.forValues().setValueToField(instance, value);
        }

        for (PropertyMeta pm : meta.getAllCounterMetas()) {
            pm.forValues().setValueToField(entity,null);
        }

        ((Factory) instance).setCallbacks(new Callback[] {
                buildInterceptor(context, entity, alreadyLoaded),
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

    public void validateEntity(Object entity, Map<Class<?>, EntityMeta> entityMetaMap) {
        Validator.validateNotNull(entity, "Entity should not be null");

        Class<?> baseClass = proxifier.deriveBaseClass(entity);
        EntityMeta entityMeta = entityMetaMap.get(baseClass);
        validateEntity(entity, entityMeta);

    }
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

    }

    public void validateNotClusteredCounter(Object entity, Map<Class<?>, EntityMeta> entityMetaMap) {
        log.trace("Validate that entity {} is not a clustered counter", entity);
        Class<?> baseClass = proxifier.deriveBaseClass(entity);
        EntityMeta entityMeta = entityMetaMap.get(baseClass);
        Validator.validateFalse(entityMeta.structure().isClusteredCounter(),
                "The entity '%s' is a clustered counter and does not support insert/update with TTL", entity);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

        return proxifier.removeProxy(proxies);
    }

    protected <T> SliceQueryBuilder<T> sliceQuery(Class<T> entityClass) {
        Validator.validateNotNull(entityClass,"The entityClass should be provided for slice query");
        EntityMeta meta = entityMetaMap.get(entityClass);
        Validator.validateNotNull(meta, "The entity '%s' is not managed by achilles", entityClass.getName());
        Validator.validateTrue(meta.structure().isClusteredEntity(),"Cannot perform slice query on entity type '%s' because it is " + "not a clustered entity",meta.getClassName());
        return new SliceQueryBuilder<>(sliceQueryExecutor, entityClass, meta);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

        log.debug("Execute typed query for entity class {}", entityClass);
        Validator.validateNotNull(entityClass, "The entityClass for typed query should not be null");
        Validator.validateNotNull(regularStatement, "The regularStatement for typed query should not be null");
        Validator.validateTrue(entityMetaMap.containsKey(entityClass),"Cannot perform typed query because the entityClass '%s' is not managed by Achilles",entityClass.getCanonicalName());

        EntityMeta meta = entityMetaMap.get(entityClass);
        typedQueryValidator.validateTypedQuery(entityClass, regularStatement, meta);
        return new TypedQuery<>(entityClass, daoContext, configContext, regularStatement, meta, contextFactory, MANAGED, boundValues);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

    protected <T> TypedQuery<T> rawTypedQuery(Class<T> entityClass, RegularStatement regularStatement, Object... boundValues) {
        Validator.validateNotNull(entityClass, "The entityClass for typed query should not be null");
        Validator.validateNotNull(regularStatement, "The regularStatement for typed query should not be null");
        Validator.validateTrue(entityMetaMap.containsKey(entityClass),"Cannot perform typed query because the entityClass '%s' is not managed by Achilles",entityClass.getCanonicalName());

        EntityMeta meta = entityMetaMap.get(entityClass);
        typedQueryValidator.validateRawTypedQuery(entityClass, regularStatement, meta);
        return new TypedQuery<>(entityClass, daoContext, configContext, regularStatement, meta, contextFactory, NOT_MANAGED, boundValues);
    }
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta

        typedQueryValidator.validateRawTypedQuery(entityClass, regularStatement, meta);
        return new TypedQuery<>(entityClass, daoContext, configContext, regularStatement, meta, contextFactory, NOT_MANAGED, boundValues);
    }

    protected <T> TypedQuery<T> indexedQuery(Class<T> entityClass, IndexCondition indexCondition) {
        EntityMeta entityMeta = entityMetaMap.get(entityClass);

        Validator.validateFalse(entityMeta.structure().isClusteredEntity(), "Index query is not supported for clustered entity. Please use typed query/native query");
        Validator.validateNotNull(indexCondition, "Index condition should not be null");

        entityMeta.forTranscoding().encodeIndexConditionValue(indexCondition);

        String indexColumnName = indexCondition.getColumnName();
        final EntityMetaConfig metaConfig = entityMeta.config();
        final Select.Where statement = select().from(metaConfig.getKeyspaceName(), metaConfig.getTableName()).where(eq(indexColumnName, bindMarker(indexColumnName)));
        return this.typedQueryInternal(entityClass, statement, indexCondition.getColumnValue());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.