net.ibizsys.model.engine.querydsl.database.sql.QuerydslSession Maven / Gradle / Ivy
package net.ibizsys.model.engine.querydsl.database.sql;
import java.util.HashMap;
import java.util.Map;
import net.ibizsys.model.dataentity.IPSDataEntity;
public class QuerydslSession implements IQuerydslSession {
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(QuerydslSession.class);
private Map querydslDataEntityMap = new HashMap();
private Map aliasIndexMap = new HashMap();
private Map paramMap = new HashMap();
private int nAliasIndex = 1;
private String strDBType = null;
public QuerydslSession() {
}
public QuerydslSession(Map paramMap) {
if(paramMap!=null) {
this.paramMap.putAll(paramMap);
}
}
@Override
public int getAliasIndex(String strTag) {
Integer nRet = this.aliasIndexMap.get(strTag);
if(nRet == null) {
nRet = nAliasIndex;
nAliasIndex += 10;
this.aliasIndexMap.put(strTag, nRet);
}
return nRet;
}
@Override
public int getCurrentAliasIndex() {
return this.nAliasIndex;
}
@Override
public String getAlias(String strTag) {
return String.format("t%1$s", this.getAliasIndex(strTag));
}
@Override
public String getDBType() {
return this.strDBType;
}
public void setDBType(String strDBType) {
this.strDBType = strDBType;
}
@Override
public IQuerydslDataEntity getQuerydslDataEntity(IPSDataEntity iPSDataEntity, String strTag) {
IQuerydslDataEntity iQuerydslDataEntity = this.querydslDataEntityMap.get(strTag);
if(iQuerydslDataEntity == null) {
iQuerydslDataEntity = this.createQuerydslDataEntity(iPSDataEntity, strTag);
this.querydslDataEntityMap.put(strTag, iQuerydslDataEntity);
}
return iQuerydslDataEntity;
}
protected IQuerydslDataEntity createQuerydslDataEntity(IPSDataEntity iPSDataEntity, String strTag) {
return new QuerydslDataEntity(this, iPSDataEntity, strTag);
}
@Override
public Object getParam(String strName) {
return this.paramMap.get(strName);
}
@Override
public void setParam(String strName, Object objValue) {
this.paramMap.put(strName, objValue);
}
@Override
public Object getContext(String strContextType, String strName) {
Object value = this.getParam(strContextType);
if(value instanceof Map) {
return ((Map)value).get(strName);
}
return null;
}
@Override
public boolean isEnableDynamicContext() {
return false;
}
}