To find out more about eXo add-ons development, read the dedicated eXo documentation.
angular-sample-portlet
org.exoplatform.commons.api.portlet.GenericDispatchedViewPortlet
portlet-view-dispatched-file-path
/frontend/index.html
text/html
Angular Sample Portlet
angular-sample-portlet
angularSamplePortletBundle
angularSamplePortletBundle
polyfillsBundle
polyfillsBundle
com.github.eirslett
frontend-maven-plugin
1.0
src/main/webapp/frontend/
target/frontend-maven-plugin
install node and npm
install-node-and-npm
src/main/webapp/
target/node-and-npm
${nodeVersion}
${npmVersion}
npm webpack
npm
src/main/webapp/frontend/
target/node-and-npm
install webpack -g
npm install
npm
src/main/webapp/frontend/
target/node-and-npm
install
npm build
npm
src/main/webapp/frontend
target/node-and-npm/
run build
org.exoplatform.container.definition.PortalContainerConfig
Change PortalContainer Definitions
registerChangePlugin
org.exoplatform.container.definition.PortalContainerDefinitionChangePlugin
101
apply.default
true
change
angular-portlets
org.exoplatform.container.web.PortalContainerConfigOwner
org.exoplatform.portal.config.UserPortalConfigService
new.portal.config.user.listener
initListener
org.exoplatform.portal.config.NewPortalConfigListener
this listener init the portal configuration
portal.configuration
description
products
Products
*:/platform/users
*:/platform/administrators
false
angular-portlets
products-management-portlet
*:/platform/users
false
org.exoplatform.commons.api.persistence.DataInitializer
SampleChangeLogsPlugin
addChangeLogsPlugin
org.exoplatform.commons.persistence.impl.ChangeLogsPlugin
changelogs
Change logs of Atis
db.changelogs/changelog-1.0.0.xml
@Entity
@ExoEntity
@Table(name = "PRODUCT")
public class Product {
@Id
@SequenceGenerator(name="SEQ_PRODUCT_PRODUCT_ID", sequenceName="SEQ_PRODUCT_PRODUCT_ID")
@GeneratedValue(strategy=GenerationType.AUTO, generator="SEQ_PRODUCT_PRODUCT_ID")
@Column(name="PRODUCT_ID")
private Long productId;
@Column(name="PRODUCT_NAME")
private String productName;
@Column(name="PRODUCT_AMOUNT")
private String productAmount;
...
org.exoplatform.dao.ProductDAO
--------------------------------------------------------------
package org.exoplatform.dao;
import org.exoplatform.entity.Product;
import org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl;
public class ProductDAO extends GenericDAOJPAImpl {
}
org.exoplatform.services.rest.CrudPortletRestService
package org.exoplatform.services.rest;
import java.util.List;
import javax.annotation.security.RolesAllowed;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.json.JSONArray;
import org.json.JSONObject;
import org.exoplatform.dao.ProductDAO;
import org.exoplatform.entity.Product;
import org.exoplatform.services.rest.resource.ResourceContainer;
@Path("crud")
public class CrudPortletRestService implements ResourceContainer {
private ProductDAO productDAO;
public CrudPortletRestService(ProductDAO productDAO) {
this.productDAO = productDAO;
}
@GET
@Path("/addProduct")
@RolesAllowed("users")
public Response addProduct(@Context UriInfo uriInfo,
@QueryParam("productName") String productName,
@QueryParam("productAmount") String productAmount) throws Exception {
...
}
@GET
@Path("/deleteProduct/{productId}")
@RolesAllowed("users")
public Response deleteProduct(@Context UriInfo uriInfo, @PathParam("productId") String productId) throws Exception {
...
}
@GET
@Path("/getAllProducts")
@RolesAllowed("users")
public Response getAllProducts(@Context UriInfo uriInfo) throws Exception {
...
}
@GET
@Path("/getProductById/{productId}")
@RolesAllowed("users")
public Response getProductById(@Context UriInfo uriInfo, @PathParam("productId") String productId) throws Exception {
...
}
@GET
@Path("/updateProduct/{productId}")
@RolesAllowed("users")
public Response updateProduct(@Context UriInfo uriInfo,
@PathParam("productId") String productId,
@QueryParam("productName") String productName,
@QueryParam("productAmount") String productAmount) throws Exception {
...
}
}
( Your e-mail address will not be published)
Thank you very much
You’re welcome