Forums de discussion

PortalPreferences: number at the end

Jose Pablo Araya, modifié il y a 8 années.

PortalPreferences: number at the end

New Member Publications: 2 Date d'inscription: 14/09/15 Publications récentes
Hi,

I have a doubt: what is the number at the end of the portal preferences that are stored in the portalPreferences table? How can I know this number?

These are two preferences that are saved there:

	<preference>
		<name>ldap.security.principal.70922</name>
		<value>dir\jose.p.araya.camacho</value>
	</preference>
	<preference>
		<name>ldap.server.name.70922</name>
		<value>TEST</value>
	</preference>


I need to know this number in order to use the next code:
        final String providerURL = PrefsPropsUtil.getString(companyId, "ldap.base.provider.url.70922");
        final String principal = PrefsPropsUtil.getString(companyId, "ldap.security.principal.70922");
        final String credentials = PrefsPropsUtil.getString(companyId, "ldap.security.credentials.70922");
        final String baseDN = PrefsPropsUtil.getString(companyId, "ldap.base.dn.70922");


Thanks guys!
thumbnail
Shinn Lok, modifié il y a 8 années.

RE: PortalPreferences: number at the end (Réponse)

Junior Member Publications: 89 Date d'inscription: 14/01/11 Publications récentes
The number you are looking at is the LDAP Server ID. You can grab the list of server ids using:

PrefsPropsUtil.getString(company.getCompanyId(), "ldap.server.ids")


If you want the server that the user came from you can use:

user.getLdapServerId()
Jose Pablo Araya, modifié il y a 8 années.

RE: PortalPreferences: number at the end

New Member Publications: 2 Date d'inscription: 14/09/15 Publications récentes
Thanks for the help guys, it was very useful.

Regards!
thumbnail
Punam Shah, modifié il y a 8 années.

RE: PortalPreferences: number at the end

Regular Member Publications: 117 Date d'inscription: 20/01/12 Publications récentes
You need to convert liferay preference object to javax.portlets.preference. easier way to access all the preferences.

After then you will get all the stored preferences keys by invoking "getNames()". iterate each enumerate and apply if condition name.startsWith().....

HTH!!!