code: public String getPortletId(String portletName, String servletContextName) {
      String portletId = portletName;
  
      if (Validator.isNotNull(servletContextName)) {
        if (servletContextName.startsWith("/")) {
          servletContextName = servletContextName.substring(1);
        }
        portletId = portletId.concat(PortletConstants.WAR_SEPARATOR).concat(servletContextName);
      }
  
      portletId = PortalUtil.getJsSafePortletId(portletId);
      return portletId;
    }
docs: copied from
  https://github.com/liferay/liferay-portal/blob/master/portal-impl
  /src/com/liferay/portal/service/impl/PortletLocalServiceImpl.java
  
  see
  http://stackoverflow.com/questions/11151001/how-to-get-portlet-id-using-
  the-portlet-name-in-liferay