Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
Upgrade to Vaadin v8.3.0 without v7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-baiborodine committed Mar 5, 2018
1 parent 7877e9d commit 9671b83
Show file tree
Hide file tree
Showing 45 changed files with 1,061 additions and 807 deletions.
134 changes: 45 additions & 89 deletions pom.xml
Expand Up @@ -19,8 +19,8 @@
<description>JPetStore Vaadin 8 with Spring Boot</description>

<properties>
<vaadin.version>8.1.5</vaadin.version>
<vaadin-spring.version>2.1.0.beta2</vaadin-spring.version>
<vaadin.version>8.3.0</vaadin.version>
<vaadin-spring.version>3.0.0</vaadin-spring.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
<org.vaadin.spring.version>0.0.7.RELEASE</org.vaadin.spring.version>

Expand Down Expand Up @@ -60,15 +60,15 @@
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-compatibility-server</artifactId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-compatibility-client-compiled</artifactId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-compatibility-themes</artifactId>
<artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
Expand Down Expand Up @@ -107,18 +107,8 @@
</dependency>
<dependency>
<groupId>org.vaadin</groupId>
<artifactId>viritin-v7-compatibility</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>formcheckbox</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>stepper</artifactId>
<version>2.4.0</version>
<artifactId>viritin</artifactId>
<version>2.3</version>
</dependency>

<!-- Spring -->
Expand Down Expand Up @@ -181,105 +171,71 @@
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.6</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>
${basedir}/src/main/webapp/VAADIN/
</directory>
<includes>
<include>widgetsets/**/*</include>
<include>themes/styles.css</include>
<include>themes/styles.scss.cache</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.source}</target>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<version>${vaadin.plugin.version}</version>
<dependencies>
<!-- For Travis -->
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
</dependencies>
<configuration>
<widgetsetMode>${vaadin.widgetset.mode}</widgetsetMode>
<extraJvmArgs>-Xmx2g -Xss1024k</extraJvmArgs>
<webappDirectory>
${basedir}/src/main/resources/VAADIN/widgetsets
</webappDirectory>
<!--<hostedWebapp>-->
<!--${basedir}/src/main/resources/VAADIN/widgetsets-->
<!--</hostedWebapp>-->
<persistentunitcachedir>
${project.build.directory}
</persistentunitcachedir>
<deploy>${project.build.directory}/gwt-deploy</deploy>
<compileReport>false</compileReport>
<noServer>true</noServer>
<!-- Remove draftCompile when project is ready -->
<draftCompile>true</draftCompile>
<style>OBF</style>
<!--<strict>true</strict>-->
<extraJvmArgs>-Xmx1G</extraJvmArgs>
</configuration>
<executions>
<execution>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<!-- <modules> <module>com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet</module>
</modules> -->
</configuration>
<goals>
<goal>resources</goal>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile-theme</goal>
<goal>compile</goal>
<goal>compile-theme</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<jvmArguments>
<!-- -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005-->
</jvmArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<id>enforce-no-snapshots</id>
<goals>
<goal>copy-resources</goal>
<goal>enforce</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/VAADIN</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources/VAADIN</directory>
</resource>
</resources>
<rules>
<requireReleaseDeps>
<message>No Snapshots Allowed!</message>
</requireReleaseDeps>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
Expand Down
Expand Up @@ -8,6 +8,9 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;

import javax.validation.Validator;

/**
* @author Igor Baiborodine
Expand Down Expand Up @@ -35,4 +38,9 @@ public OrderService orderService() {
public LoginService loginService() {
return new LoginService();
}

@Bean
public Validator validator() {
return new LocalValidatorFactoryBean();
}
}
Expand Up @@ -16,6 +16,8 @@

package com.kiroule.jpetstore.vaadinspring.domain;

import org.hibernate.validator.constraints.NotEmpty;

import java.io.Serializable;

/**
Expand All @@ -26,20 +28,32 @@ public class Account implements Serializable {

private static final long serialVersionUID = 8751282105532159742L;

@NotEmpty
private String username;
@NotEmpty
private String password;
@NotEmpty
private String email;
@NotEmpty
private String firstName;
@NotEmpty
private String lastName;
private String status;
@NotEmpty
private String address1;
private String address2;
@NotEmpty
private String city;
@NotEmpty
private String state;
@NotEmpty
private String zip;
@NotEmpty
private String country;
@NotEmpty
private String phone;
private String favouriteCategoryId;
@NotEmpty
private String languagePreference;
private boolean listOption;
private boolean bannerOption;
Expand Down
Expand Up @@ -16,6 +16,10 @@

package com.kiroule.jpetstore.vaadinspring.domain;

import com.google.common.base.MoreObjects;

import org.hibernate.validator.constraints.NotEmpty;

/**
* @author Igor Baiborodine
*
Expand All @@ -25,8 +29,11 @@ public class BillingDetails extends OrderDetails {
private static final long serialVersionUID = 4974454158308328436L;

// Payment method
@NotEmpty
private String cardType;
@NotEmpty
private String cardNumber;
@NotEmpty
private String expiryDate;

public BillingDetails() {}
Expand Down Expand Up @@ -58,4 +65,13 @@ public String getExpiryDate() {
public void setExpiryDate(String expiryDate) {
this.expiryDate = expiryDate;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("cardType", cardType)
.add("cardNumber", cardNumber)
.add("expiryDate", expiryDate)
.toString();
}
}
Expand Up @@ -70,6 +70,18 @@ public void incrementQuantity() {
calculateTotal();
}

public String getDescription() {
return this.item.getDescription();
}

public String getProductId() {
return this.item.getProductId();
}

public BigDecimal getListPrice() {
return this.getItem().getListPrice();
}

private void calculateTotal() {
if (item != null && item.getListPrice() != null) {
total = item.getListPrice().multiply(new BigDecimal(quantity));
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/com/kiroule/jpetstore/vaadinspring/domain/Item.java
Expand Up @@ -42,7 +42,7 @@ public class Item implements Serializable {
private String attribute4;
private String attribute5;
private Product product;
private int quantity;
private Integer quantity;

public String getItemId() {
return itemId;
Expand All @@ -52,11 +52,11 @@ public void setItemId(String itemId) {
this.itemId = itemId.trim();
}

public int getQuantity() {
public Integer getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}

Expand Down Expand Up @@ -148,6 +148,14 @@ public void setAttribute5(String attribute5) {
this.attribute5 = attribute5;
}

public String getDescription() {
return this.attribute1 + " " + this.getProduct().getName();
}

public String getProductDescription() {
return this.getProduct().getName();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Expand Up @@ -274,6 +274,10 @@ public List<LineItem> getLineItems() {
return lineItems;
}

public String getShipToFullName() {
return this.shipToFirstName + " " + this.shipToLastName;
}

public void initOrder(String username, BillingDetails billingDetails, ShippingDetails shippingDetails, Cart cart) {

this.username = username;
Expand Down

0 comments on commit 9671b83

Please sign in to comment.