/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * 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. */ package com.liferay.document.library.web.internal.portlet.action; import com.liferay.document.library.kernel.service.DLAppLocalService; import com.liferay.portal.kernel.portlet.PortletLayoutFinder; import com.liferay.portal.kernel.repository.model.FileEntry; import com.liferay.portal.struts.FindActionHelper; import javax.portlet.PortletURL; import javax.servlet.http.HttpServletRequest; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; /** * @author Sergio González */ @Component( immediate = true, property = "model.class.name=com.liferay.portal.kernel.repository.model.FileEntry", service = FindActionHelper.class ) public class DLFileEntryFindActionHelper extends BaseDLFindActionHelper { @Override public long getGroupId(long primaryKey) throws Exception { FileEntry fileEntry = _dlAppLocalService.getFileEntry(primaryKey); return fileEntry.getGroupId(); } @Override public String getPrimaryKeyParameterName() { return "fileEntryId"; } @Override public void setPrimaryKeyParameter(PortletURL portletURL, long primaryKey) throws Exception { portletURL.setParameter( getPrimaryKeyParameterName(), String.valueOf(primaryKey)); } @Override protected void addRequiredParameters( HttpServletRequest request, String portletId, PortletURL portletURL) { portletURL.setParameter( "mvcRenderCommandName", "/document_library/view_file_entry"); } @Override protected PortletLayoutFinder getPortletLayoutFinder() { return _portletPageFinder; } @Reference(unbind = "-") protected void setDLAppLocalService(DLAppLocalService dlAppLocalService) { _dlAppLocalService = dlAppLocalService; } @Reference( target = "(model.class.name=com.liferay.portal.kernel.repository.model.FileEntry)", unbind = "-" ) protected void setPortletLayoutFinder( PortletLayoutFinder portletPageFinder) { _portletPageFinder = portletPageFinder; } private DLAppLocalService _dlAppLocalService; private PortletLayoutFinder _portletPageFinder; }