掲示板

PortalPreferences: number at the end

8年前 に Jose Pablo Araya によって更新されました。

PortalPreferences: number at the end

New Member 投稿: 2 参加年月日: 15/09/14 最新の投稿
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
8年前 に Shinn Lok によって更新されました。

RE: PortalPreferences: number at the end (回答)

Junior Member 投稿: 89 参加年月日: 11/01/14 最新の投稿
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()
8年前 に Jose Pablo Araya によって更新されました。

RE: PortalPreferences: number at the end

New Member 投稿: 2 参加年月日: 15/09/14 最新の投稿
Thanks for the help guys, it was very useful.

Regards!
thumbnail
8年前 に Punam Shah によって更新されました。

RE: PortalPreferences: number at the end

Regular Member 投稿: 117 参加年月日: 12/01/20 最新の投稿
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!!!