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:at.bibbox.reactjsservice.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//  w  ww.jav 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,
                    "BiBBoX-Reactjs-interface-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("BiBBoX-Reactjs-interface-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 = "BiBBoX-Reactjs-interface-portlet";
        }

        return _servletContextName;
    }
}

From source file:at.graz.hmmc.liferay.portlet.puch.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from  w w  w .ja 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,
                    "PuchMuseum-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("PuchMuseum-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 = "PuchMuseum-portlet";
        }

        return _servletContextName;
    }
}

From source file:at.graz.meduni.bibbox.liferay.portlet.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//from   w  ww .  j a  v a2  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,
                    "BIBBOXDocker-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("BIBBOXDocker-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 = "BIBBOXDocker-portlet";
        }

        return _servletContextName;
    }
}

From source file:at.graz.meduni.liferay.api.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from ww  w . j  a  va  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,
                    "idcard-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("idcard-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 = "idcard-portlet";
        }

        return _servletContextName;
    }
}

From source file:at.graz.meduni.liferay.api.service.impl.rdconnectServiceImpl.java

License:Open Source License

/**
 * /*from ww  w .  jav  a  2s.  c o  m*/
 */
public JSONObject regbb(long organizationId) {
    JSONObject json = JSONFactoryUtil.createJSONObject();
    long maincontactrole = Long.parseLong(PropsUtil.get("rdconnectmaincontactid"));
    try {
        Organization organization = OrganizationLocalServiceUtil.getOrganization(organizationId);
        String type = organization.getExpandoBridge().getAttribute("Organization Type").toString()
                .toLowerCase();
        json.put("ID", organization.getOrganizationId());
        json.put("name", organization.getName());
        json.put("date of inclusion", organization.getCreateDate());
        json.put("last activities", organization.getModifiedDate());
        JSONObject json_address = JSONFactoryUtil.createJSONObject();
        json_address.put("name of host institution", organization.getAddress().getStreet1());
        json_address.put("street1", organization.getAddress().getStreet2());
        json_address.put("street2", organization.getAddress().getStreet3());
        json_address.put("zip", organization.getAddress().getZip());
        json_address.put("city", organization.getAddress().getCity());
        json_address.put("country", organization.getAddress().getCountry().getNameCurrentValue());
        json.put("address", json_address);
        json.put("type", type);
        List<Website> websites = WebsiteLocalServiceUtil.getWebsites(organization.getCompanyId(),
                Organization.class.getName(), organization.getOrganizationId());
        JSONArray json_url_array = JSONFactoryUtil.createJSONArray();
        for (Website website : websites) {
            json_url_array.put(website.getUrl());
        }
        json.put("url", json_url_array);
        JSONObject json_main_contact = JSONFactoryUtil.createJSONObject();
        List<User> userlist = UserLocalServiceUtil.getOrganizationUsers(organizationId);
        for (User user_mc : userlist) {
            List<UserGroupRole> usergrouprolles = UserGroupRoleLocalServiceUtil
                    .getUserGroupRoles(user_mc.getUserId(), organization.getGroup().getGroupId());
            for (UserGroupRole ugr : usergrouprolles) {
                if (ugr.getRoleId() == maincontactrole) {
                    json_main_contact.put("title", user_mc.getGreeting());
                    json_main_contact.put("first name", user_mc.getFirstName());
                    json_main_contact.put("last name", user_mc.getLastName());
                    List<Phone> phones = user_mc.getPhones();
                    for (Phone phone : phones) {
                        if (phone.isPrimary()) {
                            json_main_contact.put("phone", phone.getNumber() + "" + phone.getExtension());
                        }
                    }
                    json_main_contact.put("email", user_mc.getEmailAddress());
                }
            }
        }
        json.put("main contact", json_main_contact);
        // TODO
        String ddlname = "default";
        if (type.equalsIgnoreCase("biobank")) {
            ddlname = "bb_core";
        } else {
            ddlname = "core";
        }
        List<DDLRecordSet> rdc_recordlist = DDLRecordSetLocalServiceUtil
                .getRecordSets(organization.getGroupId());
        for (DDLRecordSet rdc_rs : rdc_recordlist) {
            String rdc_rsname = String.valueOf(rdc_rs.getNameCurrentValue());
            if (rdc_rsname.equalsIgnoreCase(ddlname)) {
                List<DDLRecord> records = rdc_rs.getRecords();
                for (DDLRecord record : records) {
                    String type_of_host_institution = "";
                    String target_population = "";
                    JSONArray json_also_listed_in_array = JSONFactoryUtil.createJSONArray();
                    if (record.getField("Host_institution_is_a") != null) {
                        type_of_host_institution = record.getField("Host_institution_is_a").getValue()
                                .toString().replaceAll("\"\\]|\\[\"", "");
                    }
                    if (record.getField("Target_population_of_the_registry") != null) {
                        target_population = record.getField("Target_population_of_the_registry").getValue()
                                .toString().replaceAll("\"\\]|\\[\"", "");
                    }
                    if (record.getField(
                            "The_registry_biobanks_is_listed_in_other_inventories_networks") != null) {
                        String[] also_listed_in = record
                                .getField("The_registry_biobanks_is_listed_in_other_inventories_networks")
                                .getValue().toString().replaceAll("\"\\]|\\[\"", "").split("\",\"");
                        for (String also_listed_initems : also_listed_in) {
                            if (also_listed_initems.equalsIgnoreCase("not specified")) {
                                continue;
                            }
                            json_also_listed_in_array.put(also_listed_initems);
                        }
                    }

                    json.put("type of host institution", type_of_host_institution);
                    json.put("target population", target_population);
                    json.put("also listed in", json_also_listed_in_array);

                }
            }
        }
        JSONArray json_diseases_array = JSONFactoryUtil.createJSONArray();
        List<DiseaseMatrix> diseasematrixs = DiseaseMatrixLocalServiceUtil.getDiseaseMatrixs(organizationId, -1,
                -1);
        for (DiseaseMatrix diseasematrix : diseasematrixs) {
            JSONObject json_disease_matrix = JSONFactoryUtil.createJSONObject();
            json_disease_matrix.put("name", diseasematrix.getDiseasename());
            json_disease_matrix.put("number", diseasematrix.getPatientcount());
            json_disease_matrix.put("gene", diseasematrix.getGene());
            json_disease_matrix.put("orphacode", diseasematrix.getOrphanumber());
            json_disease_matrix.put("icd10", diseasematrix.getIcd10());
            json_disease_matrix.put("omim", diseasematrix.getOmim());
            json_disease_matrix.put("synonym", diseasematrix.getSynonym());
            json_diseases_array.put(json_disease_matrix);
        }
        json.put("diseases", json_diseases_array);
    } catch (Exception e) {
        System.out.println("ERROR: rdconnectServiceImpl::regbb(long organizationId)");
        e.printStackTrace();
    }
    return json;
}

From source file:at.graz.meduni.liferay.api.service.impl.rdconnectServiceImpl.java

License:Open Source License

/**
 * //from ww w  .j a va  2 s . com
 */
public JSONArray regbbs() {
    JSONArray jsonarray = JSONFactoryUtil.createJSONArray();
    try {
        String parentid_string = PropsUtil.get("rdconnectcatalougeid");
        long parentid = Long.parseLong(parentid_string);
        List<Organization> organizations = OrganizationLocalServiceUtil
                .getOrganizations(CompanyThreadLocal.getCompanyId(), parentid);
        for (Organization organization : organizations) {
            String type = organization.getExpandoBridge().getAttribute("Organization Type").toString()
                    .toLowerCase();
            JSONObject json = JSONFactoryUtil.createJSONObject();
            json.put("ID", organization.getOrganizationId());
            json.put("name", organization.getName());
            json.put("type", type);
            jsonarray.put(json);
        }
    } catch (SystemException e) {
        System.out.println("ERROR: rdconnectServiceImpl::regbbs()");
        e.printStackTrace();
    }
    return jsonarray;
}

From source file:at.graz.meduni.liferay.api.service.impl.rdconnectServiceImpl.java

License:Open Source License

/**
 * /*w w  w.  j  a v  a  2 s  . com*/
 * @return
 */
public JSONArray regs() {
    JSONArray jsonarray = JSONFactoryUtil.createJSONArray();
    try {
        String parentid_string = PropsUtil.get("rdconnectcatalougeid");
        long parentid = Long.parseLong(parentid_string);
        List<Organization> organizations = OrganizationLocalServiceUtil
                .getOrganizations(CompanyThreadLocal.getCompanyId(), parentid);
        for (Organization organization : organizations) {
            String type = organization.getExpandoBridge().getAttribute("Organization Type").toString()
                    .toLowerCase();
            if (!type.equalsIgnoreCase("registry")) {
                continue;
            }
            JSONObject json = JSONFactoryUtil.createJSONObject();
            json.put("ID", organization.getOrganizationId());
            json.put("name", organization.getName());
            json.put("type", type);
            jsonarray.put(json);
        }
    } catch (SystemException e) {
        System.out.println("ERROR: rdconnectServiceImpl::regbbs()");
        e.printStackTrace();
    }
    return jsonarray;
}

From source file:at.graz.meduni.liferay.api.service.impl.rdconnectServiceImpl.java

License:Open Source License

/**
 * /* www  .j  av  a  2s. c o  m*/
 * @return
 */
public JSONArray bbs() {
    JSONArray jsonarray = JSONFactoryUtil.createJSONArray();
    try {
        String parentid_string = PropsUtil.get("rdconnectcatalougeid");
        long parentid = Long.parseLong(parentid_string);
        List<Organization> organizations = OrganizationLocalServiceUtil
                .getOrganizations(CompanyThreadLocal.getCompanyId(), parentid);
        for (Organization organization : organizations) {
            String type = organization.getExpandoBridge().getAttribute("Organization Type").toString()
                    .toLowerCase();
            if (!type.equalsIgnoreCase("biobank")) {
                continue;
            }
            JSONObject json = JSONFactoryUtil.createJSONObject();
            json.put("ID", organization.getOrganizationId());
            json.put("name", organization.getName());
            json.put("type", type);
            jsonarray.put(json);
        }
    } catch (SystemException e) {
        System.out.println("ERROR: rdconnectServiceImpl::regbbs()");
        e.printStackTrace();
    }
    return jsonarray;
}

From source file:at.graz.meduni.liferay.portlet.bbmriat.service.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }// w w  w .j  av 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,
                    "BBMRIAT-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("BBMRIAT-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 = "BBMRIAT-portlet";
        }

        return _servletContextName;
    }
}

From source file:at.graz.meduni.liferay.portlet.bibbox.kdssmp.service.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from  w  w w . j av 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,
                    "BiBBoxKDSSMP-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("BiBBoxKDSSMP-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 = "BiBBoxKDSSMP-portlet";
        }

        return _servletContextName;
    }
}