Package org.jboss.solder.properties.query

Examples of org.jboss.solder.properties.query.AnnotatedPropertyCriteria


        );
    }

    protected void configureIdentityId() throws IdentityException {
        List<Property<Object>> props = PropertyQueries.createQuery(identityClass)
                .addCriteria(new AnnotatedPropertyCriteria(Id.class))
                .getResultList();

        if (props.size() == 1) {
            modelProperties.put(PROPERTY_IDENTITY_ID, props.get(0));
        } else {
View Full Code Here


        return entityClass.isAnnotationPresent(Entity.class);
    }

    private static Property<Serializable> primaryKey(Class<?> entityClass) {
        PropertyQuery<Serializable> query = PropertyQueries.<Serializable>createQuery(entityClass)
                                                           .addCriteria(new AnnotatedPropertyCriteria(Id.class));

        if (query.getFirstResult() == null) {
            query = PropertyQueries.<Serializable>createQuery(entityClass)
                    .addCriteria(new AnnotatedPropertyCriteria(EmbeddedId.class));
        }

        if (query.getFirstResult() == null) {
            throw new IllegalStateException("Class " + entityClass + " has no id defined");
        }
View Full Code Here

    boolean isEntity(Class<?> entity) {
        return entity.isAnnotationPresent(Entity.class);
    }

    boolean hasPrimaryKey(Class<?> entity) {
        final AnnotatedPropertyCriteria hasId = new AnnotatedPropertyCriteria(Id.class);
        PropertyQuery<Serializable> query = PropertyQueries.<Serializable> createQuery(entity).addCriteria(hasId);
        return query.getFirstResult() != null;
    }
View Full Code Here

   
    private void updateTimestamps(Object entity, boolean create) {
        long systime = System.currentTimeMillis();
        List<Property<Object>> properties = new LinkedList<Property<Object>>();
        PropertyQuery<Object> query = PropertyQueries.<Object>createQuery(entity.getClass())
                .addCriteria(new AnnotatedPropertyCriteria(ModifiedOn.class));
        properties.addAll(query.getWritableResultList());
        if (create) {
            query = PropertyQueries.<Object>createQuery(entity.getClass())
                    .addCriteria(new AnnotatedPropertyCriteria(CreatedOn.class));
            properties.addAll(query.getWritableResultList());
        }
        for (Property<Object> property : properties) {
            setProperty(entity, property, systime, create);
        }
View Full Code Here

        updatePrincipal(entity);
    }

    private void updatePrincipal(Object entity) {
        PropertyQuery<Object> query = PropertyQueries.<Object>createQuery(entity.getClass())
                .addCriteria(new AnnotatedPropertyCriteria(ModifiedBy.class));
        for (Property<Object> property : query.getWritableResultList()) {
            setProperty(entity, property);
        }
    }
View Full Code Here

        }
    }
   
    private static List<PropertyCriteria> criteriaList(Class<?> entityClass) {
        List<PropertyCriteria> criteria = new LinkedList<PropertyCriteria>();
        criteria.add(new AnnotatedPropertyCriteria(Id.class));
        criteria.add(new AnnotatedPropertyCriteria(EmbeddedId.class));
        String fromMappingFiles = PersistenceUnits.instance().primaryKeyField(entityClass);
        if (fromMappingFiles != null) {
            criteria.add(new NamedPropertyCriteria(fromMappingFiles));
        }
        return criteria;
View Full Code Here

   
    private void updateTimestamps(Object entity, boolean create) {
        long systime = System.currentTimeMillis();
        List<Property<Object>> properties = new LinkedList<Property<Object>>();
        PropertyQuery<Object> query = PropertyQueries.<Object>createQuery(entity.getClass())
                .addCriteria(new AnnotatedPropertyCriteria(ModifiedOn.class));
        properties.addAll(query.getWritableResultList());
        if (create) {
            query = PropertyQueries.<Object>createQuery(entity.getClass())
                    .addCriteria(new AnnotatedPropertyCriteria(CreatedOn.class));
            properties.addAll(query.getWritableResultList());
        }
        for (Property<Object> property : properties) {
            setProperty(entity, property, systime, create);
        }
View Full Code Here

        updatePrincipal(entity);
    }

    private void updatePrincipal(Object entity) {
        PropertyQuery<Object> query = PropertyQueries.<Object>createQuery(entity.getClass())
                .addCriteria(new AnnotatedPropertyCriteria(ModifiedBy.class));
        for (Property<Object> property : query.getWritableResultList()) {
            setProperty(entity, property);
        }
    }
View Full Code Here

        }
    }
   
    private static List<PropertyCriteria> criteriaList(Class<?> entityClass) {
        List<PropertyCriteria> criteria = new LinkedList<PropertyCriteria>();
        criteria.add(new AnnotatedPropertyCriteria(Id.class));
        criteria.add(new AnnotatedPropertyCriteria(EmbeddedId.class));
        String fromMappingFiles = PersistenceUnits.instance().primaryKeyField(entityClass);
        if (fromMappingFiles != null) {
            criteria.add(new NamedPropertyCriteria(fromMappingFiles));
        }
        return criteria;
View Full Code Here

TOP

Related Classes of org.jboss.solder.properties.query.AnnotatedPropertyCriteria

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.