Forums de discussion

Extending a Microstrategy Portlet

Marvin Bleiberg, modifié il y a 10 années.

Extending a Microstrategy Portlet

New Member Publications: 16 Date d'inscription: 04/06/12 Publications récentes
I have a third-party (Microstrategy) Portlet that is working as expected. I would like to extend that portlet, by allowing it (read-only) access to specific Liferay data (native, or custom fields in Expando).
a) Does Liferay allow or prevent this type of access from a 3rd party portlet?
b) given the answer to "a", what are options and recommendations to accomplish this?
I understand that Liferay data can in theory be accessed programatically, but do not have any idea whether/how to do this from a 3rd party portlet.

thank you!
Marvin
thumbnail
David H Nebinger, modifié il y a 10 années.

RE: Extending a Microstrategy Portlet

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
All liferay data is in a database, so you can use the database connection to access the data.

Unfortunately the liferay database is esoteric and subject to change w/ each new release. You may be able to figure out the tables/joins you want to pull together into MS, but there's no guarantee it is going to continue to work.

Many of the FK fields are logical-only (no DBMS FK definitions), and often times the value may point to one of many other tables depending upon other column values for the row.
Marvin Bleiberg, modifié il y a 10 années.

RE: Extending a Microstrategy Portlet

New Member Publications: 16 Date d'inscription: 04/06/12 Publications récentes
David-
Thank you for your reply.
Assuming I use Custom Fields (Expando tables) - Is direct access of the db the only (or best) way for the portlet to access this data? I was hoping there might be an existing Liferay service to pull the desired data, and that this service can easily be made available to a third party portlet.
thank you-
Marvin
thumbnail
David H Nebinger, modifié il y a 10 années.

RE: Extending a Microstrategy Portlet

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
Sure, there's the Liferay API which is the preferred method of accessing this data.

Honestly I don't know a lot about microstrategy, but I'm not sure how you would plug into the Liferay API (a Java API) using an existing, canned 3rd party portlet.
Marvin Bleiberg, modifié il y a 10 années.

RE: Extending a 3rd-party java Portlet

New Member Publications: 16 Date d'inscription: 04/06/12 Publications récentes
For any generic 3rd party portlet written in java that displays 3rd party content (but not Liferay content) - does the Liferay platform allow the portlet to call for data from Liferay using the Liferay API, or is this prevented by design? If the former - is there some small set of code to be added to the portlet? If the latter - Is there some straightforward Liferay configuration setting that needs to be turned on/off?
I'm hoping to understand enough about the approach required, in order to give a java developer something specific to accomplish.

thank you-
Marvin
thumbnail
David H Nebinger, modifié il y a 10 années.

RE: Extending a 3rd-party java Portlet

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
Any portlet can access the Liferay API. The API is there for anyone to use.

The questions that you'll encounter are:

1. do you have the source for the "3rd party portlet"? If not, you may be out of luck. Having the source is a requirement.

2. do you have an experienced developer? You'll need someone that knows their stuff, either as an employee or via a consulting firm.
Marvin Bleiberg, modifié il y a 10 années.

RE: Extending a 3rd-party java Portlet

New Member Publications: 16 Date d'inscription: 04/06/12 Publications récentes
David-
The answer to #1 is "yes", we do have the source code. My java developer's response is as follows:
[indent]"The MicroStrategy portlet runs on separate war. We do not want to make a direct database call within this war . You said that Liferay has API for database call, do you know if those API make a call to expose Liferay public interface? We do not want to manage specific Liferay configuration setting inside the MicroStrategy portlet war"[/indent]

The developer is not an expert in Liferay - hopefully you can answer her questions, or at least help us understand if we are on the wrong track somehow.
thank you again for your help.
thumbnail
David H Nebinger, modifié il y a 10 années.

RE: Extending a 3rd-party java Portlet

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
All Liferay portlets have access to the portal-service.jar that is in the global library directory of the app server (lib/ext in tomcat).

It is this jar that has the entire Liferay API that is available to the portlet. To get a list of users, for example, you can use com.liferay.portal.service.UserLocalServiceUtil.getUsers(-1,-1) to retrieve a list of Liferay users.

There are many other services contained within portal-service.jar to access all kinds of things...
Marvin Bleiberg, modifié il y a 10 années.

RE: Extending a 3rd-party java Portlet

New Member Publications: 16 Date d'inscription: 04/06/12 Publications récentes
David-
I found this code in the internet:

User user = UserLocalServiceUtil.getUserById(userid);

For setting the value
user.getExpandoBridge().setAttribute(IConstants.EXPANDO_USER_JOB_DESCRIPTION, "some desc" );

For retrieving the value
user.getExpandoBridge().getAttribute(IConstants.EXPANDO_USER_JOB_DESCRIPTION);

In my case, I declared "propertyA"on the User level. Is it correct to retrieve propertyA with -
user.getExpandoBridge().getAttribute("propertyA");

thank you-
Marvin
thumbnail
David H Nebinger, modifié il y a 10 années.

RE: Extending a 3rd-party java Portlet

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
Sure.
Marvin Bleiberg, modifié il y a 10 années.

RE: Extending a 3rd-party java Portlet

New Member Publications: 16 Date d'inscription: 04/06/12 Publications récentes
David-
Thank you for your help so far. We've been able to get the expando values fromthe tables for a simple text field, but are struggling with getting the value where the Expando field type is "Group of Text Values". How should we approach this? In general - Is there a good reference for differences in using these field types?
thank you again-
Marvin
Marvin Bleiberg, modifié il y a 10 années.

RE: Extending a 3rd-party java Portlet

New Member Publications: 16 Date d'inscription: 04/06/12 Publications récentes
David-
Thank you - we were able to resolve that last part.

If anyone wants the code, this is what we used to get the value from Expando, where the Expando field type is "Group of Text Values":
User user = UserLocalServiceUtil.getUserById(liferayUserID));
String[] attrGroupArray = (String[]) user.getExpandoBridge().getAttribute("AttrGroup");
if (attrGroupArray.length > 0){
attrGroupvalue = attrGroupArray [0];
}