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

com.jpattern.orm.crud.OrmCRUDQuery Maven / Gradle / Ivy

There is a newer version: 3.5.1
Show newest version
package com.jpattern.orm.crud;



/**
 * 
 * @author Francesco Cina
 *
 * 22/mag/2011
 */
public class OrmCRUDQuery implements IOrmCRUDQuery {

	/**
	 * 
	 */
	
	private final String updateQuery;
	private final String deleteQuery;
	private final String loadQuery;
	private final String saveQuery;
	private final String baseSelectClause;
	private final String baseFromClause;
	private final boolean generatedKey;
	private final String beanVersionQuery;

	public OrmCRUDQuery(String deleteQuery, String loadQuery, String saveQuery, String updateQuery, String baseSelectClause, String baseFromClause, boolean generatedKey,
			String beanVersionQuery) {
		this.deleteQuery = deleteQuery;
		this.loadQuery = loadQuery;
		this.saveQuery = saveQuery;
		this.updateQuery = updateQuery;
		this.baseSelectClause = baseSelectClause;
		this.baseFromClause = baseFromClause;
		this.generatedKey = generatedKey;
		this.beanVersionQuery = beanVersionQuery;
	}
	
	@Override
	public String getLoadQuery() {
		return loadQuery;
	}

	@Override
	public String getSaveQuery() {
		return saveQuery;
	}

	@Override
	public String getDeleteQuery() {
		return deleteQuery;
	}

	@Override
	public String getUpdateQuery() {
		return updateQuery;
	}

	@Override
	public boolean generatedKey() {
		return generatedKey;
	}

	@Override
	public String getBaseSelectClause() {
		return getBaseSelectClause(getBaseFromClause() + ".");
	}

	@Override
	public String getBaseFromClause() {
		return baseFromClause;
	}

	@Override
	public String getBaseSelectClause(String rowNamePrefix) {
		return baseSelectClause.replaceAll("\\" + ICrudConstants.ROW_NAME_PREFIX_PLACEHOLDER, rowNamePrefix);
	}

	@Override
	public String getBeanVersionQuery() {
		return beanVersionQuery;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy