Example usage for org.hibernate.criterion Restrictions and

List of usage examples for org.hibernate.criterion Restrictions and

Introduction

In this page you can find the example usage for org.hibernate.criterion Restrictions and.

Prototype

public static LogicalExpression and(Criterion lhs, Criterion rhs) 

Source Link

Document

Return the conjuction of two expressions

Usage

From source file:org.egov.pims.service.EmployeeServiceImpl.java

License:Open Source License

/**
 * Returns the list of Employees who are assigned to the given department as
 * of given date.//from   w w w .j  a  va2s.c  om
 * 
 * @param deptId
 *            - Integer representing id of department
 * @param date
 *            - Given date. If null, current date is assumed.
 * @return List of EmployeeView
 */
public List<EmployeeView> getEmployeeInfoBasedOnDeptAndDate(Integer deptId, Date date) {
    if (date == null)
        date = new Date();
    List<EmployeeView> employeeList = new ArrayList<EmployeeView>();
    Criteria criteria = getCurrentSession().createCriteria(EmployeeView.class)
            .createAlias("deptId", "department").add(Restrictions.eq("department.id", deptId))
            .add(Restrictions.eq("isActive", 1))
            .add(Restrictions.and(Restrictions.le("fromDate", date), Restrictions.ge("toDate", date)));
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return criteria.list();
}

From source file:org.egov.pims.service.PersonalInformationService.java

License:Open Source License

private Criteria getCriteriaForEmpSearchByStatus(Integer statusid, Date fromDate, Date toDate) {
    EgwStatus egwStatus = egwStatusHibernateDAO.findById(statusid, false);
    DetachedCriteria detachCriteriaPersonalInfo = DetachedCriteria.forClass(PersonalInformation.class, "emp");
    if (egwStatus.getModuletype().equals("Employee")
            && egwStatus.getDescription().equalsIgnoreCase("Employed")) {
        detachCriteriaPersonalInfo.createAlias("emp.egpimsAssignment", "assPrd")
                .add(Restrictions.and(Restrictions.le("assPrd.fromDate", toDate), Restrictions
                        .or(Restrictions.ge("assPrd.toDate", toDate), Restrictions.isNull("assPrd.toDate"))));

    } else if (egwStatus.getModuletype().equals("Employee")
            && egwStatus.getDescription().equalsIgnoreCase("Retired")) {
        detachCriteriaPersonalInfo.add(Restrictions.between("emp.retirementDate", fromDate, toDate));

    } else if (egwStatus.getModuletype().equals("Employee")
            && egwStatus.getDescription().equalsIgnoreCase("Deceased")) {
        detachCriteriaPersonalInfo.add(Restrictions.between("emp.deathDate", fromDate, toDate));
    }/*from ww  w  . j  ava2  s .  co m*/
    return detachCriteriaPersonalInfo.getExecutableCriteria(getCurrentSession());
}

From source file:org.egov.pims.service.PersonalInformationService.java

License:Open Source License

/**
 * This API returns the list of EmployeeView objects which have a current assignment or
 * assignment as on date based on the parameters in the map.
 * @param criteriaParams - HashMap<String,Object> where the following keys are supported:-
 * "departmentId"    - Pass the id of the department to restrict the employees to
 * "designationId"  - Pass the id of the designation to restrict the resultset
 * "isPrimary"      - Possible values "Y" or "N". If "Y", then only employees with 
 *                Primary assignment will be returned. If "N" only employees with 
 *                temporary assignment is returned. If this key is not present in the map,
 *                employees with both temporary as well as primary assignments are returned.
 * "asOnDate"      - Value should be the date for which the employees need to have an
 *                assignment. If this key is not passed, employeed that have an assignment
 *                as of today will be returned.
 * @param pageNo/*from w  w w  .  j  av a  2  s .  c  om*/
 * @param pageSize
 * @return
 */
public List<EmployeeView> getListOfEmployeeViewBasedOnCriteria(HashMap<String, Object> criteriaParams,
        Integer pageNo, Integer pageSize) {

    List<EmployeeView> employeeList = new ArrayList<EmployeeView>();
    try {
        Criteria criteria = getCurrentSession().createCriteria(EmployeeView.class);
        Date asOnDate;
        for (Map.Entry<String, Object> entry : criteriaParams.entrySet()) {
            if ("departmentId".equals(entry.getKey())) {
                criteria.createAlias("deptId", "department")
                        .add(Restrictions.eq("department.id", entry.getValue()));
            }
            if ("designationId".equals(entry.getKey())) {
                criteria.createAlias("desigId", "designation")
                        .add(Restrictions.eq("designation.designationId", entry.getValue()));
            }
            if ("isPrimary".equals(entry.getKey())) {
                criteria.add(Restrictions.eq("isPrimary", entry.getValue()));
            }
            if ("asOnDate".equals(entry.getKey()))
                asOnDate = (Date) entry.getValue();
            else
                asOnDate = DateUtils.today();
            criteria.add(Restrictions.and(Restrictions.le("fromDate", asOnDate),
                    Restrictions.ge("toDate", asOnDate)));

        }
        criteria.addOrder(Order.asc("id"));
        employeeList = new Page(criteria, pageNo, pageSize).getList();
    } catch (Exception e) {
        throw new ApplicationRuntimeException("Error occured in searching for employees", e);
    }

    return employeeList;
}

From source file:org.egov.pims.service.PersonalInformationService.java

License:Open Source License

/**
 * This API returns the list of EmployeeView objects which have a current assignment or
 * assignment as on date based on the parameters in the map.
 * @param criteriaParams - HashMap<String,Object> where the following keys are supported:-
 * "departmentId"    - Pass the List of id of the department to restrict the employees to
 * "designationId"  - Pass the id of the designation to restrict the resultset
 * "isPrimary"      - Possible values "Y" or "N". If "Y", then only employees with 
 *                Primary assignment will be returned. If "N" only employees with 
 *                temporary assignment is returned. If this key is not present in the map,
 *                employees with both temporary as well as primary assignments are returned.
 * "employeeName"    - Pass employee name.
 * "employeeCode"    - Pass employee codes as list.       
 * "isActive"        - Pass Integer Value either 0 or 1.    * 
 * "asOnDate"      - Value should be the date for which the employees need to have an
 *                assignment. If this key is not passed, employeed that have an assignment
 *                as of today will be returned.
 * @param pageNo//w  w w.java  2 s.  c  o m
 * @param pageSize
 * @return
 */

public List<EmployeeView> getListOfEmployeeViewBasedOnListOfDesignationAndOtherCriteria(
        HashMap<String, Object> criteriaParams, Integer pageNo, Integer pageSize) {

    List<EmployeeView> employeeList = new ArrayList<EmployeeView>();
    try {
        Criteria criteria = getCurrentSession().createCriteria(EmployeeView.class);
        Date asOnDate;
        for (Map.Entry<String, Object> entry : criteriaParams.entrySet()) {
            if ("departmentId".equals(entry.getKey())) {
                criteria.createAlias("deptId", "department")
                        .add(Restrictions.eq("department.id", entry.getValue()));
            }
            if ("designationId".equals(entry.getKey())) {
                criteria.createAlias("desigId", "designation")
                        .add(Restrictions.in("designation.designationId", (List<Integer>) entry.getValue()));
            }
            if ("isPrimary".equals(entry.getKey())) {
                criteria.add(Restrictions.eq("isPrimary", entry.getValue()));
            }
            if ("employeeName".equals(entry.getKey()) && entry.getValue() != null
                    && !"".equals(entry.getValue())) {
                criteria.add(Restrictions.ilike("employeeName", entry.getValue().toString(),
                        org.hibernate.criterion.MatchMode.ANYWHERE));
            }
            if ("isActive".equals(entry.getKey()) && entry.getValue() != null && !"".equals(entry.getValue())) {
                criteria.add(Restrictions.eq("isActive", Integer.valueOf(entry.getValue().toString())));
            }
            if ("employeeCode".equals(entry.getKey())) {
                criteria.add(Restrictions.in("employeeCode", (List<String>) entry.getValue()));
            }

            if ("asOnDate".equals(entry.getKey()))
                asOnDate = (Date) entry.getValue();
            else
                asOnDate = DateUtils.today();
            criteria.add(Restrictions.and(Restrictions.le("fromDate", asOnDate),
                    Restrictions.ge("toDate", asOnDate)));

        }
        criteria.addOrder(Order.asc("id"));
        employeeList = new Page(criteria, pageNo, pageSize).getList();
    } catch (Exception e) {
        throw new ApplicationRuntimeException("Error occured in searching for employees", e);
    }

    return employeeList;
}

