Commit 8788d918 authored by Rémi GAUTHIER's avatar Rémi GAUTHIER Committed by Yann Mombrun

Various fixes on more than 6 issues

- WEBLAB-1537 / WEBLAB-1519 / WEBLAB-1538 / #879 : communication meta/source
- WEBLAB-1606 / #1181 : link doc traduction/original
- WEBLAB-1607 / #1180 : link doc native
- WEBLAB-1525 / #1269 : config dates hramonisation
- #1206 : add source button with permission control

git-svn-id: svn://svn.forge.objectweb.org/svnroot/weblab/trunk/WebLabServices/Portlets/metadata-portlet@4609 a803c184-d8de-4a0e-a52b-d3eef88212b6
parent 198c5f7a
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<relativePath>../parent/pom.xml</relativePath> <relativePath>../parent/pom.xml</relativePath>
</parent> </parent>
<groupId>org.ow2.weblab.portlets</groupId>
<artifactId>weblab-metaview</artifactId> <artifactId>weblab-metaview</artifactId>
<version>2.2.5-SNAPSHOT</version> <version>2.2.5-SNAPSHOT</version>
...@@ -37,6 +36,12 @@ ...@@ -37,6 +36,12 @@
<groupId>org.ow2.weblab.components</groupId> <groupId>org.ow2.weblab.components</groupId>
<artifactId>weblab-taglib</artifactId> <artifactId>weblab-taglib</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.2.3</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<description>This portlet displays WebLab resources metadata.</description> <description>This portlet displays WebLab resources metadata.</description>
......
...@@ -19,27 +19,40 @@ package org.ow2.weblab.portlet.business.bean; ...@@ -19,27 +19,40 @@ package org.ow2.weblab.portlet.business.bean;
import java.util.Date; import java.util.Date;
import javax.annotation.Resource;
@Resource
public class TimeConfig { public class TimeConfig {
private long maxEndDateMS; private long maxEndDateMS;
private String formatDateTimeForJSTL;
public TimeConfig() { public TimeConfig() {
this.setMaxEndDateMS(new Date()); this.setMaxEndDateMS(new Date());
} }
public long getMaxEndDateMS() { public long getMaxEndDateMS() {
return this.maxEndDateMS; return this.maxEndDateMS;
} }
public void setMaxEndDateMS(final Date maxEndDateMS) { public void setMaxEndDateMS(final Date maxEndDateMS) {
this.maxEndDateMS = maxEndDateMS.getTime(); this.maxEndDateMS = maxEndDateMS.getTime();
} }
public String getFormatDateTimeForJSTL() {
return formatDateTimeForJSTL;
}
public void setFormatDateTimeForJSTL(String formatDateTimeForJSTL) {
this.formatDateTimeForJSTL = formatDateTimeForJSTL;
}
} }
...@@ -21,6 +21,7 @@ import java.net.URI; ...@@ -21,6 +21,7 @@ import java.net.URI;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.ow2.weblab.core.model.Document;
import org.ow2.weblab.core.model.PieceOfKnowledge; import org.ow2.weblab.core.model.PieceOfKnowledge;
import org.ow2.weblab.core.model.Resource; import org.ow2.weblab.core.model.Resource;
import org.ow2.weblab.core.services.ContentNotAvailableException; import org.ow2.weblab.core.services.ContentNotAvailableException;
...@@ -41,5 +42,8 @@ public interface MetaViewBusinessServices { ...@@ -41,5 +42,8 @@ public interface MetaViewBusinessServices {
public PieceOfKnowledge getPoKForSelectedTranslation(final URI uri, final URI serviceURI, final String lang); public PieceOfKnowledge getPoKForSelectedTranslation(final URI uri, final URI serviceURI, final String lang);
public PieceOfKnowledge getPoKToUseAsSource(Document doc, String sourceTab);
} }
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package org.ow2.weblab.portlet.business.service;
import javax.portlet.PortletRequest;
import com.liferay.portal.kernel.exception.SystemException;
/**
* Interface defining the service is charge of permission control
*
* @author rgauthier
*/
public interface PermissionService {
public boolean hasAdminRole(PortletRequest request) throws SystemException;
}
...@@ -31,6 +31,7 @@ import org.apache.commons.logging.LogFactory; ...@@ -31,6 +31,7 @@ import org.apache.commons.logging.LogFactory;
import org.ow2.weblab.core.annotator.AbstractAnnotator.Operator; import org.ow2.weblab.core.annotator.AbstractAnnotator.Operator;
import org.ow2.weblab.core.annotator.BaseAnnotator; import org.ow2.weblab.core.annotator.BaseAnnotator;
import org.ow2.weblab.core.model.Resource; import org.ow2.weblab.core.model.Resource;
import org.ow2.weblab.portlet.business.bean.TimeConfig;
import org.purl.dc.elements.DublinCoreAnnotator; import org.purl.dc.elements.DublinCoreAnnotator;
/** /**
...@@ -46,14 +47,15 @@ public class EditMetaServices { ...@@ -46,14 +47,15 @@ public class EditMetaServices {
private final Map<String, List<String>> editMetaConf; private final Map<String, List<String>> editMetaConf;
private final Log logger = LogFactory.getLog(this.getClass()); private final TimeConfig timeConfig;
private final String pattern = "MM/dd/yyyy HH:mm"; private final Log logger = LogFactory.getLog(this.getClass());
public EditMetaServices(final Map<String, List<String>> editMeta) { public EditMetaServices(final Map<String, List<String>> editMeta, final TimeConfig timeConfig) {
this.editMetaConf = editMeta; this.editMetaConf = editMeta;
this.timeConfig = timeConfig;
} }
...@@ -71,7 +73,7 @@ public class EditMetaServices { ...@@ -71,7 +73,7 @@ public class EditMetaServices {
* a map which represents the key-value parameters of the edit * a map which represents the key-value parameters of the edit
* form * form
* @return * @return
* the modified resource. * the modified resource.
*/ */
public Resource writeContent(final Resource resource, final Map<String, String[]> parameterMap) { public Resource writeContent(final Resource resource, final Map<String, String[]> parameterMap) {
for (final String keyParam : parameterMap.keySet()) { for (final String keyParam : parameterMap.keySet()) {
...@@ -83,7 +85,6 @@ public class EditMetaServices { ...@@ -83,7 +85,6 @@ public class EditMetaServices {
this.logger.error("Unable to parse date value, the correct format must be MM/dd/yyyy HH:mm", e); this.logger.error("Unable to parse date value, the correct format must be MM/dd/yyyy HH:mm", e);
} }
} }
} }
return resource; return resource;
} }
...@@ -118,7 +119,7 @@ public class EditMetaServices { ...@@ -118,7 +119,7 @@ public class EditMetaServices {
} else if (valueType.equals("double")) { } else if (valueType.equals("double")) {
this.write(resource, xlmns, URI.create(entireNameSpace), keyParam, Double.class, Double.valueOf(value)); this.write(resource, xlmns, URI.create(entireNameSpace), keyParam, Double.class, Double.valueOf(value));
} else if (valueType.equals("date")) { } else if (valueType.equals("date")) {
final SimpleDateFormat dateFormat = new SimpleDateFormat(this.pattern); final SimpleDateFormat dateFormat = new SimpleDateFormat(timeConfig.getFormatDateTimeForJSTL());
this.write(resource, xlmns, URI.create(entireNameSpace), keyParam, Date.class, dateFormat.parse(value.toString())); this.write(resource, xlmns, URI.create(entireNameSpace), keyParam, Date.class, dateFormat.parse(value.toString()));
} else if (valueType.equals("integer")) { } else if (valueType.equals("integer")) {
this.write(resource, xlmns, URI.create(entireNameSpace), keyParam, Integer.class, Integer.valueOf(value)); this.write(resource, xlmns, URI.create(entireNameSpace), keyParam, Integer.class, Integer.valueOf(value));
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2016 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package org.ow2.weblab.portlet.business.service.impl;
import java.util.List;
import javax.portlet.PortletRequest;
import org.ow2.weblab.portlet.business.service.PermissionService;
import org.springframework.stereotype.Service;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.User;
import com.liferay.portal.theme.ThemeDisplay;
/**
* Implementation of {@link PermissionService} using Liferay role permissions.
*
* @author rgauthier
*/
@Service
public class LiferayPermissionServiceImpl implements PermissionService {
private final List<String> adminRoles;
public LiferayPermissionServiceImpl(final List<String> adminRoles) {
this.adminRoles = adminRoles;
}
/*
* (non-Javadoc)
*
* @see org.ow2.weblab.portlet.business.service.PermissionService#hasAdminRole(javax.portlet.ResourceRequest)
*/
@Override
public boolean hasAdminRole(PortletRequest request) throws SystemException {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
User user = themeDisplay.getUser();
for (String role : adminRoles) {
for (Role userRole : user.getRoles()) {
if (userRole.getName().equals(role))
return true;
}
}
return false;
}
}
...@@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory; ...@@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory;
import org.ow2.weblab.core.extended.exception.WebLabCheckedException; import org.ow2.weblab.core.extended.exception.WebLabCheckedException;
import org.ow2.weblab.core.extended.factory.ExceptionFactory; import org.ow2.weblab.core.extended.factory.ExceptionFactory;
import org.ow2.weblab.core.helper.impl.SemanticResource; import org.ow2.weblab.core.helper.impl.SemanticResource;
import org.ow2.weblab.core.model.Document;
import org.ow2.weblab.core.model.PieceOfKnowledge; import org.ow2.weblab.core.model.PieceOfKnowledge;
import org.ow2.weblab.core.model.Resource; import org.ow2.weblab.core.model.Resource;
import org.ow2.weblab.core.model.processing.WProcessingAnnotator; import org.ow2.weblab.core.model.processing.WProcessingAnnotator;
...@@ -181,5 +182,25 @@ public class WSBusinessServicesImpl implements MetaViewBusinessServices { ...@@ -181,5 +182,25 @@ public class WSBusinessServicesImpl implements MetaViewBusinessServices {
return pok; return pok;
} }
@Override
public PieceOfKnowledge getPoKToUseAsSource(Document doc, String sourceTab) {
final PieceOfKnowledge pok = new PieceOfKnowledge();
pok.setUri("weblab://" + UUID.randomUUID());
URI uri = URI.create(pok.getUri());
final DublinCoreAnnotator dcaDoc = new DublinCoreAnnotator(doc);
final WProcessingAnnotator wpaPok = new WProcessingAnnotator(uri, pok);
final DublinCoreAnnotator dcaDPok = new DublinCoreAnnotator(uri, pok);
wpaPok.writeLabel(dcaDoc.readSource().firstTypedValue());
dcaDPok.writeType(sourceTab);
return pok;
}
} }
...@@ -24,6 +24,8 @@ import java.util.Map; ...@@ -24,6 +24,8 @@ import java.util.Map;
import javax.portlet.ActionRequest; import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse; import javax.portlet.ActionResponse;
import javax.portlet.PortletRequest;
import javax.portlet.PortletURL;
import javax.portlet.ResourceRequest; import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse; import javax.portlet.ResourceResponse;
...@@ -34,6 +36,7 @@ import org.ow2.weblab.core.model.Resource; ...@@ -34,6 +36,7 @@ import org.ow2.weblab.core.model.Resource;
import org.ow2.weblab.portlet.business.bean.EditMetaConfBean; import org.ow2.weblab.portlet.business.bean.EditMetaConfBean;
import org.ow2.weblab.portlet.business.bean.TimeConfig; import org.ow2.weblab.portlet.business.bean.TimeConfig;
import org.ow2.weblab.portlet.business.bean.taglib.DataTaglib; import org.ow2.weblab.portlet.business.bean.taglib.DataTaglib;
import org.ow2.weblab.portlet.business.service.PermissionService;
import org.ow2.weblab.portlet.business.service.ResourceSaverService; import org.ow2.weblab.portlet.business.service.ResourceSaverService;
import org.ow2.weblab.portlet.business.service.impl.EditMetaServices; import org.ow2.weblab.portlet.business.service.impl.EditMetaServices;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -44,6 +47,13 @@ import org.springframework.web.portlet.ModelAndView; ...@@ -44,6 +47,13 @@ import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.bind.annotation.ActionMapping; import org.springframework.web.portlet.bind.annotation.ActionMapping;
import org.springframework.web.portlet.bind.annotation.ResourceMapping; import org.springframework.web.portlet.bind.annotation.ResourceMapping;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil;
import com.liferay.portlet.PortletURLFactoryUtil;
/** /**
* The controller in charge of the edition. * The controller in charge of the edition.
* *
...@@ -52,12 +62,13 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping; ...@@ -52,12 +62,13 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping;
@Controller @Controller
@RequestMapping(value = "VIEW") @RequestMapping(value = "VIEW")
@SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage", @SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage",
"useGeoserverExposedMap","editError" }) "useGeoserverExposedMap", "editError" })
public class EditMetaController { public class EditMetaController {
private static final String USE_GEOSERVER_EXPOSED_MAP = "useGeoserverExposedMap"; private static final String USE_GEOSERVER_EXPOSED_MAP = "useGeoserverExposedMap";
private static final String EDIT_ERROR = "editError"; private static final String EDIT_ERROR = "editError";
...@@ -91,14 +102,23 @@ public class EditMetaController { ...@@ -91,14 +102,23 @@ public class EditMetaController {
private final DataTaglib dataTaglib; private final DataTaglib dataTaglib;
private final TimeConfig timeConfig;
private final ResourceSaverService resourceSaverService; private final ResourceSaverService resourceSaverService;
public EditMetaController(final EditMetaConfBean editMetaData, final DataTaglib dataTaglib, final ResourceSaverService resourceSaverService) { private final PermissionService permissionService;
public EditMetaController(final EditMetaConfBean editMetaData, final TimeConfig timeConfig, final DataTaglib dataTaglib, final ResourceSaverService resourceSaverService,
final PermissionService permissionService) {
super(); super();
this.editMetaData = editMetaData; this.editMetaData = editMetaData;
this.timeConfig = timeConfig;
this.dataTaglib = dataTaglib; this.dataTaglib = dataTaglib;
this.resourceSaverService = resourceSaverService; this.resourceSaverService = resourceSaverService;
this.permissionService = permissionService;
} }
...@@ -110,7 +130,7 @@ public class EditMetaController { ...@@ -110,7 +130,7 @@ public class EditMetaController {
final ModelAndView mav = new ModelAndView(); final ModelAndView mav = new ModelAndView();
final ModelMap model = (ModelMap) request.getPortletSession().getAttribute("model"); final ModelMap model = (ModelMap) request.getPortletSession().getAttribute("model");
if (!model.containsAttribute(EditMetaController.TIME_CONFIG)) { if (!model.containsAttribute(EditMetaController.TIME_CONFIG)) {
model.addAttribute(EditMetaController.TIME_CONFIG, new TimeConfig()); model.addAttribute(EditMetaController.TIME_CONFIG, timeConfig);
} }
if (!model.containsAttribute(EditMetaController.DATA_TAGLIB) || !model.containsAttribute(EditMetaController.DATA_LANGUAGE)) { if (!model.containsAttribute(EditMetaController.DATA_TAGLIB) || !model.containsAttribute(EditMetaController.DATA_LANGUAGE)) {
model.addAttribute(EditMetaController.DATA_TAGLIB, this.dataTaglib.getFormats()); model.addAttribute(EditMetaController.DATA_TAGLIB, this.dataTaglib.getFormats());
...@@ -124,8 +144,8 @@ public class EditMetaController { ...@@ -124,8 +144,8 @@ public class EditMetaController {
if (!model.containsAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP)) { if (!model.containsAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP)) {
model.addAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP, Boolean.valueOf(this.editMetaData.isUseGeoserverExposedMap())); model.addAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP, Boolean.valueOf(this.editMetaData.isUseGeoserverExposedMap()));
} }
if (!model.containsAttribute(EditMetaController.EDIT_ERROR)){ if (!model.containsAttribute(EditMetaController.EDIT_ERROR)) {
model.addAttribute(EditMetaController.EDIT_ERROR, false); model.addAttribute(EditMetaController.EDIT_ERROR, false);
} }
mav.setView("editview"); mav.setView("editview");
...@@ -134,25 +154,34 @@ public class EditMetaController { ...@@ -134,25 +154,34 @@ public class EditMetaController {
} }
@ResourceMapping("canceledit")
public ModelAndView cancelEdit(final ResourceRequest request, final ResourceResponse response, final ModelMap model) {
response.setContentType(EditMetaController.TEXT_HTML);
response.setCharacterEncoding(EditMetaController.UTF_8);
final ModelAndView mav = new ModelAndView();
mav.setView("view_meta_ajax");
mav.addAllObjects(model);
return mav;
}
@ResourceMapping("clearErrorAttribute") @ResourceMapping("clearErrorAttribute")
public void clearModelAttribute(final ModelMap model){ public void clearModelAttribute(final ModelMap model) {
model.addAttribute(EditMetaController.EDIT_ERROR,false); model.addAttribute(EditMetaController.EDIT_ERROR, false);
}
@ActionMapping(params = "action=cancel")
public void cancelEdit(final ActionRequest actionRequest, final ActionResponse response, final ModelMap model) throws SystemException, PortalException, IOException {
this.logger.debug("view redirect after cancel method called");
// build link to default portlet jsp
String portletName = (String) actionRequest.getAttribute(WebKeys.PORTLET_ID);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletURL portletURL = PortletURLFactoryUtil.create(PortalUtil.getHttpServletRequest(actionRequest), portletName, themeDisplay.getLayout().getPlid(), PortletRequest.RENDER_PHASE);
response.sendRedirect(portletURL.toString());
} }
@ActionMapping(params = "action=save") @ActionMapping(params = "action=save")
public void saveEdit(final ActionRequest request, final ActionResponse response, final ModelMap model) { public void saveEdit(final ActionRequest request, final ActionResponse response, final ModelMap model) throws SystemException, PortalException, IOException {
this.logger.debug("saveEdit method called"); this.logger.debug("saveEdit method called");
if (!permissionService.hasAdminRole(request)) {
logger.error("The current user does not have the role to be authorized to edit the metadata of any document!");
return;
}
if (this.resourceSaverService == null) { if (this.resourceSaverService == null) {
this.logger.error("No resource saver service configured !!!"); this.logger.error("No resource saver service configured !!!");
return; return;
...@@ -161,7 +190,7 @@ public class EditMetaController { ...@@ -161,7 +190,7 @@ public class EditMetaController {
final Resource resource = (Resource) model.get(EditMetaController.RESOURCE); final Resource resource = (Resource) model.get(EditMetaController.RESOURCE);
final Map<String, List<String>> editMeta = (LinkedHashMap<String, List<String>>) model.get(EditMetaController.EDIT_META_DATA); final Map<String, List<String>> editMeta = (LinkedHashMap<String, List<String>>) model.get(EditMetaController.EDIT_META_DATA);
final Map<String, String[]> parameterMap = request.getParameterMap(); final Map<String, String[]> parameterMap = request.getParameterMap();
final EditMetaServices editMetaServices = new EditMetaServices(editMeta); final EditMetaServices editMetaServices = new EditMetaServices(editMeta, timeConfig);
editMetaServices.writeContent(resource, parameterMap); editMetaServices.writeContent(resource, parameterMap);
boolean worked = false; boolean worked = false;
try { try {
...@@ -177,6 +206,4 @@ public class EditMetaController { ...@@ -177,6 +206,4 @@ public class EditMetaController {
model.addAttribute(EditMetaController.RESOURCE, resource); model.addAttribute(EditMetaController.RESOURCE, resource);
request.getPortletSession().setAttribute("model", model); request.getPortletSession().setAttribute("model", model);
} }
} }
...@@ -32,6 +32,7 @@ import javax.xml.namespace.QName; ...@@ -32,6 +32,7 @@ import javax.xml.namespace.QName;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.ow2.weblab.core.model.Document;
import org.ow2.weblab.core.model.PieceOfKnowledge; import org.ow2.weblab.core.model.PieceOfKnowledge;
import org.ow2.weblab.core.model.Resource; import org.ow2.weblab.core.model.Resource;
import org.ow2.weblab.core.services.ContentNotAvailableException; import org.ow2.weblab.core.services.ContentNotAvailableException;
...@@ -40,6 +41,7 @@ import org.ow2.weblab.core.services.UnexpectedException; ...@@ -40,6 +41,7 @@ import org.ow2.weblab.core.services.UnexpectedException;
import org.ow2.weblab.portlet.business.bean.DisplayMetaConfBean; import org.ow2.weblab.portlet.business.bean.DisplayMetaConfBean;
import org.ow2.weblab.portlet.business.bean.RDFPropertiesConfBean; import org.ow2.weblab.portlet.business.bean.RDFPropertiesConfBean;
import org.ow2.weblab.portlet.business.service.MetaViewBusinessServices; import org.ow2.weblab.portlet.business.service.MetaViewBusinessServices;
import org.ow2.weblab.portlet.business.service.PermissionService;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
...@@ -52,6 +54,8 @@ import org.springframework.web.portlet.bind.annotation.EventMapping; ...@@ -52,6 +54,8 @@ import org.springframework.web.portlet.bind.annotation.EventMapping;
import org.springframework.web.portlet.bind.annotation.RenderMapping; import org.springframework.web.portlet.bind.annotation.RenderMapping;
import org.springframework.web.portlet.bind.annotation.ResourceMapping; import org.springframework.web.portlet.bind.annotation.ResourceMapping;
import com.liferay.portal.kernel.exception.SystemException;
/** /**
* Metaview portlet Spring MVC controller. * Metaview portlet Spring MVC controller.
* Business layer is accessible by Spring business services * Business layer is accessible by Spring business services
...@@ -63,11 +67,11 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping; ...@@ -63,11 +67,11 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping;
@Controller @Controller
@RequestMapping(value = "VIEW") @RequestMapping(value = "VIEW")
@SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage", @SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage",
"useGeoserverExposedMap","editError" }) "useGeoserverExposedMap", "editError" })
public class MetaViewController { public class MetaViewController {
private static final String RESOURCE = "resource"; protected static final String RESOURCE = "resource";
private static final String IS_LOADED_RESOURCE = "isLoadedResource"; private static final String IS_LOADED_RESOURCE = "isLoadedResource";
...@@ -76,6 +80,12 @@ public class MetaViewController { ...@@ -76,6 +80,12 @@ public class MetaViewController {
private static final String IS_EMPTY_MODEL = "isEmptyModel"; private static final String IS_EMPTY_MODEL = "isEmptyModel";
private static final String HAS_ADMIN_ROLE = "userHasAdminRole";
protected static final String ALLOW_SOURCE_EVENTING = "allowSourceEventing";
// attributes // attributes
protected final Log logger = LogFactory.getLog(this.getClass()); protected final Log logger = LogFactory.getLog(this.getClass());
...@@ -83,17 +93,30 @@ public class MetaViewController { ...@@ -83,17 +93,30 @@ public class MetaViewController {
protected final MetaViewBusinessServices metaviewBusinessService; protected final MetaViewBusinessServices metaviewBusinessService;
protected final PermissionService permissionService;
protected final DisplayMetaConfBean metaDisplayConf; protected final DisplayMetaConfBean metaDisplayConf;
protected final RDFPropertiesConfBean rdfProperties; protected final RDFPropertiesConfBean rdfProperties;
public MetaViewController(final MetaViewBusinessServices metaviewBusinessService, final DisplayMetaConfBean metaDisplayConf, final RDFPropertiesConfBean rdfProperties) { protected final String sourceTypeTab;
protected final Boolean allowSourceEventing;
public MetaViewController(final MetaViewBusinessServices metaviewBusinessService, final PermissionService permissionService, final DisplayMetaConfBean metaDisplayConf,
final RDFPropertiesConfBean rdfProperties, final String sourceTypeTab, final Boolean allowSourceEventing) {
super(); super();
this.metaviewBusinessService = metaviewBusinessService; this.metaviewBusinessService = metaviewBusinessService;
this.permissionService = permissionService;
this.metaDisplayConf = metaDisplayConf; this.metaDisplayConf = metaDisplayConf;
this.rdfProperties = rdfProperties; this.rdfProperties = rdfProperties;
this.sourceTypeTab = sourceTypeTab;
this.allowSourceEventing = allowSourceEventing;
} }
...@@ -142,6 +165,25 @@ public class MetaViewController { ...@@ -142,6 +165,25 @@ public class MetaViewController {
} }