List of usage examples for com.liferay.portal.kernel.util StringPool PERCENT
String PERCENT
To view the source code for com.liferay.portal.kernel.util StringPool PERCENT.
Click Source Link
From source file:org.oep.cmon.portlet.doanhnghiep.xacthuc.utils.XacThucDoanhNghiepUtils.java
License:Apache License
@SuppressWarnings("unchecked") public static List<CongDan> getListCongDan(String ten, int start, int end) { List<CongDan> results = null; DynamicQuery query = DynamicQueryFactoryUtil.forClass(CongDan.class); query.addOrder(OrderFactoryUtil.asc("ten")); query.setLimit(start, end);/*from w ww . j a v a2 s . c o m*/ 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)); criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("tinhtrang", Constants.TINHTRANG_SONG)); 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.doanhnghiep.xacthuc.utils.XacThucDoanhNghiepUtils.java
License:Apache License
@SuppressWarnings("unchecked") public static List<YeuCauDangKyDN> getListYeuCauDangKy(String maOrTenOrEmail, long loaiDoiTuongId, int trangThai, int start, int end) { List<YeuCauDangKyDN> results = new ArrayList<YeuCauDangKyDN>(); DynamicQuery query = DynamicQueryFactoryUtil.forClass(YeuCauDangKyDN.class); query.addOrder(OrderFactoryUtil.asc("id")); query.setLimit(start, end);//from w w w . j av a 2 s .c o m if (!maOrTenOrEmail.equals("")) { Criterion criterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + maOrTenOrEmail + StringPool.PERCENT); criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("maGiayPhep", StringPool.PERCENT + maOrTenOrEmail + StringPool.PERCENT)); criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("maSoThue", StringPool.PERCENT + maOrTenOrEmail + StringPool.PERCENT)); criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("email", StringPool.PERCENT + maOrTenOrEmail + StringPool.PERCENT)); query = query.add(criterion); } if (loaiDoiTuongId != 0) { Criterion criterion1 = RestrictionsFactoryUtil.eq("loaiDoiTuongId", loaiDoiTuongId); query = query.add(criterion1); } if (trangThai != 99) { Criterion criterion2 = RestrictionsFactoryUtil.eq("trangThai", trangThai); query = query.add(criterion2); } try { results = YeuCauDangKyDNLocalServiceUtil.dynamicQuery(query); } catch (SystemException e) { } if (results == null) { results = new ArrayList<YeuCauDangKyDN>(); } return results; }
From source file:org.oep.cmon.portlet.doanhnghiep.xacthuc.utils.XacThucDoanhNghiepUtils.java
License:Apache License
@SuppressWarnings("unchecked") public static int countListYeuCauDangKy(String maOrTenOrEmail, long loaiDoiTuongId, int trangThai) { List<YeuCauDangKyDN> results = new ArrayList<YeuCauDangKyDN>(); DynamicQuery query = DynamicQueryFactoryUtil.forClass(YeuCauDangKyDN.class); if (!maOrTenOrEmail.equals("")) { Criterion criterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + maOrTenOrEmail + StringPool.PERCENT); criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("maGiayPhep", StringPool.PERCENT + maOrTenOrEmail + StringPool.PERCENT)); criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("maSoThue", StringPool.PERCENT + maOrTenOrEmail + StringPool.PERCENT)); criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.ilike("email", StringPool.PERCENT + maOrTenOrEmail + StringPool.PERCENT)); query = query.add(criterion);// w w w . j a va 2 s . co m } if (loaiDoiTuongId != 0) { Criterion criterion1 = RestrictionsFactoryUtil.eq("loaiDoiTuongId", loaiDoiTuongId); query = query.add(criterion1); } if (loaiDoiTuongId != 99) { Criterion criterion2 = RestrictionsFactoryUtil.eq("trangThai", trangThai); query = query.add(criterion2); } try { results = YeuCauDangKyDNLocalServiceUtil.dynamicQuery(query); } catch (SystemException e) { } if (results == null) { results = new ArrayList<YeuCauDangKyDN>(); } return results.size(); }
From source file:org.oep.cmon.portlet.quanlyvaitro.business.QuanLyVaiTroBusiness.java
License:Apache License
/** * This is function findByVaiTro//from w w w . j ava2 s . c o m * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param maTen * @param start * @param end * @throws Exception * @return List<VaiTro> */ public static List<VaiTro> findByVaiTro(String maTen, int start, int end) throws Exception { List<VaiTro> results = null; try { DynamicQuery query = DynamicQueryFactoryUtil.forClass(VaiTro.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; criterion = RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE); if (!Helpers.isEmpty(maTen)) { criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.or( RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + maTen + StringPool.PERCENT), RestrictionsFactoryUtil.ilike("ma", StringPool.PERCENT + maTen + StringPool.PERCENT))); } // Define search criteria query = query.add(criterion); results = VaiTroLocalServiceUtil.dynamicQuery(query); } catch (Exception se) { _log.error(se.getMessage(), se); throw se; } return results; }
From source file:org.oep.cmon.portlet.quanlyvaitro.business.QuanLyVaiTroBusiness.java
License:Apache License
/** * This is function countByVaiTro// ww w . j av a 2s . co m * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param maTen * @throws Exception * @return Long */ public static Long countByVaiTro(String maTen) throws Exception { long count = 0; try { DynamicQuery query = DynamicQueryFactoryUtil.forClass(VaiTro.class); // This is a test line for display all request if there's no search // criteria Criterion criterion = null; criterion = RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE); if (!Helpers.isEmpty(maTen)) { criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.or( RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + maTen + StringPool.PERCENT), RestrictionsFactoryUtil.ilike("ma", StringPool.PERCENT + maTen + StringPool.PERCENT))); } query = query.add(criterion); query.setProjection(ProjectionFactoryUtil.rowCount()); Iterator<Long> resultsItr = VaiTroLocalServiceUtil.dynamicQuery(query).iterator(); if (resultsItr.hasNext()) { count = ((Long) resultsItr.next()).longValue(); } } catch (Exception se) { _log.error(se.getMessage(), se); throw se; } return count; }
From source file:org.oep.cmon.portlet.tainguyen.action.TaiNguyenPortlet.java
License:Apache License
/** * This is function findByTaiNguyen/*from w ww . j ava 2 s .co m*/ * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param ten * @param ungDungId * @param heThongId * @param start * @param end * @throws Exception * @return List<TaiNguyen> */ @SuppressWarnings("unchecked") public List<TaiNguyen> findByTaiNguyen(String ten, Long ungDungId, Long heThongId, int start, int end) { List<TaiNguyen> results = null; DynamicQuery query = DynamicQueryFactoryUtil.forClass(TaiNguyen.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; criterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + ten + StringPool.PERCENT); if (ungDungId != null) { criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("ungDungId", ungDungId)); } if (heThongId != null) { criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("heThongId", heThongId)); } criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE)); // Define search criteria query = query.add(criterion); try { results = TaiNguyenLocalServiceUtil.dynamicQuery(query); } catch (SystemException e) { } if (results == null) { results = new ArrayList<TaiNguyen>(); } return results; }
From source file:org.oep.cmon.portlet.tainguyen.action.TaiNguyenPortlet.java
License:Apache License
/** * This is function countByTaiNguyen//w w w .j a v a 2s .co m * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param ten * @param ungDungId * @param heThongId * @return long */ @SuppressWarnings("unchecked") public long countByTaiNguyen(String ten, Long ungDungId, Long heThongId) { DynamicQuery query = DynamicQueryFactoryUtil.forClass(TaiNguyen.class); Criterion criterion = null; criterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + ten + StringPool.PERCENT); if (ungDungId != null) { criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("ungDungId", ungDungId)); } if (heThongId != null) { criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("heThongId", heThongId)); } criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("daXoa", Constants.ACTIVE)); query = query.add(criterion); //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 = TaiNguyenLocalServiceUtil.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.taocongdan.business.TaoCongDanBusiness.java
License:Apache License
/** * This is fucntion findByCongDan/* w w w. ja v a 2 s. c o m*/ * 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 a 2s . c o 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; }
From source file:org.oep.cmon.portlet.thamso.action.ThamSoPortlet.java
License:Apache License
/** * This is fucntion findByTenThamSo//from w w w. j a va 2 s . com * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param String keyWord, Long ungDungId, Long heThongId, int start, int end * @return List<ThamSo> */ @SuppressWarnings("unchecked") public List<ThamSo> findByTenThamSo(String keyWord, Long ungDungId, Long heThongId, int start, int end) { List<ThamSo> results = null; if (keyWord.trim().length() > 0 | ungDungId != null | heThongId != null) { // Query code request using keyword DynamicQuery query = DynamicQueryFactoryUtil.forClass(ThamSo.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 criteriaTen = RestrictionsFactoryUtil.ilike("Ten", StringPool.PERCENT + keyWord + StringPool.PERCENT); Criterion criteriaUngDung = null; Criterion criteriaHeThong = null; if (ungDungId != null) { criteriaUngDung = RestrictionsFactoryUtil.eq("UngDungId", ungDungId); } else { criteriaUngDung = RestrictionsFactoryUtil.isNull("UngDungId"); } if (heThongId != null) { criteriaHeThong = RestrictionsFactoryUtil.eq("HeThongId", heThongId); } else { criteriaHeThong = RestrictionsFactoryUtil.isNull("HeThongId"); } Criterion criteria = RestrictionsFactoryUtil.and(criteriaUngDung, criteriaHeThong); query = query.add(RestrictionsFactoryUtil.and(criteriaTen, criteria)); try { results = ThamSoLocalServiceUtil.dynamicQuery(query); } catch (SystemException e) { } } else { try { DynamicQuery query = DynamicQueryFactoryUtil.forClass(ThamSo.class); query.addOrder(OrderFactoryUtil.asc("Ten")); query.setLimit(start, end); results = ThamSoLocalServiceUtil.dynamicQuery(query); } catch (SystemException e) { } } if (results == null) { results = new ArrayList<ThamSo>(); } return results; }