From source file:org.egov.ptis.domain.dao.property.BoundaryCategoryHibDao.java

License:Open Source License

@Override
public BoundaryCategory getBoundaryCategoryByBoundaryAndCategory(Criterion criterion) {
    Criteria criteria = getCurrentSession().createCriteria(BoundaryCategory.class);
    BoundaryCategory boundaryCategory = null;
    if (criterion != null) {
        Criterion dateCondn1 = Restrictions.and(Restrictions.le("fromDate", new Date()),
                Restrictions.isNull("toDate"));
        Criterion dateCondn2 = Restrictions.and(Restrictions.le("fromDate", new Date()),
                Restrictions.ge("toDate", new Date()));
        Criterion dateCondn = Restrictions.or(dateCondn1, dateCondn2);

        criteria.add(criterion);//from ww  w .j av a  2  s  . c o  m
        criteria.add(dateCondn);
        criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
        boundaryCategory = (BoundaryCategory) criteria.uniqueResult();
    }
    return boundaryCategory;
}

From source file:org.egov.ptis.domain.dao.property.CategoryHibDao.java

License:Open Source License

/**
 * Returns Category object by CategoryName and Usage by passing criterion as
 * a parameter/*  w w  w.  ja v a 2 s  . c o m*/
 * 
 * @param criterion
 * @return Category.
 **/

@Override
public Category getCategoryByCategoryNameAndUsage(Criterion criterion) {
    Criteria criteria = getCurrentSession().createCriteria(Category.class);
    Category category = null;
    if (criterion != null) {
        Criterion dateCondn1 = Restrictions.and(Restrictions.le(FROM_DATE, new Date()),
                Restrictions.isNull(TO_DATE));
        Criterion dateCondn2 = Restrictions.and(Restrictions.le(FROM_DATE, new Date()),
                Restrictions.ge(TO_DATE, new Date()));
        Criterion dateCondn = Restrictions.or(dateCondn1, dateCondn2);

        criteria.add(criterion);
        criteria.add(dateCondn);
        criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
        category = (Category) criteria.uniqueResult();
    }
    return category;
}

From source file:org.egov.ptis.domain.dao.property.CategoryHibDao.java

License:Open Source License

/**
 * Returns ategory by category amount and usage id by passing criterion as a
 * parameter//  w w  w  .  ja v a2 s  .c om
 * 
 * @param criterion
 * @return List Category.
 **/

@Override
public List<Category> getCategoryByCatAmtAndUsage(Criterion criterion) {
    Criteria criteria = getCurrentSession().createCriteria(Category.class);
    if (criterion != null) {
        Criterion dateCondn1 = Restrictions.and(Restrictions.le(FROM_DATE, new Date()),
                Restrictions.isNull(TO_DATE));
        Criterion dateCondn2 = Restrictions.and(Restrictions.le(FROM_DATE, new Date()),
                Restrictions.ge(TO_DATE, new Date()));
        Criterion dateCondn = Restrictions.or(dateCondn1, dateCondn2);

        criteria.add(criterion);
        criteria.add(dateCondn);
        criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    }
    return criteria.list();
}

From source file:org.esn.esobase.data.DBService.java

