-
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.
Added modules for usecases (extracted from EJB layer)
- Loading branch information
Showing
32 changed files
with
1,170 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,16 @@ | ||
<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>usecases</artifactId> | ||
<packaging>pom</packaging> | ||
<name>Usecases</name> | ||
<modules> | ||
<module>usecases-identity</module> | ||
<module>usecases-catalog</module> | ||
<module>usecases-ecommerce</module> | ||
</modules> | ||
</project> |
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,19 @@ | ||
<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>usecases</artifactId> | ||
<version>7.0.6-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>usecases-catalog</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.glassfish.javaeetutorial</groupId> | ||
<artifactId>dukes-domain-model</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
<name>Catalog Management Usecases</name> | ||
</project> |
68 changes: 68 additions & 0 deletions
68
...secases-catalog/src/main/java/com/forest/usecase/catalog/AbstractBaseCategoryManager.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,68 @@ | ||
package com.forest.usecase.catalog; | ||
|
||
import java.util.List; | ||
|
||
import com.forest.model.Category; | ||
import com.forest.usecase.catalog.persistence.CategoryPersistence; | ||
|
||
public abstract class AbstractBaseCategoryManager implements CategoryManager { | ||
|
||
protected abstract CategoryPersistence getCategoryPersistence (); | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.CategoryManager#createCategory(com.forest.model.Category) | ||
*/ | ||
@Override | ||
public void createCategory(Category category) { | ||
getCategoryPersistence().createCategory(category); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.CategoryManager#getCategory(java.lang.Integer) | ||
*/ | ||
@Override | ||
public Category getCategory(Integer id) { | ||
return getCategoryPersistence().getCategory(id); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.CategoryManager#updateCategory(com.forest.model.Category) | ||
*/ | ||
@Override | ||
public void updateCategory(Category category) { | ||
getCategoryPersistence().updateCategory(category); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.CategoryManager#removeCategory(com.forest.model.Category) | ||
*/ | ||
@Override | ||
public void removeCategory(Category category) { | ||
getCategoryPersistence().removeCategory(category); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.CategoryManager#count() | ||
*/ | ||
@Override | ||
public int count() { | ||
return getCategoryPersistence().count(); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.CategoryManager#getAll() | ||
*/ | ||
@Override | ||
public List<Category> getAll () { | ||
return getCategoryPersistence().findAll(); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.CategoryManager#getAllInRange(int) | ||
*/ | ||
@Override | ||
public List<Category> getAllInRange (int... range) { | ||
return getCategoryPersistence().findRange(range); | ||
} | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
...usecases-catalog/src/main/java/com/forest/usecase/catalog/AbstractBaseProductManager.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,77 @@ | ||
package com.forest.usecase.catalog; | ||
|
||
import java.util.List; | ||
|
||
import com.forest.model.Product; | ||
import com.forest.usecase.catalog.persistence.ProductPersistence; | ||
|
||
public abstract class AbstractBaseProductManager implements ProductManager { | ||
|
||
protected abstract ProductPersistence getProductPersistence(); | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.ProductManager#createProduct(com.forest.model.Product) | ||
*/ | ||
@Override | ||
public void createProduct(Product product) { | ||
getProductPersistence().createProduct(product); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.ProductManager#getProductsInCategory(int, int) | ||
*/ | ||
@Override | ||
public List<Product> getProductsInCategory(int categoryId, int... range) { | ||
return getProductPersistence().findByCategory(range, categoryId); | ||
} | ||
|
||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.ProductManager#getProduct(java.lang.Integer) | ||
*/ | ||
@Override | ||
public Product getProduct(Integer id) { | ||
return getProductPersistence().getProduct(id); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.ProductManager#updateProduct(com.forest.model.Product) | ||
*/ | ||
@Override | ||
public void updateProduct(Product product) { | ||
getProductPersistence().updateProduct(product); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.ProductManager#removeProduct(com.forest.model.Product) | ||
*/ | ||
@Override | ||
public void removeProduct(Product product) { | ||
getProductPersistence().removeProduct(product); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.ProductManager#count() | ||
*/ | ||
@Override | ||
public int count() { | ||
return getProductPersistence().count(); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.ProductManager#getAll() | ||
*/ | ||
@Override | ||
public List<Product> getAll () { | ||
return getProductPersistence().findAll(); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.forest.usecase.catalog.ProductManager#getAllInRange(int) | ||
*/ | ||
@Override | ||
public List<Product> getAllInRange (int... range) { | ||
return getProductPersistence().findRange(range); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
usecases/usecases-catalog/src/main/java/com/forest/usecase/catalog/CategoryManager.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,23 @@ | ||
package com.forest.usecase.catalog; | ||
|
||
import java.util.List; | ||
|
||
import com.forest.model.Category; | ||
|
||
public interface CategoryManager { | ||
|
||
public abstract void createCategory(Category category); | ||
|
||
public abstract Category getCategory(Integer id); | ||
|
||
public abstract void updateCategory(Category category); | ||
|
||
public abstract void removeCategory(Category category); | ||
|
||
public abstract int count(); | ||
|
||
public abstract List<Category> getAll(); | ||
|
||
public abstract List<Category> getAllInRange(int... range); | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
usecases/usecases-catalog/src/main/java/com/forest/usecase/catalog/ProductManager.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,26 @@ | ||
package com.forest.usecase.catalog; | ||
|
||
import java.util.List; | ||
|
||
import com.forest.model.Product; | ||
|
||
public interface ProductManager { | ||
|
||
public abstract void createProduct(Product product); | ||
|
||
public abstract List<Product> getProductsInCategory(int categoryId, | ||
int... range); | ||
|
||
public abstract Product getProduct(Integer id); | ||
|
||
public abstract void updateProduct(Product product); | ||
|
||
public abstract void removeProduct(Product product); | ||
|
||
public abstract int count(); | ||
|
||
public abstract List<Product> getAll(); | ||
|
||
public abstract List<Product> getAllInRange(int... range); | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...ses-catalog/src/main/java/com/forest/usecase/catalog/persistence/CategoryPersistence.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,23 @@ | ||
package com.forest.usecase.catalog.persistence; | ||
|
||
import java.util.List; | ||
|
||
import com.forest.model.Category; | ||
|
||
public interface CategoryPersistence { | ||
|
||
public void createCategory(Category category); | ||
|
||
public void updateCategory(Category category); | ||
|
||
public void removeCategory(Category category); | ||
|
||
public Category getCategory(int id); | ||
|
||
public int count(); | ||
|
||
public List<Category> findAll(); | ||
|
||
public List<Category> findRange(int... range); | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...ases-catalog/src/main/java/com/forest/usecase/catalog/persistence/ProductPersistence.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,25 @@ | ||
package com.forest.usecase.catalog.persistence; | ||
|
||
import java.util.List; | ||
|
||
import com.forest.model.Product; | ||
|
||
public interface ProductPersistence { | ||
|
||
public void createProduct(Product product); | ||
|
||
public void updateProduct(Product product); | ||
|
||
public void removeProduct(Product product); | ||
|
||
public Product getProduct(int id); | ||
|
||
public int count(); | ||
|
||
public List<Product> findAll(); | ||
|
||
public List<Product> findRange(int... range); | ||
|
||
public List<Product> findByCategory(int[] range, int categoryId); | ||
|
||
} |
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,19 @@ | ||
<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>usecases</artifactId> | ||
<version>7.0.6-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>usecases-ecommerce</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.glassfish.javaeetutorial</groupId> | ||
<artifactId>dukes-domain-model</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.