Example usage for com.liferay.portal.kernel.dao.orm RestrictionsFactoryUtil isNotNull

List of usage examples for com.liferay.portal.kernel.dao.orm RestrictionsFactoryUtil isNotNull

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.orm RestrictionsFactoryUtil isNotNull.

Prototype

public static Criterion isNotNull(String propertyName) 

Source Link

Usage

From source file:at.graz.meduni.liferay.portlet.bibbox.service.service.impl.InvitationOrganisationLocalServiceImpl.java

License:Open Source License

/**
 * @throws SystemException /*  w w  w.ja  v  a 2s  . c  om*/
 */
public List<InvitationOrganisation> getInvitationOrganisationByStatus(boolean rejacted) throws SystemException {
    /*DynamicQuery subQuery = DynamicQueryFactoryUtil.forClass(Invitation.class, "subQuery", PortalClassLoaderUtil.getClassLoader())
    .setProjection(ProjectionFactoryUtil.property("subQuery.invitationId"))
    .add(PropertyFactoryUtil.forName("subQuery.invitationId").eqProperty("answerdQuery.invitationId"))
    .add(PropertyFactoryUtil.forName("subQuery.invitationsend").isNotNull());
            
    DynamicQuery answerdQuery = DynamicQueryFactoryUtil.forClass(InvitationOrganisation.class, "answerdQuery", PortalClassLoaderUtil.getClassLoader())
    .add(PropertyFactoryUtil.forName("subQuery.invitationId").eq(subQuery));*/

    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(InvitationOrganisation.class);
    Criterion criterion = null;
    if (rejacted) {
        criterion = RestrictionsFactoryUtil.isNotNull("reactdate");
        dynamicQuery.addOrder(OrderFactoryUtil.desc("reactdate"));
    } else {
        criterion = RestrictionsFactoryUtil.isNull("reactdate");
    }
    dynamicQuery.addOrder(OrderFactoryUtil.desc("invitationOrganisationId"));

    //dynamicQuery.setProjection(ProjectionFactoryUtil.groupProperty("organisationId"));

    dynamicQuery.add(criterion);

    List<InvitationOrganisation> invitationorganisation = InvitationOrganisationLocalServiceUtil
            .dynamicQuery(dynamicQuery);
    return invitationorganisation;
}

From source file:org.oep.cmon.portlet.doanhnghiep.quanlytaikhoan.business.QuanLyTaiKhoan.java

License:Apache License

/**
 * This is  function get count DoanhNghiep
 * Version: 1.0/* www. j a  v a2 s. c  o  m*/
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param ten
 * @param loaiDoiTuongId
 * @throws trangThai
 * @return long
 */
public static long countByDoanhNghiep(String ten, long loaiDoiTuongId, int trangThai) {

    DynamicQuery query = DynamicQueryFactoryUtil.forClass(DoanhNghiep.class);

    if (!ten.equals("")) {
        Criterion criterion = null;
        ten = ten.toUpperCase();
        criterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + ten + StringPool.PERCENT);

        criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("tenTiengNuocNgoai",
                StringPool.PERCENT + ten + StringPool.PERCENT));
        criterion = RestrictionsFactoryUtil.or(criterion,
                RestrictionsFactoryUtil.ilike("tenVietTat", StringPool.PERCENT + ten + StringPool.PERCENT));

        criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("emailDoanhNghiep",
                StringPool.PERCENT + ten + StringPool.PERCENT));
        criterion = RestrictionsFactoryUtil.or(criterion,
                RestrictionsFactoryUtil.ilike("soGCNDKKD", StringPool.PERCENT + ten + StringPool.PERCENT));
        criterion = RestrictionsFactoryUtil.and(criterion,
                RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE));
        query = query.add(criterion);
    }
    if (loaiDoiTuongId != 0) {
        Criterion criterion1 = RestrictionsFactoryUtil.eq("loaiDoiTuongId", loaiDoiTuongId);
        criterion1 = RestrictionsFactoryUtil.and(criterion1,
                RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE));
        query = query.add(criterion1);
    }
    if (trangThai != 99) {
        Criterion criterion2 = null;
        if (trangThai == 2) {
            criterion2 = RestrictionsFactoryUtil.isNull("taiKhoanNguoiDungId");
        } else
            criterion2 = RestrictionsFactoryUtil.isNotNull("taiKhoanNguoiDungId");

        criterion2 = RestrictionsFactoryUtil.and(criterion2,
                RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE));
        query = query.add(criterion2);
    }

    //query.setProjection(ProjectionFactoryUtil.max("thuTuHienThi"));
    query.setProjection(ProjectionFactoryUtil.rowCount());
    //query.setProjection(ProjectionFactoryUtil.sum("counter"));
    //DynamicQueryInitializ dqi = new DynamicQueryInitializerImpl(query);

    long count = 0;

    try {
        Iterator<Long> resultsItr = DoanhNghiepLocalServiceUtil.dynamicQuery(query).iterator();

        if (resultsItr.hasNext()) {
            count = ((Long) resultsItr.next()).longValue();
        }
    } catch (SystemException se) {
        // _log.error(se.getMessage(), se);
    }

    return count;
}