@Transactional
public HierarchicalContainer searchInCatalogs(String search, HierarchicalContainer hc) {
    hc.removeAllItems();/* www.  j  a v  a 2 s. c  om*/
    Integer weightValue = null;
    List<Criterion> searchTermitems = new ArrayList<>();
    try {
        weightValue = new Integer(search);
        searchTermitems.add(Restrictions.eq("weight", weightValue));
    } catch (NumberFormatException ex) {

    }
    searchTermitems.add(Restrictions.ilike("textEn", search, MatchMode.ANYWHERE));
    searchTermitems.add(Restrictions.ilike("textRu", search, MatchMode.ANYWHERE));
    LogicalExpression searchTerms = Restrictions.and(
            Restrictions.or(searchTermitems.toArray(new Criterion[searchTermitems.size()])),
            Restrictions.eq("deprecated", Boolean.FALSE));
    if (weightValue != null) {

    }
    Session session = (Session) em.getDelegate();

    Criteria npcCrit = session.createCriteria(GSpreadSheetsNpcName.class);
    npcCrit.add(searchTerms);
    List<GSpreadSheetsNpcName> npcList = npcCrit.list();
    for (GSpreadSheetsNpcName npc : npcList) {
        Item item = hc.addItem(npc);
        item.getItemProperty("textEn").setValue(npc.getTextEn());
        if (npc.getSex() != null) {
            item.getItemProperty("textEn")
                    .setValue(npc.getTextEn() + "(" + npc.getSex().toString().substring(0, 1) + ")");
        }
        item.getItemProperty("textRu").setValue(npc.getTextRu());
        item.getItemProperty("weight").setValue(npc.getWeight());
        item.getItemProperty("translator").setValue(npc.getTranslator());
        item.getItemProperty("catalogType").setValue("NPC");

    }
    Criteria locationCrit = session.createCriteria(GSpreadSheetsLocationName.class);
    locationCrit.add(searchTerms);
    List<GSpreadSheetsLocationName> locationList = locationCrit.list();
    for (GSpreadSheetsLocationName loc : locationList) {
        Item item = hc.addItem(loc);
        item.getItemProperty("textEn").setValue(loc.getTextEn());
        item.getItemProperty("textRu").setValue(loc.getTextRu());
        item.getItemProperty("weight").setValue(loc.getWeight());
        item.getItemProperty("translator").setValue(loc.getTranslator());
        item.getItemProperty("catalogType").setValue("?");

    }
    Criteria activatorCrit = session.createCriteria(GSpreadSheetsActivator.class);
    activatorCrit.add(searchTerms);
    List<GSpreadSheetsActivator> activatorList = activatorCrit.list();
    for (GSpreadSheetsActivator loc : activatorList) {
        Item item = hc.addItem(loc);
        item.getItemProperty("textEn").setValue(loc.getTextEn());
        item.getItemProperty("textRu").setValue(loc.getTextRu());
        item.getItemProperty("weight").setValue(loc.getWeight());
        item.getItemProperty("translator").setValue(loc.getTranslator());
        item.getItemProperty("catalogType").setValue("?");

    }

    Criteria itemNameCrit = session.createCriteria(GSpreadSheetsItemName.class);
    itemNameCrit.add(searchTerms);
    List<GSpreadSheetsItemName> itemNameList = itemNameCrit.list();
    for (GSpreadSheetsItemName row : itemNameList) {
        Item item = hc.addItem(row);
        item.getItemProperty("textEn").setValue(row.getTextEn());
        item.getItemProperty("textRu").setValue(row.getTextRu());
        item.getItemProperty("weight").setValue(row.getWeight());
        item.getItemProperty("translator").setValue(row.getTranslator());
        item.getItemProperty("catalogType").setValue("? ");

    }

    Criteria itemDescriptionCrit = session.createCriteria(GSpreadSheetsItemDescription.class);
    itemDescriptionCrit.add(searchTerms);
    List<GSpreadSheetsItemDescription> itemDescriptionList = itemDescriptionCrit.list();
    for (GSpreadSheetsItemDescription row : itemDescriptionList) {
        Item item = hc.addItem(row);
        item.getItemProperty("textEn").setValue(row.getTextEn());
        item.getItemProperty("textRu").setValue(row.getTextRu());
        item.getItemProperty("weight").setValue(row.getWeight());
        item.getItemProperty("translator").setValue(row.getTranslator());
        item.getItemProperty("catalogType").setValue("? ");

    }

    Criteria questNameCrit = session.createCriteria(GSpreadSheetsQuestName.class);
    questNameCrit.add(searchTerms);
    List<GSpreadSheetsQuestName> questNameList = questNameCrit.list();
    for (GSpreadSheetsQuestName row : questNameList) {
        Item item = hc.addItem(row);
        item.getItemProperty("textEn").setValue(row.getTextEn());
        item.getItemProperty("textRu").setValue(row.getTextRu());
        item.getItemProperty("weight").setValue(row.getWeight());
        item.getItemProperty("translator").setValue(row.getTranslator());
        item.getItemProperty("catalogType").setValue("? ?");

    }

    Criteria questDescriptionCrit = session.createCriteria(GSpreadSheetsQuestDescription.class);
    questDescriptionCrit.add(searchTerms);
    List<GSpreadSheetsQuestDescription> questDescriptionList = questDescriptionCrit.list();
    for (GSpreadSheetsQuestDescription row : questDescriptionList) {
        Item item = hc.addItem(row);
        item.getItemProperty("textEn").setValue(row.getTextEn());
        item.getItemProperty("textRu").setValue(row.getTextRu());
        item.getItemProperty("weight").setValue(row.getWeight());
        item.getItemProperty("translator").setValue(row.getTranslator());
        item.getItemProperty("catalogType").setValue("? ?");

    }

    Criteria questDirectionCrit = session.createCriteria(GSpreadSheetsQuestDirection.class);
    questDirectionCrit.add(searchTerms);
    List<GSpreadSheetsQuestDirection> questDirectionList = questDirectionCrit.list();
    for (GSpreadSheetsQuestDirection row : questDirectionList) {
        Item item = hc.addItem(row);
        item.getItemProperty("textEn").setValue(row.getTextEn());
        item.getItemProperty("textRu").setValue(row.getTextRu());
        item.getItemProperty("weight").setValue(row.getWeight());
        item.getItemProperty("translator").setValue(row.getTranslator());
        item.getItemProperty("catalogType").setValue(" ?");

    }

    Criteria questStartTipCrit = session.createCriteria(GSpreadSheetsQuestStartTip.class);
    questStartTipCrit.add(searchTerms);
    List<GSpreadSheetsQuestStartTip> questStartTipList = questStartTipCrit.list();
    for (GSpreadSheetsQuestStartTip row : questStartTipList) {
        Item item = hc.addItem(row);
        item.getItemProperty("textEn").setValue(row.getTextEn());
        item.getItemProperty("textRu").setValue(row.getTextRu());
        item.getItemProperty("weight").setValue(row.getWeight());
        item.getItemProperty("translator").setValue(row.getTranslator());
        item.getItemProperty("catalogType").setValue("?? ");
    }

    Criteria questEndTipCrit = session.createCriteria(GSpreadSheetsQuestEndTip.class);
    questEndTipCrit.add(searchTerms);
    List<GSpreadSheetsQuestEndTip> questEndTipList = questEndTipCrit.list();
    for (GSpreadSheetsQuestEndTip row : questEndTipList) {
        Item item = hc.addItem(row);
        item.getItemProperty("textEn").setValue(row.getTextEn());
        item.getItemProperty("textRu").setValue(row.getTextRu());
        item.getItemProperty("weight").setValue(row.getWeight());
        item.getItemProperty("translator").setValue(row.getTranslator());
        item.getItemProperty("catalogType").setValue("? ");
    }

    Criteria journalEntryCrit = session.createCriteria(GSpreadSheetsJournalEntry.class);
    journalEntryCrit.add(searchTerms);
    List<GSpreadSheetsJournalEntry> journalEntryList = journalEntryCrit.list();
    for (GSpreadSheetsJournalEntry row : journalEntryList) {
        Item item = hc.addItem(row);
        item.getItemProperty("textEn").setValue(row.getTextEn());
        item.getItemProperty("textRu").setValue(row.getTextRu());
        item.getItemProperty("weight").setValue(row.getWeight());
        item.getItemProperty("translator").setValue(row.getTranslator());
        item.getItemProperty("catalogType").setValue("?  ");

    }

    Criteria npcPhraseCrit = session.createCriteria(GSpreadSheetsNpcPhrase.class);
    npcPhraseCrit.add(searchTerms);
    List<GSpreadSheetsNpcPhrase> npcPhraseList = npcPhraseCrit.list();
    for (GSpreadSheetsNpcPhrase gSpreadSheetsNpcPhrase : npcPhraseList) {
        Item item = hc.addItem(gSpreadSheetsNpcPhrase);
        item.getItemProperty("textEn").setValue(gSpreadSheetsNpcPhrase.getTextEn());
        item.getItemProperty("textRu").setValue(gSpreadSheetsNpcPhrase.getTextRu());
        item.getItemProperty("weight").setValue(gSpreadSheetsNpcPhrase.getWeight());
        item.getItemProperty("translator").setValue(gSpreadSheetsNpcPhrase.getTranslator());
        item.getItemProperty("catalogType").setValue(" NPC");

    }
    Criteria playerPhraseCrit = session.createCriteria(GSpreadSheetsPlayerPhrase.class);
    playerPhraseCrit.add(searchTerms);
    List<GSpreadSheetsPlayerPhrase> playerPhraseList = playerPhraseCrit.list();
    for (GSpreadSheetsPlayerPhrase gSpreadSheetsPlayerPhrase : playerPhraseList) {
        Item item = hc.addItem(gSpreadSheetsPlayerPhrase);
        item.getItemProperty("textEn").setValue(gSpreadSheetsPlayerPhrase.getTextEn());
        item.getItemProperty("textRu").setValue(gSpreadSheetsPlayerPhrase.getTextRu());
        item.getItemProperty("weight").setValue(gSpreadSheetsPlayerPhrase.getWeight());
        item.getItemProperty("translator").setValue(gSpreadSheetsPlayerPhrase.getTranslator());
        item.getItemProperty("catalogType").setValue(" ");

    }
    Criteria achievementCrit = session.createCriteria(GSpreadSheetsAchievement.class);
    achievementCrit.add(searchTerms);
    List<GSpreadSheetsAchievement> achievementList = achievementCrit.list();
    for (GSpreadSheetsAchievement i : achievementList) {
        Item item = hc.addItem(i);
        item.getItemProperty("textEn").setValue(i.getTextEn());
        item.getItemProperty("textRu").setValue(i.getTextRu());
        item.getItemProperty("weight").setValue(i.getWeight());
        item.getItemProperty("translator").setValue(i.getTranslator());
        item.getItemProperty("catalogType").setValue("?");

    }
    Criteria achievementDescriptionCrit = session.createCriteria(GSpreadSheetsAchievementDescription.class);
    achievementDescriptionCrit.add(searchTerms);
    List<GSpreadSheetsAchievementDescription> achievementDescriptionList = achievementDescriptionCrit.list();
    for (GSpreadSheetsAchievementDescription i : achievementDescriptionList) {
        Item item = hc.addItem(i);
        item.getItemProperty("textEn").setValue(i.getTextEn());
        item.getItemProperty("textRu").setValue(i.getTextRu());
        item.getItemProperty("weight").setValue(i.getWeight());
        item.getItemProperty("translator").setValue(i.getTranslator());
        item.getItemProperty("catalogType").setValue("? ??");

    }
    Criteria noteCrit = session.createCriteria(GSpreadSheetsNote.class);
    noteCrit.add(searchTerms);
    List<GSpreadSheetsNote> noteList = noteCrit.list();
    for (GSpreadSheetsNote i : noteList) {
        Item item = hc.addItem(i);
        item.getItemProperty("textEn").setValue(i.getTextEn());
        item.getItemProperty("textRu").setValue(i.getTextRu());
        item.getItemProperty("weight").setValue(i.getWeight());
        item.getItemProperty("translator").setValue(i.getTranslator());
        item.getItemProperty("catalogType").setValue("?");

    }
    Criteria abilityDescriptionCrit = session.createCriteria(GSpreadSheetsAbilityDescription.class);
    abilityDescriptionCrit.add(searchTerms);
    List<GSpreadSheetsAbilityDescription> abilityDescriptionList = abilityDescriptionCrit.list();
    for (GSpreadSheetsAbilityDescription i : abilityDescriptionList) {
        Item item = hc.addItem(i);
        item.getItemProperty("textEn").setValue(i.getTextEn());
        item.getItemProperty("textRu").setValue(i.getTextRu());
        item.getItemProperty("weight").setValue(i.getWeight());
        item.getItemProperty("translator").setValue(i.getTranslator());
        item.getItemProperty("catalogType").setValue("? ???");

    }
    Criteria collectibleCrit = session.createCriteria(GSpreadSheetsCollectible.class);
    collectibleCrit.add(searchTerms);
    List<GSpreadSheetsCollectible> collectibleList = collectibleCrit.list();
    for (GSpreadSheetsCollectible i : collectibleList) {
        Item item = hc.addItem(i);
        item.getItemProperty("textEn").setValue(i.getTextEn());
        item.getItemProperty("textRu").setValue(i.getTextRu());
        item.getItemProperty("weight").setValue(i.getWeight());
        item.getItemProperty("translator").setValue(i.getTranslator());
        item.getItemProperty("catalogType").setValue(" ");

    }
    Criteria collectibleDescriptionCrit = session.createCriteria(GSpreadSheetsCollectibleDescription.class);
    collectibleDescriptionCrit.add(searchTerms);
    List<GSpreadSheetsCollectibleDescription> collectibleDescriptionList = collectibleDescriptionCrit.list();
    for (GSpreadSheetsCollectibleDescription i : collectibleDescriptionList) {
        Item item = hc.addItem(i);
        item.getItemProperty("textEn").setValue(i.getTextEn());
        item.getItemProperty("textRu").setValue(i.getTextRu());
        item.getItemProperty("weight").setValue(i.getWeight());
        item.getItemProperty("translator").setValue(i.getTranslator());
        item.getItemProperty("catalogType")
                .setValue("?  ");

    }
    Criteria loadscreenCrit = session.createCriteria(GSpreadSheetsLoadscreen.class);
    loadscreenCrit.add(searchTerms);
    List<GSpreadSheetsLoadscreen> loadscreenList = loadscreenCrit.list();
    for (GSpreadSheetsLoadscreen i : loadscreenList) {
        Item item = hc.addItem(i);
        item.getItemProperty("textEn").setValue(i.getTextEn());
        item.getItemProperty("textRu").setValue(i.getTextRu());
        item.getItemProperty("weight").setValue(i.getWeight());
        item.getItemProperty("translator").setValue(i.getTranslator());
        item.getItemProperty("catalogType").setValue(" ?");

    }
    Criteria esoInterfaceVariableCrit = session.createCriteria(EsoInterfaceVariable.class);
    searchTermitems = new ArrayList<>();
    searchTermitems.add(Restrictions.ilike("textEn", search, MatchMode.ANYWHERE));
    searchTermitems.add(Restrictions.ilike("textRu", search, MatchMode.ANYWHERE));
    searchTermitems.add(Restrictions.ilike("name", search, MatchMode.ANYWHERE));
    esoInterfaceVariableCrit
            .add(Restrictions.or(searchTermitems.toArray(new Criterion[searchTermitems.size()])));
    List<EsoInterfaceVariable> esoInterfaceVariableList = esoInterfaceVariableCrit.list();
    for (EsoInterfaceVariable i : esoInterfaceVariableList) {
        Item item = hc.addItem(i);
        item.getItemProperty("textEn").setValue(i.getTextEn());
        item.getItemProperty("textRu").setValue(i.getTextRu());
        item.getItemProperty("translator").setValue(i.getTranslator());
        item.getItemProperty("catalogType").setValue(" ?");
    }

    return hc;
}