Skip to content

Commit

Permalink
Merge pull request #18 from openviglet/0.3.2
Browse files Browse the repository at this point in the history
0.3.2 - Ecommerce
  • Loading branch information
alegauss authored Aug 25, 2018
2 parents 768fe95 + a3a6e5f commit 0d9b023
Show file tree
Hide file tree
Showing 95 changed files with 3,319 additions and 1,055 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<attribute name="gradle_used_by_scope" value="test"/>
</attributes>
</classpathentry>
<classpathentry excluding="templates/|js/" kind="src" output="bin/main" path="src/main/resources">
<classpathentry excluding="js/|templates/" kind="src" output="bin/main" path="src/main/resources">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
Expand Down
246 changes: 246 additions & 0 deletions .settings/org.eclipse.jpt.core.prefs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
## 0.3.2

#### NEW FEATURES
* MongoDB
* Show content files from /sites URL: Response file with mime type
* E-Commerce: reCAPTCHA Widget
* E-Commerce: reCAPTCHA Field Type
* E-Commerce: Payment Field Type
* E-Commerce: Payment Types and Settings
* Viglet Turing Integration: Indexing Posts in Semantic Navigation
* InContext Editing using Float Menu to Regions
* Site Form: Create Forms into Site and save as Posts into Shiohara CMS
* Combo Box Field Type

#### IMPROVEMENTS
* Spring Boot 2.0.4 and Gradle 4.9

## 0.3.1 (July 06, 2018)

