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:com.sohlman.liferay.bffss.service.impl.FileInfoLocalServiceImpl.java
License:Open Source License
@Override public void deleteFileInfosByDirectory(long companyId, long repositoryId, String dirName) throws SystemException, PortalException { if (!dirName.endsWith(StringPool.SLASH)) { dirName = dirName.concat(StringPool.SLASH); }// w w w . j av a 2 s. c o m dirName = dirName.concat(StringPool.PERCENT); List<FileInfo> fileInfos = fileInfoPersistence.findByC_R_LikeP(companyId, repositoryId, dirName); for (FileInfo fileInfo : fileInfos) { deleteFileInfo(fileInfo); } }
From source file:com.sohlman.liferay.bffss.service.impl.FileInfoLocalServiceImpl.java
License:Open Source License
@Override public List<FileInfo> getFileInfosByDirectory(long companyId, long repositoryId, String dirName) throws SystemException { if (!dirName.endsWith(StringPool.SLASH)) { dirName = dirName.concat(StringPool.SLASH); }// w w w .j a v a2 s.c o m dirName = dirName.concat(StringPool.PERCENT); return fileInfoPersistence.findByC_R_LikeP(companyId, repositoryId, dirName); }
From source file:de.fraunhofer.fokus.movepla.service.impl.LoggingLocalServiceImpl.java
License:Open Source License
public List<Logging> getLoggingsByCategories() { List<Logging> resultList = new ArrayList<Logging>(); List<Logging> tmpApplications = new ArrayList<Logging>(); try {//from w w w. j a v a2s . com List<Category> allCategories = CategoryLocalServiceUtil.getCategories(10154); for (Category category : allCategories) { String catIdString = String.valueOf(category.getCategoryId()); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class); ProjectionList projectionList = ProjectionFactoryUtil.projectionList(); projectionList.add(ProjectionFactoryUtil.sum("passel")); dynamicQuery.setProjection(projectionList); // only one category Criterion criterion = RestrictionsFactoryUtil.like("categoryIDString", catIdString); // categoryId at the beginning criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("categoryIDString", catIdString + ";" + StringPool.PERCENT)); // categoryId at the end criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("categoryIDString", StringPool.PERCENT + ";" + catIdString)); // categoryId in the middle criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("categoryIDString", StringPool.PERCENT + ";" + catIdString + ";" + StringPool.PERCENT)); dynamicQuery.add(criterion); Order defaultOrder = OrderFactoryUtil.desc("passel"); dynamicQuery.addOrder(defaultOrder); List<Long> result = dynamicQuery(dynamicQuery); // _log.info("catIdString::result.size(): " + catIdString + "::" + result.size()); if (result.size() > 0) { // _log.info("result.get(0): " + result.get(0)); if (result.get(0) != null) { Logging log = new LoggingImpl(); log.setCategoryIDString(category.getCategoryName()); long _p = result.get(0); // _log.info("_p: " + _p); log.setPassel(_p); tmpApplications.add(log); // _log.info("tmpApplications.size(): " + tmpApplications.size()); } else { continue; } } } resultList.addAll(tmpApplications); OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc"); Collections.sort(resultList, orderByComparator); } catch (Exception e) { _log.info("Exception: " + e.getMessage()); e.printStackTrace(); } return resultList; }
From source file:de.fraunhofer.fokus.movepla.service.impl.LoggingLocalServiceImpl.java
License:Open Source License
public List<Logging> getLoggingsByRegions() { List<Logging> resultList = new ArrayList<Logging>(); List<Logging> tmpApplications = new ArrayList<Logging>(); try {//from w w w. jav a 2 s .c o m List<Region> allRegions = RegionLocalServiceUtil.findByc(10154); for (Region region : allRegions) { String regIdString = String.valueOf(region.getRegionId()); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class); ProjectionList projectionList = ProjectionFactoryUtil.projectionList(); projectionList.add(ProjectionFactoryUtil.sum("passel")); dynamicQuery.setProjection(projectionList); // only one category Criterion criterion = RestrictionsFactoryUtil.like("regionIDString", regIdString); // categoryId at the beginning criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("regionIDString", regIdString + ";" + StringPool.PERCENT)); // categoryId at the end criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("regionIDString", StringPool.PERCENT + ";" + regIdString)); // categoryId in the middle criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("regionIDString", StringPool.PERCENT + ";" + regIdString + ";" + StringPool.PERCENT)); dynamicQuery.add(criterion); Order defaultOrder = OrderFactoryUtil.desc("passel"); dynamicQuery.addOrder(defaultOrder); List<Long> result = dynamicQuery(dynamicQuery); if (result.size() > 0) { if (result.get(0) != null) { Logging log = new LoggingImpl(); log.setRegionIDString(region.getName()); long _p = result.get(0); log.setPassel(_p); tmpApplications.add(log); } else { continue; } } } resultList.addAll(tmpApplications); OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc"); Collections.sort(resultList, orderByComparator); } catch (Exception e) { _log.info("Exception: " + e.getMessage()); e.printStackTrace(); } return resultList; }
From source file:de.fraunhofer.fokus.movepla.service.impl.LoggingLocalServiceImpl.java
License:Open Source License
public List<Logging> getLoggingsByMissingEntitlements() { List<Logging> resultList = new ArrayList<Logging>(); List<Logging> tmpApplications = new ArrayList<Logging>(); try {// w ww . j a v a2 s . c om List<Entitlement> allEntitlements = EntitlementLocalServiceUtil.getEntitlements(10154); for (Entitlement entitlement : allEntitlements) { String entitlementIdString = String.valueOf(entitlement.getEntitlementId()); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class); ProjectionList projectionList = ProjectionFactoryUtil.projectionList(); projectionList.add(ProjectionFactoryUtil.sum("passel")); dynamicQuery.setProjection(projectionList); // only one category Criterion criterion = RestrictionsFactoryUtil .not(RestrictionsFactoryUtil.like("entitlementIDString", entitlementIdString)); // categoryId at the beginning criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", entitlementIdString + ";" + StringPool.PERCENT))); // categoryId at the end criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", StringPool.PERCENT + ";" + entitlementIdString))); // categoryId in the middle criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", StringPool.PERCENT + ";" + entitlementIdString + ";" + StringPool.PERCENT))); dynamicQuery.add(criterion); Order defaultOrder = OrderFactoryUtil.desc("passel"); dynamicQuery.addOrder(defaultOrder); List<Long> result = dynamicQuery(dynamicQuery); if (result.size() > 0) { if (result.get(0) != null) { Logging log = new LoggingImpl(); log.setEntitlementIDString(entitlement.getEntitlementName()); long _p = result.get(0); log.setPassel(_p); tmpApplications.add(log); } else { continue; } } } resultList.addAll(tmpApplications); OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc"); Collections.sort(resultList, orderByComparator); } catch (Exception e) { _log.info("Exception: " + e.getMessage()); e.printStackTrace(); } return resultList; }
From source file:de.fraunhofer.fokus.movepla.service.impl.LoggingLocalServiceImpl.java
License:Open Source License
public List<Logging> getLoggingsByPlatforms() { List<Logging> resultList = new ArrayList<Logging>(); List<Logging> tmpApplications = new ArrayList<Logging>(); try {//from w w w . ja va 2 s. c o m List<String> allPlatforms = new ArrayList<String>(); allPlatforms.add("android"); allPlatforms.add("ios"); allPlatforms.add("webapp"); allPlatforms.add("windows"); allPlatforms.add("blackberry"); allPlatforms.add("ubuntu"); for (String platform : allPlatforms) { DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class); ProjectionList projectionList = ProjectionFactoryUtil.projectionList(); projectionList.add(ProjectionFactoryUtil.sum("passel")); dynamicQuery.setProjection(projectionList); // only one category Criterion criterion = RestrictionsFactoryUtil.like("targetOS", platform); // categoryId at the beginning criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetOS", platform + ";" + StringPool.PERCENT)); // categoryId at the end criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetOS", StringPool.PERCENT + ";" + platform)); // categoryId in the middle criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetOS", StringPool.PERCENT + ";" + platform + ";" + StringPool.PERCENT)); dynamicQuery.add(criterion); Order defaultOrder = OrderFactoryUtil.desc("passel"); dynamicQuery.addOrder(defaultOrder); List<Long> result = dynamicQuery(dynamicQuery); if (result.size() > 0) { if (result.get(0) != null) { Logging log = new LoggingImpl(); log.setTargetOS(platform); long _p = result.get(0); log.setPassel(_p); tmpApplications.add(log); } else { continue; } } } resultList.addAll(tmpApplications); OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc"); Collections.sort(resultList, orderByComparator); } catch (Exception e) { _log.info("Exception: " + e.getMessage()); e.printStackTrace(); } return resultList; }
From source file:de.fraunhofer.fokus.movepla.service.impl.LoggingLocalServiceImpl.java
License:Open Source License
public List<Logging> getLoggingsByTargetCategories() { List<Logging> resultList = new ArrayList<Logging>(); List<Logging> tmpApplications = new ArrayList<Logging>(); try {//from w w w .j a va 2 s. com List<String> allTargetCategories = new ArrayList<String>(); allTargetCategories.add("Smartphone"); allTargetCategories.add("Tablet"); for (String targetCategory : allTargetCategories) { DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class); ProjectionList projectionList = ProjectionFactoryUtil.projectionList(); projectionList.add(ProjectionFactoryUtil.sum("passel")); dynamicQuery.setProjection(projectionList); // only one category Criterion criterion = RestrictionsFactoryUtil.like("targetCategory", targetCategory); // categoryId at the beginning criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetCategory", targetCategory + ";" + StringPool.PERCENT)); // categoryId at the end criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetCategory", StringPool.PERCENT + ";" + targetCategory)); // categoryId in the middle criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetCategory", StringPool.PERCENT + ";" + targetCategory + ";" + StringPool.PERCENT)); dynamicQuery.add(criterion); Order defaultOrder = OrderFactoryUtil.desc("passel"); dynamicQuery.addOrder(defaultOrder); List<Long> result = dynamicQuery(dynamicQuery); if (result.size() > 0) { if (result.get(0) != null) { Logging log = new LoggingImpl(); log.setTargetCategory(targetCategory); long _p = result.get(0); log.setPassel(_p); tmpApplications.add(log); } else { continue; } } } resultList.addAll(tmpApplications); OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc"); Collections.sort(resultList, orderByComparator); } catch (Exception e) { _log.info("Exception: " + e.getMessage()); e.printStackTrace(); } return resultList; }
From source file:org.oep.cmon.dao.cc.service.persistence.CongChucFinderImpl.java
License:Apache License
/** * This is fucntion find CongChuc by coQuanQuanLyId and keyword and start, end value for paging * Version: 1.0/*w w w . j a v a 2 s .co m*/ * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param long : Value of coQuanQuanLyId; string keyword; int start ; int end; * @return List<CongChuc> */ @SuppressWarnings("unchecked") public List<CongChuc> listCongChuc(long coQuanQuanLyId, String maOrTenOrEmail, int start, int end) throws SystemException { List<CongChuc> listCongChuc = new ArrayList<CongChuc>(); Session session = null; try { session = openSession(); StringBuffer sql = new StringBuffer(); sql.append( "SELECT a.* FROM cmon_congchuc a INNER JOIN cmon_taikhoannguoidung b ON a.taikhoannguoidungid = b.id WHERE 1=1"); if (!Helpers.isEmpty(maOrTenOrEmail)) { sql.append( " AND (upper(a.ma) LIKE (:maOrTenOrEmail) OR upper(a.hovaten) LIKE (:maOrTenOrEmail) OR upper(b.email) LIKE(:maOrTenOrEmail))"); } if (coQuanQuanLyId > 0) { sql.append(" AND a.coquanquanlyid = :coquanquanlyid"); } sql.append(" ORDER BY a.hovaten ASC"); SQLQuery q = session.createSQLQuery(sql.toString()); q.setCacheable(false); q.setLong("coquanquanlyid", coQuanQuanLyId); q.setString("maOrTenOrEmail", StringPool.PERCENT + maOrTenOrEmail.toUpperCase() + StringPool.PERCENT); q.addEntity("CongChuc", CongChucImpl.class); listCongChuc = (List<CongChuc>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { } finally { closeSession(session); } return listCongChuc; }
From source file:org.oep.cmon.dao.cc.service.persistence.CongChucFinderImpl.java
License:Apache License
/** * This is fucntion count CongChuc by coQuanQuanLyId and keyword * Version: 1.0//from ww w .j a v a2 s . co m * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param long : Value of coQuanQuanLyId; string keyword; * @return int */ public int countListCongChuc(long coQuanQuanLyId, String maOrTenOrEmail) throws SystemException { int total = 0; Session session = null; try { session = openSession(); StringBuffer sql = new StringBuffer(); sql.append( "SELECT count(a.id) FROM cmon_congchuc a INNER JOIN cmon_taikhoannguoidung b ON a.taikhoannguoidungid = b.id WHERE 1=1"); if (!Helpers.isEmpty(maOrTenOrEmail)) { sql.append( " AND (upper(a.ma) LIKE (:maOrTenOrEmail) OR upper(a.hovaten) LIKE (:maOrTenOrEmail) OR upper(b.email) LIKE(:maOrTenOrEmail))"); } if (coQuanQuanLyId > 0) { sql.append(" AND a.coquanquanlyid = :coquanquanlyid"); } SQLQuery q = session.createSQLQuery(sql.toString()); q.setCacheable(false); q.setLong("coquanquanlyid", coQuanQuanLyId); q.setString("maOrTenOrEmail", StringPool.PERCENT + maOrTenOrEmail.toUpperCase() + StringPool.PERCENT); total = Integer.valueOf(q.uniqueResult().toString()); } catch (Exception e) { } finally { closeSession(session); } return total; }
From source file:org.oep.cmon.portlet.admin.congchuc.utils.CongChucUtils.java
License:Apache License
/** * This is function search CoQuanQuanLy by Ma or Ten * Version: 1.0//from w w w.ja v a2s. co m * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param searchInputText * @param daXoa * @throws Exception * @return List<CoQuanQuanLy> */ @SuppressWarnings("unchecked") public static List<CoQuanQuanLy> searchCoQuanQuanLyByMaOrTen(String searchInputText, int daXoa) throws Exception { List<CoQuanQuanLy> listCoQuanQuanLy = new ArrayList<CoQuanQuanLy>(); DynamicQuery query = DynamicQueryFactoryUtil.forClass(CoQuanQuanLyImpl.class, PortalClassLoaderUtil.getClassLoader()); if (!searchInputText.equals("")) { Criterion creterion = RestrictionsFactoryUtil.ilike("ten", StringPool.PERCENT + searchInputText + StringPool.PERCENT); creterion = RestrictionsFactoryUtil.or(creterion, RestrictionsFactoryUtil.ilike("ma", StringPool.PERCENT + searchInputText + StringPool.PERCENT)); query.add(creterion); } query.add(PropertyFactoryUtil.forName(CmonFields.daXoa).eq(Constants.ACTIVATED)); query.add(PropertyFactoryUtil.forName("capCoQuanQuanlyId") .ne(Long.valueOf(ThamSoLocalServiceUtil.getValue("HMS_COQUANHCSN_ID")))); query.addOrder(OrderFactoryUtil.asc("ten")); listCoQuanQuanLy = CoQuanQuanLyLocalServiceUtil.dynamicQuery(query, QueryUtil.ALL_POS, QueryUtil.ALL_POS); return listCoQuanQuanLy; }