-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
260 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.glassfish.javaeetutorial</groupId> | ||
<artifactId>portlet</artifactId> | ||
<version>7.0.6-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>catalog-portlet</artifactId> | ||
<name>Catalog portlet </name> | ||
<packaging>bundle</packaging> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.glassfish.javaeetutorial</groupId> | ||
<artifactId>usecases-catalog</artifactId> | ||
<version>7.0.6-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<version>2.5.3</version> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<instructions> | ||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> | ||
<Export-Package></Export-Package> | ||
<Private-Package>com.forest.portlet.catalog</Private-Package> | ||
<Import-Package> | ||
javax.servlet, | ||
javax.portlet;version=0.0.0, | ||
com.forest.model, | ||
* | ||
</Import-Package> | ||
<Include-Resource> | ||
META-INF/resources=src/main/resources | ||
</Include-Resource> | ||
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> | ||
<Require-Capability> | ||
osgi.extender;filter:="(&(osgi.extender=jsp.taglib)(uri=http://java.sun.com/portlet_2_0))", | ||
osgi.extender;filter:="(&(osgi.extender=jsp.taglib)(uri=http://liferay.com/tld/aui))", | ||
osgi.extender;filter:="(&(osgi.extender=jsp.taglib)(uri=http://liferay.com/tld/portlet))", | ||
osgi.extender;filter:="(&(osgi.extender=jsp.taglib)(uri=http://liferay.com/tld/theme))", | ||
osgi.extender;filter:="(&(osgi.extender=jsp.taglib)(uri=http://liferay.com/tld/ui))" | ||
</Require-Capability> | ||
<_dsannotations>*</_dsannotations> | ||
</instructions> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
</project> |
56 changes: 56 additions & 0 deletions
56
portlet/catalog-portlet/src/main/java/com/forest/portlet/catalog/CatalogPortlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.forest.portlet.catalog; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.portlet.Portlet; | ||
import javax.portlet.PortletException; | ||
import javax.portlet.RenderRequest; | ||
import javax.portlet.RenderResponse; | ||
|
||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
import org.osgi.service.component.annotations.ReferenceCardinality; | ||
import org.osgi.service.component.annotations.ReferencePolicy; | ||
|
||
import com.forest.usecase.catalog.ProductManager; | ||
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet; | ||
|
||
@Component(immediate = true, property = { | ||
"com.liferay.portlet.css-class-wrapper=portlet-catalog", | ||
"com.liferay.portlet.display-category=category.sample", | ||
"com.liferay.portlet.reasultinstanceable=false", | ||
"com.liferay.portlet.preferences-owned-by-group=true", | ||
"com.liferay.portlet.private-request-attributes=false", | ||
"com.liferay.portlet.private-session-attributes=false", | ||
"com.liferay.portlet.render-weight=50", | ||
"javax.portlet.display-name=Duke's Catalog", | ||
"javax.portlet.expiration-cache=0", | ||
"javax.portlet.init-param.template-path=/", | ||
"javax.portlet.init-param.view-template=/view.jsp", | ||
"javax.portlet.security-role-ref=power-user,user" }, service = Portlet.class) | ||
public class CatalogPortlet extends MVCPortlet { | ||
|
||
ProductManager productManager; | ||
|
||
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL) | ||
void bindProductManager(ProductManager productManager) { | ||
this.productManager = productManager; | ||
} | ||
|
||
void unbindProductManager(ProductManager productManager) { | ||
this.productManager = null; | ||
} | ||
|
||
@Override | ||
public void doView(RenderRequest renderRequest, | ||
RenderResponse renderResponse) throws IOException, PortletException { | ||
|
||
if (productManager == null) { | ||
include("/error.jsp", renderRequest, renderResponse); | ||
} else { | ||
renderRequest.setAttribute("productManager", productManager); | ||
super.doView(renderRequest, renderResponse); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<h3> Coffee time !!!</h3> | ||
|
||
Why don't you cet a cup of coffee while we try to put our catalog back online! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> | ||
|
||
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> | ||
|
||
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui"%> | ||
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%> | ||
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%> | ||
|
||
<%@ page import="com.liferay.portal.kernel.util.Constants"%> | ||
<%@ page import="com.liferay.portal.kernel.util.ParamUtil"%> | ||
<%@ page import="com.liferay.portal.kernel.util.StringPool"%> | ||
<%@ page import="com.liferay.portal.kernel.util.WebKeys"%> | ||
<%@ page import="javax.portlet.PortletURL"%> | ||
<%@ page import="com.forest.model.Product"%> | ||
<%@ page import="com.forest.usecase.catalog.ProductManager"%> | ||
<%@ page import="java.util.List"%> | ||
|
||
<portlet:defineObjects /> | ||
|
||
<liferay-theme:defineObjects /> | ||
|
||
<% | ||
PortletURL portletURL = renderResponse.createRenderURL(); | ||
String currentURL = portletURL.toString(); | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
<%@ include file="/init.jsp" %> | ||
|
||
<% | ||
ProductManager pm = (ProductManager)request.getAttribute("productManager"); | ||
List<Product> products = pm.getAll(); | ||
%> | ||
|
||
|
||
<liferay-ui:search-container | ||
total="<%= products.size() %>" | ||
> | ||
<liferay-ui:search-container-results | ||
results="<%= products %>" | ||
/> | ||
|
||
<liferay-ui:search-container-row | ||
className="com.forest.model.Product" | ||
escapedModel="true" | ||
modelVar="foo" | ||
> | ||
<liferay-ui:search-container-column-text | ||
name="id" | ||
property="id" | ||
valign="top" | ||
/> | ||
|
||
<liferay-ui:search-container-column-text | ||
name="name" | ||
property="name" | ||
valign="top" | ||
/> | ||
|
||
<liferay-ui:search-container-column-text | ||
name="description" | ||
property="description" | ||
valign="top" | ||
/> | ||
|
||
<liferay-ui:search-container-column-text | ||
name="price" | ||
property="price" | ||
valign="top" | ||
/> | ||
</liferay-ui:search-container-row> | ||
|
||
<liferay-ui:search-iterator /> | ||
</liferay-ui:search-container> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.glassfish.javaeetutorial</groupId> | ||
<artifactId>dukes-forest</artifactId> | ||
<version>7.0.6-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>portlet</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<liferay.version>7.0.0-m4</liferay.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.osgi</groupId> | ||
<artifactId>org.osgi.core</artifactId> | ||
<version>5.0.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.osgi</groupId> | ||
<artifactId>org.osgi.compendium</artifactId> | ||
<version>5.0.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.liferay.portal</groupId> | ||
<artifactId>portal-service</artifactId> | ||
<version>${liferay.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.portlet</groupId> | ||
<artifactId>portlet-api</artifactId> | ||
<version>2.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>servlet-api</artifactId> | ||
<version>2.5</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>liferay</id> | ||
<url>http://cdn.repository.liferay.com/nexus/content/groups/public</url> | ||
</repository> | ||
</repositories> | ||
|
||
|
||
|
||
<modules> | ||
<module>catalog-portlet</module> | ||
</modules> | ||
</project> |