Example usage for com.liferay.portal.kernel.util PropsUtil get

List of usage examples for com.liferay.portal.kernel.util PropsUtil get

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsUtil get.

Prototype

public static String get(String key) 

Source Link

Usage

From source file:com.mobilekipyonetim.service.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//  w ww.  j a  va  2s.  c o m

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "Navigator2-Portlet-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("Navigator2-Portlet-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "Navigator2-Portlet-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.mpower.springcrud.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from  w  w  w.j  a v  a  2 s  .c  o  m*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "Book-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("Book-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "Book-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.ms3.landing.service.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//from ww w .ja v  a  2s .c o m

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "landing-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("landing-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "landing-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.myslayer.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//from  www .j a  v a2 s  . c  om

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "SPA-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("SPA-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "SPA-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.near.notificaciones.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//from  www.  j  a v a  2  s .c o m

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "reynasa-notifications-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("reynasa-notifications-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "reynasa-notifications-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.near.notificaciones.service.impl.RNotificationServiceImpl.java

License:Open Source License

public String[] addNewNotification(String codigoRemitente, List<String> codigoDestinatarioList,
        Date fechaPrevista, String titulo, String contenido, Integer motivo) {
    Long companyId = Long.parseLong(PropsUtil.get("reynasa.fidelizacion.companyId"));
    String[] resultArray = null;/*from www .  java  2s  .c om*/
    User remitente = null;
    try {
        remitente = UserLocalServiceUtil.getUserByScreenName(companyId, codigoRemitente);
        if (titulo != null && !titulo.trim().isEmpty()) {
            if (contenido != null && !contenido.trim().isEmpty()) {
                if (motivo != null && motivo != 0) {
                    String[] arrayRedireccionMotivo = RedireccionesRetriever.getRedireccionURL(motivo);
                    if (RedireccionesRetriever.getRedireccionURL(motivo) != null) {
                        User destinatario;
                        if (codigoDestinatarioList != null && !codigoDestinatarioList.isEmpty()) {
                            String horaPrevista, diaPrevisto;
                            SimpleDateFormat diaFormat = new SimpleDateFormat("dd/MM/yyyy");
                            SimpleDateFormat horaFormat = new SimpleDateFormat("HH:mm");
                            resultArray = new String[codigoDestinatarioList.size()];
                            String codigoDestinatario;
                            if (fechaPrevista != null) {
                                horaPrevista = horaFormat.format(fechaPrevista);
                                diaPrevisto = diaFormat.format(fechaPrevista);
                            } else {
                                Date fechaActual = new Date();
                                horaPrevista = horaFormat.format(fechaActual);
                                diaPrevisto = diaFormat.format(fechaActual);
                            }
                            JSONObject payloadJSON = JSONFactoryUtil.createJSONObject();
                            String redireccionMotivo = "<br><br><a href='" + arrayRedireccionMotivo[0]
                                    + "'><i class='icon-globe'></i> Ir a " + arrayRedireccionMotivo[1] + "</a>";
                            payloadJSON.put("userId", remitente.getUserId());
                            payloadJSON.put("remitenteNombre", remitente.getFullName());
                            payloadJSON.put("titulo", titulo);
                            payloadJSON.put("contenido", contenido + redireccionMotivo);
                            payloadJSON.put("fechaPrevista", diaPrevisto);
                            payloadJSON.put("horaPrevista", horaPrevista);
                            NotificationEvent notificationEvent;
                            for (int i = 0; i < codigoDestinatarioList.size(); i++) {
                                codigoDestinatario = codigoDestinatarioList.get(i);
                                if (codigoDestinatario != null && !codigoDestinatario.trim().isEmpty()) {
                                    try {
                                        destinatario = UserLocalServiceUtil.getUserByScreenName(companyId,
                                                codigoDestinatario);
                                        notificationEvent = new NotificationEvent(new Date().getTime(),
                                                ReynasaNotificationHandler.PORTLET_ID, payloadJSON);
                                        UserNotificationEventLocalServiceUtil.addUserNotificationEvent(
                                                destinatario.getUserId(), notificationEvent);
                                        resultArray[i] = "'" + codigoDestinatario
                                                + "': Notificacin enviada correctamente";
                                        logger.info(resultArray[i]);
                                    } catch (NoSuchUserException e) {
                                        resultArray[i] = "'" + codigoDestinatario
                                                + "': No se ha encontrado el destinatario";
                                        logger.error(resultArray[i]);
                                    } catch (Exception e) {
                                        resultArray[i] = "'" + codigoDestinatario
                                                + "': Ha habido un error durante el envo de la notificacin";
                                        logger.error(resultArray[i]);
                                    }
                                }
                            }
                        } else {
                            resultArray = new String[1];
                            resultArray[0] = "Error: Debe seleccionar un destinatario como mnimo";
                            logger.error(resultArray[0]);
                        }
                    } else {
                        resultArray = new String[1];
                        resultArray[0] = "Error: El motivo introducido para la notificacin no es vlido";
                        logger.error(resultArray[0]);
                    }
                } else {
                    resultArray = new String[1];
                    resultArray[0] = "Error: Debe introducir un motivo para la notificacin";
                    logger.error(resultArray[0]);
                }
            } else {
                resultArray = new String[1];
                resultArray[0] = "Error: Debe introducir un contenido para la notificacin";
                logger.error(resultArray[0]);
            }
        } else {
            resultArray = new String[1];
            resultArray[0] = "Error: Debe introducir un ttulo para la notificacin";
            logger.error(resultArray[0]);
        }
    } catch (NoSuchUserException e) {
        resultArray = new String[1];
        resultArray[0] = "Error: No se ha encontrado el usuario remitente";
        logger.error(resultArray[0]);
    } catch (Exception e) {
        resultArray = new String[1];
        resultArray[0] = "Error: Ha habido un error durante la operacin";
        logger.error(resultArray[0]);
    }
    return resultArray;
}

From source file:com.near.reynasa.masiveLoadUser.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from  ww w  .j  a  v a2 s. co m*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "reynasa-masiveUserLoad-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("reynasa-masiveUserLoad-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "reynasa-masiveUserLoad-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.newsmaker.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from www  . j a  v  a  2 s . c om*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "newsmaker-detailnews-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("newsmaker-detailnews-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "newsmaker-detailnews-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.NewSubscriber.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*  ww w.  j a va 2s  . co  m*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "NewSubscriber-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("NewSubscriber-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "NewSubscriber-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.nyu.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/* w w w .j  a v  a2 s  .com*/

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "ny-you-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("ny-you-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "ny-you-portlet";
        }

        return _servletContextName;
    }
}