package com.tcs.hrr.dao;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.tcs.hrr.domain.Requirement;
/**
* A data access object (DAO) providing persistence and search support for
* Requirement entities. Transaction control of the save(), update() and
* delete() operations can directly support Spring container-managed
* transactions or they can be augmented to handle user-managed Spring
* transactions. Each of these methods provides additional information for how
* to configure it for the desired type of transaction control.
*
* @see com.tcs.hrr.domain.Requirement
* @author MyEclipse Persistence Tools
*/
public class RequirementDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(RequirementDAO.class);
// property constants
public static final String REQUIREMENT_ID = "requirementId";
public static final String REQUEST_ID = "requestId";
public static final String IOU = "iou";
public static final String CUSTOMER_GROUP = "customerGroup";
public static final String CUSTOMER = "customer";
public static final String LOCATION = "location";
public static final String KEY_RESOURCE = "keyResource";
public static final String COMPETENCY_AREA = "competencyArea";
public static final String FOCUS_AREA = "focusArea";
public static final String SUB_FOCUS_AREA = "subFocusArea";
public static final String COMPETENCY_SUB_AREA = "competencySubArea";
public static final String COMPETENCY_SUB_AREA1 = "competencySubArea1";
public static final String COMPETENCY_SUB_AREA2 = "competencySubArea2";
public static final String COMPETENCY_SUB_AREA3 = "competencySubArea3";
public static final String PROFICIENCY = "proficiency";
public static final String EXPERIENCE = "experience";
public static final String RESUME_STATUS = "resumeStatus";
public static final String ROLE = "role";
public static final String TOTAL_EXP = "totalExp";
public static final String REALIZATION = "realization";
public static final String CURRENCY = "currency";
public static final String REMARKS = "remarks";
public static final String SUTIABEL_CANDIDATE = "sutiabelCandidate";
public static final String PREFFERED_STAFF_SOURCE = "prefferedStaffSource";
public static final String PREFFERED_DESIGNATION = "prefferedDesignation";
public static final String LOCATION_DETAIL = "locationDetail";
public static final String CITY = "city";
public static final String COUNTRY = "country";
public static final String STAFF_REASON = "staffReason";
public static final String WONNO = "wonno";
public static final String PROJECT_TYPE = "projectType";
public static final String WORK_SECTOR_ONSITE = "workSectorOnsite";
public static final String WORK_SECTOR_OFFSITE = "workSectorOffsite";
public static final String REQUEST_EMP_ID = "requestEmpId";
public static final String REQUEST_EMP_NAME = "requestEmpName";
public static final String RESUME_REJECT_NO = "resumeRejectNo";
public static final String REQUIREMENT_TYPE = "requirementType";
public static final String RMG_EMP_NO = "rmgEmpNo";
public static final String RMG_EMP_NAME = "rmgEmpName";
public static final String GRS_STATUS = "grsStatus";
public static final String REASSIGN_HISTORY = "reassignHistory";
public static final String BA_COMPNAME = "baCompname";
public static final String GRS_EMP_ID = "grsEmpId";
public static final String GRS_EMP_NAME = "grsEmpName";
public static final String HORIZONTAL = "horizontal";
public static final String STATUS = "status";
public static final String TAG_OWNER_ID = "tagOwnerId";
public static final String RESULT_REASON = "resultReason";
public static final String RESOURCE = "resource";
public static final String CREATE_BY = "createBy";
public static final String UPDATE_BY = "updateBy";
protected void initDao() {
// do nothing
}
public void save(Requirement transientInstance) {
log.debug("saving Requirement instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Requirement persistentInstance) {
log.debug("deleting Requirement instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Requirement findById(java.lang.Integer id) {
log.debug("getting Requirement instance with id: " + id);
try {
Requirement instance = (Requirement) getHibernateTemplate().get(
"com.tcs.hrr.domain.Requirement", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Requirement instance) {
log.debug("finding Requirement instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Requirement instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Requirement as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByRequirementId(Object requirementId) {
return findByProperty(REQUIREMENT_ID, requirementId);
}
public List findByRequestId(Object requestId) {
return findByProperty(REQUEST_ID, requestId);
}
public List findByIou(Object iou) {
return findByProperty(IOU, iou);
}
public List findByCustomerGroup(Object customerGroup) {
return findByProperty(CUSTOMER_GROUP, customerGroup);
}
public List findByCustomer(Object customer) {
return findByProperty(CUSTOMER, customer);
}
public List findByLocation(Object location) {
return findByProperty(LOCATION, location);
}
public List findByKeyResource(Object keyResource) {
return findByProperty(KEY_RESOURCE, keyResource);
}
public List findByCompetencyArea(Object competencyArea) {
return findByProperty(COMPETENCY_AREA, competencyArea);
}
public List findByFocusArea(Object focusArea) {
return findByProperty(FOCUS_AREA, focusArea);
}
public List findBySubFocusArea(Object subFocusArea) {
return findByProperty(SUB_FOCUS_AREA, subFocusArea);
}
public List findByCompetencySubArea(Object competencySubArea) {
return findByProperty(COMPETENCY_SUB_AREA, competencySubArea);
}
public List findByCompetencySubArea1(Object competencySubArea1) {
return findByProperty(COMPETENCY_SUB_AREA1, competencySubArea1);
}
public List findByCompetencySubArea2(Object competencySubArea2) {
return findByProperty(COMPETENCY_SUB_AREA2, competencySubArea2);
}
public List findByCompetencySubArea3(Object competencySubArea3) {
return findByProperty(COMPETENCY_SUB_AREA3, competencySubArea3);
}
public List findByProficiency(Object proficiency) {
return findByProperty(PROFICIENCY, proficiency);
}
public List findByExperience(Object experience) {
return findByProperty(EXPERIENCE, experience);
}
public List findByResumeStatus(Object resumeStatus) {
return findByProperty(RESUME_STATUS, resumeStatus);
}
public List findByRole(Object role) {
return findByProperty(ROLE, role);
}
public List findByTotalExp(Object totalExp) {
return findByProperty(TOTAL_EXP, totalExp);
}
public List findByRealization(Object realization) {
return findByProperty(REALIZATION, realization);
}
public List findByCurrency(Object currency) {
return findByProperty(CURRENCY, currency);
}
public List findByRemarks(Object remarks) {
return findByProperty(REMARKS, remarks);
}
public List findBySutiabelCandidate(Object sutiabelCandidate) {
return findByProperty(SUTIABEL_CANDIDATE, sutiabelCandidate);
}
public List findByPrefferedStaffSource(Object prefferedStaffSource) {
return findByProperty(PREFFERED_STAFF_SOURCE, prefferedStaffSource);
}
public List findByPrefferedDesignation(Object prefferedDesignation) {
return findByProperty(PREFFERED_DESIGNATION, prefferedDesignation);
}
public List findByLocationDetail(Object locationDetail) {
return findByProperty(LOCATION_DETAIL, locationDetail);
}
public List findByCity(Object city) {
return findByProperty(CITY, city);
}
public List findByCountry(Object country) {
return findByProperty(COUNTRY, country);
}
public List findByStaffReason(Object staffReason) {
return findByProperty(STAFF_REASON, staffReason);
}
public List findByWonno(Object wonno) {
return findByProperty(WONNO, wonno);
}
public List findByProjectType(Object projectType) {
return findByProperty(PROJECT_TYPE, projectType);
}
public List findByWorkSectorOnsite(Object workSectorOnsite) {
return findByProperty(WORK_SECTOR_ONSITE, workSectorOnsite);
}
public List findByWorkSectorOffsite(Object workSectorOffsite) {
return findByProperty(WORK_SECTOR_OFFSITE, workSectorOffsite);
}
public List findByRequestEmpId(Object requestEmpId) {
return findByProperty(REQUEST_EMP_ID, requestEmpId);
}
public List findByRequestEmpName(Object requestEmpName) {
return findByProperty(REQUEST_EMP_NAME, requestEmpName);
}
public List findByResumeRejectNo(Object resumeRejectNo) {
return findByProperty(RESUME_REJECT_NO, resumeRejectNo);
}
public List findByRequirementType(Object requirementType) {
return findByProperty(REQUIREMENT_TYPE, requirementType);
}
public List findByRmgEmpNo(Object rmgEmpNo) {
return findByProperty(RMG_EMP_NO, rmgEmpNo);
}
public List findByRmgEmpName(Object rmgEmpName) {
return findByProperty(RMG_EMP_NAME, rmgEmpName);
}
public List findByGrsStatus(Object grsStatus) {
return findByProperty(GRS_STATUS, grsStatus);
}
public List findByReassignHistory(Object reassignHistory) {
return findByProperty(REASSIGN_HISTORY, reassignHistory);
}
public List findByBaCompname(Object baCompname) {
return findByProperty(BA_COMPNAME, baCompname);
}
public List findByGrsEmpId(Object grsEmpId) {
return findByProperty(GRS_EMP_ID, grsEmpId);
}
public List findByGrsEmpName(Object grsEmpName) {
return findByProperty(GRS_EMP_NAME, grsEmpName);
}
public List findByHorizontal(Object horizontal) {
return findByProperty(HORIZONTAL, horizontal);
}
public List findByStatus(Object status) {
return findByProperty(STATUS, status);
}
public List findByTagOwnerId(Object tagOwnerId) {
return findByProperty(TAG_OWNER_ID, tagOwnerId);
}
public List findByResultReason(Object resultReason) {
return findByProperty(RESULT_REASON, resultReason);
}
public List findByResource(Object resource) {
return findByProperty(RESOURCE, resource);
}
public List findByCreateBy(Object createBy) {
return findByProperty(CREATE_BY, createBy);
}
public List findByUpdateBy(Object updateBy) {
return findByProperty(UPDATE_BY, updateBy);
}
public List findAll() {
log.debug("finding all Requirement instances");
try {
String queryString = "from Requirement";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Requirement merge(Requirement detachedInstance) {
log.debug("merging Requirement instance");
try {
Requirement result = (Requirement) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Requirement instance) {
log.debug("attaching dirty Requirement instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Requirement instance) {
log.debug("attaching clean Requirement instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static RequirementDAO getFromApplicationContext(
ApplicationContext ctx) {
return (RequirementDAO) ctx.getBean("RequirementDAO");
}
public List findAllRequirementIds(){
String stringQuery = "select requirementId from Requirement";
Query query = this.getSession().createQuery(stringQuery);
List list = query.list();
return list;
}
}