Commit a80f7aa1 authored by abenkaddour's avatar abenkaddour

Add actions in the controller

parent acfea85a
Pipeline #2085 passed with stages
in 1 minute and 58 seconds
...@@ -183,6 +183,34 @@ public class MetaViewController { ...@@ -183,6 +183,34 @@ public class MetaViewController {
final PieceOfKnowledge pok = this.metaviewBusinessService.getPoKToUseAsSource(doc, this.sourceTypeTab); final PieceOfKnowledge pok = this.metaviewBusinessService.getPoKToUseAsSource(doc, this.sourceTypeTab);
response.setEvent(QName.valueOf("{http://weblab.ow2.org/portlet/metaview/action}useAsSource"), pok); response.setEvent(QName.valueOf("{http://weblab.ow2.org/portlet/metaview/action}useAsSource"), pok);
} }
/**
* The user add the current document to the basket. An event to share this action is sent to others Portlets.
*
* @param response
* The action response
* @param model
* The model
*/
@ActionMapping(params = "action=addToBasketMeta")
public void addToBasket(final ActionResponse response, final ModelMap model) {
response.setEvent(QName.valueOf("{http://weblab.ow2.org/portlet/metaview/action}addToBasket"), (Document) model.get(MetaViewController.RESOURCE));
}
/**
* The user pin the current document to the basket. An event to share this action is sent to others Portlets.
*
* @param response
* The action response
* @param model
* The model
*/
@ActionMapping(params = "action=pinToBasketMeta")
public void pinToBasket(final ActionResponse response, final ModelMap model) {
response.setEvent(QName.valueOf("{http://weblab.ow2.org/portlet/metaview/action}pinToBasket"), (Document) model.get(MetaViewController.RESOURCE));
}
// ############################################################################# // #############################################################################
...@@ -277,5 +305,4 @@ public class MetaViewController { ...@@ -277,5 +305,4 @@ public class MetaViewController {
mav.addObject("message_error", ex.getMessage()); mav.addObject("message_error", ex.getMessage());
return mav; return mav;
} }
} }
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
<supported-publishing-event> <supported-publishing-event>
<qname xmlns:meta="http://weblab.ow2.org/events/meta">meta:useAsSource</qname> <qname xmlns:meta="http://weblab.ow2.org/events/meta">meta:useAsSource</qname>
</supported-publishing-event> </supported-publishing-event>
<supported-publishing-event>
<qname xmlns:meta="http://weblab.ow2.org/events/meta">meta:addDocument</qname>
</supported-publishing-event>
<supported-publishing-event>
<qname xmlns:meta="http://weblab.ow2.org/events/meta">meta:pinDocument</qname>
</supported-publishing-event>
</portlet> </portlet>
<!-- filters --> <!-- filters -->
...@@ -97,4 +103,12 @@ ...@@ -97,4 +103,12 @@
<qname xmlns:meta="http://weblab.ow2.org/events/meta">meta:useAsSource</qname> <qname xmlns:meta="http://weblab.ow2.org/events/meta">meta:useAsSource</qname>
<value-type>org.ow2.weblab.core.model.PieceOfKnowledge</value-type> <value-type>org.ow2.weblab.core.model.PieceOfKnowledge</value-type>
</event-definition> </event-definition>
<event-definition>
<qname xmlns:meta="http://weblab.ow2.org/events/meta">meta:addDocument</qname>
<value-type>org.ow2.weblab.core.model.Document</value-type>
</event-definition>
<event-definition>
<qname xmlns:meta="http://weblab.ow2.org/events/meta">meta:pinDocument</qname>
<value-type>org.ow2.weblab.core.model.Document</value-type>
</event-definition>
</portlet-app> </portlet-app>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment