com.bld.commons.service.QueryJpql Maven / Gradle / Ivy
The newest version!
/**
* @author Francesco Baldi
* @mail [email protected]
* @class bld.commons.service.QueryJpql.java
*/
package com.bld.commons.service;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import org.apache.commons.collections4.MapUtils;
/**
* The Class QueryJpql.
*
* @param the generic type
*/
public abstract class QueryJpql {
/** The map one to many. */
protected Map> mapOneToMany;
/**
* Instantiates a new query jpql.
*/
public QueryJpql() {
super();
this.mapOneToMany=new HashMap<>();
}
/**
* Map one to many.
*/
public abstract void mapOneToMany();
/**
* Select by filter.
*
* @return the string
*/
public abstract String selectByFilter();
public abstract String selectIdByFilter();
/**
* Count by filter.
*
* @return the string
*/
public abstract String countByFilter();
/**
* Delete by filter.
*
* @return the string
*/
public abstract String deleteByFilter();
/**
* Map condizioni.
*
* @return the map
*/
public abstract Map mapConditions();
/**
* Map delete conditions.
*
* @return the map
*/
public abstract Map mapDeleteConditions();
/**
* Map native conditions.
*
* @return the map
*/
public abstract Map> mapNativeConditions();
/**
* Map native orders.
*
* @return the map
*/
public abstract Map mapNativeOrders();
/**
* Map jpa orders.
*
* @return the map
*/
public abstract Map mapJpaOrders();
/**
* Adds the join one to many.
*
* @param key the key
* @param join the join
*/
protected void addJoinOneToMany(String key, String... join) {
if (!this.mapOneToMany.containsKey(key))
this.mapOneToMany.put(key, new LinkedHashSet<>());
this.mapOneToMany.get(key).addAll(new LinkedHashSet<>(Arrays.asList(join)));
}
/**
* Gets the map one to many.
*
* @return the map one to many
*/
public Map> getMapOneToMany() {
if(MapUtils.isEmpty(this.mapOneToMany))
this.mapOneToMany();
return mapOneToMany;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy