cancel
Showing results for 
Search instead for 
Did you mean: 

Development of a SearchComponent - How to start?

Former Member
0 Kudos

I am trying to develop Search Component and I have few doubts.

1) finding jar files for development. I am using class locator to find them, but how do I include it? Should I add those jar copy in my par file? Or is the reference enough? Will be picked up from portal location during run time?

2) I am trying to dynamically change the search folder during search. Is this possible?

3) Can Search component be a simple java class or should it be a Portal Component/Service?

Thanks,

Deepak

Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Deepak,

> 1) finding jar files for development. I am using class locator to find them, but how do I include it?

At build time through the .classpath file, which ClassLocator does for you. At runtime through the (Private)SharingReference reference within portalapp.xml.

> Should I add those jar copy in my par file?

No, never!!!

> Or is the reference enough? Will be picked up from portal location during run time?

Yes. See http://help.sap.com/saphelp_erp2004/helpdata/en/3d/571140d72dc442e10000000a1550b0/frameset.htm and around.

> 2) I am trying to dynamically change the search folder during search. Is this possible?

I'm unsure what you mean exactly, but of course it is possible to define under which folder the search should start. Obviously, as you may allow the end user to pick up such a folder!

> 3) Can Search component be a simple java class or should it be a Portal Component/Service?

It is a class; nevertheless, you need a dummy service within your project which adds your classloader to the CrtClassloaderRegistry.

See https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/41cbcb56-0701-0010-43b4-fbc138ea... for more details; the docu has some bugs, but should be helpful to understand how all things work together.

Hope it helps

Detlev

Former Member
0 Kudos

Hi Detlev,

Thanks for your inputs. It helps.

I have another question, how to retrieve user information (the user who is currently logged-in) from a stand alone class? I know I can get this from request object, but how to get it if I don't have request object with me?

Thanks,

Deepak

detlev_beutner
Active Contributor
0 Kudos

Hi Deepak,

> how to get it if I don't have request object with me?

Normally you can't, as you will need some client-server-roundtrip for having a user in the context. Having this, you should have access to such a request object.

There are some situations, where for example a user object is implicitely given, as this is the case for resources (a resource always "lives" in a resource context, which has got the user).

The same holds for the proxy object accessible in some cases from within flexUI components; see for example https://www.sdn.sap.com/irj/scn/thread?messageID=3600511 - Praveens answer. As far as I remember, that should hold for search components, too.

Hope it helps

Detlev

Former Member
0 Kudos

Hi Detlev,

How can I get Proxy object from search component? Please help.

Thanks,

Deepak

detlev_beutner
Active Contributor
0 Kudos

Hi Deepak,

Checked again, and sorry, it's not the proxy. But: The framework calls setDynpage, so that you have a reference to this. From this, you can call getPageContext().getRequest(). Check of which concrete type this will be. I remember that there are at least two ways to access the request - and one worked, the other didn't (two ways in the sense of looking sharp at the APIDoc). I hope the one I showed now is the one that works

Hope it helps

Detlev

Former Member
0 Kudos

Thanks a lot Detlev. This fixed my problem

Thanks & Regards,

Deepak

Answers (0)