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

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

Introduction

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

Prototype

public static Criterion not(Criterion expression) 

Source Link

Usage

From source file:at.meduni.liferay.portlet.rdconnect.service.impl.CandidateLocalServiceImpl.java

License:Open Source License

public List<Candidate> getFilterdCandidates(String name, String country, String type, String source,
        String state) throws SystemException {
    if (country.equals("all")) {
        country = "";
    }//from   ww w.  jav a2 s  .  co  m
    if (type.equals("all")) {
        type = "";
    } else {
        if (type.equals("Registry"))
            type = "Registr";
    }
    if (source.equals("all")) {
        source = "";
    }
    if (state.equals("all")) {
        state = "";
    }

    // Dynamic Query for search
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Candidate.class);

    Criterion criterion = null;

    Criterion criterion_subunit = RestrictionsFactoryUtil.isNull("subunitof");
    criterion_subunit = RestrictionsFactoryUtil.or(criterion_subunit,
            RestrictionsFactoryUtil.eq("subunitof", ""));

    Criterion criterion_diseases = RestrictionsFactoryUtil.ilike("diseasesfreetext",
            StringPool.PERCENT + name + StringPool.PERCENT);
    criterion_diseases = RestrictionsFactoryUtil.or(criterion_diseases,
            RestrictionsFactoryUtil.ilike("diseasescodes", StringPool.PERCENT + name + StringPool.PERCENT));
    criterion_diseases = RestrictionsFactoryUtil.or(criterion_diseases,
            RestrictionsFactoryUtil.ilike("name", StringPool.PERCENT + name + StringPool.PERCENT));
    criterion_diseases = RestrictionsFactoryUtil.or(criterion_diseases,
            RestrictionsFactoryUtil.ilike("candidatesubtype", StringPool.PERCENT + name + StringPool.PERCENT));

    try {
        long searchlong = Long.valueOf(name);
        criterion_diseases = RestrictionsFactoryUtil.or(criterion_diseases,
                RestrictionsFactoryUtil.eq("candidateId", searchlong));
    } catch (Exception e) {

    }

    criterion = RestrictionsFactoryUtil.ilike("source", StringPool.PERCENT + source + StringPool.PERCENT);
    criterion = RestrictionsFactoryUtil.and(criterion,
            RestrictionsFactoryUtil.ilike("country", StringPool.PERCENT + country + StringPool.PERCENT));
    criterion = RestrictionsFactoryUtil.and(criterion,
            RestrictionsFactoryUtil.ilike("candidatetype", StringPool.PERCENT + type + StringPool.PERCENT));
    if (state.equalsIgnoreCase("")) {
        criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil
                .not(RestrictionsFactoryUtil.ilike("state", StringPool.PERCENT + "X" + StringPool.PERCENT)));
    } else {
        criterion = RestrictionsFactoryUtil.and(criterion,
                RestrictionsFactoryUtil.ilike("state", StringPool.PERCENT + state + StringPool.PERCENT));
    }
    criterion = RestrictionsFactoryUtil.and(criterion, criterion_diseases);
    criterion = RestrictionsFactoryUtil.and(criterion, criterion_subunit);

    dynamicQuery.add(criterion);

    Order countryOrder = OrderFactoryUtil.desc("country");
    Order nameOrder = OrderFactoryUtil.desc("name");
    //Order candidateidOrder = OrderFactoryUtil.asc("candidateId");
    //Order masteridOrder = OrderFactoryUtil.desc("masterId");

    dynamicQuery.addOrder(countryOrder);
    dynamicQuery.addOrder(nameOrder);

    List<Candidate> candidates = CandidateLocalServiceUtil.dynamicQuery(dynamicQuery);

    //List<Candidate> candidates = candidatePersistence.findByCNSTDD(country, name, source, type, diseases_freetext, diseases_code, "");
    return candidates;
}

From source file:br.com.seatecnologia.cldf.enquetenoticia.service.impl.EnqueteNoticiaLocalServiceImpl.java

License:Open Source License

public List<JournalArticle> getNoticiasNaoAssociadas(long questionId, int start, int end)
        throws SystemException, PortalException {
    List<EnqueteNoticia> enquetesAssociadas = EnqueteNoticiaUtil.findByQuestionID(questionId, start, end);
    List<Object> listaArtigosAssociados = new ArrayList<Object>();

    for (EnqueteNoticia enqueteNoticia : enquetesAssociadas) {
        long articleId = enqueteNoticia.getArticleId();
        listaArtigosAssociados.add(articleId);
    }//  w  ww  .  ja v a 2  s  . c o m

    DynamicQuery query = DynamicQueryFactoryUtil.forClass(JournalArticle.class,
            PortalClassLoaderUtil.getClassLoader());
    if (!listaArtigosAssociados.isEmpty()) {
        query.add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("id").in(listaArtigosAssociados)));
    }
    @SuppressWarnings("unchecked")
    List<JournalArticle> results = JournalArticleLocalServiceUtil.dynamicQuery(query, start, end);

    return results;

}

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  ww . j a  v  a2 s . 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.j a  va  2 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.ext.portlet.halcon.service.impl.AuditoriaPerfiladorLocalServiceImpl.java

License:Open Source License

public Long obtenerListaAuditoriaPerfiladorCount(Integer filas, Integer pagina, Integer cboTipoDocumento,
        Integer cboPerfilador, String txtFechaInicio, String txtFechaFin) throws BusinessException {

    _log.info(" obtenerListaAuditoriaSimulador datos cboTipoDocumento : " + cboTipoDocumento
            + "  cboPerfilador : " + cboPerfilador + "  txtFechaInicio : " + txtFechaInicio + "  txtFechaFin : "
            + txtFechaFin);/*w w  w  .java 2 s. c  o m*/
    try {

        ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil
                .locate(ClpSerializer.getServletContextName(), "portletClassLoader");
        DynamicQuery consultaAuditoriaPerfilador = DynamicQueryFactoryUtil.forClass(AuditoriaPerfilador.class,
                classLoader);
        if (cboTipoDocumento != null && cboTipoDocumento > 0) {
            consultaAuditoriaPerfilador
                    .add(PropertyFactoryUtil.forName("tipoDocumento").eq(String.valueOf(cboTipoDocumento)))
                    .add(PropertyFactoryUtil.forName("tipoDocumento").isNotNull())
                    .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("tipoDocumento").eq("")));
        }
        if (cboPerfilador != null && cboPerfilador > 0) {
            consultaAuditoriaPerfilador
                    .add(PropertyFactoryUtil.forName("perfilador").eq(String.valueOf(cboPerfilador)))
                    .add(PropertyFactoryUtil.forName("perfilador").isNotNull())
                    .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("perfilador").eq("")));
        }
        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");
                consultaAuditoriaPerfilador
                        .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);
            e.printStackTrace();
        }

        Long count = AuditoriaPerfiladorLocalServiceUtil.dynamicQueryCount(consultaAuditoriaPerfilador);
        return count;

    } catch (Exception e) {
        // throw new
        // BusinessException(nameClase+" - obtenerListaAuditoriaPerfiladorCount",e.toString());
        _log.error(Propiedades.getResourceBundleMetodo(
                "capa.halcon.auditoria.perfilador.obtenerlistaauditoriaperfiladorcount") + e.toString());
        throw new BusinessException(Propiedades.getResourceBundle("capa.halcon.auditoria.perfilador",
                "capa.halcon.auditoria.perfilador.obtenerlistaauditoriaperfiladorcount"), e.toString());
    }
}

From source file:com.ext.portlet.halcon.service.impl.AuditoriaPerfiladorLocalServiceImpl.java

License:Open Source License

@SuppressWarnings("unchecked")
public List<AuditoriaPerfilador> obtenerListaAuditoriaPerfilador(Integer filas, Integer pagina,
        Integer cboTipoDocumento, Integer cboPerfilador, String txtFechaInicio, String txtFechaFin)
        throws BusinessException {
    _log.info(" obtenerListaAuditoriaSimulador datos cboTipoDocumento : " + cboTipoDocumento
            + "  cboPerfilador : " + cboPerfilador + "  txtFechaInicio : " + txtFechaInicio + "  txtFechaFin : "
            + txtFechaFin);/*from  w  w w . j  ava2  s.  c  om*/
    try {

        ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil
                .locate(ClpSerializer.getServletContextName(), "portletClassLoader");
        DynamicQuery consultaAuditoriaPerfilador = DynamicQueryFactoryUtil.forClass(AuditoriaPerfilador.class,
                classLoader);
        if (cboTipoDocumento != null && cboTipoDocumento > 0) {
            consultaAuditoriaPerfilador
                    .add(PropertyFactoryUtil.forName("tipoDocumento").eq(String.valueOf(cboTipoDocumento)))
                    .add(PropertyFactoryUtil.forName("tipoDocumento").isNotNull())
                    .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("tipoDocumento").eq("")));
        }
        if (cboPerfilador != null && cboPerfilador > 0) {
            consultaAuditoriaPerfilador
                    .add(PropertyFactoryUtil.forName("perfilador").eq(String.valueOf(cboPerfilador)))
                    .add(PropertyFactoryUtil.forName("perfilador").isNotNull())
                    .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("perfilador").eq("")));
        }
        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");
                consultaAuditoriaPerfilador
                        .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);
            e.printStackTrace();
        }

        consultaAuditoriaPerfilador.addOrder(OrderFactoryUtil.desc("fechaHora"));
        if (filas > 0 && pagina > 0) {
            int init = (filas * pagina - filas);
            int fin = init + filas;

            List<AuditoriaPerfilador> lst = AuditoriaPerfiladorLocalServiceUtil
                    .dynamicQuery(consultaAuditoriaPerfilador, init, fin);
            _log.info(" select  obtenerListaAuditoriaPerfilador lst.size() :" + lst.size());

            return lst;
        } else {
            List<AuditoriaPerfilador> lst = AuditoriaPerfiladorLocalServiceUtil
                    .dynamicQuery(consultaAuditoriaPerfilador);
            _log.info(" select  obtenerListaAuditoriaPerfilador lst.size() :" + lst.size());
            return lst;
        }

    } catch (Exception e) {
        // throw new
        // BusinessException(nameClase+" - obtenerListaAuditoriaPerfilador",e.toString());
        _log.error(Propiedades.getResourceBundleMetodo(
                "capa.halcon.auditoria.perfilador.obtenerlistaauditoriaperfilador") + e.toString());
        throw new BusinessException(Propiedades.getResourceBundle("capa.halcon.auditoria.perfilador",
                "capa.halcon.auditoria.perfilador.obtenerlistaauditoriaperfilador"), e.toString());
    }
}

From source file:com.ext.portlet.halcon.service.impl.AuditoriaSimuladorLocalServiceImpl.java

License:Open Source License

public Integer obtenerListaSimuladoresCount(Integer filas, Integer pagina, Integer cboTipoDocumento,
        Integer simulador, String txtFechaInicio, String txtFechaFin) throws BusinessException {

    _log.info(" obtenerListaSimuladoresCount datos cboTipoDocumento : " + cboTipoDocumento + "  simulador : "
            + simulador + "  txtFechaInicio : " + txtFechaInicio + "  txtFechaFin : " + txtFechaFin);
    try {//from   w w  w  .  ja  va 2 s. c om

        ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil
                .locate(ClpSerializer.getServletContextName(), "portletClassLoader");
        DynamicQuery consultaAuditoriaSimulador = DynamicQueryFactoryUtil.forClass(AuditoriaSimulador.class,
                classLoader);

        if (cboTipoDocumento != null && cboTipoDocumento > 0) {
            consultaAuditoriaSimulador
                    .add(PropertyFactoryUtil.forName("tipoDocumento").eq(String.valueOf(cboTipoDocumento)))
                    .add(PropertyFactoryUtil.forName("tipoDocumento").isNotNull())
                    .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("tipoDocumento").eq("")));
        }

        if (simulador != null && simulador > 0) {
            consultaAuditoriaSimulador
                    .add(PropertyFactoryUtil.forName("tipoSimulador").eq(String.valueOf(simulador)))
                    .add(PropertyFactoryUtil.forName("tipoSimulador").isNotNull())
                    .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("tipoSimulador").eq("")));
        }

        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");
                consultaAuditoriaSimulador
                        .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(consultaAuditoriaSimulador);
        return count.intValue();

    } catch (Exception e) {
        //System.out.println(e);
        //throw new BusinessException(nameClase+" - obtenerListaSimuladoresCount",e.toString());
        _log.error(Propiedades.getResourceBundleMetodo(
                "capa.halcon.auditoria.simulador.obtenerlistasimuladorescount") + e.toString());
        throw new BusinessException(Propiedades.getResourceBundle("capa.halcon.auditoria.simulador",
                "capa.halcon.auditoria.simulador.obtenerlistasimuladorescount"), e.toString());
    }
}

From source file:com.ext.portlet.halcon.service.impl.AuditoriaSimuladorLocalServiceImpl.java

License:Open Source License

public List<AuditoriaSimulador> obtenerListaSimuladores(Integer filas, Integer pagina, Integer cboTipoDocumento,
        Integer simulador, String txtFechaInicio, String txtFechaFin) throws BusinessException {
    _log.info(" obtenerListaSimuladores datos cboTipoDocumento : " + cboTipoDocumento + "  simulador : "
            + simulador + "  txtFechaInicio : " + txtFechaInicio + "  txtFechaFin : " + txtFechaFin);
    try {//  w  ww .j a  va 2 s. co m

        ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil
                .locate(ClpSerializer.getServletContextName(), "portletClassLoader");
        DynamicQuery consultaAuditoriaSimulador = DynamicQueryFactoryUtil.forClass(AuditoriaSimulador.class,
                classLoader);

        if (cboTipoDocumento != null && cboTipoDocumento > 0) {
            consultaAuditoriaSimulador
                    .add(PropertyFactoryUtil.forName("tipoDocumento").eq(String.valueOf(cboTipoDocumento)))
                    .add(PropertyFactoryUtil.forName("tipoDocumento").isNotNull())
                    .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("tipoDocumento").eq("")));
        }

        if (simulador != null && simulador > 0) {
            consultaAuditoriaSimulador
                    .add(PropertyFactoryUtil.forName("tipoSimulador").eq(String.valueOf(simulador)))
                    .add(PropertyFactoryUtil.forName("tipoSimulador").isNotNull())
                    .add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("tipoSimulador").eq("")));
        }

        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");
                consultaAuditoriaSimulador
                        .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);
        }
        consultaAuditoriaSimulador.addOrder(OrderFactoryUtil.desc("fechaHora"));
        if (filas > 0 && pagina > 0) {
            int init = (filas * pagina - filas);
            int fin = init + filas;

            @SuppressWarnings("unchecked")
            List<AuditoriaSimulador> lst = AuditoriaSimuladorLocalServiceUtil
                    .dynamicQuery(consultaAuditoriaSimulador, init, fin);
            _log.info(" select  obtenerListaAuditoriaCajaSorpresa lst.size() :" + lst.size());

            return lst;
        } else {
            @SuppressWarnings("unchecked")
            List<AuditoriaSimulador> lst = AuditoriaSimuladorLocalServiceUtil
                    .dynamicQuery(consultaAuditoriaSimulador);
            _log.info(" select  -1 -1 obtenerListaAuditoriaCajaSorpresa lst.size() :" + lst.size());
            return lst;
        }

    } catch (Exception e) {
        //throw new BusinessException(nameClase+" - obtenerListaSimuladores",e.toString());
        _log.error(Propiedades.getResourceBundleMetodo(
                "capa.halcon.auditoria.simulador.auditoriasimuladorlocalserviceutil") + e.toString());
        throw new BusinessException(Propiedades.getResourceBundle("capa.halcon.auditoria.simulador",
                "capa.halcon.auditoria.simulador.auditoriasimuladorlocalserviceutil"), e.toString());
    }
}

From source file:com.ext.portlet.halcon.service.impl.CargaDescuentoLocalServiceImpl.java

License:Open Source License

/**
 * se obtiene la lista de descuentos la cantidad de filas la pagina la cual se encuentra
 * @throws BusinessException //from  w  w w.  ja  v  a2  s  .co m
 */
public List<CargaDescuento> obtenerUbicacionMapaDescuentos(String buscar, String distrito, Integer categoria,
        int pagina, int filas) throws BusinessException {

    _log.info(" obtenerUbicacionMapaDescuentos datos ingresados[ buscar :" + buscar + ", distrito: " + distrito
            + ", categoria: " + categoria + ", pagina : " + pagina + ", filas : " + filas + "]");

    ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(),
            "portletClassLoader");
    DynamicQuery consultaCargaTienda = DynamicQueryFactoryUtil.forClass(CargaDescuento.class, classLoader);

    if (!buscar.equals("") && buscar.length() > 0) {
        consultaCargaTienda.add(PropertyFactoryUtil.forName("local").like("%" + buscar + "%"));
    }
    if (distrito != null && distrito.length() > 0) {
        consultaCargaTienda.add(PropertyFactoryUtil.forName("idDistrito").eq(distrito));
    }
    if (categoria != null && categoria > 0) {
        consultaCargaTienda.add(PropertyFactoryUtil.forName("categoria").eq(String.valueOf(categoria)));
    }
    consultaCargaTienda.add(PropertyFactoryUtil.forName("latitud").isNotNull());
    consultaCargaTienda.add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("latitud").eq("")));
    consultaCargaTienda.add(PropertyFactoryUtil.forName("longitud").isNotNull());
    consultaCargaTienda.add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("longitud").eq("")));
    try {
        int init = (filas * pagina - filas);
        int fin = init + filas;
        @SuppressWarnings("unchecked")
        List<CargaDescuento> lstDescuento = CargaDescuentoLocalServiceUtil.dynamicQuery(consultaCargaTienda,
                init, fin);
        _log.info(" select  obtenerUbicacionMapaDescuentos stDescuento.size() :" + lstDescuento.size());
        return lstDescuento;
    } catch (Exception e) {
        //         _log.error(" error al select  obtenerUbicacionMapaDescuentos : " + e.getMessage());
        //         throw new BusinessException(nameClase+" - obtenerUbicacionMapaDescuentos",e.toString());
        _log.error(Propiedades.getResourceBundleMetodo(
                "capa.halcon.carga.descuento.obtenerubicacionmapadescuentos") + e.toString());
        throw new BusinessException(Propiedades.getResourceBundle("capa.halcon.carga.descuento",
                "capa.halcon.carga.descuento.obtenerubicacionmapadescuentos"), e.toString());
    }
}

From source file:com.ext.portlet.halcon.service.impl.CargaDescuentoLocalServiceImpl.java

License:Open Source License

/**
 * se la cantidad de registros en total// w  w w.  j av a2  s  .co m
 * la cantidad de filas 
 * la pagina la cual se encuentra
 * @throws BusinessException 
 */
public Long obtenerUbicacionMapaCargaDescuentosCount(String buscar, String distrito, Integer categoria,
        int pagina, int filas) throws BusinessException {

    try {
        _log.info(" obtenerUbicacionMapaCargaDescuentosCount datos ingresados[ buscar :" + buscar
                + ", distrito: " + distrito + ", categoria: " + categoria + ", pagina : " + pagina
                + ", filas : " + filas + "]");

        ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil
                .locate(ClpSerializer.getServletContextName(), "portletClassLoader");
        DynamicQuery consultaCargaDescuento = DynamicQueryFactoryUtil.forClass(CargaDescuento.class,
                classLoader);

        if (!buscar.equals("") && buscar.length() > 0) {
            consultaCargaDescuento.add(PropertyFactoryUtil.forName("local").like("%" + buscar + "%"));
        }

        if (distrito != null && distrito.length() > 0) {
            consultaCargaDescuento.add(PropertyFactoryUtil.forName("idDistrito").eq(String.valueOf(distrito)));
        }

        if (categoria != null && categoria > 0) {
            consultaCargaDescuento.add(PropertyFactoryUtil.forName("categoria").eq(String.valueOf(categoria)));
        }

        consultaCargaDescuento.add(PropertyFactoryUtil.forName("latitud").isNotNull());
        consultaCargaDescuento.add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("latitud").eq("")));
        consultaCargaDescuento.add(PropertyFactoryUtil.forName("longitud").isNotNull());
        consultaCargaDescuento.add(RestrictionsFactoryUtil.not(PropertyFactoryUtil.forName("longitud").eq("")));

        Long count = CargaDescuentoLocalServiceUtil.dynamicQueryCount(consultaCargaDescuento);

        _log.info(" select  obtenerUbicacionMapaCargaDescuentosCount count :" + count);
        return count;
    } catch (Exception e) {
        //         _log.error(" error al obtenerUbicacionMapaCargaDescuentosCount : "+e.getMessage());
        //         throw new BusinessException(nameClase+" - obtenerUbicacionMapaCargaDescuentosCount",e.toString());
        _log.error(Propiedades.getResourceBundleMetodo(
                "capa.halcon.carga.descuento.obtenerubicacionmapacargadescuentoscount") + e.toString());
        throw new BusinessException(Propiedades.getResourceBundle("capa.halcon.carga.descuento",
                "capa.halcon.carga.descuento.obtenerubicacionmapacargadescuentoscount"), e.toString());
    }
}