#### NEW FEATURES
Expand Down
18 changes: 15 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext { springBootVersion = '2.0.3.RELEASE'
ext { springBootVersion = '2.0.4.RELEASE'
hibernateVersion = '5.9.1.Final'
httpClientVersion = '4.5.2'
swaggerVersion = '2.8.0'
Expand Down Expand Up @@ -90,9 +90,13 @@ dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version:"${springBootVersion}"
compile group: 'org.springframework.boot', name: 'spring-boot-starter-activemq', version:"${springBootVersion}"
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version:"${springBootVersion}"
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb', version:"${springBootVersion}"

// Spring
compile group: 'org.springframework', name: 'spring-test', version: '5.0.6.RELEASE'
compile group: 'org.springframework', name: 'spring-test', version: '5.0.8.RELEASE'

// MongoDB
compile group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo'

// JGit
compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: "${jgitVersion}"
Expand Down Expand Up @@ -129,6 +133,14 @@ dependencies {
compile group: 'io.springfox', name: 'springfox-swagger2', version: "${swaggerVersion}"
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: "${swaggerVersion}"

// Gson - is used by reCAPTCHA
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'

/// Payment Slip
compile group: 'br.com.caelum.stella', name: 'caelum-stella-boleto', version: '2.1.2'
compile group: 'com.lowagie', name: 'itext', version: '2.1.7'


// WebJars
compile 'org.webjars.bower:jquery:1.12.4'
compile 'org.webjars.bower:jquery.ui:1.11.3'
Expand Down Expand Up @@ -157,7 +169,7 @@ dependencies {
}

task wrapper(type: Wrapper) {
gradleVersion = '4.8.1'
gradleVersion = '4.9'
}

test {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
38 changes: 38 additions & 0 deletions src/main/java/com/viglet/shiohara/api/customer/ShCustomerAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.viglet.shiohara.api.customer;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.annotation.JsonView;
import com.viglet.shiohara.api.ShJsonView;
import com.viglet.shiohara.persistence.document.customer.ShCustomer;
import com.viglet.shiohara.persistence.repository.customer.ShCustomerRepository;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/api/v2/customer")
@Api(tags = "Customer", description = "Customer API")
public class ShCustomerAPI {

@Autowired
private ShCustomerRepository repository;

@ApiOperation(value = "Customer list")
@GetMapping
@JsonView({ ShJsonView.ShJsonViewObject.class })
public List<ShCustomer> shCustomerList() throws Exception {
repository.deleteAll();

// save a couple of customers
repository.save(new ShCustomer("Alice", "Smith"));
repository.save(new ShCustomer("Bob", "Smith"));

return repository.findByLastName("Smith");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.viglet.shiohara.api.ecommerce;

import java.util.List;
import java.util.function.Consumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.annotation.JsonView;
import com.viglet.shiohara.api.ShJsonView;
import com.viglet.shiohara.persistence.model.ecommerce.ShEcomOrder;
import com.viglet.shiohara.persistence.repository.ecommerce.ShEcomOrderRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/api/v2/ecom/order")
@Api(tags = "Order", description = "Order API")
public class ShEcomOrderAPI {

@Autowired
private ShEcomOrderRepository shEcomOrderRepository;

@ApiOperation(value = "Order List")
@GetMapping
@JsonView({ ShJsonView.ShJsonViewObject.class })
public List<ShEcomOrder> shEcomOrderList() throws Exception {
return shEcomOrderRepository.findAll();
}

@ApiOperation(value = "Show a Order")
@GetMapping("/{id}")
@JsonView({ ShJsonView.ShJsonViewObject.class })
public ShEcomOrder ShEcomOrderGet(@PathVariable String id) throws Exception {
return shEcomOrderRepository.findById(id).get();
}

@ApiOperation(value = "Update a Order")
@PutMapping("/{id}")
@JsonView({ ShJsonView.ShJsonViewObject.class })
public ShEcomOrder ShEcomOrderUpdate(@PathVariable String id,
@RequestBody ShEcomOrder shEcomOrder) throws Exception {

ShEcomOrder shEcomOrderEdit = shEcomOrderRepository.findById(id).get();

shEcomOrderEdit.setDescription(shEcomOrder.getDescription());

shEcomOrderRepository.saveAndFlush(shEcomOrderEdit);

return shEcomOrderEdit;
}

@Transactional
@ApiOperation(value = "Delete a Order")
@DeleteMapping("/{id}")
public boolean ShEcomOrderDelete(@PathVariable String id) throws Exception {
shEcomOrderRepository.findById(id).ifPresent(new Consumer<ShEcomOrder>() {
@Override
public void accept(ShEcomOrder shEcomOrder) {
shEcomOrderRepository.delete(shEcomOrder);
}
});
return true;
}

@ApiOperation(value = "Create a Order")
@PostMapping
@JsonView({ ShJsonView.ShJsonViewObject.class })
public ShEcomOrder ShEcomOrderAdd(@RequestBody ShEcomOrder shEcomOrder) throws Exception {
shEcomOrderRepository.save(shEcomOrder);

return shEcomOrder;

}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package com.viglet.shiohara.api.ecommerce;

import java.util.Date;
import java.util.List;
import java.util.function.Consumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.annotation.JsonView;

import com.viglet.shiohara.api.ShJsonView;
import com.viglet.shiohara.persistence.model.ecommerce.ShEcomPaymentTypeDefinition;
import com.viglet.shiohara.persistence.repository.ecommerce.ShEcomPaymentTypeDefinitionRepository;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/api/v2/ecom/payment/type/definition")
@Api(tags = "Payment Type Definition", description = "Payment Type Definition API")
public class ShEcomPaymentTypeDefinitionAPI {

@Autowired
private ShEcomPaymentTypeDefinitionRepository shEcomPaymentTypeDefinitionRepository;

@ApiOperation(value = "Payment Type list")
@GetMapping
@JsonView({ ShJsonView.ShJsonViewObject.class })
public List<ShEcomPaymentTypeDefinition> shEcomPaymentTypeDefinitionList() throws Exception {
return shEcomPaymentTypeDefinitionRepository.findAll();
}

@ApiOperation(value = "Show a Payment Type")
@GetMapping("/{id}")
@JsonView({ ShJsonView.ShJsonViewObject.class })
public ShEcomPaymentTypeDefinition shEcomPaymentTypeDefinitioneGet(@PathVariable String id) throws Exception {
return shEcomPaymentTypeDefinitionRepository.findById(id).get();
}

@ApiOperation(value = "Update a Payment Type")
@PutMapping("/{id}")
@JsonView({ ShJsonView.ShJsonViewObject.class })
public ShEcomPaymentTypeDefinition shEcomPaymentTypeDefinitionUpdate(@PathVariable String id,
@RequestBody ShEcomPaymentTypeDefinition shEcomPaymentTypeDefinition) throws Exception {

ShEcomPaymentTypeDefinition shEcomPaymentTypeDefinitionEdit = shEcomPaymentTypeDefinitionRepository.findById(id).get();

shEcomPaymentTypeDefinitionEdit.setDate(new Date());
shEcomPaymentTypeDefinitionEdit.setClassName(shEcomPaymentTypeDefinition.getClassName());
shEcomPaymentTypeDefinitionEdit.setDescription(shEcomPaymentTypeDefinition.getDescription());
shEcomPaymentTypeDefinitionEdit.setName(shEcomPaymentTypeDefinition.getName());
shEcomPaymentTypeDefinitionEdit.setSettingPath(shEcomPaymentTypeDefinition.getSettingPath());

shEcomPaymentTypeDefinitionRepository.saveAndFlush(shEcomPaymentTypeDefinitionEdit);

return shEcomPaymentTypeDefinitionEdit;
}

@Transactional
@ApiOperation(value = "Delete a Payment Type")
@DeleteMapping("/{id}")
public boolean shEcomPaymentTypeDefinitionDelete(@PathVariable String id) throws Exception {
shEcomPaymentTypeDefinitionRepository.findById(id).ifPresent(new Consumer<ShEcomPaymentTypeDefinition>() {
@Override
public void accept(ShEcomPaymentTypeDefinition shEcomPaymentTypeDefinition) {
shEcomPaymentTypeDefinitionRepository.delete(shEcomPaymentTypeDefinition);
}
});
return true;
}

@ApiOperation(value = "Create a Payment Type")
@PostMapping
@JsonView({ ShJsonView.ShJsonViewObject.class })
public ShEcomPaymentTypeDefinition ShEcomPaymentTypeAdd(@RequestBody ShEcomPaymentTypeDefinition shEcomPaymentTypeDefinition) throws Exception {
shEcomPaymentTypeDefinition.setDate(new Date());
shEcomPaymentTypeDefinitionRepository.save(shEcomPaymentTypeDefinition);

return shEcomPaymentTypeDefinition;

}
}
Loading

0 comments on commit 0d9b023

Please sign in to comment.