Combining Alfresco actions together

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2009 08:50 AM
Hi all,
I am facing a scenario in which I am executing an action in the Alfresco web project.
Suppose,
1.In the user sandbox,when we click on deploy action from more actions menu,deploy snapshot is performed.
2.If the deployment is success,I want to execute a preview icon in the monitor deployment page.
3.(i.e)Preview action is executed depending on the result of first action(deploy).
4.In the deployment callback mechanism, when the deployment is successful ,I tried getting the current facescontext so that we can atleast navigate to the new page,but facescontext is coming as null.
5.Can we combine two actions together?
6.Or atleast can we able to handle navigation using faces context in deployment callbacks.?
Any help appreciated…Thanks..
I am facing a scenario in which I am executing an action in the Alfresco web project.
Suppose,
1.In the user sandbox,when we click on deploy action from more actions menu,deploy snapshot is performed.
2.If the deployment is success,I want to execute a preview icon in the monitor deployment page.
3.(i.e)Preview action is executed depending on the result of first action(deploy).
4.In the deployment callback mechanism, when the deployment is successful ,I tried getting the current facescontext so that we can atleast navigate to the new page,but facescontext is coming as null.
5.Can we combine two actions together?
6.Or atleast can we able to handle navigation using faces context in deployment callbacks.?
Any help appreciated…Thanks..
<bean id="avm-deploy-website" class="org.alfresco.repo.avm.actions.AVMDeployWebsiteAction" parent="action-executer"> <property name="callbacks"> <list> <ref bean="deploymentCallbackPreview" /> </list> </property>
public class DeploymentCallbackPreview extends SelfRenderingComponent implements DeploymentCallback, Serializable { public void eventOccurred(DeploymentEvent event){ if (event.getType().equals(Type.START)) { //continue } else if (event.getType().equals(Type.END)) { // if we get the END event the deployment was successful FacesContext fc =FacesContext.getCurrentInstance(); // coming as null fc.getApplication().getNavigationHandler().handleNavigation(fc,"", "dialog:customPriview"); } } }
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2009 10:42 AM
You haven't got a faces context in the deployment callback because the deployment callback is running on a separate thread that is not connected to the UI.
The way the deployment monitoring JSF client works is to use an AJAX callback which is periodically polling a shared object in the HTTP Session. And it is this object that is updated from the deployment callback thread. So when deployment finishes the AJAX callback sees the change in state and navigates away.
So some possible solutions. You could break into the deployment monitoring ajax code and navigate to your preview page rather than the deployment results page.
As for your original question about chaining actions together. Deployment actions are queued and executed on the deployment thread pool. Unless you simply lump the code of multiple actions together there's no inbuilt way of linking actions together. In fact if you queue two actions you can't even guarantee the order that they will run.
A simple approach that would work would be queue an action from an earlier action and have a chain of actions.
You may also be tempted to dd your own action to run the deployment synchronously rather than asynchronously but at that point I think you could easily thrash your server.
The way the deployment monitoring JSF client works is to use an AJAX callback which is periodically polling a shared object in the HTTP Session. And it is this object that is updated from the deployment callback thread. So when deployment finishes the AJAX callback sees the change in state and navigates away.
So some possible solutions. You could break into the deployment monitoring ajax code and navigate to your preview page rather than the deployment results page.
As for your original question about chaining actions together. Deployment actions are queued and executed on the deployment thread pool. Unless you simply lump the code of multiple actions together there's no inbuilt way of linking actions together. In fact if you queue two actions you can't even guarantee the order that they will run.
A simple approach that would work would be queue an action from an earlier action and have a chain of actions.
You may also be tempted to dd your own action to run the deployment synchronously rather than asynchronously but at that point I think you could easily thrash your server.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2009 01:40 AM
Hi,
Can u give me some reference how can we use ajax callback functionality at the config level since I don't want to break the code or can u give me some examples where the actions are combined or queued together..Thanks.
Can u give me some reference how can we use ajax callback functionality at the config level since I don't want to break the code or can u give me some examples where the actions are combined or queued together..Thanks.
