Thanks Nicklas.

I know this issue has come up on the mailing list a couple of times, but I'm 
not sure what the solution is. As I said, I'm linking directly to Experiments 
in BASE from my Flex application. I'm doing this by doing an HTTP POST to 
/login.jsp with a redirect to 
views/experiments/index.jsp?cmd=ViewItem&item_id=...&ID=...

This works fine but there are a couple of problems. The first is that I call 
/login.jsp every time I link to an experiment. I'm using the same ID every time 
to avoid creating a new session. Is this the correct thing to do?

The second problem is this issue with the active project. What is the correct 
way to ensure that the link works i.e. avoiding linking to an Experiment that 
isn't shared with the 'active' project? I have tried the following:

1. Generate a session ID
2. Use the webservices API to set the active project for this sessionID
3. Post to /login.jsp using this sessionID

But this doesn't seem to work. Is there a way to link directly to an 
Experiment, ignoring whatever Project is currently active? Any help would be 
gratefully received.

Mark.


-----Original Message-----
From: basedb-devel-boun...@lists.sourceforge.net 
[mailto:basedb-devel-boun...@lists.sourceforge.net] On Behalf Of Nicklas 
Nordborg
Sent: 07 January 2010 07:31
To: BASE dev
Subject: Re: [basedb-devel] Setting active project via API

Woodbridge, Mark R wrote:
> Hi,
> 
>  
> 
> I'm linking to experiments in BASE from another web application. This 
> works fine, including automatically logging in, as long as the 
> experiment belongs to the user's active project. I'd like to ensure that 
> the correct project is activated before the user clicks on the link. 
> Does anyone know if I can get the relevant project id from an experiment 
> id? There doesn't seem to be an ExperimentInfo.getProject() method.

There is no such method since an experiment can belong to more than one 
project. The web service API has very limited functionality. The 
functionality that currently exists was implemented to support some 
specific use cases (mainly related to downloading data files) for a 
project that we participated in.

Using the regular BASE API you can find the projects by putting the 
experiment in a collection and then using a multi-permissions object:

Collection<Experiment> experiments = ...
MultiPermissions mp = new MultiPermissions(experiments);
ItemQuery<Project> q = mp.getProjects();
List<Project> project = q.list(dc);

The code is a bit awkward, but for some reason the obvious approach, 
Experiment.getProjectKey().getProjects(), is missing.

/Nicklas

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel

Reply via email to