use of javax.portlet.PortletURL in project liferay-blade-samples by liferay.
the class BladeActionConfigurationIcon method getURL.
public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {
HttpServletRequest servletRequest = _portal.getHttpServletRequest(portletRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
FileEntry fileEntry = _retrieveFile(servletRequest);
PortletURL portletURL = PortletURLFactoryUtil.create(servletRequest, "blade_document_action_portlet_BladeDocumentActionPortlet", themeDisplay.getPlid(), PortletRequest.RENDER_PHASE);
String fileName = fileEntry.getFileName();
String mimeType = fileEntry.getMimeType();
String version = fileEntry.getVersion();
String createdDate = String.valueOf(fileEntry.getCreateDate());
String createdUserName = fileEntry.getUserName();
String statusLabel = null;
try {
FileVersion fileVersion = fileEntry.getLatestFileVersion();
int status = fileVersion.getStatus();
statusLabel = WorkflowConstants.getStatusLabel(status);
} catch (PortalException pe) {
_log.log(LogService.LOG_ERROR, pe.getMessage(), pe);
}
portletURL.setParameter("fileName", fileName);
portletURL.setParameter("mimeType", mimeType);
portletURL.setParameter("version", version);
portletURL.setParameter("statusLabel", statusLabel);
portletURL.setParameter("createdDate", createdDate);
portletURL.setParameter("createdUserName", createdUserName);
try {
portletURL.setWindowState(LiferayWindowState.POP_UP);
} catch (WindowStateException wse) {
_log.log(LogService.LOG_ERROR, wse.getMessage(), wse);
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("javascript:Liferay.Util.openWindow(");
stringBuilder.append("{dialog: {cache: false,width:800,modal: true},");
stringBuilder.append("title: 'basic information',id: ");
stringBuilder.append("'testPopupIdUnique',uri: '");
stringBuilder.append(portletURL.toString() + "'});");
return stringBuilder.toString();
}
use of javax.portlet.PortletURL in project acs-community-packaging by Alfresco.
the class AlfrescoFacesPortlet method getRenderURL.
/**
* Creates a render URL from the given request and parameters
*
* @param request
* the request
* @param parameters
* the parameters
* @return the render url
*/
public static String getRenderURL(ServletRequest request, Map<String, String[]> parameters) {
RenderResponse renderResp = (RenderResponse) request.getAttribute("javax.portlet.response");
if (renderResp == null) {
throw new IllegalStateException("RenderResponse object is null");
}
PortletURL url = renderResp.createRenderURL();
url.setParameters(parameters);
return url.toString();
}
use of javax.portlet.PortletURL in project liferay-ide by liferay.
the class AlbumAssetRenderer method getURLViewInContext.
@Override
public String getURLViewInContext(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse, String noSuchEntryRedirect) {
try {
long plid = PortalUtil.getPlidFromPortletId(_album.getGroupId(), PortletKeys.ALBUMS);
if (plid == LayoutConstants.DEFAULT_PLID) {
return StringPool.BLANK;
}
PortletURL portletURL = PortletURLFactoryUtil.create(liferayPortletRequest, PortletKeys.ALBUMS, plid, PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/albums/view_album.jsp");
portletURL.setParameter("albumId", String.valueOf(_album.getAlbumId()));
return portletURL.toString();
} catch (Exception e) {
}
return StringPool.BLANK;
}
use of javax.portlet.PortletURL in project liferay-ide by liferay.
the class AlbumAssetRenderer method getURLEdit.
@Override
public PortletURL getURLEdit(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse) throws Exception {
PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(getControlPanelPlid(liferayPortletRequest), AlbumsPortlet.PORTLET_ID, PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/albums/edit_album.jsp");
portletURL.setParameter("albumId", String.valueOf(_album.getAlbumId()));
return portletURL;
}
use of javax.portlet.PortletURL in project liferay-ide by liferay.
the class ArtistAssetRenderer method getURLViewInContext.
@Override
public String getURLViewInContext(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse, String noSuchEntryRedirect) {
try {
long plid = PortalUtil.getPlidFromPortletId(_artist.getGroupId(), PortletKeys.ARTISTS);
if (plid == LayoutConstants.DEFAULT_PLID) {
return StringPool.BLANK;
}
PortletURL portletURL = PortletURLFactoryUtil.create(liferayPortletRequest, PortletKeys.ARTISTS, plid, PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/artists/view_artist.jsp");
portletURL.setParameter("artistId", String.valueOf(_artist.getArtistId()));
return portletURL.toString();
} catch (Exception e) {
}
return StringPool.BLANK;
}
Aggregations