All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nuiton.topia.it.mapping.test12.GeneratedA12ATopiaDao Maven / Gradle / Ivy

There is a newer version: 4.0
Show newest version
package org.nuiton.topia.it.mapping.test12;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;
import org.nuiton.topia.it.mapping.AbstractTopiaItMappingTopiaDao;
import org.nuiton.topia.it.mapping.TopiaItMappingEntityEnum;
import org.nuiton.topia.persistence.TopiaDao;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep;

@Generated(value = "org.nuiton.topia.templates.EntityDaoTransformer", date = "Thu Oct 13 17:59:14 CEST 2016")
public abstract class GeneratedA12ATopiaDao extends AbstractTopiaItMappingTopiaDao {

    @Override
    public Class getEntityClass() {
        return (Class) A12A.class;
    }

    @Override
    public TopiaItMappingEntityEnum getTopiaEntityEnum() {
        return TopiaItMappingEntityEnum.A12A;
    }

    @Override
    public void delete(E entity) {
        if ( ! entity.isPersisted()) {
            throw new IllegalArgumentException("entity " + entity  + " is not persisted, you can't delete it");
        }

        super.delete(entity);
    }

    public E createByNotNull(int integerField, String stringField, Date dateField) {
        return create(A12A.PROPERTY_INTEGER_FIELD, integerField, A12A.PROPERTY_STRING_FIELD, stringField, A12A.PROPERTY_DATE_FIELD, dateField);
    }

    public TopiaQueryBuilderAddCriteriaOrRunQueryStep forIntegerFieldIn(Collection v) {
        TopiaQueryBuilderAddCriteriaOrRunQueryStep result = forIn(A12A.PROPERTY_INTEGER_FIELD, (Collection) v);
        return result;
    }

    public TopiaQueryBuilderAddCriteriaOrRunQueryStep forIntegerFieldEquals(int v) {
        TopiaQueryBuilderAddCriteriaOrRunQueryStep result = forEquals(A12A.PROPERTY_INTEGER_FIELD, v);
        return result;
    }

    @Deprecated
    public E findByIntegerField(int v) {
        return forIntegerFieldEquals(v).findAnyOrNull();
    }

    @Deprecated
    public List findAllByIntegerField(int v) {
        return forIntegerFieldEquals(v).findAll();
    }

    public TopiaQueryBuilderAddCriteriaOrRunQueryStep forStringFieldIn(Collection v) {
        TopiaQueryBuilderAddCriteriaOrRunQueryStep result = forIn(A12A.PROPERTY_STRING_FIELD, (Collection) v);
        return result;
    }

    public TopiaQueryBuilderAddCriteriaOrRunQueryStep forStringFieldEquals(String v) {
        TopiaQueryBuilderAddCriteriaOrRunQueryStep result = forEquals(A12A.PROPERTY_STRING_FIELD, v);
        return result;
    }

    @Deprecated
    public E findByStringField(String v) {
        return forStringFieldEquals(v).findAnyOrNull();
    }

    @Deprecated
    public List findAllByStringField(String v) {
        return forStringFieldEquals(v).findAll();
    }

    public TopiaQueryBuilderAddCriteriaOrRunQueryStep forDateFieldIn(Collection v) {
        TopiaQueryBuilderAddCriteriaOrRunQueryStep result = forIn(A12A.PROPERTY_DATE_FIELD, (Collection) v);
        return result;
    }

    public TopiaQueryBuilderAddCriteriaOrRunQueryStep forDateFieldEquals(Date v) {
        TopiaQueryBuilderAddCriteriaOrRunQueryStep result = forEquals(A12A.PROPERTY_DATE_FIELD, v);
        return result;
    }

    @Deprecated
    public E findByDateField(Date v) {
        return forDateFieldEquals(v).findAnyOrNull();
    }

    @Deprecated
    public List findAllByDateField(Date v) {
        return forDateFieldEquals(v).findAll();
    }

    @Override
    public  List findUsages(Class type, E entity) {
        return new LinkedList();
    }

    @Override
    public Map, List> findAllUsages(E entity) {
        return new HashMap, List>();
    }

    @Override
    public List getAggregate(E entity) throws TopiaException {
        List tmp = new ArrayList();

        // pour tous les attributs rechecher les composites et les class d'asso
        // on les ajoute dans tmp

        // on refait un tour sur chaque entity de tmp pour recuperer leur
        // composite
        List result = new ArrayList();
        for (TopiaEntity e : tmp) {
            result.add(e);
            TopiaDao dao = (TopiaDao) topiaDaoSupplier.getDao(e.getClass());
            result.addAll(dao.getAggregate(e));
        }
        return result;
    }

    @Override
    public List getComposite(E entity) throws TopiaException {
        List tmp = new ArrayList();

        // pour tous les attributs rechecher les composites et les class d'asso
        // on les ajoute dans tmp

        // on refait un tour sur chaque entity de tmp pour recuperer leur
        // composite
        List result = new ArrayList();
        for (TopiaEntity e : tmp) {
            if (e != null) {
                result.add(e);
                TopiaDao dao = (TopiaDao) topiaDaoSupplier.getDao(e.getClass());
                result.addAll(dao.getComposite(e));
            }
        }
        return result;
    }

} //GeneratedA12ATopiaDao