Fórum

PortalPreferences: number at the end

Jose Pablo Araya, modificado 8 Anos atrás.

PortalPreferences: number at the end

New Member Postagens: 2 Data de Entrada: 14/09/15 Postagens Recentes
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, modificado 8 Anos atrás.

RE: PortalPreferences: number at the end (Resposta)

Junior Member Postagens: 89 Data de Entrada: 14/01/11 Postagens Recentes
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, modificado 8 Anos atrás.

RE: PortalPreferences: number at the end

New Member Postagens: 2 Data de Entrada: 14/09/15 Postagens Recentes
Thanks for the help guys, it was very useful.

Regards!
thumbnail
Punam Shah, modificado 8 Anos atrás.

RE: PortalPreferences: number at the end

Regular Member Postagens: 117 Data de Entrada: 20/01/12 Postagens Recentes
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!!!