From source file:org.oep.cmon.portlet.doanhnghiep.quanlytaikhoan.business.QuanLyTaiKhoan.java

License:Apache License

/**
 * This is  function get list DoanhNghiep
 * Version: 1.0//from  ww  w .  java 2s.  c  om
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param ten
 * @param loaiDoiTuongId
 * @param trangThai
 * @param start
 * @param end
 * @throws SystemException
 */
public static List<DoanhNghiep> getListDoanhNghiep(String ten, long loaiDoiTuongId, int trangThai, int start,
        int end) throws SystemException {

    DynamicQuery query = DynamicQueryFactoryUtil.forClass(DoanhNghiep.class);
    List<DoanhNghiep> results = null;
    if (!ten.equals("")) {
        Criterion criterion = null;
        ten = ten.toUpperCase();
        criterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + ten + StringPool.PERCENT);

        criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("tenTiengNuocNgoai",
                StringPool.PERCENT + ten + StringPool.PERCENT));
        criterion = RestrictionsFactoryUtil.or(criterion,
                RestrictionsFactoryUtil.ilike("tenVietTat", StringPool.PERCENT + ten + StringPool.PERCENT));

        criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("emailDoanhNghiep",
                StringPool.PERCENT + ten + StringPool.PERCENT));
        criterion = RestrictionsFactoryUtil.or(criterion,
                RestrictionsFactoryUtil.ilike("soGCNDKKD", StringPool.PERCENT + ten + StringPool.PERCENT));
        criterion = RestrictionsFactoryUtil.and(criterion,
                RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE));
        query = query.add(criterion);
    }
    if (loaiDoiTuongId != 0) {
        Criterion criterion1 = RestrictionsFactoryUtil.eq("loaiDoiTuongId", loaiDoiTuongId);
        criterion1 = RestrictionsFactoryUtil.and(criterion1,
                RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE));
        query = query.add(criterion1);
    }
    if (trangThai != 99) {
        Criterion criterion2 = null;
        if (trangThai == 2) {
            criterion2 = RestrictionsFactoryUtil.isNull("taiKhoanNguoiDungId");
        } else
            criterion2 = RestrictionsFactoryUtil.isNotNull("taiKhoanNguoiDungId");

        criterion2 = RestrictionsFactoryUtil.and(criterion2,
                RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE));
        query = query.add(criterion2);
    }
    results = DoanhNghiepLocalServiceUtil.dynamicQuery(query);
    if (results == null) {
        results = new ArrayList<DoanhNghiep>();
    }
    return results;

}

From source file:org.oep.cmon.portlet.taocongdan.business.TaoCongDanBusiness.java

License:Apache License

/**
  * This is fucntion findByCongDan/*from  w  ww  .  ja  v a  2  s.  com*/
  * Version: 1.0
  *  
  * History: 
  *   DATE        AUTHOR      DESCRIPTION 
  *  ------------------------------------------------- 
  *  3-March-2013  Nam Dinh    Create new
  * @param String ten, String taiKhoanNguoiDungId, int start, int end
  * @return List<CongDan>
  */
@SuppressWarnings("unchecked")
public static List<CongDan> findByCongDan(String ten, String taiKhoanNguoiDungId, int start, int end) {
    List<CongDan> results = null;
    DynamicQuery query = DynamicQueryFactoryUtil.forClass(CongDan.class);
    query.addOrder(OrderFactoryUtil.asc("ten"));
    query.setLimit(start, end);
    // This is a test line for display all request if there's no search criteria
    Criterion criterion = null;

    ten = ten.toUpperCase();

    criterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + ten + StringPool.PERCENT);
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("ho", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("dem", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("tenDayDu", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("email", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("ma", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("soCmnd", StringPool.PERCENT + ten + StringPool.PERCENT));

    if (taiKhoanNguoiDungId != "") {
        if (taiKhoanNguoiDungId.equals(String.valueOf(Constants.TaoCongDan.CO_TAI_KHOAN))) {
            criterion = RestrictionsFactoryUtil.and(criterion,
                    RestrictionsFactoryUtil.isNotNull("taiKhoanNguoiDungId"));
        } else {
            criterion = RestrictionsFactoryUtil.and(criterion,
                    RestrictionsFactoryUtil.isNull("taiKhoanNguoiDungId"));
        }
    }

    criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE));
    // Define search criteria         
    query = query.add(criterion);

    try {
        results = CongDanLocalServiceUtil.dynamicQuery(query);
    } catch (SystemException e) {
    }

    if (results == null) {
        results = new ArrayList<CongDan>();
    }
    return results;

}

From source file:org.oep.cmon.portlet.taocongdan.business.TaoCongDanBusiness.java

License:Apache License

/**
  * This is fucntion countByCongDan/*w  w  w . j  a v  a2  s .  co  m*/
  * Version: 1.0
  *  
  * History: 
  *   DATE        AUTHOR      DESCRIPTION 
  *  ------------------------------------------------- 
  *  3-March-2013  Nam Dinh    Create new
  * @param String ten, String taiKhoanNguoiDungId
  * @return long
  */
@SuppressWarnings("unchecked")
public static long countByCongDan(String ten, String taiKhoanNguoiDungId) {
    DynamicQuery query = DynamicQueryFactoryUtil.forClass(CongDan.class);
    Criterion criterion = null;
    ten = ten.toUpperCase();

    criterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + ten + StringPool.PERCENT);
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("ho", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("dem", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("tenDayDu", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("email", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("ma", StringPool.PERCENT + ten + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.or(criterion,
            RestrictionsFactoryUtil.ilike("soCmnd", StringPool.PERCENT + ten + StringPool.PERCENT));

    if (taiKhoanNguoiDungId != "") {
        if (taiKhoanNguoiDungId.equals(String.valueOf(Constants.TaoCongDan.CO_TAI_KHOAN))) {
            criterion = RestrictionsFactoryUtil.and(criterion,
                    RestrictionsFactoryUtil.isNotNull("taiKhoanNguoiDungId"));
        } else {
            criterion = RestrictionsFactoryUtil.and(criterion,
                    RestrictionsFactoryUtil.isNull("taiKhoanNguoiDungId"));
        }
    }

    criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE));

    query = query.add(criterion);

    query.setProjection(ProjectionFactoryUtil.rowCount());

    long count = 0;

    try {
        Iterator<Long> resultsItr = CongDanLocalServiceUtil.dynamicQuery(query).iterator();

        if (resultsItr.hasNext()) {
            count = ((Long) resultsItr.next()).longValue();
        }
    } catch (SystemException se) {
        // _log.error(se.getMessage(), se);
    }

    return count;
}