List of usage examples for com.liferay.portal.kernel.dao.orm RestrictionsFactoryUtil disjunction
public static Disjunction disjunction()
From source file:br.com.prodevelopment.lapidarios.evento.service.persistence.EventoAgendaExportActionableDynamicQuery.java
License:Open Source License
@Override protected void addCriteria(DynamicQuery dynamicQuery) { Criterion modifiedDateCriterion = _portletDataContext.getDateRangeCriteria("modifiedDate"); Criterion statusDateCriterion = _portletDataContext.getDateRangeCriteria("statusDate"); if ((modifiedDateCriterion != null) && (statusDateCriterion != null)) { Disjunction disjunction = RestrictionsFactoryUtil.disjunction(); disjunction.add(modifiedDateCriterion); disjunction.add(statusDateCriterion); dynamicQuery.add(disjunction);//from w w w .j a va 2s. com } if (getStagedModelType().getReferrerClassNameId() >= 0) { Property classNameIdProperty = PropertyFactoryUtil.forName("classNameId"); dynamicQuery.add(classNameIdProperty.eq(getStagedModelType().getReferrerClassNameId())); } Property workflowStatusProperty = PropertyFactoryUtil.forName("status"); if (_portletDataContext.isInitialPublication()) { dynamicQuery.add(workflowStatusProperty.ne(WorkflowConstants.STATUS_IN_TRASH)); } else { StagedModelDataHandler<?> stagedModelDataHandler = StagedModelDataHandlerRegistryUtil .getStagedModelDataHandler(EventoAgenda.class.getName()); dynamicQuery.add(workflowStatusProperty.in(stagedModelDataHandler.getExportableStatuses())); } }
From source file:br.com.prodevelopment.lapidarios.loja.service.persistence.LojaExportActionableDynamicQuery.java
License:Open Source License
@Override protected void addCriteria(DynamicQuery dynamicQuery) { Criterion modifiedDateCriterion = _portletDataContext.getDateRangeCriteria("modifiedDate"); Criterion statusDateCriterion = _portletDataContext.getDateRangeCriteria("statusDate"); if ((modifiedDateCriterion != null) && (statusDateCriterion != null)) { Disjunction disjunction = RestrictionsFactoryUtil.disjunction(); disjunction.add(modifiedDateCriterion); disjunction.add(statusDateCriterion); dynamicQuery.add(disjunction);//from w w w . j a v a2 s . c om } if (getStagedModelType().getReferrerClassNameId() >= 0) { Property classNameIdProperty = PropertyFactoryUtil.forName("classNameId"); dynamicQuery.add(classNameIdProperty.eq(getStagedModelType().getReferrerClassNameId())); } Property workflowStatusProperty = PropertyFactoryUtil.forName("status"); if (_portletDataContext.isInitialPublication()) { dynamicQuery.add(workflowStatusProperty.ne(WorkflowConstants.STATUS_IN_TRASH)); } else { StagedModelDataHandler<?> stagedModelDataHandler = StagedModelDataHandlerRegistryUtil .getStagedModelDataHandler(Loja.class.getName()); dynamicQuery.add(workflowStatusProperty.in(stagedModelDataHandler.getExportableStatuses())); } }
From source file:ca.efendi.datafeeds.service.base.CJProductLocalServiceBaseImpl.java
License:Open Source License
@Override public ExportActionableDynamicQuery getExportActionableDynamicQuery( final PortletDataContext portletDataContext) { final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() { @Override/*from w ww . j av a2s . c om*/ public long performCount() throws PortalException { ManifestSummary manifestSummary = portletDataContext.getManifestSummary(); StagedModelType stagedModelType = getStagedModelType(); long modelAdditionCount = super.performCount(); manifestSummary.addModelAdditionCount(stagedModelType, modelAdditionCount); long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext, stagedModelType); manifestSummary.addModelDeletionCount(stagedModelType, modelDeletionCount); return modelAdditionCount; } }; initActionableDynamicQuery(exportActionableDynamicQuery); exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() { @Override public void addCriteria(DynamicQuery dynamicQuery) { Criterion modifiedDateCriterion = portletDataContext.getDateRangeCriteria("modifiedDate"); Criterion statusDateCriterion = portletDataContext.getDateRangeCriteria("statusDate"); if ((modifiedDateCriterion != null) && (statusDateCriterion != null)) { Disjunction disjunction = RestrictionsFactoryUtil.disjunction(); disjunction.add(modifiedDateCriterion); disjunction.add(statusDateCriterion); dynamicQuery.add(disjunction); } Property workflowStatusProperty = PropertyFactoryUtil.forName("status"); if (portletDataContext.isInitialPublication()) { dynamicQuery.add(workflowStatusProperty.ne(WorkflowConstants.STATUS_IN_TRASH)); } else { StagedModelDataHandler<?> stagedModelDataHandler = StagedModelDataHandlerRegistryUtil .getStagedModelDataHandler(CJProduct.class.getName()); dynamicQuery.add(workflowStatusProperty.in(stagedModelDataHandler.getExportableStatuses())); } } }); exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId()); exportActionableDynamicQuery .setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<CJProduct>() { @Override public void performAction(CJProduct cjProduct) throws PortalException { StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, cjProduct); } }); exportActionableDynamicQuery .setStagedModelType(new StagedModelType(PortalUtil.getClassNameId(CJProduct.class.getName()))); return exportActionableDynamicQuery; }
From source file:com.apstamp.liferay.service.impl.TemplateLocalServiceImpl.java
License:Open Source License
protected DynamicQuery buildTemplateDynamicQuery(long templateId, String clienteEmail, String empresaEmail, String clienteNome, String clienteEmpresa, String empresaNome, String empresaRepresentante, String projetoNome, String projetoTecnologia, String projetoTag, boolean andSearch) { Junction junction = null;// ww w . j av a 2 s .c o m if (andSearch) junction = RestrictionsFactoryUtil.conjunction(); else junction = RestrictionsFactoryUtil.disjunction(); //campos do cliente if (templateId > 0) { Property property = PropertyFactoryUtil.forName("templateId"); junction.add(property.eq(Long.valueOf(templateId))); } if (Validator.isNotNull(clienteNome)) { Property property = PropertyFactoryUtil.forName("clienteNome"); String value = (new StringBuilder("%")).append(clienteNome).append("%").toString(); junction.add(property.like(value)); } if (Validator.isNotNull(clienteEmpresa)) { Property property = PropertyFactoryUtil.forName("clienteEmpresa"); String value = (new StringBuilder("%")).append(clienteEmpresa).append("%").toString(); junction.add(property.like(value)); } //campos da empresa if (Validator.isNotNull(empresaNome)) { Property property = PropertyFactoryUtil.forName("empresaNome"); String value = (new StringBuilder("%")).append(empresaNome).append("%").toString(); junction.add(property.like(value)); } if (Validator.isNotNull(empresaRepresentante)) { Property property = PropertyFactoryUtil.forName("empresaRepresentante"); String value = (new StringBuilder("%")).append(empresaRepresentante).append("%").toString(); junction.add(property.like(value)); } //campos projeto if (Validator.isNotNull(projetoNome)) { Property property = PropertyFactoryUtil.forName("projetoNome"); String value = (new StringBuilder("%")).append(projetoNome).append("%").toString(); junction.add(property.like(value)); } if (Validator.isNotNull(projetoTecnologia)) { Property property = PropertyFactoryUtil.forName("projetoTecnologia"); String value = (new StringBuilder("%")).append(projetoTecnologia).append("%").toString(); junction.add(property.like(value)); } if (Validator.isNotNull(projetoTag)) { Property property = PropertyFactoryUtil.forName("projetoTag"); String value = (new StringBuilder("%")).append(projetoTag).append("%").toString(); junction.add(property.like(value)); } if (Validator.isNotNull(clienteEmail)) { Property property = PropertyFactoryUtil.forName("clienteEmail"); String value = (new StringBuilder("%")).append(clienteEmail).append("%").toString(); junction.add(property.like(value)); } if (Validator.isNotNull(empresaEmail)) { Property property = PropertyFactoryUtil.forName("empresaEmail"); String value = (new StringBuilder("%")).append(empresaEmail).append("%").toString(); junction.add(property.like(value)); } DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Template.class, getClassLoader()); return dynamicQuery.add(junction); }
From source file:com.commsen.liferay.multidevice.rules.service.impl.RuleLocalServiceImpl.java
License:Open Source License
/** * Returns list of rules matching the company, group, layout and user's device. * /*from ww w .jav a2s.co m*/ * @param companyId company (instance) id * @param groupId group (community/organization) id * @param layoutId layout (page) id * @param device user's device * @action the rule action type (change theme, redirect) * @return list of rules matching the company, group, layout and user's device. */ public List<Rule> getMatchingRules(long companyId, long groupId, long layoutId, Device device) { List<Rule> result = Collections.emptyList(); // Brand and model query part Junction modelMatchesOrNull = RestrictionsFactoryUtil.disjunction(); modelMatchesOrNull.add(PropertyFactoryUtil.forName("model").eq(device.getModel())); modelMatchesOrNull.add(PropertyFactoryUtil.forName("model").isNull()); Junction brandMatchesAndModelMatchesOrNull = RestrictionsFactoryUtil.conjunction(); brandMatchesAndModelMatchesOrNull.add(PropertyFactoryUtil.forName("brand").eq(device.getBrand())); brandMatchesAndModelMatchesOrNull.add(modelMatchesOrNull); Junction brandNullOrMatchesWithModelMatchesOrNull = RestrictionsFactoryUtil.disjunction(); brandNullOrMatchesWithModelMatchesOrNull.add(PropertyFactoryUtil.forName("brand").isNull()); brandNullOrMatchesWithModelMatchesOrNull.add(brandMatchesAndModelMatchesOrNull); // Operating system query part Junction osVersionMatchesOrNull = RestrictionsFactoryUtil.disjunction(); osVersionMatchesOrNull.add(PropertyFactoryUtil.forName("osVersion").eq(device.getOSVersion())); osVersionMatchesOrNull.add(PropertyFactoryUtil.forName("osVersion").isNull()); Junction osNameMatchesAndOsVersionMathcesOrNull = RestrictionsFactoryUtil.conjunction(); osNameMatchesAndOsVersionMathcesOrNull.add(PropertyFactoryUtil.forName("os").eq(device.getOS())); osNameMatchesAndOsVersionMathcesOrNull.add(osVersionMatchesOrNull); Junction osNameNullOrMatchesWithOsVersionMathcesOrNull = RestrictionsFactoryUtil.disjunction(); osNameNullOrMatchesWithOsVersionMathcesOrNull.add(PropertyFactoryUtil.forName("os").isNull()); osNameNullOrMatchesWithOsVersionMathcesOrNull.add(osNameMatchesAndOsVersionMathcesOrNull); // Browser query part Junction browserVersionMatchesOrNull = RestrictionsFactoryUtil.disjunction(); browserVersionMatchesOrNull .add(PropertyFactoryUtil.forName("browserVersion").eq(device.getBrowserVersion())); browserVersionMatchesOrNull.add(PropertyFactoryUtil.forName("browserVersion").isNull()); Junction browserNameMatchesAndBrowserVersionMathcesOrNull = RestrictionsFactoryUtil.conjunction(); browserNameMatchesAndBrowserVersionMathcesOrNull .add(PropertyFactoryUtil.forName("browser").eq(device.getBrowser())); browserNameMatchesAndBrowserVersionMathcesOrNull.add(browserVersionMatchesOrNull); Junction browserNameNullOrMatchesWithBrowserVersionMatchesOrNull = RestrictionsFactoryUtil.disjunction(); browserNameNullOrMatchesWithBrowserVersionMatchesOrNull .add(PropertyFactoryUtil.forName("browser").isNull()); browserNameNullOrMatchesWithBrowserVersionMatchesOrNull .add(browserNameMatchesAndBrowserVersionMathcesOrNull); // Pointing device query part Junction pointingMethodMatchesOrNull = RestrictionsFactoryUtil.disjunction(); pointingMethodMatchesOrNull .add(PropertyFactoryUtil.forName("pointingMethod").eq(device.getPointingMethod())); pointingMethodMatchesOrNull.add(PropertyFactoryUtil.forName("pointingMethod").isNull()); // Is tablet query part Junction tabletMatchesOrNull = RestrictionsFactoryUtil.disjunction(); tabletMatchesOrNull.add(PropertyFactoryUtil.forName("tablet").eq(Boolean.toString(device.isTablet()))); tabletMatchesOrNull.add(PropertyFactoryUtil.forName("tablet").isNull()); // Has qwerty keyboard query part Junction qwertyKeyboardMatchesOrNull = RestrictionsFactoryUtil.disjunction(); qwertyKeyboardMatchesOrNull .add(PropertyFactoryUtil.forName("qwertyKeyboad").eq(Boolean.toString(device.hasQwertyKeyboard()))); qwertyKeyboardMatchesOrNull.add(PropertyFactoryUtil.forName("qwertyKeyboad").isNull()); // Page query part Junction pageMatchesOrNull = RestrictionsFactoryUtil.disjunction(); pageMatchesOrNull.add(PropertyFactoryUtil.forName("layoutId").eq(0l)); pageMatchesOrNull.add(PropertyFactoryUtil.forName("layoutId").eq(layoutId)); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Rule.class); dynamicQuery.add(PropertyFactoryUtil.forName("companyId").eq(companyId)); dynamicQuery.add(PropertyFactoryUtil.forName("groupId").eq(groupId)); dynamicQuery.add(pageMatchesOrNull); dynamicQuery.add(brandNullOrMatchesWithModelMatchesOrNull); dynamicQuery.add(osNameNullOrMatchesWithOsVersionMathcesOrNull); dynamicQuery.add(browserNameNullOrMatchesWithBrowserVersionMatchesOrNull); dynamicQuery.add(pointingMethodMatchesOrNull); dynamicQuery.add(tabletMatchesOrNull); dynamicQuery.add(qwertyKeyboardMatchesOrNull); dynamicQuery.addOrder(OrderFactoryUtil.desc("layoutId")); dynamicQuery.addOrder(OrderFactoryUtil.asc("priority")); try { result = RuleUtil.findWithDynamicQuery(dynamicQuery); } catch (SystemException e) { _log.error("Failed to find theme rules matching " + device, e); } return result; }
From source file:com.ext.portlet.halcon.service.impl.AuditoriaCajaSorpresaLocalServiceImpl.java
License:Open Source License
/** * Se obtiene la cantidad maxima de registros segun la consulta * @throws BusinessException //from w w w . ja v a2s . c om */ public Long obtenerListaCajaSorpresaCount(Integer filas, Integer pagina, Integer cboTipoDocumento, String producto, String txtFechaInicio, String txtFechaFin) throws BusinessException { _log.info(" obtenerListaCajaSorpresaCount datos cboTipoDocumento : " + cboTipoDocumento + " producto : " + producto + " txtFechaInicio : " + txtFechaInicio + " txtFechaFin : " + txtFechaFin); try { ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil .locate(ClpSerializer.getServletContextName(), "portletClassLoader"); DynamicQuery consultaAuditoriaCajaSorpresa = DynamicQueryFactoryUtil .forClass(AuditoriaCajaSorpresa.class, classLoader); if (cboTipoDocumento != null && cboTipoDocumento > 0) { consultaAuditoriaCajaSorpresa .add(PropertyFactoryUtil.forName("tipoDocumento").eq(String.valueOf(cboTipoDocumento))) .add(PropertyFactoryUtil.forName("tipoDocumento").isNotNull()) .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("tipoDocumento").eq(""))); } if (producto != null && !producto.equals("0")) { Disjunction funcionOr = RestrictionsFactoryUtil.disjunction(); funcionOr.add(PropertyFactoryUtil.forName("codProducto1").eq(producto)); funcionOr.add(PropertyFactoryUtil.forName("codProducto2").eq(producto)); funcionOr.add(PropertyFactoryUtil.forName("codProducto3").eq(producto)); consultaAuditoriaCajaSorpresa.add(funcionOr); } try { if ((txtFechaInicio != null && (!txtFechaInicio.equals("")) && txtFechaInicio.length() > 0) && (txtFechaFin != null && (!txtFechaFin.equals("")) && txtFechaFin.length() > 0)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); consultaAuditoriaCajaSorpresa .add(PropertyFactoryUtil.forName("fechaHora") .gt(sdf.parse(txtFechaInicio + " 00:00:00"))) .add(PropertyFactoryUtil.forName("fechaHora").lt(sdf.parse(txtFechaFin + " 23:59:59"))); } } catch (Exception e) { System.out.println(e); } Long count = AuditoriaPerfiladorLocalServiceUtil.dynamicQueryCount(consultaAuditoriaCajaSorpresa); return count; } catch (Exception e) { //System.out.println(e); //throw new BusinessException(nameClase+" - obtenerListaCajaSorpresaCount",e.toString()); _log.error(Propiedades.getResourceBundleMetodo( "capa.halcon.auditoria.cajasorpresa.obtenerlistacajasorpresacount") + e.toString()); throw new BusinessException(Propiedades.getResourceBundle("capa.halcon.auditoria.cajasorpresa", "capa.halcon.auditoria.cajasorpresa.obtenerlistacajasorpresacount"), e.toString()); } }
From source file:com.ext.portlet.halcon.service.impl.AuditoriaCajaSorpresaLocalServiceImpl.java
License:Open Source License
/** * Se obtiene los registros del reporte de caja sorpresa. * @throws BusinessException //w ww. ja va2 s. c o m */ @SuppressWarnings("unchecked") public List<AuditoriaCajaSorpresa> obtenerListaAuditoriaCajaSorpresa(Integer filas, Integer pagina, Integer cboTipoDocumento, String producto, String txtFechaInicio, String txtFechaFin) throws BusinessException { _log.info( " obtenerListaAuditoriaCajaSorpresa datos cboTipoDocumento : " + cboTipoDocumento + " producto : " + producto + " txtFechaInicio : " + txtFechaInicio + " txtFechaFin : " + txtFechaFin); try { ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil .locate(ClpSerializer.getServletContextName(), "portletClassLoader"); DynamicQuery consultaAuditoriaCajaSorpresa = DynamicQueryFactoryUtil .forClass(AuditoriaCajaSorpresa.class, classLoader); if (cboTipoDocumento != null && cboTipoDocumento > 0) { consultaAuditoriaCajaSorpresa .add(PropertyFactoryUtil.forName("tipoDocumento").eq(String.valueOf(cboTipoDocumento))) .add(PropertyFactoryUtil.forName("tipoDocumento").isNotNull()) .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("tipoDocumento").eq(""))); } if (producto != null && !producto.equals("0")) { Disjunction funcionOr = RestrictionsFactoryUtil.disjunction(); funcionOr.add(PropertyFactoryUtil.forName("codProducto1").eq(producto)); funcionOr.add(PropertyFactoryUtil.forName("codProducto2").eq(producto)); funcionOr.add(PropertyFactoryUtil.forName("codProducto3").eq(producto)); consultaAuditoriaCajaSorpresa.add(funcionOr); } try { if ((txtFechaInicio != null && (!txtFechaInicio.equals("")) && txtFechaInicio.length() > 0) && (txtFechaFin != null && (!txtFechaFin.equals("")) && txtFechaFin.length() > 0)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); consultaAuditoriaCajaSorpresa .add(PropertyFactoryUtil.forName("fechaHora") .gt(sdf.parse(txtFechaInicio + " 00:00:00"))) .add(PropertyFactoryUtil.forName("fechaHora").lt(sdf.parse(txtFechaFin + " 23:59:59"))); } } catch (Exception e) { System.out.println(e); } consultaAuditoriaCajaSorpresa.addOrder(OrderFactoryUtil.desc("fechaHora")); if (filas > 0 && pagina > 0) { int init = (filas * pagina - filas); int fin = init + filas; List<AuditoriaCajaSorpresa> lst = AuditoriaPerfiladorLocalServiceUtil .dynamicQuery(consultaAuditoriaCajaSorpresa, init, fin); _log.info(" select obtenerListaAuditoriaCajaSorpresa lst.size() :" + lst.size()); return lst; } else { List<AuditoriaCajaSorpresa> lst = AuditoriaPerfiladorLocalServiceUtil .dynamicQuery(consultaAuditoriaCajaSorpresa); _log.info(" select -1 -1 obtenerListaAuditoriaCajaSorpresa lst.size() :" + lst.size()); return lst; } } catch (Exception e) { //throw new BusinessException(nameClase+" - obtenerListaAuditoriaCajaSorpresa",e.toString()); _log.error(Propiedades.getResourceBundleMetodo( "capa.halcon.auditoria.cajasorpresa.obtenerlistaauditoriacajasorpresa") + e.toString()); throw new BusinessException(Propiedades.getResourceBundle("capa.halcon.auditoria.cajasorpresa", "capa.halcon.auditoria.cajasorpresa.obtenerlistaauditoriacajasorpresa"), e.toString()); } }
From source file:com.fsoft.bn.service.impl.ScheduleLocalServiceImpl.java
License:Open Source License
/** * @param start// w ww.j ava2 s.c o m * @param end * @param keyword * @return * @throws SystemException */ @SuppressWarnings("unchecked") private List<User> getAllUsersOrderBy(int start, int end, String keyword) throws SystemException { List<User> allUsers = new ArrayList<User>(); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(User.class, PortalClassLoaderUtil.getClassLoader()); OrderByComparator order = OrderByComparatorFactoryUtil.create("USER_", "firstName", "middleName", "lastName", true); if (null != keyword && !StringUtils.isBlank(keyword)) { String key = "%" + keyword.trim() + "%"; Junction junction = RestrictionsFactoryUtil.disjunction(); junction.add(RestrictionsFactoryUtil.ilike("firstName", key)) .add(RestrictionsFactoryUtil.ilike("lastName", key)) .add(RestrictionsFactoryUtil.ilike("middleName", key)) .add(RestrictionsFactoryUtil.ilike("jobTitle", key)); dynamicQuery.add(junction); allUsers.addAll(UserLocalServiceUtil.dynamicQuery(dynamicQuery, start, end, order)); Set<User> set = new HashSet<User>(allUsers); allUsers = new ArrayList<User>(set); } else { allUsers = UserLocalServiceUtil.dynamicQuery(dynamicQuery, start, end, order); } return allUsers; }
From source file:com.fsoft.bn.service.impl.StaffInfoLocalServiceImpl.java
License:Open Source License
public List<StaffInfo> searchStaffInfo(String content, String typeSearch, long organization, int begin, int end) throws SystemException { DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(StaffInfoImpl.class) .add(PropertyFactoryUtil.forName("deleted").eq(false)); Junction junction = RestrictionsFactoryUtil.disjunction(); if (organization > 0) { dynamicQuery.add(RestrictionsFactoryUtil.eq("organizations_id", organization)); }/*w ww . j a va2 s. c o m*/ if (!StringUtil.isEmpty(content)) { content = "%" + content + "%"; if ("All".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_role", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_phone", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_email", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_firstname", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_middlename", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_lastname", content)); } else if ("Role".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_role", content)); } else if ("Phone".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_phone", content)); } else if ("Email".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_email", content)); } else if ("Name".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_firstname", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_middlename", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_lastname", content)); } } dynamicQuery.add(junction); List<StaffInfo> staffInfosList = StaffInfoUtil.findWithDynamicQuery(dynamicQuery, begin, end); return staffInfosList; //return StaffInfoFinderUtil.searchStaffInfo(content, typeSearch, organization, begin, end); }
From source file:com.fsoft.bn.service.impl.StaffInfoLocalServiceImpl.java
License:Open Source License
public int countResultSearchStaffInfo(String content, String typeSearch, long organization) throws SystemException { DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(StaffInfoImpl.class) .add(PropertyFactoryUtil.forName("deleted").eq(false)); Junction junction = RestrictionsFactoryUtil.disjunction(); if (organization > 0) { dynamicQuery.add(RestrictionsFactoryUtil.eq("organizations_id", organization)); }/* ww w . j a v a 2 s . c om*/ if (!StringUtil.isEmpty(content)) { content = "%" + content + "%"; if ("All".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_role", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_phone", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_email", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_firstname", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_middlename", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_lastname", content)); } else if ("Role".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_role", content)); } else if ("Phone".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_phone", content)); } else if ("Email".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_email", content)); } else if ("Name".equals(typeSearch)) { junction.add(RestrictionsFactoryUtil.ilike("staff_firstname", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_middlename", content)); junction.add(RestrictionsFactoryUtil.ilike("staff_lastname", content)); } } dynamicQuery.add(junction); List<StaffInfo> staffInfosList = StaffInfoUtil.findWithDynamicQuery(dynamicQuery); if (staffInfosList == null) { return 0; } return staffInfosList.size(); //return StaffInfoFinderUtil.countResultSearchStaffInfo(content, typeSearch, organization); }