
META-INF.resources.view_module.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.marketplace.app.manager.web Show documentation
Show all versions of com.liferay.marketplace.app.manager.web Show documentation
Liferay Marketplace App Manager Web
<%--
/**
* 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.
*/
--%>
<%@ include file="/init.jsp" %>
<%
String app = ParamUtil.getString(request, "app");
AppDisplay appDisplay = null;
List bundles = BundleManagerUtil.getBundles();
if (Validator.isNumber(app)) {
appDisplay = AppDisplayFactoryUtil.getAppDisplay(bundles, Long.parseLong(app));
}
if (appDisplay == null) {
appDisplay = AppDisplayFactoryUtil.getAppDisplay(bundles, app);
}
String moduleGroup = ParamUtil.getString(request, "moduleGroup");
ModuleGroupDisplay moduleGroupDisplay = null;
if (Validator.isNotNull(moduleGroup)) {
moduleGroupDisplay = ModuleGroupDisplayFactoryUtil.getModuleGroupDisplay(appDisplay, moduleGroup);
}
String symbolicName = ParamUtil.getString(request, "symbolicName");
String version = ParamUtil.getString(request, "version");
Bundle bundle = BundleManagerUtil.getBundle(symbolicName, version);
String pluginType = ParamUtil.getString(request, "pluginType", "components");
String orderByType = ParamUtil.getString(request, "orderByType", "asc");
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("mvcPath", "/view_module.jsp");
portletURL.setParameter("app", app);
portletURL.setParameter("moduleGroup", moduleGroup);
portletURL.setParameter("symbolicName", bundle.getSymbolicName());
portletURL.setParameter("version", String.valueOf(bundle.getVersion()));
portletURL.setParameter("pluginType", pluginType);
portletURL.setParameter("orderByType", orderByType);
portletDisplay.setShowBackIcon(true);
PortletURL backURL = renderResponse.createRenderURL();
if (Validator.isNull(app)) {
backURL.setParameter("mvcPath", "/view.jsp");
}
else {
backURL.setParameter("mvcPath", "/view_modules.jsp");
backURL.setParameter("app", app);
backURL.setParameter("moduleGroup", moduleGroup);
}
portletDisplay.setURLBack(backURL.toString());
Dictionary headers = bundle.getHeaders();
String bundleName = GetterUtil.getString(headers.get(BundleConstants.BUNDLE_NAME));
renderResponse.setTitle(bundleName);
if (Validator.isNull(app)) {
PortletURL viewURL = renderResponse.createRenderURL();
viewURL.setParameter("mvcPath", "/view.jsp");
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "app-manager"), viewURL.toString());
PortalUtil.addPortletBreadcrumbEntry(request, bundleName, null);
}
else {
MarketplaceAppManagerUtil.addPortletBreadcrumbEntry(appDisplay, moduleGroupDisplay, bundle, request, renderResponse);
}
%>
<%
String emptyResultsMessage = "no-portlets-were-found";
if (pluginType.equals("components")) {
emptyResultsMessage = "no-components-were-found";
}
%>
<%
BundleContext bundleContext = bundle.getBundleContext();
List> serviceReferences = Collections.>emptyList();
if (pluginType.equals("portlets")) {
Collection> serviceReferenceCollection = bundleContext.getServiceReferences(Portlet.class, "(service.bundleid=" + bundle.getBundleId() + ")");
serviceReferences = new ArrayList>(serviceReferenceCollection);
serviceReferences = ListUtil.sort(serviceReferences, new ModuleServiceReferenceComparator("javax.portlet.display-name", orderByType));
}
else {
ServiceReference>[] serviceReferenceArray = (ServiceReference>[])bundleContext.getServiceReferences((String)null, "(&(service.bundleid=" + bundle.getBundleId() + ")(component.id=*))");
serviceReferences = ListUtil.toList(serviceReferenceArray);
serviceReferences = ListUtil.sort(serviceReferences, new ModuleServiceReferenceComparator("component.name", orderByType));
}
int end = searchContainer.getEnd();
if (end > serviceReferences.size()) {
end = serviceReferences.size();
}
searchContainer.setResults(serviceReferences.subList(searchContainer.getStart(), end));
searchContainer.setTotal(serviceReferences.size());
%>
<%
String description = StringPool.BLANK;
String name = StringPool.BLANK;
if (pluginType.equals("portlets")) {
name = MarketplaceAppManagerUtil.getSearchContainerFieldText(serviceReference.getProperty("javax.portlet.display-name"));
String modulePortletDescription = MarketplaceAppManagerUtil.getSearchContainerFieldText(serviceReference.getProperty("javax.portlet.description"));
String modulePortletName = MarketplaceAppManagerUtil.getSearchContainerFieldText(serviceReference.getProperty("javax.portlet.name"));
if (Validator.isNotNull(modulePortletDescription)) {
description = modulePortletName + " - " + modulePortletDescription;
}
else {
description = modulePortletName;
}
}
else {
name = MarketplaceAppManagerUtil.getSearchContainerFieldText(serviceReference.getProperty("component.name"));
}
%>
<%= name %>
<%= description %>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy