repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
TerrenceMiao/camel-spring | src/test/java/org/paradise/validator/PersonValidatorTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import static org.junit.Assert.assertTrue; | package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
public class PersonValidatorTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
| // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
// Path: src/test/java/org/paradise/validator/PersonValidatorTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import static org.junit.Assert.assertTrue;
package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
public class PersonValidatorTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
| Person person = new Person(new Car(new Insurance(insuranceName, insurancePolicy))); |
TerrenceMiao/camel-spring | src/test/java/org/paradise/validator/PersonValidatorTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import static org.junit.Assert.assertTrue; | package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
public class PersonValidatorTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
| // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
// Path: src/test/java/org/paradise/validator/PersonValidatorTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import static org.junit.Assert.assertTrue;
package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
public class PersonValidatorTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
| Person person = new Person(new Car(new Insurance(insuranceName, insurancePolicy))); |
TerrenceMiao/camel-spring | src/test/java/org/paradise/validator/PersonValidatorTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import static org.junit.Assert.assertTrue; | package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
public class PersonValidatorTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person = new Person(new Car(new Insurance(insuranceName, insurancePolicy)));
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testValidateAgePassed() throws Exception {
person.setAge(1); | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
// Path: src/test/java/org/paradise/validator/PersonValidatorTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import static org.junit.Assert.assertTrue;
package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
public class PersonValidatorTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person = new Person(new Car(new Insurance(insuranceName, insurancePolicy)));
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testValidateAgePassed() throws Exception {
person.setAge(1); | assertTrue("Incorrect age", PersonValidator.validateAge(person) instanceof ValidationSuccess); |
TerrenceMiao/camel-spring | src/test/java/org/paradise/validator/PersonValidatorTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import static org.junit.Assert.assertTrue; | package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
public class PersonValidatorTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person = new Person(new Car(new Insurance(insuranceName, insurancePolicy)));
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testValidateAgePassed() throws Exception {
person.setAge(1);
assertTrue("Incorrect age", PersonValidator.validateAge(person) instanceof ValidationSuccess);
person.setAge(129);
assertTrue("Incorrect age", PersonValidator.validateAge(person) instanceof ValidationSuccess);
person.setAge(100);
assertTrue("Incorrect age", PersonValidator.validateAge(person) instanceof ValidationSuccess);
}
@Test
public void testValidateAgeFailed() throws Exception {
person.setAge(0); | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
// Path: src/test/java/org/paradise/validator/PersonValidatorTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import static org.junit.Assert.assertTrue;
package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
public class PersonValidatorTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person = new Person(new Car(new Insurance(insuranceName, insurancePolicy)));
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testValidateAgePassed() throws Exception {
person.setAge(1);
assertTrue("Incorrect age", PersonValidator.validateAge(person) instanceof ValidationSuccess);
person.setAge(129);
assertTrue("Incorrect age", PersonValidator.validateAge(person) instanceof ValidationSuccess);
person.setAge(100);
assertTrue("Incorrect age", PersonValidator.validateAge(person) instanceof ValidationSuccess);
}
@Test
public void testValidateAgeFailed() throws Exception {
person.setAge(0); | assertTrue("Incorrect age", PersonValidator.validateAge(person) instanceof ValidationFailure); |
TerrenceMiao/camel-spring | src/main/java/org/paradise/validator/PersonValidator.java | // Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Validation.java
// public abstract class Validation<L, A> {
//
// protected final A value;
//
// public Validation(A value) {
// this.value = value;
// }
//
// public abstract <B> Validation<L, B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper);
//
// public abstract boolean isSuccess();
//
// }
| import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import org.paradise.monad.Validation;
import org.springframework.stereotype.Component; | package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
@Component
public class PersonValidator {
| // Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Validation.java
// public abstract class Validation<L, A> {
//
// protected final A value;
//
// public Validation(A value) {
// this.value = value;
// }
//
// public abstract <B> Validation<L, B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper);
//
// public abstract boolean isSuccess();
//
// }
// Path: src/main/java/org/paradise/validator/PersonValidator.java
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import org.paradise.monad.Validation;
import org.springframework.stereotype.Component;
package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
@Component
public class PersonValidator {
| public static Validation<String, Person> validateAge(Person p) { |
TerrenceMiao/camel-spring | src/main/java/org/paradise/validator/PersonValidator.java | // Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Validation.java
// public abstract class Validation<L, A> {
//
// protected final A value;
//
// public Validation(A value) {
// this.value = value;
// }
//
// public abstract <B> Validation<L, B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper);
//
// public abstract boolean isSuccess();
//
// }
| import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import org.paradise.monad.Validation;
import org.springframework.stereotype.Component; | package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
@Component
public class PersonValidator {
| // Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Validation.java
// public abstract class Validation<L, A> {
//
// protected final A value;
//
// public Validation(A value) {
// this.value = value;
// }
//
// public abstract <B> Validation<L, B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper);
//
// public abstract boolean isSuccess();
//
// }
// Path: src/main/java/org/paradise/validator/PersonValidator.java
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import org.paradise.monad.Validation;
import org.springframework.stereotype.Component;
package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
@Component
public class PersonValidator {
| public static Validation<String, Person> validateAge(Person p) { |
TerrenceMiao/camel-spring | src/main/java/org/paradise/validator/PersonValidator.java | // Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Validation.java
// public abstract class Validation<L, A> {
//
// protected final A value;
//
// public Validation(A value) {
// this.value = value;
// }
//
// public abstract <B> Validation<L, B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper);
//
// public abstract boolean isSuccess();
//
// }
| import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import org.paradise.monad.Validation;
import org.springframework.stereotype.Component; | package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
@Component
public class PersonValidator {
public static Validation<String, Person> validateAge(Person p) { | // Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Validation.java
// public abstract class Validation<L, A> {
//
// protected final A value;
//
// public Validation(A value) {
// this.value = value;
// }
//
// public abstract <B> Validation<L, B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper);
//
// public abstract boolean isSuccess();
//
// }
// Path: src/main/java/org/paradise/validator/PersonValidator.java
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import org.paradise.monad.Validation;
import org.springframework.stereotype.Component;
package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
@Component
public class PersonValidator {
public static Validation<String, Person> validateAge(Person p) { | return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p); |
TerrenceMiao/camel-spring | src/main/java/org/paradise/validator/PersonValidator.java | // Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Validation.java
// public abstract class Validation<L, A> {
//
// protected final A value;
//
// public Validation(A value) {
// this.value = value;
// }
//
// public abstract <B> Validation<L, B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper);
//
// public abstract boolean isSuccess();
//
// }
| import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import org.paradise.monad.Validation;
import org.springframework.stereotype.Component; | package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
@Component
public class PersonValidator {
public static Validation<String, Person> validateAge(Person p) { | // Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationFailure.java
// public class ValidationFailure<L, A> extends Validation<L, A> {
//
// protected final L left;
//
// public ValidationFailure(L left, A value) {
// super(value);
// this.left = left;
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return new ValidationFailure(left, mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// Validation<?, ? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new ValidationFailure(left, result.value) : new ValidationFailure(((ValidationFailure<L, B>) result).left, result.value);
// }
//
// public boolean isSuccess() {
// return false;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/ValidationSuccess.java
// public class ValidationSuccess<L, A> extends Validation<L, A> {
//
// public ValidationSuccess(A value) {
// super(value);
// }
//
// public <B> Validation<L, B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// public <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper) {
// return (Validation<L, B>) mapper.apply(value);
// }
//
// public boolean isSuccess() {
// return true;
// }
//
// public static <L, A> ValidationSuccess<L, A> success(A value) {
// return new ValidationSuccess<>(value);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Validation.java
// public abstract class Validation<L, A> {
//
// protected final A value;
//
// public Validation(A value) {
// this.value = value;
// }
//
// public abstract <B> Validation<L, B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Validation<L, B> flatMap(Function<? super A, Validation<?, ? extends B>> mapper);
//
// public abstract boolean isSuccess();
//
// }
// Path: src/main/java/org/paradise/validator/PersonValidator.java
import org.paradise.domain.Person;
import org.paradise.monad.ValidationFailure;
import org.paradise.monad.ValidationSuccess;
import org.paradise.monad.Validation;
import org.springframework.stereotype.Component;
package org.paradise.validator;
/**
* Created by terrence on 12/03/2016.
*/
@Component
public class PersonValidator {
public static Validation<String, Person> validateAge(Person p) { | return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p); |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/PersonService.java | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
| // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/main/java/org/paradise/service/PersonService.java
import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
| private final PersonValidator personValidator; |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/PersonService.java | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
| // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/main/java/org/paradise/service/PersonService.java
import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
| String getCarInsuranceName(Person person) { |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/PersonService.java | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar) | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/main/java/org/paradise/service/PersonService.java
import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar) | .flatMap(Car::getInsurance) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/PersonService.java | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance) | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/main/java/org/paradise/service/PersonService.java
import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance) | .map(Insurance::getName) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/PersonService.java | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown")
;
}
| // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/main/java/org/paradise/service/PersonService.java
import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown")
;
}
| String getCarInsurancePolicy(Person person) throws NullValueException { |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/PersonService.java | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown")
;
}
String getCarInsurancePolicy(Person person) throws NullValueException {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getPolicy)
.orElseThrow(() -> new NullValueException())
;
}
void getAddressCityNameIfPresent(Person person) {
person.getAddress(person) | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/main/java/org/paradise/service/PersonService.java
import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown")
;
}
String getCarInsurancePolicy(Person person) throws NullValueException {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getPolicy)
.orElseThrow(() -> new NullValueException())
;
}
void getAddressCityNameIfPresent(Person person) {
person.getAddress(person) | .flatMap(Address::getCity) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/PersonService.java | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown")
;
}
String getCarInsurancePolicy(Person person) throws NullValueException {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getPolicy)
.orElseThrow(() -> new NullValueException())
;
}
void getAddressCityNameIfPresent(Person person) {
person.getAddress(person)
.flatMap(Address::getCity)
.ifPresent(this::process) | // Path: src/main/java/org/paradise/domain/Address.java
// public class Address {
//
// private static City city;
//
// public Address(City city) {
//
// this.city = city;
// }
//
// public static <U> Try<City> getCity(U u) {
//
// return city == null
// ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL"))
// : new TrySuccess(city);
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/City.java
// public class City {
//
// private static String name;
//
// public City(String name) {
//
// this.name = name;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/main/java/org/paradise/service/PersonService.java
import org.paradise.domain.Address;
import org.paradise.domain.Car;
import org.paradise.domain.City;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@Service
public class PersonService {
private final PersonValidator personValidator;
@Autowired
public PersonService(PersonValidator personValidator) {
this.personValidator = personValidator;
}
String getCarInsuranceName(Person person) {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown")
;
}
String getCarInsurancePolicy(Person person) throws NullValueException {
return Optional.of(person)
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getPolicy)
.orElseThrow(() -> new NullValueException())
;
}
void getAddressCityNameIfPresent(Person person) {
person.getAddress(person)
.flatMap(Address::getCity)
.ifPresent(this::process) | .map(City::getName) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/domain/Address.java | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
| import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess; | package org.paradise.domain;
/**
* Created by terrence on 14/03/2016.
*/
public class Address {
private static City city;
public Address(City city) {
this.city = city;
}
| // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
// Path: src/main/java/org/paradise/domain/Address.java
import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
package org.paradise.domain;
/**
* Created by terrence on 14/03/2016.
*/
public class Address {
private static City city;
public Address(City city) {
this.city = city;
}
| public static <U> Try<City> getCity(U u) { |
TerrenceMiao/camel-spring | src/main/java/org/paradise/domain/Address.java | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
| import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess; | package org.paradise.domain;
/**
* Created by terrence on 14/03/2016.
*/
public class Address {
private static City city;
public Address(City city) {
this.city = city;
}
public static <U> Try<City> getCity(U u) {
return city == null | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
// Path: src/main/java/org/paradise/domain/Address.java
import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
package org.paradise.domain;
/**
* Created by terrence on 14/03/2016.
*/
public class Address {
private static City city;
public Address(City city) {
this.city = city;
}
public static <U> Try<City> getCity(U u) {
return city == null | ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL")) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/domain/Address.java | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
| import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess; | package org.paradise.domain;
/**
* Created by terrence on 14/03/2016.
*/
public class Address {
private static City city;
public Address(City city) {
this.city = city;
}
public static <U> Try<City> getCity(U u) {
return city == null | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
// Path: src/main/java/org/paradise/domain/Address.java
import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
package org.paradise.domain;
/**
* Created by terrence on 14/03/2016.
*/
public class Address {
private static City city;
public Address(City city) {
this.city = city;
}
public static <U> Try<City> getCity(U u) {
return city == null | ? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL")) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/domain/Address.java | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
| import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess; | package org.paradise.domain;
/**
* Created by terrence on 14/03/2016.
*/
public class Address {
private static City city;
public Address(City city) {
this.city = city;
}
public static <U> Try<City> getCity(U u) {
return city == null
? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL")) | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
// Path: src/main/java/org/paradise/domain/Address.java
import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
package org.paradise.domain;
/**
* Created by terrence on 14/03/2016.
*/
public class Address {
private static City city;
public Address(City city) {
this.city = city;
}
public static <U> Try<City> getCity(U u) {
return city == null
? new TryFailure<>(city).failure(u.toString(), new NullValueException("City is NULL")) | : new TrySuccess(city); |
TerrenceMiao/camel-spring | src/test/java/org/paradise/service/PersonServiceTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@RunWith(MockitoJUnitRunner.class)
public class PersonServiceTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
| // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/test/java/org/paradise/service/PersonServiceTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@RunWith(MockitoJUnitRunner.class)
public class PersonServiceTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
| Person person; |
TerrenceMiao/camel-spring | src/test/java/org/paradise/service/PersonServiceTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@RunWith(MockitoJUnitRunner.class)
public class PersonServiceTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person;
@InjectMocks
PersonService personService;
@Mock | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/test/java/org/paradise/service/PersonServiceTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@RunWith(MockitoJUnitRunner.class)
public class PersonServiceTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person;
@InjectMocks
PersonService personService;
@Mock | PersonValidator mockPersonValidator; |
TerrenceMiao/camel-spring | src/test/java/org/paradise/service/PersonServiceTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@RunWith(MockitoJUnitRunner.class)
public class PersonServiceTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person;
@InjectMocks
PersonService personService;
@Mock
PersonValidator mockPersonValidator;
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetCarInsuranceNameAndPolicy() throws Exception {
| // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/test/java/org/paradise/service/PersonServiceTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@RunWith(MockitoJUnitRunner.class)
public class PersonServiceTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person;
@InjectMocks
PersonService personService;
@Mock
PersonValidator mockPersonValidator;
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetCarInsuranceNameAndPolicy() throws Exception {
| person = new Person(new Car(new Insurance(insuranceName, insurancePolicy))); |
TerrenceMiao/camel-spring | src/test/java/org/paradise/service/PersonServiceTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when; | package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@RunWith(MockitoJUnitRunner.class)
public class PersonServiceTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person;
@InjectMocks
PersonService personService;
@Mock
PersonValidator mockPersonValidator;
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetCarInsuranceNameAndPolicy() throws Exception {
| // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/test/java/org/paradise/service/PersonServiceTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
package org.paradise.service;
/**
* Created by terrence on 12/03/2016.
*/
@RunWith(MockitoJUnitRunner.class)
public class PersonServiceTest {
String insuranceName = "Pacific Insurance";
String insurancePolicy = "Pacific Insurance Policy";
Person person;
@InjectMocks
PersonService personService;
@Mock
PersonValidator mockPersonValidator;
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetCarInsuranceNameAndPolicy() throws Exception {
| person = new Person(new Car(new Insurance(insuranceName, insurancePolicy))); |
TerrenceMiao/camel-spring | src/test/java/org/paradise/service/PersonServiceTest.java | // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
| import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when; |
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetCarInsuranceNameAndPolicy() throws Exception {
person = new Person(new Car(new Insurance(insuranceName, insurancePolicy)));
assertSame("Incorrect car insurance name", insuranceName, personService.getCarInsuranceName(person));
assertSame("Incorrect car insurance policy", insurancePolicy, personService.getCarInsurancePolicy(person));
}
@Test
public void testGetCarInsuranceNameUnknown() {
person = new Person(null);
assertSame("Incorrect car insurance name", "Unknown", personService.getCarInsuranceName(person));
person = new Person(new Car(null));
assertSame("Incorrect car insurance name", "Unknown", personService.getCarInsuranceName(person));
person = new Person(new Car(new Insurance(null, insurancePolicy)));
assertSame("Incorrect car insurance name", "Unknown", personService.getCarInsuranceName(person));
}
| // Path: src/main/java/org/paradise/domain/Car.java
// public class Car {
//
// private static Optional<Insurance> insurance;
//
// public Car(Insurance insurance) {
// this.insurance = Optional.ofNullable(insurance);
// }
//
// public static <U> Optional<Insurance> getInsurance(U u) {
// return insurance;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Insurance.java
// public class Insurance {
//
// private static String name;
// private static String policy;
//
// public Insurance(String name, String policy) {
// this.name = name;
// this.policy = policy;
// }
//
// public static <U> String getName(U u) {
// return name;
// }
//
// public static <U> String getPolicy(U u) {
// return policy;
// }
//
// }
//
// Path: src/main/java/org/paradise/domain/Person.java
// public class Person {
//
// private String name;
// private int age;
//
// private static Optional<Car> car;
//
// private static Address address;
//
//
// public Person(Car car) {
// this.car = Optional.ofNullable(car);
// }
//
// public static <U> Optional<Car> getCar(U u) {
// return car;
// }
//
// public static <U> Try<Address> getAddress(U u) {
//
// return address == null
// ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL"))
// : new TrySuccess(address);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// @Override
// public String toString() {
// return "Person {" +
// "name = [" + name + ']' +
// ", age = [" + age + ']' +
// ", car = [" + car + ']' +
// ", address = [" + address + ']' +
// '}';
// }
//
// }
//
// Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/validator/PersonValidator.java
// @Component
// public class PersonValidator {
//
// public static Validation<String, Person> validateAge(Person p) {
// return (p.getAge() > 0 && p.getAge() < 130) ? new ValidationSuccess(p) : new ValidationFailure("Age must be between 0 and 130", p);
// }
//
// public static Validation<String, Person> validateName(Person p) {
// return Character.isUpperCase(p.getName().charAt(0)) ? new ValidationSuccess(p) : new ValidationFailure("Name must start with uppercase", p);
// }
//
// public Boolean validate(Person p) {
//
// return Boolean.FALSE;
// }
//
// }
// Path: src/test/java/org/paradise/service/PersonServiceTest.java
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.paradise.domain.Car;
import org.paradise.domain.Insurance;
import org.paradise.domain.Person;
import org.paradise.exception.NullValueException;
import org.paradise.validator.PersonValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetCarInsuranceNameAndPolicy() throws Exception {
person = new Person(new Car(new Insurance(insuranceName, insurancePolicy)));
assertSame("Incorrect car insurance name", insuranceName, personService.getCarInsuranceName(person));
assertSame("Incorrect car insurance policy", insurancePolicy, personService.getCarInsurancePolicy(person));
}
@Test
public void testGetCarInsuranceNameUnknown() {
person = new Person(null);
assertSame("Incorrect car insurance name", "Unknown", personService.getCarInsuranceName(person));
person = new Person(new Car(null));
assertSame("Incorrect car insurance name", "Unknown", personService.getCarInsuranceName(person));
person = new Person(new Car(new Insurance(null, insurancePolicy)));
assertSame("Incorrect car insurance name", "Unknown", personService.getCarInsuranceName(person));
}
| @Test(expected = NullValueException.class) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/domain/Person.java | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
| import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
import java.util.Optional; | package org.paradise.domain;
/**
* Created by terrence on 12/03/2016.
*/
public class Person {
private String name;
private int age;
private static Optional<Car> car;
private static Address address;
public Person(Car car) {
this.car = Optional.ofNullable(car);
}
public static <U> Optional<Car> getCar(U u) {
return car;
}
| // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
// Path: src/main/java/org/paradise/domain/Person.java
import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
import java.util.Optional;
package org.paradise.domain;
/**
* Created by terrence on 12/03/2016.
*/
public class Person {
private String name;
private int age;
private static Optional<Car> car;
private static Address address;
public Person(Car car) {
this.car = Optional.ofNullable(car);
}
public static <U> Optional<Car> getCar(U u) {
return car;
}
| public static <U> Try<Address> getAddress(U u) { |
TerrenceMiao/camel-spring | src/main/java/org/paradise/domain/Person.java | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
| import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
import java.util.Optional; | package org.paradise.domain;
/**
* Created by terrence on 12/03/2016.
*/
public class Person {
private String name;
private int age;
private static Optional<Car> car;
private static Address address;
public Person(Car car) {
this.car = Optional.ofNullable(car);
}
public static <U> Optional<Car> getCar(U u) {
return car;
}
public static <U> Try<Address> getAddress(U u) {
return address == null | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
// Path: src/main/java/org/paradise/domain/Person.java
import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
import java.util.Optional;
package org.paradise.domain;
/**
* Created by terrence on 12/03/2016.
*/
public class Person {
private String name;
private int age;
private static Optional<Car> car;
private static Address address;
public Person(Car car) {
this.car = Optional.ofNullable(car);
}
public static <U> Optional<Car> getCar(U u) {
return car;
}
public static <U> Try<Address> getAddress(U u) {
return address == null | ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL")) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/domain/Person.java | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
| import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
import java.util.Optional; | package org.paradise.domain;
/**
* Created by terrence on 12/03/2016.
*/
public class Person {
private String name;
private int age;
private static Optional<Car> car;
private static Address address;
public Person(Car car) {
this.car = Optional.ofNullable(car);
}
public static <U> Optional<Car> getCar(U u) {
return car;
}
public static <U> Try<Address> getAddress(U u) {
return address == null | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
// Path: src/main/java/org/paradise/domain/Person.java
import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
import java.util.Optional;
package org.paradise.domain;
/**
* Created by terrence on 12/03/2016.
*/
public class Person {
private String name;
private int age;
private static Optional<Car> car;
private static Address address;
public Person(Car car) {
this.car = Optional.ofNullable(car);
}
public static <U> Optional<Car> getCar(U u) {
return car;
}
public static <U> Try<Address> getAddress(U u) {
return address == null | ? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL")) |
TerrenceMiao/camel-spring | src/main/java/org/paradise/domain/Person.java | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
| import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
import java.util.Optional; | package org.paradise.domain;
/**
* Created by terrence on 12/03/2016.
*/
public class Person {
private String name;
private int age;
private static Optional<Car> car;
private static Address address;
public Person(Car car) {
this.car = Optional.ofNullable(car);
}
public static <U> Optional<Car> getCar(U u) {
return car;
}
public static <U> Try<Address> getAddress(U u) {
return address == null
? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL")) | // Path: src/main/java/org/paradise/exception/NullValueException.java
// public class NullValueException extends Exception {
//
// public NullValueException() {
// }
//
// public NullValueException(String message) {
// super(message);
// }
//
// public NullValueException(Throwable cause) {
// super(cause);
// }
//
// public NullValueException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public NullValueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/Try.java
// public abstract class Try<A> {
//
// protected A value;
//
// public Try(A value) {
// this.value = value;
// }
//
// public abstract Boolean isSuccess();
//
// public abstract Boolean isFailure();
//
// public abstract void throwException();
//
// public abstract <B> Try<B> map(Function<? super A, ? extends B> mapper);
//
// public abstract <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper);
//
//
// public <A> Try<A> failure(String message) {
// return new TryFailure<>((A) value, message);
// }
//
// public <A> Try<A> failure(Exception e) {
// return new TryFailure<>((A) value, e);
// }
//
// public <A> Try<A> failure(String message, Exception e) {
// return new TryFailure<>((A) value, message, e);
// }
//
// public <A> Try<A> success(A value) {
// return new TrySuccess<>(value);
// }
//
// public Try<A> ifPresent(Consumer c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return success(null);
// }
// }
//
// public Try<A> ifPresentOrThrow(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// throw ((TryFailure<A>) this).getException();
// }
// }
// public Try<A> ifPresentOrFail(Consumer<A> c) {
// if (isSuccess()) {
// c.accept(value);
// return success(value);
// } else {
// return failure("Failed to fail!");
// }
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TryFailure.java
// public class TryFailure<A> extends Try<A> {
//
// private RuntimeException exception;
//
// public TryFailure(A value) {
// super(value);
// }
//
// public TryFailure(A value, String message) {
// super(value);
// this.exception = new IllegalStateException(message);
// }
//
// public TryFailure(A value, String message, Exception e) {
// super(value);
// this.exception = new IllegalStateException(message, e);
// }
//
// public TryFailure(A value, Exception e) {
// super(value);
// this.exception = new IllegalStateException(e);
// }
//
// @Override
// public Boolean isSuccess() {
// return false;
// }
//
// @Override
// public Boolean isFailure() {
// return true;
// }
//
// @Override
// public void throwException() {
// throw this.exception;
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return new TryFailure<>(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// Try<? extends B> result = mapper.apply(value);
//
// return result.isSuccess() ? new TrySuccess<>(result.value) : new TryFailure<>(((Try<B>) result).value);
// }
//
// public RuntimeException getException() {
// return exception;
// }
//
// }
//
// Path: src/main/java/org/paradise/monad/TrySuccess.java
// public class TrySuccess<A> extends Try<A> {
//
// public TrySuccess(A value) {
// super(value);
// }
//
// @Override
// public Boolean isSuccess() {
// return true;
// }
//
// @Override
// public Boolean isFailure() {
// return false;
// }
//
// @Override
// public void throwException() {
// }
//
// @Override
// public <B> Try<B> map(Function<? super A, ? extends B> mapper) {
// return success(mapper.apply(value));
// }
//
// @Override
// public <B> Try<B> flatMap(Function<? super A, Try<? extends B>> mapper) {
// return (Try<B>) mapper.apply(value);
// }
//
// }
// Path: src/main/java/org/paradise/domain/Person.java
import org.paradise.exception.NullValueException;
import org.paradise.monad.Try;
import org.paradise.monad.TryFailure;
import org.paradise.monad.TrySuccess;
import java.util.Optional;
package org.paradise.domain;
/**
* Created by terrence on 12/03/2016.
*/
public class Person {
private String name;
private int age;
private static Optional<Car> car;
private static Address address;
public Person(Car car) {
this.car = Optional.ofNullable(car);
}
public static <U> Optional<Car> getCar(U u) {
return car;
}
public static <U> Try<Address> getAddress(U u) {
return address == null
? new TryFailure<>(address).failure(u.toString(), new NullValueException("Address is NULL")) | : new TrySuccess(address); |
TerrenceMiao/camel-spring | src/main/java/org/paradise/repository/RedisRepository.java | // Path: src/main/java/org/paradise/Constants.java
// public class Constants {
//
// public static final String OK = "OK";
//
// public static final String CURRENT_VERSION = "/v1";
//
// public static final String HEALTH_CHECK_PATH = CURRENT_VERSION + "/health";
// public static final String PDF_PATH = CURRENT_VERSION + "/pdf";
//
// public static final String REDIS_KEY = "camelKey";
// public static final String REDIS_FIELD = "camelField";
//
// private Constants() {
// }
//
// }
| import org.paradise.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.PostConstruct;
import java.util.Map; | package org.paradise.repository;
/**
* Created by terrence on 24/07/2016.
*/
@Repository
public class RedisRepository {
private RedisTemplate<String, String> redisTemplate;
private HashOperations hashOps;
@Autowired
public RedisRepository(RedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
@PostConstruct
private void init() {
hashOps = redisTemplate.opsForHash();
}
public void saveHash(String hashKey, Object value) { | // Path: src/main/java/org/paradise/Constants.java
// public class Constants {
//
// public static final String OK = "OK";
//
// public static final String CURRENT_VERSION = "/v1";
//
// public static final String HEALTH_CHECK_PATH = CURRENT_VERSION + "/health";
// public static final String PDF_PATH = CURRENT_VERSION + "/pdf";
//
// public static final String REDIS_KEY = "camelKey";
// public static final String REDIS_FIELD = "camelField";
//
// private Constants() {
// }
//
// }
// Path: src/main/java/org/paradise/repository/RedisRepository.java
import org.paradise.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.PostConstruct;
import java.util.Map;
package org.paradise.repository;
/**
* Created by terrence on 24/07/2016.
*/
@Repository
public class RedisRepository {
private RedisTemplate<String, String> redisTemplate;
private HashOperations hashOps;
@Autowired
public RedisRepository(RedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
@PostConstruct
private void init() {
hashOps = redisTemplate.opsForHash();
}
public void saveHash(String hashKey, Object value) { | hashOps.put(Constants.REDIS_KEY, hashKey, value); |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/RedisService.java | // Path: src/main/java/org/paradise/Constants.java
// public class Constants {
//
// public static final String OK = "OK";
//
// public static final String CURRENT_VERSION = "/v1";
//
// public static final String HEALTH_CHECK_PATH = CURRENT_VERSION + "/health";
// public static final String PDF_PATH = CURRENT_VERSION + "/pdf";
//
// public static final String REDIS_KEY = "camelKey";
// public static final String REDIS_FIELD = "camelField";
//
// private Constants() {
// }
//
// }
//
// Path: src/main/java/org/paradise/repository/RedisRepository.java
// @Repository
// public class RedisRepository {
//
// private RedisTemplate<String, String> redisTemplate;
//
// private HashOperations hashOps;
//
// @Autowired
// public RedisRepository(RedisTemplate redisTemplate) {
// this.redisTemplate = redisTemplate;
// }
//
// @PostConstruct
// private void init() {
// hashOps = redisTemplate.opsForHash();
// }
//
// public void saveHash(String hashKey, Object value) {
// hashOps.put(Constants.REDIS_KEY, hashKey, value);
// }
//
// public void updateHash(String hashKey, Object value) {
// hashOps.put(Constants.REDIS_KEY, hashKey, value);
// }
//
// public Object findHash(String hashKey) {
// return hashOps.get(Constants.REDIS_KEY, hashKey);
// }
//
// public Map<Object, Object> findAllHash() {
// return hashOps.entries(Constants.REDIS_KEY);
// }
//
// public void deleteHash(String hashKey) {
// hashOps.delete(Constants.REDIS_KEY, hashKey);
// }
//
// }
| import org.paradise.Constants;
import org.paradise.repository.RedisRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; | package org.paradise.service;
/**
* Created by terrence on 24/07/2016.
*/
@Component
public class RedisService {
private static final Logger LOG = LoggerFactory.getLogger(RedisService.class);
| // Path: src/main/java/org/paradise/Constants.java
// public class Constants {
//
// public static final String OK = "OK";
//
// public static final String CURRENT_VERSION = "/v1";
//
// public static final String HEALTH_CHECK_PATH = CURRENT_VERSION + "/health";
// public static final String PDF_PATH = CURRENT_VERSION + "/pdf";
//
// public static final String REDIS_KEY = "camelKey";
// public static final String REDIS_FIELD = "camelField";
//
// private Constants() {
// }
//
// }
//
// Path: src/main/java/org/paradise/repository/RedisRepository.java
// @Repository
// public class RedisRepository {
//
// private RedisTemplate<String, String> redisTemplate;
//
// private HashOperations hashOps;
//
// @Autowired
// public RedisRepository(RedisTemplate redisTemplate) {
// this.redisTemplate = redisTemplate;
// }
//
// @PostConstruct
// private void init() {
// hashOps = redisTemplate.opsForHash();
// }
//
// public void saveHash(String hashKey, Object value) {
// hashOps.put(Constants.REDIS_KEY, hashKey, value);
// }
//
// public void updateHash(String hashKey, Object value) {
// hashOps.put(Constants.REDIS_KEY, hashKey, value);
// }
//
// public Object findHash(String hashKey) {
// return hashOps.get(Constants.REDIS_KEY, hashKey);
// }
//
// public Map<Object, Object> findAllHash() {
// return hashOps.entries(Constants.REDIS_KEY);
// }
//
// public void deleteHash(String hashKey) {
// hashOps.delete(Constants.REDIS_KEY, hashKey);
// }
//
// }
// Path: src/main/java/org/paradise/service/RedisService.java
import org.paradise.Constants;
import org.paradise.repository.RedisRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
package org.paradise.service;
/**
* Created by terrence on 24/07/2016.
*/
@Component
public class RedisService {
private static final Logger LOG = LoggerFactory.getLogger(RedisService.class);
| private RedisRepository redisRepository; |
TerrenceMiao/camel-spring | src/main/java/org/paradise/service/RedisService.java | // Path: src/main/java/org/paradise/Constants.java
// public class Constants {
//
// public static final String OK = "OK";
//
// public static final String CURRENT_VERSION = "/v1";
//
// public static final String HEALTH_CHECK_PATH = CURRENT_VERSION + "/health";
// public static final String PDF_PATH = CURRENT_VERSION + "/pdf";
//
// public static final String REDIS_KEY = "camelKey";
// public static final String REDIS_FIELD = "camelField";
//
// private Constants() {
// }
//
// }
//
// Path: src/main/java/org/paradise/repository/RedisRepository.java
// @Repository
// public class RedisRepository {
//
// private RedisTemplate<String, String> redisTemplate;
//
// private HashOperations hashOps;
//
// @Autowired
// public RedisRepository(RedisTemplate redisTemplate) {
// this.redisTemplate = redisTemplate;
// }
//
// @PostConstruct
// private void init() {
// hashOps = redisTemplate.opsForHash();
// }
//
// public void saveHash(String hashKey, Object value) {
// hashOps.put(Constants.REDIS_KEY, hashKey, value);
// }
//
// public void updateHash(String hashKey, Object value) {
// hashOps.put(Constants.REDIS_KEY, hashKey, value);
// }
//
// public Object findHash(String hashKey) {
// return hashOps.get(Constants.REDIS_KEY, hashKey);
// }
//
// public Map<Object, Object> findAllHash() {
// return hashOps.entries(Constants.REDIS_KEY);
// }
//
// public void deleteHash(String hashKey) {
// hashOps.delete(Constants.REDIS_KEY, hashKey);
// }
//
// }
| import org.paradise.Constants;
import org.paradise.repository.RedisRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; | package org.paradise.service;
/**
* Created by terrence on 24/07/2016.
*/
@Component
public class RedisService {
private static final Logger LOG = LoggerFactory.getLogger(RedisService.class);
private RedisRepository redisRepository;
@Autowired
public RedisService(RedisRepository redisRepository) {
this.redisRepository = redisRepository;
}
public void getMessage(String message) {
redisRepository.saveHash("RedisMessage", message);
LOG.debug("Redis message is: " + redisRepository.findHash("RedisMessage")); | // Path: src/main/java/org/paradise/Constants.java
// public class Constants {
//
// public static final String OK = "OK";
//
// public static final String CURRENT_VERSION = "/v1";
//
// public static final String HEALTH_CHECK_PATH = CURRENT_VERSION + "/health";
// public static final String PDF_PATH = CURRENT_VERSION + "/pdf";
//
// public static final String REDIS_KEY = "camelKey";
// public static final String REDIS_FIELD = "camelField";
//
// private Constants() {
// }
//
// }
//
// Path: src/main/java/org/paradise/repository/RedisRepository.java
// @Repository
// public class RedisRepository {
//
// private RedisTemplate<String, String> redisTemplate;
//
// private HashOperations hashOps;
//
// @Autowired
// public RedisRepository(RedisTemplate redisTemplate) {
// this.redisTemplate = redisTemplate;
// }
//
// @PostConstruct
// private void init() {
// hashOps = redisTemplate.opsForHash();
// }
//
// public void saveHash(String hashKey, Object value) {
// hashOps.put(Constants.REDIS_KEY, hashKey, value);
// }
//
// public void updateHash(String hashKey, Object value) {
// hashOps.put(Constants.REDIS_KEY, hashKey, value);
// }
//
// public Object findHash(String hashKey) {
// return hashOps.get(Constants.REDIS_KEY, hashKey);
// }
//
// public Map<Object, Object> findAllHash() {
// return hashOps.entries(Constants.REDIS_KEY);
// }
//
// public void deleteHash(String hashKey) {
// hashOps.delete(Constants.REDIS_KEY, hashKey);
// }
//
// }
// Path: src/main/java/org/paradise/service/RedisService.java
import org.paradise.Constants;
import org.paradise.repository.RedisRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
package org.paradise.service;
/**
* Created by terrence on 24/07/2016.
*/
@Component
public class RedisService {
private static final Logger LOG = LoggerFactory.getLogger(RedisService.class);
private RedisRepository redisRepository;
@Autowired
public RedisService(RedisRepository redisRepository) {
this.redisRepository = redisRepository;
}
public void getMessage(String message) {
redisRepository.saveHash("RedisMessage", message);
LOG.debug("Redis message is: " + redisRepository.findHash("RedisMessage")); | LOG.debug("Redis HSET value is: [" + redisRepository.findHash(Constants.REDIS_FIELD) + "]"); |
ewolff/microservice-consul | microservice-consul-demo/microservice-consul-demo-order/src/test/java/com/ewolff/microservice/order/logic/CustomerConsumerDrivenContractTest.java | // Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/OrderApp.java
// @SpringBootApplication
// @EnableDiscoveryClient
// @RibbonClient("order")
// public class OrderApp {
//
// @Bean
// public RestTemplate restTemplate() {
// return new RestTemplate();
// }
//
// public static void main(String[] args) {
// SpringApplication.run(OrderApp.class, args);
// }
//
// }
//
// Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/clients/CustomerClient.java
// @Component
// public class CustomerClient {
//
// private final Logger log = LoggerFactory.getLogger(CustomerClient.class);
//
// private RestTemplate restTemplate;
// private String customerServiceHost;
// private long customerServicePort;
// private boolean useRibbon;
// private LoadBalancerClient loadBalancer;
//
// static class CustomerPagedResources extends PagedModel<Customer> {
//
// }
//
// @Autowired
// public CustomerClient(@Value("${customer.service.host:customer}") String customerServiceHost,
// @Value("${customer.service.port:8080}") long customerServicePort,
// @Value("${spring.cloud.consul.ribbon.enabled:false}") boolean useRibbon,
// @Autowired RestTemplate restTemplate) {
// super();
// this.restTemplate = restTemplate;
// this.customerServiceHost = customerServiceHost;
// this.customerServicePort = customerServicePort;
// this.useRibbon = useRibbon;
// }
//
// @Autowired(required = false)
// public void setLoadBalancer(LoadBalancerClient loadBalancer) {
// this.loadBalancer = loadBalancer;
// }
//
// public boolean isValidCustomerId(long customerId) {
// RestTemplate restTemplate = new RestTemplate();
// try {
// ResponseEntity<String> entity = restTemplate.getForEntity(customerURL() + customerId, String.class);
// return entity.getStatusCode().is2xxSuccessful();
// } catch (final HttpClientErrorException e) {
// if (e.getStatusCode().value() == 404)
// return false;
// else
// throw e;
// }
// }
//
// protected RestTemplate getRestTemplate() {
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// mapper.registerModule(new Jackson2HalModule());
//
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
// converter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON));
// converter.setObjectMapper(mapper);
//
// return new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
// }
//
// public Collection<Customer> findAll() {
// PagedModel<Customer> pagedResources = getRestTemplate().getForObject(customerURL(),
// CustomerPagedResources.class);
// return pagedResources.getContent();
// }
//
// private String customerURL() {
// String url;
// if (useRibbon) {
// ServiceInstance instance = loadBalancer.choose("CUSTOMER");
// url = String.format("http://%s:%s/customer/", instance.getHost(), instance.getPort());
// } else {
// url = String.format("http://%s:%s/customer/", customerServiceHost, customerServicePort);
// }
// log.trace("Customer: URL {} ", url);
// return url;
//
// }
//
// public Customer getOne(long customerId) {
// return restTemplate.getForObject(customerURL() + customerId, Customer.class);
// }
// }
| import com.ewolff.microservice.order.OrderApp;
import com.ewolff.microservice.order.clients.Customer;
import com.ewolff.microservice.order.clients.CustomerClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Collection;
import static org.junit.Assert.*; | package com.ewolff.microservice.order.logic;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = OrderApp.class)
@ActiveProfiles("test")
public class CustomerConsumerDrivenContractTest {
@Autowired | // Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/OrderApp.java
// @SpringBootApplication
// @EnableDiscoveryClient
// @RibbonClient("order")
// public class OrderApp {
//
// @Bean
// public RestTemplate restTemplate() {
// return new RestTemplate();
// }
//
// public static void main(String[] args) {
// SpringApplication.run(OrderApp.class, args);
// }
//
// }
//
// Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/clients/CustomerClient.java
// @Component
// public class CustomerClient {
//
// private final Logger log = LoggerFactory.getLogger(CustomerClient.class);
//
// private RestTemplate restTemplate;
// private String customerServiceHost;
// private long customerServicePort;
// private boolean useRibbon;
// private LoadBalancerClient loadBalancer;
//
// static class CustomerPagedResources extends PagedModel<Customer> {
//
// }
//
// @Autowired
// public CustomerClient(@Value("${customer.service.host:customer}") String customerServiceHost,
// @Value("${customer.service.port:8080}") long customerServicePort,
// @Value("${spring.cloud.consul.ribbon.enabled:false}") boolean useRibbon,
// @Autowired RestTemplate restTemplate) {
// super();
// this.restTemplate = restTemplate;
// this.customerServiceHost = customerServiceHost;
// this.customerServicePort = customerServicePort;
// this.useRibbon = useRibbon;
// }
//
// @Autowired(required = false)
// public void setLoadBalancer(LoadBalancerClient loadBalancer) {
// this.loadBalancer = loadBalancer;
// }
//
// public boolean isValidCustomerId(long customerId) {
// RestTemplate restTemplate = new RestTemplate();
// try {
// ResponseEntity<String> entity = restTemplate.getForEntity(customerURL() + customerId, String.class);
// return entity.getStatusCode().is2xxSuccessful();
// } catch (final HttpClientErrorException e) {
// if (e.getStatusCode().value() == 404)
// return false;
// else
// throw e;
// }
// }
//
// protected RestTemplate getRestTemplate() {
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// mapper.registerModule(new Jackson2HalModule());
//
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
// converter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON));
// converter.setObjectMapper(mapper);
//
// return new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
// }
//
// public Collection<Customer> findAll() {
// PagedModel<Customer> pagedResources = getRestTemplate().getForObject(customerURL(),
// CustomerPagedResources.class);
// return pagedResources.getContent();
// }
//
// private String customerURL() {
// String url;
// if (useRibbon) {
// ServiceInstance instance = loadBalancer.choose("CUSTOMER");
// url = String.format("http://%s:%s/customer/", instance.getHost(), instance.getPort());
// } else {
// url = String.format("http://%s:%s/customer/", customerServiceHost, customerServicePort);
// }
// log.trace("Customer: URL {} ", url);
// return url;
//
// }
//
// public Customer getOne(long customerId) {
// return restTemplate.getForObject(customerURL() + customerId, Customer.class);
// }
// }
// Path: microservice-consul-demo/microservice-consul-demo-order/src/test/java/com/ewolff/microservice/order/logic/CustomerConsumerDrivenContractTest.java
import com.ewolff.microservice.order.OrderApp;
import com.ewolff.microservice.order.clients.Customer;
import com.ewolff.microservice.order.clients.CustomerClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Collection;
import static org.junit.Assert.*;
package com.ewolff.microservice.order.logic;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = OrderApp.class)
@ActiveProfiles("test")
public class CustomerConsumerDrivenContractTest {
@Autowired | CustomerClient customerClient; |
ewolff/microservice-consul | microservice-consul-demo/microservice-consul-demo-order/src/test/java/com/ewolff/microservice/order/logic/CatalogConsumerDrivenContractTest.java | // Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/OrderApp.java
// @SpringBootApplication
// @EnableDiscoveryClient
// @RibbonClient("order")
// public class OrderApp {
//
// @Bean
// public RestTemplate restTemplate() {
// return new RestTemplate();
// }
//
// public static void main(String[] args) {
// SpringApplication.run(OrderApp.class, args);
// }
//
// }
//
// Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/clients/CatalogClient.java
// @Component
// public class CatalogClient {
//
// private final Logger log = LoggerFactory.getLogger(CatalogClient.class);
//
// public static class ItemPagedResources extends PagedModel<Item> {
//
// }
//
// private RestTemplate restTemplate;
// private String catalogServiceHost;
// private long catalogServicePort;
// private boolean useRibbon;
// private LoadBalancerClient loadBalancer;
//
// @Autowired
// public CatalogClient(@Value("${catalog.service.host:catalog}") String catalogServiceHost,
// @Value("${catalog.service.port:8080}") long catalogServicePort,
// @Value("${spring.cloud.consul.ribbon.enabled:false}") boolean useRibbon,
// @Autowired RestTemplate restTemplate) {
// super();
// this.restTemplate = restTemplate;
// this.catalogServiceHost = catalogServiceHost;
// this.catalogServicePort = catalogServicePort;
// this.useRibbon = useRibbon;
// }
//
// @Autowired(required = false)
// public void setLoadBalancer(LoadBalancerClient loadBalancer) {
// this.loadBalancer = loadBalancer;
// }
//
// protected RestTemplate getRestTemplate() {
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// mapper.registerModule(new Jackson2HalModule());
//
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
// converter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON));
// converter.setObjectMapper(mapper);
//
// return new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
// }
//
// public double price(long itemId) {
// return getOne(itemId).getPrice();
// }
//
// public Collection<Item> findAll() {
// PagedModel<Item> pagedResources = getRestTemplate().getForObject(catalogURL(), ItemPagedResources.class);
// return pagedResources.getContent();
// }
//
// private String catalogURL() {
// String url;
// if (useRibbon) {
// ServiceInstance instance = loadBalancer.choose("CATALOG");
// url = String.format("http://%s:%s/catalog/", instance.getHost(), instance.getPort());
// } else {
// url = String.format("http://%s:%s/catalog/", catalogServiceHost, catalogServicePort);
// }
// log.trace("Catalog: URL {} ", url);
// return url;
// }
//
// public Item getOne(long itemId) {
// return restTemplate.getForObject(catalogURL() + itemId, Item.class);
// }
//
// }
| import com.ewolff.microservice.order.OrderApp;
import com.ewolff.microservice.order.clients.CatalogClient;
import com.ewolff.microservice.order.clients.Item;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Collection;
import static org.junit.Assert.assertEquals; | package com.ewolff.microservice.order.logic;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = OrderApp.class)
@ActiveProfiles("test")
public class CatalogConsumerDrivenContractTest {
@Autowired | // Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/OrderApp.java
// @SpringBootApplication
// @EnableDiscoveryClient
// @RibbonClient("order")
// public class OrderApp {
//
// @Bean
// public RestTemplate restTemplate() {
// return new RestTemplate();
// }
//
// public static void main(String[] args) {
// SpringApplication.run(OrderApp.class, args);
// }
//
// }
//
// Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/clients/CatalogClient.java
// @Component
// public class CatalogClient {
//
// private final Logger log = LoggerFactory.getLogger(CatalogClient.class);
//
// public static class ItemPagedResources extends PagedModel<Item> {
//
// }
//
// private RestTemplate restTemplate;
// private String catalogServiceHost;
// private long catalogServicePort;
// private boolean useRibbon;
// private LoadBalancerClient loadBalancer;
//
// @Autowired
// public CatalogClient(@Value("${catalog.service.host:catalog}") String catalogServiceHost,
// @Value("${catalog.service.port:8080}") long catalogServicePort,
// @Value("${spring.cloud.consul.ribbon.enabled:false}") boolean useRibbon,
// @Autowired RestTemplate restTemplate) {
// super();
// this.restTemplate = restTemplate;
// this.catalogServiceHost = catalogServiceHost;
// this.catalogServicePort = catalogServicePort;
// this.useRibbon = useRibbon;
// }
//
// @Autowired(required = false)
// public void setLoadBalancer(LoadBalancerClient loadBalancer) {
// this.loadBalancer = loadBalancer;
// }
//
// protected RestTemplate getRestTemplate() {
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// mapper.registerModule(new Jackson2HalModule());
//
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
// converter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON));
// converter.setObjectMapper(mapper);
//
// return new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
// }
//
// public double price(long itemId) {
// return getOne(itemId).getPrice();
// }
//
// public Collection<Item> findAll() {
// PagedModel<Item> pagedResources = getRestTemplate().getForObject(catalogURL(), ItemPagedResources.class);
// return pagedResources.getContent();
// }
//
// private String catalogURL() {
// String url;
// if (useRibbon) {
// ServiceInstance instance = loadBalancer.choose("CATALOG");
// url = String.format("http://%s:%s/catalog/", instance.getHost(), instance.getPort());
// } else {
// url = String.format("http://%s:%s/catalog/", catalogServiceHost, catalogServicePort);
// }
// log.trace("Catalog: URL {} ", url);
// return url;
// }
//
// public Item getOne(long itemId) {
// return restTemplate.getForObject(catalogURL() + itemId, Item.class);
// }
//
// }
// Path: microservice-consul-demo/microservice-consul-demo-order/src/test/java/com/ewolff/microservice/order/logic/CatalogConsumerDrivenContractTest.java
import com.ewolff.microservice.order.OrderApp;
import com.ewolff.microservice.order.clients.CatalogClient;
import com.ewolff.microservice.order.clients.Item;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
package com.ewolff.microservice.order.logic;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = OrderApp.class)
@ActiveProfiles("test")
public class CatalogConsumerDrivenContractTest {
@Autowired | CatalogClient catalogClient; |
ewolff/microservice-consul | microservice-consul-demo/microservice-consul-demo-customer/src/main/java/com/ewolff/microservice/customer/web/CustomerController.java | // Path: microservice-consul-demo/microservice-consul-demo-customer/src/main/java/com/ewolff/microservice/customer/Customer.java
// @Entity
// public class Customer {
//
// @Id
// @GeneratedValue
// private Long id;
//
// @Column(nullable = false)
// private String name;
//
// @Column(nullable = false)
// private String firstname;
//
// @Column(nullable = false)
// @Email
// private String email;
//
// @Column(nullable = false)
// private String street;
//
// @Column(nullable = false)
// private String city;
//
// public Customer() {
// super();
// id = 0l;
// }
//
// public Customer(String firstname, String name, String email, String street,
// String city) {
// super();
// this.name = name;
// this.firstname = firstname;
// this.email = email;
// this.street = street;
// this.city = city;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFirstname() {
// return firstname;
// }
//
// public void setFirstname(String firstname) {
// this.firstname = firstname;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getStreet() {
// return street;
// }
//
// public void setStreet(String street) {
// this.street = street;
// }
//
// public String getCity() {
// return city;
// }
//
// public void setCity(String city) {
// this.city = city;
// }
//
// @Override
// public String toString() {
// return ToStringBuilder.reflectionToString(this);
// }
//
// @Override
// public int hashCode() {
// return HashCodeBuilder.reflectionHashCode(this);
//
// }
//
// @Override
// public boolean equals(Object obj) {
// return EqualsBuilder.reflectionEquals(this, obj);
// }
//
// }
| import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.ewolff.microservice.customer.Customer;
import com.ewolff.microservice.customer.CustomerRepository; | package com.ewolff.microservice.customer.web;
@Controller
public class CustomerController {
private CustomerRepository customerRepository;
@Autowired
public CustomerController(CustomerRepository customerRepository) {
this.customerRepository = customerRepository;
}
@RequestMapping(value = "/{id}.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView customer(@PathVariable("id") long id) {
return new ModelAndView("customer", "customer",
customerRepository.findById(id).get());
}
@RequestMapping("/list.html")
public ModelAndView customerList() {
return new ModelAndView("customerlist", "customers",
customerRepository.findAll());
}
@RequestMapping(value = "/form.html", method = RequestMethod.GET)
public ModelAndView add() { | // Path: microservice-consul-demo/microservice-consul-demo-customer/src/main/java/com/ewolff/microservice/customer/Customer.java
// @Entity
// public class Customer {
//
// @Id
// @GeneratedValue
// private Long id;
//
// @Column(nullable = false)
// private String name;
//
// @Column(nullable = false)
// private String firstname;
//
// @Column(nullable = false)
// @Email
// private String email;
//
// @Column(nullable = false)
// private String street;
//
// @Column(nullable = false)
// private String city;
//
// public Customer() {
// super();
// id = 0l;
// }
//
// public Customer(String firstname, String name, String email, String street,
// String city) {
// super();
// this.name = name;
// this.firstname = firstname;
// this.email = email;
// this.street = street;
// this.city = city;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFirstname() {
// return firstname;
// }
//
// public void setFirstname(String firstname) {
// this.firstname = firstname;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getStreet() {
// return street;
// }
//
// public void setStreet(String street) {
// this.street = street;
// }
//
// public String getCity() {
// return city;
// }
//
// public void setCity(String city) {
// this.city = city;
// }
//
// @Override
// public String toString() {
// return ToStringBuilder.reflectionToString(this);
// }
//
// @Override
// public int hashCode() {
// return HashCodeBuilder.reflectionHashCode(this);
//
// }
//
// @Override
// public boolean equals(Object obj) {
// return EqualsBuilder.reflectionEquals(this, obj);
// }
//
// }
// Path: microservice-consul-demo/microservice-consul-demo-customer/src/main/java/com/ewolff/microservice/customer/web/CustomerController.java
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.ewolff.microservice.customer.Customer;
import com.ewolff.microservice.customer.CustomerRepository;
package com.ewolff.microservice.customer.web;
@Controller
public class CustomerController {
private CustomerRepository customerRepository;
@Autowired
public CustomerController(CustomerRepository customerRepository) {
this.customerRepository = customerRepository;
}
@RequestMapping(value = "/{id}.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView customer(@PathVariable("id") long id) {
return new ModelAndView("customer", "customer",
customerRepository.findById(id).get());
}
@RequestMapping("/list.html")
public ModelAndView customerList() {
return new ModelAndView("customerlist", "customers",
customerRepository.findAll());
}
@RequestMapping(value = "/form.html", method = RequestMethod.GET)
public ModelAndView add() { | return new ModelAndView("customer", "customer", new Customer()); |
ewolff/microservice-consul | microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/logic/Order.java | // Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/clients/CatalogClient.java
// @Component
// public class CatalogClient {
//
// private final Logger log = LoggerFactory.getLogger(CatalogClient.class);
//
// public static class ItemPagedResources extends PagedModel<Item> {
//
// }
//
// private RestTemplate restTemplate;
// private String catalogServiceHost;
// private long catalogServicePort;
// private boolean useRibbon;
// private LoadBalancerClient loadBalancer;
//
// @Autowired
// public CatalogClient(@Value("${catalog.service.host:catalog}") String catalogServiceHost,
// @Value("${catalog.service.port:8080}") long catalogServicePort,
// @Value("${spring.cloud.consul.ribbon.enabled:false}") boolean useRibbon,
// @Autowired RestTemplate restTemplate) {
// super();
// this.restTemplate = restTemplate;
// this.catalogServiceHost = catalogServiceHost;
// this.catalogServicePort = catalogServicePort;
// this.useRibbon = useRibbon;
// }
//
// @Autowired(required = false)
// public void setLoadBalancer(LoadBalancerClient loadBalancer) {
// this.loadBalancer = loadBalancer;
// }
//
// protected RestTemplate getRestTemplate() {
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// mapper.registerModule(new Jackson2HalModule());
//
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
// converter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON));
// converter.setObjectMapper(mapper);
//
// return new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
// }
//
// public double price(long itemId) {
// return getOne(itemId).getPrice();
// }
//
// public Collection<Item> findAll() {
// PagedModel<Item> pagedResources = getRestTemplate().getForObject(catalogURL(), ItemPagedResources.class);
// return pagedResources.getContent();
// }
//
// private String catalogURL() {
// String url;
// if (useRibbon) {
// ServiceInstance instance = loadBalancer.choose("CATALOG");
// url = String.format("http://%s:%s/catalog/", instance.getHost(), instance.getPort());
// } else {
// url = String.format("http://%s:%s/catalog/", catalogServiceHost, catalogServicePort);
// }
// log.trace("Catalog: URL {} ", url);
// return url;
// }
//
// public Item getOne(long itemId) {
// return restTemplate.getForObject(catalogURL() + itemId, Item.class);
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.ewolff.microservice.order.clients.CatalogClient; | public long getCustomerId() {
return customerId;
}
public void setCustomerId(long customerId) {
this.customerId = customerId;
}
public List<OrderLine> getOrderLine() {
return orderLine;
}
public Order(long customerId) {
super();
this.customerId = customerId;
this.orderLine = new ArrayList<OrderLine>();
}
public void setOrderLine(List<OrderLine> orderLine) {
this.orderLine = orderLine;
}
public void addLine(int count, long itemId) {
this.orderLine.add(new OrderLine(count, itemId));
}
public int getNumberOfLines() {
return orderLine.size();
}
| // Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/clients/CatalogClient.java
// @Component
// public class CatalogClient {
//
// private final Logger log = LoggerFactory.getLogger(CatalogClient.class);
//
// public static class ItemPagedResources extends PagedModel<Item> {
//
// }
//
// private RestTemplate restTemplate;
// private String catalogServiceHost;
// private long catalogServicePort;
// private boolean useRibbon;
// private LoadBalancerClient loadBalancer;
//
// @Autowired
// public CatalogClient(@Value("${catalog.service.host:catalog}") String catalogServiceHost,
// @Value("${catalog.service.port:8080}") long catalogServicePort,
// @Value("${spring.cloud.consul.ribbon.enabled:false}") boolean useRibbon,
// @Autowired RestTemplate restTemplate) {
// super();
// this.restTemplate = restTemplate;
// this.catalogServiceHost = catalogServiceHost;
// this.catalogServicePort = catalogServicePort;
// this.useRibbon = useRibbon;
// }
//
// @Autowired(required = false)
// public void setLoadBalancer(LoadBalancerClient loadBalancer) {
// this.loadBalancer = loadBalancer;
// }
//
// protected RestTemplate getRestTemplate() {
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// mapper.registerModule(new Jackson2HalModule());
//
// MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
// converter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON));
// converter.setObjectMapper(mapper);
//
// return new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
// }
//
// public double price(long itemId) {
// return getOne(itemId).getPrice();
// }
//
// public Collection<Item> findAll() {
// PagedModel<Item> pagedResources = getRestTemplate().getForObject(catalogURL(), ItemPagedResources.class);
// return pagedResources.getContent();
// }
//
// private String catalogURL() {
// String url;
// if (useRibbon) {
// ServiceInstance instance = loadBalancer.choose("CATALOG");
// url = String.format("http://%s:%s/catalog/", instance.getHost(), instance.getPort());
// } else {
// url = String.format("http://%s:%s/catalog/", catalogServiceHost, catalogServicePort);
// }
// log.trace("Catalog: URL {} ", url);
// return url;
// }
//
// public Item getOne(long itemId) {
// return restTemplate.getForObject(catalogURL() + itemId, Item.class);
// }
//
// }
// Path: microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/logic/Order.java
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.ewolff.microservice.order.clients.CatalogClient;
public long getCustomerId() {
return customerId;
}
public void setCustomerId(long customerId) {
this.customerId = customerId;
}
public List<OrderLine> getOrderLine() {
return orderLine;
}
public Order(long customerId) {
super();
this.customerId = customerId;
this.orderLine = new ArrayList<OrderLine>();
}
public void setOrderLine(List<OrderLine> orderLine) {
this.orderLine = orderLine;
}
public void addLine(int count, long itemId) {
this.orderLine.add(new OrderLine(count, itemId));
}
public int getNumberOfLines() {
return orderLine.size();
}
| public double totalPrice(CatalogClient catalogClient) { |
Watchful1/PermissionsChecker | src/main/java/gr/watchful/permchecker/panels/ModEditor.java | // Path: src/main/java/gr/watchful/permchecker/datastructures/ModFile.java
// public class ModFile {
// public File file;
// public MetadataCollection mcmod;
// public String md5;
//
// public SortedListModel<String> IDs = new SortedListModel<String>();
// public SortedListModel<String> names = new SortedListModel<String>();
// public SortedListModel<String> versions = new SortedListModel<String>();
//
// public ModFile(File fileIn) {
// file = fileIn;
// md5 = "";
// }
//
// public String fileName() {
// return file.getName();
// }
//
// public void addName(String name) {
// names.addElement(name);
// }
//
// public void addID(String ID) {
// IDs.addElement(ID);
// }
//
// public String toString() {
// return file.getName();
// }
//
// public void addVersion (String version)
// {
// versions.addElement(version);
// }
//
// public ModInfo getInfo() {
// /*if(mcmod != null) {
// ModInfo temp = new ModInfo("");
// temp.modName = mcmod.
// return temp;
// }*/
// return null;
// }
// }
//
// Path: src/main/java/gr/watchful/permchecker/datastructures/ModInfo.java
// public class ModInfo {
// public static final int OPEN = 1;
// public static final int NOTIFY = 2;
// public static final int REQUEST = 3;
// public static final int FTB = 4;
// public static final int CLOSED = 5;
// public static final int UNKNOWN = 6;
//
// public boolean officialSpreadsheet;
//
// public String shortName;
//
// public String modName;
// public String modVersion;
// public String modAuthor;
// public String modAuthors;
// public String modLink;
//
// public String licenseLink;
// public String licenseImage;
// public String privateLicenseLink;
// public String privateLicenseImage;
//
// public String customLink;
// public boolean isPublicPerm;
//
// public int publicPolicy;
// public int privatePolicy;
// public String publicStringPolicy;
// public String privateStringPolicy;
//
// public String modids;
//
// public transient ArrayList<String> currentModIds;
//
// public ModInfo(String shortName) {
// officialSpreadsheet = false;
// this.shortName = shortName;
// isPublicPerm = false;
//
// init();
// }
//
// public void init() {
// if(shortName == null || shortName.equals("")) System.out.println("Trying to init a ModInfo with a null shortname, this is bad");
// if(modName == null || modName.equals("")) modName = "Unknown";
// if(modAuthor == null || modAuthor.equals("")) modAuthor = "Unknown";
// if(modLink == null || modLink.equals("")) modLink = "None";
// if(modVersion == null || modVersion.equals("")) modVersion = "Unknown";
// if(publicPolicy == 0) publicPolicy = UNKNOWN;
// if(privatePolicy == 0) privatePolicy = UNKNOWN;
// if(licenseLink == null) licenseLink = "";
// if(licenseImage == null) licenseImage = "";
// if(privateLicenseLink == null) privateLicenseLink = "";
// if(privateLicenseImage == null) privateLicenseImage = "";
// if(customLink == null) customLink = "";
// if(currentModIds == null) currentModIds = new ArrayList<>();
// }
//
// public boolean hasPublic() {
// if(publicPolicy == OPEN || publicPolicy == FTB) return true;
// else if(!customLink.equals("") && isPublicPerm) return true;
// else return false;
// }
//
// public boolean hasPrivate() {
// if(privatePolicy == OPEN || privatePolicy == FTB) return true;
// else if(!customLink.equals("")) return true;
// else return false;
// }
//
// public String getPermLink(boolean isPublic) {
// if(isPublic || privateLicenseLink.equals("")) return licenseLink;
// else return privateLicenseLink;
// }
//
// public String getPermImage(boolean isPublic) {
// if(isPublic || privateLicenseImage.equals("")) return licenseImage;
// else return privateLicenseImage;
// }
//
// public int getPolicy(boolean isPublic) {
// if(isPublic) return publicPolicy;
// else return privatePolicy;
// }
//
// public static String getStringPolicy(int num) {
// switch (num) {
// case OPEN:
// return "Open";
// case FTB:
// return "FTB";
// case NOTIFY:
// return "Notify";
// case REQUEST:
// return "Request";
// case CLOSED:
// return "Closed";
// default:
// return "Unknown";
// }
// }
// }
| import gr.watchful.permchecker.datastructures.ModFile;
import gr.watchful.permchecker.datastructures.ModInfo;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList; | package gr.watchful.permchecker.panels;
@SuppressWarnings("serial")
public class ModEditor extends JPanel {
private ModInfoEditor modInfoEditor;
public ModEditor(Dimension size) {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setMinimumSize(new Dimension(200, 100));
this.setMaximumSize(new Dimension(Integer.MAX_VALUE, 100));
this.setPreferredSize(size);
this.setAlignmentY(0);
modInfoEditor = new ModInfoEditor(size);
this.add(modInfoEditor);
}
| // Path: src/main/java/gr/watchful/permchecker/datastructures/ModFile.java
// public class ModFile {
// public File file;
// public MetadataCollection mcmod;
// public String md5;
//
// public SortedListModel<String> IDs = new SortedListModel<String>();
// public SortedListModel<String> names = new SortedListModel<String>();
// public SortedListModel<String> versions = new SortedListModel<String>();
//
// public ModFile(File fileIn) {
// file = fileIn;
// md5 = "";
// }
//
// public String fileName() {
// return file.getName();
// }
//
// public void addName(String name) {
// names.addElement(name);
// }
//
// public void addID(String ID) {
// IDs.addElement(ID);
// }
//
// public String toString() {
// return file.getName();
// }
//
// public void addVersion (String version)
// {
// versions.addElement(version);
// }
//
// public ModInfo getInfo() {
// /*if(mcmod != null) {
// ModInfo temp = new ModInfo("");
// temp.modName = mcmod.
// return temp;
// }*/
// return null;
// }
// }
//
// Path: src/main/java/gr/watchful/permchecker/datastructures/ModInfo.java
// public class ModInfo {
// public static final int OPEN = 1;
// public static final int NOTIFY = 2;
// public static final int REQUEST = 3;
// public static final int FTB = 4;
// public static final int CLOSED = 5;
// public static final int UNKNOWN = 6;
//
// public boolean officialSpreadsheet;
//
// public String shortName;
//
// public String modName;
// public String modVersion;
// public String modAuthor;
// public String modAuthors;
// public String modLink;
//
// public String licenseLink;
// public String licenseImage;
// public String privateLicenseLink;
// public String privateLicenseImage;
//
// public String customLink;
// public boolean isPublicPerm;
//
// public int publicPolicy;
// public int privatePolicy;
// public String publicStringPolicy;
// public String privateStringPolicy;
//
// public String modids;
//
// public transient ArrayList<String> currentModIds;
//
// public ModInfo(String shortName) {
// officialSpreadsheet = false;
// this.shortName = shortName;
// isPublicPerm = false;
//
// init();
// }
//
// public void init() {
// if(shortName == null || shortName.equals("")) System.out.println("Trying to init a ModInfo with a null shortname, this is bad");
// if(modName == null || modName.equals("")) modName = "Unknown";
// if(modAuthor == null || modAuthor.equals("")) modAuthor = "Unknown";
// if(modLink == null || modLink.equals("")) modLink = "None";
// if(modVersion == null || modVersion.equals("")) modVersion = "Unknown";
// if(publicPolicy == 0) publicPolicy = UNKNOWN;
// if(privatePolicy == 0) privatePolicy = UNKNOWN;
// if(licenseLink == null) licenseLink = "";
// if(licenseImage == null) licenseImage = "";
// if(privateLicenseLink == null) privateLicenseLink = "";
// if(privateLicenseImage == null) privateLicenseImage = "";
// if(customLink == null) customLink = "";
// if(currentModIds == null) currentModIds = new ArrayList<>();
// }
//
// public boolean hasPublic() {
// if(publicPolicy == OPEN || publicPolicy == FTB) return true;
// else if(!customLink.equals("") && isPublicPerm) return true;
// else return false;
// }
//
// public boolean hasPrivate() {
// if(privatePolicy == OPEN || privatePolicy == FTB) return true;
// else if(!customLink.equals("")) return true;
// else return false;
// }
//
// public String getPermLink(boolean isPublic) {
// if(isPublic || privateLicenseLink.equals("")) return licenseLink;
// else return privateLicenseLink;
// }
//
// public String getPermImage(boolean isPublic) {
// if(isPublic || privateLicenseImage.equals("")) return licenseImage;
// else return privateLicenseImage;
// }
//
// public int getPolicy(boolean isPublic) {
// if(isPublic) return publicPolicy;
// else return privatePolicy;
// }
//
// public static String getStringPolicy(int num) {
// switch (num) {
// case OPEN:
// return "Open";
// case FTB:
// return "FTB";
// case NOTIFY:
// return "Notify";
// case REQUEST:
// return "Request";
// case CLOSED:
// return "Closed";
// default:
// return "Unknown";
// }
// }
// }
// Path: src/main/java/gr/watchful/permchecker/panels/ModEditor.java
import gr.watchful.permchecker.datastructures.ModFile;
import gr.watchful.permchecker.datastructures.ModInfo;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
package gr.watchful.permchecker.panels;
@SuppressWarnings("serial")
public class ModEditor extends JPanel {
private ModInfoEditor modInfoEditor;
public ModEditor(Dimension size) {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setMinimumSize(new Dimension(200, 100));
this.setMaximumSize(new Dimension(Integer.MAX_VALUE, 100));
this.setPreferredSize(size);
this.setAlignmentY(0);
modInfoEditor = new ModInfoEditor(size);
this.add(modInfoEditor);
}
| public void setMod(ModInfo mod, String shortName, ModFile modFile) { |
Watchful1/PermissionsChecker | src/main/java/gr/watchful/permchecker/panels/ModEditor.java | // Path: src/main/java/gr/watchful/permchecker/datastructures/ModFile.java
// public class ModFile {
// public File file;
// public MetadataCollection mcmod;
// public String md5;
//
// public SortedListModel<String> IDs = new SortedListModel<String>();
// public SortedListModel<String> names = new SortedListModel<String>();
// public SortedListModel<String> versions = new SortedListModel<String>();
//
// public ModFile(File fileIn) {
// file = fileIn;
// md5 = "";
// }
//
// public String fileName() {
// return file.getName();
// }
//
// public void addName(String name) {
// names.addElement(name);
// }
//
// public void addID(String ID) {
// IDs.addElement(ID);
// }
//
// public String toString() {
// return file.getName();
// }
//
// public void addVersion (String version)
// {
// versions.addElement(version);
// }
//
// public ModInfo getInfo() {
// /*if(mcmod != null) {
// ModInfo temp = new ModInfo("");
// temp.modName = mcmod.
// return temp;
// }*/
// return null;
// }
// }
//
// Path: src/main/java/gr/watchful/permchecker/datastructures/ModInfo.java
// public class ModInfo {
// public static final int OPEN = 1;
// public static final int NOTIFY = 2;
// public static final int REQUEST = 3;
// public static final int FTB = 4;
// public static final int CLOSED = 5;
// public static final int UNKNOWN = 6;
//
// public boolean officialSpreadsheet;
//
// public String shortName;
//
// public String modName;
// public String modVersion;
// public String modAuthor;
// public String modAuthors;
// public String modLink;
//
// public String licenseLink;
// public String licenseImage;
// public String privateLicenseLink;
// public String privateLicenseImage;
//
// public String customLink;
// public boolean isPublicPerm;
//
// public int publicPolicy;
// public int privatePolicy;
// public String publicStringPolicy;
// public String privateStringPolicy;
//
// public String modids;
//
// public transient ArrayList<String> currentModIds;
//
// public ModInfo(String shortName) {
// officialSpreadsheet = false;
// this.shortName = shortName;
// isPublicPerm = false;
//
// init();
// }
//
// public void init() {
// if(shortName == null || shortName.equals("")) System.out.println("Trying to init a ModInfo with a null shortname, this is bad");
// if(modName == null || modName.equals("")) modName = "Unknown";
// if(modAuthor == null || modAuthor.equals("")) modAuthor = "Unknown";
// if(modLink == null || modLink.equals("")) modLink = "None";
// if(modVersion == null || modVersion.equals("")) modVersion = "Unknown";
// if(publicPolicy == 0) publicPolicy = UNKNOWN;
// if(privatePolicy == 0) privatePolicy = UNKNOWN;
// if(licenseLink == null) licenseLink = "";
// if(licenseImage == null) licenseImage = "";
// if(privateLicenseLink == null) privateLicenseLink = "";
// if(privateLicenseImage == null) privateLicenseImage = "";
// if(customLink == null) customLink = "";
// if(currentModIds == null) currentModIds = new ArrayList<>();
// }
//
// public boolean hasPublic() {
// if(publicPolicy == OPEN || publicPolicy == FTB) return true;
// else if(!customLink.equals("") && isPublicPerm) return true;
// else return false;
// }
//
// public boolean hasPrivate() {
// if(privatePolicy == OPEN || privatePolicy == FTB) return true;
// else if(!customLink.equals("")) return true;
// else return false;
// }
//
// public String getPermLink(boolean isPublic) {
// if(isPublic || privateLicenseLink.equals("")) return licenseLink;
// else return privateLicenseLink;
// }
//
// public String getPermImage(boolean isPublic) {
// if(isPublic || privateLicenseImage.equals("")) return licenseImage;
// else return privateLicenseImage;
// }
//
// public int getPolicy(boolean isPublic) {
// if(isPublic) return publicPolicy;
// else return privatePolicy;
// }
//
// public static String getStringPolicy(int num) {
// switch (num) {
// case OPEN:
// return "Open";
// case FTB:
// return "FTB";
// case NOTIFY:
// return "Notify";
// case REQUEST:
// return "Request";
// case CLOSED:
// return "Closed";
// default:
// return "Unknown";
// }
// }
// }
| import gr.watchful.permchecker.datastructures.ModFile;
import gr.watchful.permchecker.datastructures.ModInfo;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList; | package gr.watchful.permchecker.panels;
@SuppressWarnings("serial")
public class ModEditor extends JPanel {
private ModInfoEditor modInfoEditor;
public ModEditor(Dimension size) {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setMinimumSize(new Dimension(200, 100));
this.setMaximumSize(new Dimension(Integer.MAX_VALUE, 100));
this.setPreferredSize(size);
this.setAlignmentY(0);
modInfoEditor = new ModInfoEditor(size);
this.add(modInfoEditor);
}
| // Path: src/main/java/gr/watchful/permchecker/datastructures/ModFile.java
// public class ModFile {
// public File file;
// public MetadataCollection mcmod;
// public String md5;
//
// public SortedListModel<String> IDs = new SortedListModel<String>();
// public SortedListModel<String> names = new SortedListModel<String>();
// public SortedListModel<String> versions = new SortedListModel<String>();
//
// public ModFile(File fileIn) {
// file = fileIn;
// md5 = "";
// }
//
// public String fileName() {
// return file.getName();
// }
//
// public void addName(String name) {
// names.addElement(name);
// }
//
// public void addID(String ID) {
// IDs.addElement(ID);
// }
//
// public String toString() {
// return file.getName();
// }
//
// public void addVersion (String version)
// {
// versions.addElement(version);
// }
//
// public ModInfo getInfo() {
// /*if(mcmod != null) {
// ModInfo temp = new ModInfo("");
// temp.modName = mcmod.
// return temp;
// }*/
// return null;
// }
// }
//
// Path: src/main/java/gr/watchful/permchecker/datastructures/ModInfo.java
// public class ModInfo {
// public static final int OPEN = 1;
// public static final int NOTIFY = 2;
// public static final int REQUEST = 3;
// public static final int FTB = 4;
// public static final int CLOSED = 5;
// public static final int UNKNOWN = 6;
//
// public boolean officialSpreadsheet;
//
// public String shortName;
//
// public String modName;
// public String modVersion;
// public String modAuthor;
// public String modAuthors;
// public String modLink;
//
// public String licenseLink;
// public String licenseImage;
// public String privateLicenseLink;
// public String privateLicenseImage;
//
// public String customLink;
// public boolean isPublicPerm;
//
// public int publicPolicy;
// public int privatePolicy;
// public String publicStringPolicy;
// public String privateStringPolicy;
//
// public String modids;
//
// public transient ArrayList<String> currentModIds;
//
// public ModInfo(String shortName) {
// officialSpreadsheet = false;
// this.shortName = shortName;
// isPublicPerm = false;
//
// init();
// }
//
// public void init() {
// if(shortName == null || shortName.equals("")) System.out.println("Trying to init a ModInfo with a null shortname, this is bad");
// if(modName == null || modName.equals("")) modName = "Unknown";
// if(modAuthor == null || modAuthor.equals("")) modAuthor = "Unknown";
// if(modLink == null || modLink.equals("")) modLink = "None";
// if(modVersion == null || modVersion.equals("")) modVersion = "Unknown";
// if(publicPolicy == 0) publicPolicy = UNKNOWN;
// if(privatePolicy == 0) privatePolicy = UNKNOWN;
// if(licenseLink == null) licenseLink = "";
// if(licenseImage == null) licenseImage = "";
// if(privateLicenseLink == null) privateLicenseLink = "";
// if(privateLicenseImage == null) privateLicenseImage = "";
// if(customLink == null) customLink = "";
// if(currentModIds == null) currentModIds = new ArrayList<>();
// }
//
// public boolean hasPublic() {
// if(publicPolicy == OPEN || publicPolicy == FTB) return true;
// else if(!customLink.equals("") && isPublicPerm) return true;
// else return false;
// }
//
// public boolean hasPrivate() {
// if(privatePolicy == OPEN || privatePolicy == FTB) return true;
// else if(!customLink.equals("")) return true;
// else return false;
// }
//
// public String getPermLink(boolean isPublic) {
// if(isPublic || privateLicenseLink.equals("")) return licenseLink;
// else return privateLicenseLink;
// }
//
// public String getPermImage(boolean isPublic) {
// if(isPublic || privateLicenseImage.equals("")) return licenseImage;
// else return privateLicenseImage;
// }
//
// public int getPolicy(boolean isPublic) {
// if(isPublic) return publicPolicy;
// else return privatePolicy;
// }
//
// public static String getStringPolicy(int num) {
// switch (num) {
// case OPEN:
// return "Open";
// case FTB:
// return "FTB";
// case NOTIFY:
// return "Notify";
// case REQUEST:
// return "Request";
// case CLOSED:
// return "Closed";
// default:
// return "Unknown";
// }
// }
// }
// Path: src/main/java/gr/watchful/permchecker/panels/ModEditor.java
import gr.watchful.permchecker.datastructures.ModFile;
import gr.watchful.permchecker.datastructures.ModInfo;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
package gr.watchful.permchecker.panels;
@SuppressWarnings("serial")
public class ModEditor extends JPanel {
private ModInfoEditor modInfoEditor;
public ModEditor(Dimension size) {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setMinimumSize(new Dimension(200, 100));
this.setMaximumSize(new Dimension(Integer.MAX_VALUE, 100));
this.setPreferredSize(size);
this.setAlignmentY(0);
modInfoEditor = new ModInfoEditor(size);
this.add(modInfoEditor);
}
| public void setMod(ModInfo mod, String shortName, ModFile modFile) { |
Watchful1/PermissionsChecker | src/main/java/gr/watchful/permchecker/datastructures/ModFile.java | // Path: src/main/java/gr/watchful/permchecker/modhandling/MetadataCollection.java
// public class MetadataCollection
// {
// @SuppressWarnings("unused")
// private String modListVersion;
// private ModMetadata[] modList;
// private Map<String, ModMetadata> metadatas = Maps.newHashMap();
//
// public static MetadataCollection from(InputStream inputStream, String sourceName)
// {
// if (inputStream == null) return null;
//
// InputStreamReader reader = new InputStreamReader(inputStream);
// try
// {
// MetadataCollection collection;
// Gson gson = new GsonBuilder().registerTypeAdapter(ArtifactVersion.class, new ArtifactVersionAdapter()).create();
// JsonParser parser = new JsonParser();
// JsonElement rootElement = parser.parse(reader);
// if (rootElement.isJsonArray())
// {
// collection = new MetadataCollection();
// JsonArray jsonList = rootElement.getAsJsonArray();
// collection.modList = new ModMetadata[jsonList.size()];
// int i = 0;
// for (JsonElement mod : jsonList)
// {
// collection.modList[i++]=gson.fromJson(mod, ModMetadata.class);
// }
// }
// else
// {
// collection = gson.fromJson(rootElement, MetadataCollection.class);
// }
// collection.parseModMetadataList();
// return collection;
// }
// catch (Exception e) {
// return null;
// }
// }
//
//
// private void parseModMetadataList()
// {
// for (ModMetadata modMetadata : modList)
// {
// metadatas.put(modMetadata.modId, modMetadata);
// }
// }
//
// public static class ArtifactVersionAdapter extends TypeAdapter<ArtifactVersion>
// {
//
// @Override
// public void write(JsonWriter out, ArtifactVersion value) throws IOException
// {
// // no op - we never write these out
// }
//
// @Override
// public ArtifactVersion read(JsonReader in) throws IOException
// {
// return null;//return VersionParser.parseVersionReference(in.nextString());
// }
//
// }
//
// public String toString() {
// StringBuilder bldr = new StringBuilder();
// for(ModMetadata modMeta : metadatas.values()) {
// bldr.append(modMeta.toString()); bldr.append("\n");
// }
// return bldr.toString();
// }
// }
| import gr.watchful.permchecker.modhandling.MetadataCollection;
import java.io.File; | package gr.watchful.permchecker.datastructures;
public class ModFile {
public File file; | // Path: src/main/java/gr/watchful/permchecker/modhandling/MetadataCollection.java
// public class MetadataCollection
// {
// @SuppressWarnings("unused")
// private String modListVersion;
// private ModMetadata[] modList;
// private Map<String, ModMetadata> metadatas = Maps.newHashMap();
//
// public static MetadataCollection from(InputStream inputStream, String sourceName)
// {
// if (inputStream == null) return null;
//
// InputStreamReader reader = new InputStreamReader(inputStream);
// try
// {
// MetadataCollection collection;
// Gson gson = new GsonBuilder().registerTypeAdapter(ArtifactVersion.class, new ArtifactVersionAdapter()).create();
// JsonParser parser = new JsonParser();
// JsonElement rootElement = parser.parse(reader);
// if (rootElement.isJsonArray())
// {
// collection = new MetadataCollection();
// JsonArray jsonList = rootElement.getAsJsonArray();
// collection.modList = new ModMetadata[jsonList.size()];
// int i = 0;
// for (JsonElement mod : jsonList)
// {
// collection.modList[i++]=gson.fromJson(mod, ModMetadata.class);
// }
// }
// else
// {
// collection = gson.fromJson(rootElement, MetadataCollection.class);
// }
// collection.parseModMetadataList();
// return collection;
// }
// catch (Exception e) {
// return null;
// }
// }
//
//
// private void parseModMetadataList()
// {
// for (ModMetadata modMetadata : modList)
// {
// metadatas.put(modMetadata.modId, modMetadata);
// }
// }
//
// public static class ArtifactVersionAdapter extends TypeAdapter<ArtifactVersion>
// {
//
// @Override
// public void write(JsonWriter out, ArtifactVersion value) throws IOException
// {
// // no op - we never write these out
// }
//
// @Override
// public ArtifactVersion read(JsonReader in) throws IOException
// {
// return null;//return VersionParser.parseVersionReference(in.nextString());
// }
//
// }
//
// public String toString() {
// StringBuilder bldr = new StringBuilder();
// for(ModMetadata modMeta : metadatas.values()) {
// bldr.append(modMeta.toString()); bldr.append("\n");
// }
// return bldr.toString();
// }
// }
// Path: src/main/java/gr/watchful/permchecker/datastructures/ModFile.java
import gr.watchful.permchecker.modhandling.MetadataCollection;
import java.io.File;
package gr.watchful.permchecker.datastructures;
public class ModFile {
public File file; | public MetadataCollection mcmod; |
Watchful1/PermissionsChecker | src/main/java/gr/watchful/permchecker/panels/HTMLField.java | // Path: src/main/java/gr/watchful/permchecker/utils/DetectHtml.java
// public class DetectHtml
// {
// // adapted from post by Phil Haack and modified to match better
// public final static String tagStart=
// "\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)\\>";
// public final static String tagEnd=
// "\\</\\w+\\>";
// public final static String tagSelfClosing=
// "\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)/\\>";
// public final static String htmlEntity=
// "&[a-zA-Z][a-zA-Z0-9]+;";
// public final static Pattern htmlPattern=Pattern.compile(
// "("+tagStart+".*"+tagEnd+")|("+tagSelfClosing+")|("+htmlEntity+")",
// Pattern.DOTALL
// );
//
// /**
// * Will return true if s contains HTML markup tags or entities.
// *
// * @param s String to test
// * @return true if string contains HTML
// */
// public static boolean isHtml(String s) {
// boolean ret=false;
// if (s != null) {
// ret=htmlPattern.matcher(s).find();
// if(!ret) ret=s.contains("<br>");
// }
// return ret;
// }
//
// }
| import gr.watchful.permchecker.utils.DetectHtml;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; | });
JScrollPane scrollTextArea = new JScrollPane(textField);
VerticalTextIcon.addTab(tabbedPane, "Edit", scrollTextArea);
viewHTML = new JLabel();
viewHTML.setVerticalAlignment(SwingConstants.TOP);
JScrollPane scrollLabel = new JScrollPane(viewHTML);
scrollLabel.setMinimumSize(new Dimension(1, 100));
VerticalTextIcon.addTab(tabbedPane, "View", scrollLabel);
tabbedPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if(tabbedPane.getSelectedIndex() == 1) {
viewHTML.setText("<html>".concat(getText()).concat("<html>"));
}
}
});
this.add(tabbedPane);
}
public void setText(String in) {
textField.setText(in);
oldText = in;
}
public String getText() { | // Path: src/main/java/gr/watchful/permchecker/utils/DetectHtml.java
// public class DetectHtml
// {
// // adapted from post by Phil Haack and modified to match better
// public final static String tagStart=
// "\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)\\>";
// public final static String tagEnd=
// "\\</\\w+\\>";
// public final static String tagSelfClosing=
// "\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)/\\>";
// public final static String htmlEntity=
// "&[a-zA-Z][a-zA-Z0-9]+;";
// public final static Pattern htmlPattern=Pattern.compile(
// "("+tagStart+".*"+tagEnd+")|("+tagSelfClosing+")|("+htmlEntity+")",
// Pattern.DOTALL
// );
//
// /**
// * Will return true if s contains HTML markup tags or entities.
// *
// * @param s String to test
// * @return true if string contains HTML
// */
// public static boolean isHtml(String s) {
// boolean ret=false;
// if (s != null) {
// ret=htmlPattern.matcher(s).find();
// if(!ret) ret=s.contains("<br>");
// }
// return ret;
// }
//
// }
// Path: src/main/java/gr/watchful/permchecker/panels/HTMLField.java
import gr.watchful.permchecker.utils.DetectHtml;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
});
JScrollPane scrollTextArea = new JScrollPane(textField);
VerticalTextIcon.addTab(tabbedPane, "Edit", scrollTextArea);
viewHTML = new JLabel();
viewHTML.setVerticalAlignment(SwingConstants.TOP);
JScrollPane scrollLabel = new JScrollPane(viewHTML);
scrollLabel.setMinimumSize(new Dimension(1, 100));
VerticalTextIcon.addTab(tabbedPane, "View", scrollLabel);
tabbedPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if(tabbedPane.getSelectedIndex() == 1) {
viewHTML.setText("<html>".concat(getText()).concat("<html>"));
}
}
});
this.add(tabbedPane);
}
public void setText(String in) {
textField.setText(in);
oldText = in;
}
public String getText() { | if(DetectHtml.isHtml(textField.getText())) return textField.getText(); |
Watchful1/PermissionsChecker | src/main/java/gr/watchful/permchecker/modhandling/MetadataCollection.java | // Path: src/main/java/gr/watchful/permchecker/datastructures/ModMetadata.java
// public class ModMetadata
// {
// @SerializedName("modid")
// public String modId;
// public String name;
// public String description = "";
//
// public String url = "";
// public String updateUrl = "";
//
// public String logoFile = "";
// public String version = "";
// //public ArrayList<String> authorList;//TODO fix this
// //public ArrayList<String> authors;
// public List<String> authorList = Lists.newArrayList();
// public List<String> authors = Lists.newArrayList();
// public String credits = "";
// public String parent = "";
// public String[] screenshots;
//
// public ModMetadata()
// {
// }
//
// public String toString() {
// StringBuilder bldr = new StringBuilder();
// bldr.append(modId); bldr.append(" : ");
// bldr.append(name); bldr.append(" : ");
// bldr.append(authorList.size()); bldr.append(" : ");
// bldr.append(authors.size());
// return bldr.toString();
// }
// }
| import com.google.common.collect.Maps;
import com.google.gson.*;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import gr.watchful.permchecker.datastructures.ModMetadata;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map; | /*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package gr.watchful.permchecker.modhandling;
//import com.google.common.base.Throwables;
//import cpw.mods.fml.common.versioning.ArtifactVersion;
//import cpw.mods.fml.common.versioning.VersionParser;
public class MetadataCollection
{
@SuppressWarnings("unused")
private String modListVersion; | // Path: src/main/java/gr/watchful/permchecker/datastructures/ModMetadata.java
// public class ModMetadata
// {
// @SerializedName("modid")
// public String modId;
// public String name;
// public String description = "";
//
// public String url = "";
// public String updateUrl = "";
//
// public String logoFile = "";
// public String version = "";
// //public ArrayList<String> authorList;//TODO fix this
// //public ArrayList<String> authors;
// public List<String> authorList = Lists.newArrayList();
// public List<String> authors = Lists.newArrayList();
// public String credits = "";
// public String parent = "";
// public String[] screenshots;
//
// public ModMetadata()
// {
// }
//
// public String toString() {
// StringBuilder bldr = new StringBuilder();
// bldr.append(modId); bldr.append(" : ");
// bldr.append(name); bldr.append(" : ");
// bldr.append(authorList.size()); bldr.append(" : ");
// bldr.append(authors.size());
// return bldr.toString();
// }
// }
// Path: src/main/java/gr/watchful/permchecker/modhandling/MetadataCollection.java
import com.google.common.collect.Maps;
import com.google.gson.*;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import gr.watchful.permchecker.datastructures.ModMetadata;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package gr.watchful.permchecker.modhandling;
//import com.google.common.base.Throwables;
//import cpw.mods.fml.common.versioning.ArtifactVersion;
//import cpw.mods.fml.common.versioning.VersionParser;
public class MetadataCollection
{
@SuppressWarnings("unused")
private String modListVersion; | private ModMetadata[] modList; |
dgrunwald/arden2bytecode | src/arden/compiler/TransformationOperatorCompiler.java | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.runtime.ArdenValue;
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenNull; | handleTransformationOperator("indexMaximum", true);
}
@Override
public void caseALastFromOfFuncOp(ALastFromOfFuncOp node) {
handleTransformationOperator("last", false);
}
@Override
public void caseAFirFromOfFuncOp(AFirFromOfFuncOp node) {
handleTransformationOperator("first", false);
}
@Override
public void caseAEarFromOfFuncOp(AEarFromOfFuncOp node) {
handleTransformationOperator("indexEarliest", true);
}
@Override
public void caseALatFromOfFuncOp(ALatFromOfFuncOp node) {
handleTransformationOperator("indexLatest", true);
}
private void handleTransformationOperator(String name, boolean followedByElementAt) {
numberArgument.apply(parent);
sourceListArgument.apply(parent);
if (followedByElementAt)
context.writer.dup_x1();
context.writer.swap();
// stack: sourceList, number | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/compiler/TransformationOperatorCompiler.java
import arden.runtime.ArdenValue;
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenNull;
handleTransformationOperator("indexMaximum", true);
}
@Override
public void caseALastFromOfFuncOp(ALastFromOfFuncOp node) {
handleTransformationOperator("last", false);
}
@Override
public void caseAFirFromOfFuncOp(AFirFromOfFuncOp node) {
handleTransformationOperator("first", false);
}
@Override
public void caseAEarFromOfFuncOp(AEarFromOfFuncOp node) {
handleTransformationOperator("indexEarliest", true);
}
@Override
public void caseALatFromOfFuncOp(ALatFromOfFuncOp node) {
handleTransformationOperator("indexLatest", true);
}
private void handleTransformationOperator(String name, boolean followedByElementAt) {
numberArgument.apply(parent);
sourceListArgument.apply(parent);
if (followedByElementAt)
context.writer.dup_x1();
context.writer.swap();
// stack: sourceList, number | context.writer.invokeStatic(Compiler.getRuntimeHelper("getPrimitiveIntegerValue", ArdenValue.class)); |
dgrunwald/arden2bytecode | src/arden/compiler/TransformationOperatorCompiler.java | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.runtime.ArdenValue;
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenNull; |
@Override
public void caseAFirFromOfFuncOp(AFirFromOfFuncOp node) {
handleTransformationOperator("first", false);
}
@Override
public void caseAEarFromOfFuncOp(AEarFromOfFuncOp node) {
handleTransformationOperator("indexEarliest", true);
}
@Override
public void caseALatFromOfFuncOp(ALatFromOfFuncOp node) {
handleTransformationOperator("indexLatest", true);
}
private void handleTransformationOperator(String name, boolean followedByElementAt) {
numberArgument.apply(parent);
sourceListArgument.apply(parent);
if (followedByElementAt)
context.writer.dup_x1();
context.writer.swap();
// stack: sourceList, number
context.writer.invokeStatic(Compiler.getRuntimeHelper("getPrimitiveIntegerValue", ArdenValue.class));
// stack: sourceList, number
// now emit code like:
// (number >= 0) ? ExprssionHelpers.op(sourceList, number) :
// ArdenNull.INSTANCE;
context.writer.dup();
// stack: sourceList, number, number | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/compiler/TransformationOperatorCompiler.java
import arden.runtime.ArdenValue;
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenNull;
@Override
public void caseAFirFromOfFuncOp(AFirFromOfFuncOp node) {
handleTransformationOperator("first", false);
}
@Override
public void caseAEarFromOfFuncOp(AEarFromOfFuncOp node) {
handleTransformationOperator("indexEarliest", true);
}
@Override
public void caseALatFromOfFuncOp(ALatFromOfFuncOp node) {
handleTransformationOperator("indexLatest", true);
}
private void handleTransformationOperator(String name, boolean followedByElementAt) {
numberArgument.apply(parent);
sourceListArgument.apply(parent);
if (followedByElementAt)
context.writer.dup_x1();
context.writer.swap();
// stack: sourceList, number
context.writer.invokeStatic(Compiler.getRuntimeHelper("getPrimitiveIntegerValue", ArdenValue.class));
// stack: sourceList, number
// now emit code like:
// (number >= 0) ? ExprssionHelpers.op(sourceList, number) :
// ArdenNull.INSTANCE;
context.writer.dup();
// stack: sourceList, number, number | Label elseLabel = new Label(); |
dgrunwald/arden2bytecode | src/arden/compiler/DataCompiler.java | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue;
import arden.runtime.DatabaseQuery;
import arden.runtime.ObjectType;
import java.util.ArrayList;
import java.util.List; | // | {dmap} destination mapping_factor
// | {dasmap} destination as identifier mapping_factor?
// | {object} object l_brk object_attribute_list r_brk
// | {arg} argument
// | {cphr} call_phrase
// | {newobj} new_object_phrase
// | {expr} expr;
node.getDataAssignPhrase().apply(new VisitorBase() {
@Override
public void caseAReadDataAssignPhrase(AReadDataAssignPhrase node) {
// {read} read read_phrase
assignPhrase(lhs, node.getReadPhrase());
}
@Override
public void caseAReadasDataAssignPhrase(final AReadasDataAssignPhrase node) {
// {readas} read as identifier read_phrase
final Variable v = context.codeGenerator.getVariableOrShowError(node.getIdentifier());
if (!(v instanceof ObjectTypeVariable))
throw new RuntimeCompilerException(lhs.getPosition(), "EVENT variables must be simple identifiers");
lhs.assign(context, new Switchable() {
@Override
public void apply(Switch sw) {
node.getReadPhrase().apply(new ReadPhraseCompiler(context));
try {
context.writer.invokeInstance(DatabaseQuery.class.getMethod("execute"));
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
context.writer.loadStaticField(((ObjectTypeVariable) v).field); | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/compiler/DataCompiler.java
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue;
import arden.runtime.DatabaseQuery;
import arden.runtime.ObjectType;
import java.util.ArrayList;
import java.util.List;
// | {dmap} destination mapping_factor
// | {dasmap} destination as identifier mapping_factor?
// | {object} object l_brk object_attribute_list r_brk
// | {arg} argument
// | {cphr} call_phrase
// | {newobj} new_object_phrase
// | {expr} expr;
node.getDataAssignPhrase().apply(new VisitorBase() {
@Override
public void caseAReadDataAssignPhrase(AReadDataAssignPhrase node) {
// {read} read read_phrase
assignPhrase(lhs, node.getReadPhrase());
}
@Override
public void caseAReadasDataAssignPhrase(final AReadasDataAssignPhrase node) {
// {readas} read as identifier read_phrase
final Variable v = context.codeGenerator.getVariableOrShowError(node.getIdentifier());
if (!(v instanceof ObjectTypeVariable))
throw new RuntimeCompilerException(lhs.getPosition(), "EVENT variables must be simple identifiers");
lhs.assign(context, new Switchable() {
@Override
public void apply(Switch sw) {
node.getReadPhrase().apply(new ReadPhraseCompiler(context));
try {
context.writer.invokeInstance(DatabaseQuery.class.getMethod("execute"));
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
context.writer.loadStaticField(((ObjectTypeVariable) v).field); | context.writer.invokeStatic(Compiler.getRuntimeHelper("readAs", ArdenValue[].class, |
dgrunwald/arden2bytecode | src/arden/compiler/DataCompiler.java | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue;
import arden.runtime.DatabaseQuery;
import arden.runtime.ObjectType;
import java.util.ArrayList;
import java.util.List; | } else {
throw new RuntimeException("unknown call phrase");
}
Variable var = context.codeGenerator.getVariableOrShowError(identifier);
var.call(context, lhs.getPosition(), arguments);
assignResultFromPhrase(lhs);
}
private void assignResultFromPhrase(LeftHandSideResult lhs) {
final int phraseResultVar = context.allocateVariable();
// store phrase result in variable
context.writer.storeVariable(phraseResultVar);
List<LeftHandSideIdentifier> idents;
if (lhs instanceof LeftHandSideIdentifier) {
idents = new ArrayList<LeftHandSideIdentifier>();
idents.add((LeftHandSideIdentifier) lhs);
} else if (lhs instanceof LeftHandSideIdentifierList) {
idents = ((LeftHandSideIdentifierList) lhs).getList();
} else {
throw new RuntimeCompilerException(lhs.getPosition(), "Cannot use READ or CALL phrase in this context.");
}
for (int i = 0; i < idents.size(); i++) {
final int identNumber = i;
// for each identifier, emit:
// var_i = (i < phraseResult.Length)
// ? phraseResult.Length[i] : ArdenNull.Instance;
idents.get(i).assign(context, new Switchable() {
@Override
public void apply(Switch sw) { | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/compiler/DataCompiler.java
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue;
import arden.runtime.DatabaseQuery;
import arden.runtime.ObjectType;
import java.util.ArrayList;
import java.util.List;
} else {
throw new RuntimeException("unknown call phrase");
}
Variable var = context.codeGenerator.getVariableOrShowError(identifier);
var.call(context, lhs.getPosition(), arguments);
assignResultFromPhrase(lhs);
}
private void assignResultFromPhrase(LeftHandSideResult lhs) {
final int phraseResultVar = context.allocateVariable();
// store phrase result in variable
context.writer.storeVariable(phraseResultVar);
List<LeftHandSideIdentifier> idents;
if (lhs instanceof LeftHandSideIdentifier) {
idents = new ArrayList<LeftHandSideIdentifier>();
idents.add((LeftHandSideIdentifier) lhs);
} else if (lhs instanceof LeftHandSideIdentifierList) {
idents = ((LeftHandSideIdentifierList) lhs).getList();
} else {
throw new RuntimeCompilerException(lhs.getPosition(), "Cannot use READ or CALL phrase in this context.");
}
for (int i = 0; i < idents.size(); i++) {
final int identNumber = i;
// for each identifier, emit:
// var_i = (i < phraseResult.Length)
// ? phraseResult.Length[i] : ArdenNull.Instance;
idents.get(i).assign(context, new Switchable() {
@Override
public void apply(Switch sw) { | Label trueLabel = new Label(); |
dgrunwald/arden2bytecode | src/arden/tests/TransformationTests.java | // Path: src/arden/runtime/ArdenList.java
// public final class ArdenList extends ArdenValue {
// public final static ArdenList EMPTY = new ArdenList(new ArdenValue[0]);
//
// public final ArdenValue[] values;
//
// public ArdenList(ArdenValue[] values) {
// this.values = values;
// }
//
// @Override
// public ArdenValue setTime(long newPrimaryTime) {
// ArdenValue[] newValues = new ArdenValue[values.length];
// for (int i = 0; i < values.length; i++)
// newValues[i] = values[i].setTime(newPrimaryTime);
// return new ArdenList(newValues);
// }
//
// @Override
// public ArdenValue[] getElements() {
// return values;
// }
//
// @Override
// public String toString() {
// StringBuilder b = new StringBuilder();
// b.append('(');
// if (values.length == 1) {
// b.append(',');
// b.append(values[0].toString());
// } else if (values.length > 1) {
// b.append(values[0].toString());
// for (int i = 1; i < values.length; i++) {
// b.append(',');
// b.append(values[i].toString());
// }
// }
// b.append(')');
// return b.toString();
// }
//
// @Override
// public boolean equals(Object obj) {
// if (!(obj instanceof ArdenList))
// return false;
// ArdenList list = (ArdenList) obj;
// if (list.values.length != values.length)
// return false;
// for (int i = 0; i < values.length; i++) {
// if (!values[i].equals(list.values[i]))
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = 1;
// for (ArdenValue val : values) {
// result *= 27;
// result += val.hashCode();
// }
// return result;
// }
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.runtime.ArdenNumber;
import arden.runtime.ArdenValue;
import org.junit.Test;
import arden.runtime.ArdenList; | }
@Test
public void indexMaximumFrom() throws Exception {
assertEval("(2,3)", "INDEX MAXIMUM 2 FROM (11,14,13,12)");
assertEval("(1,2,5)", "INDEX MAXIMUM 3 FROM (3,5,1,2,4,2)");
assertEval("null", "INDEX MAX 2 FROM (3, \"asdf\")");
assertEval("(,1)", "INDEX MAXIMUM 2 FROM 3");
assertEval("()", "INDEX MAXIMUM 0 FROM (2,3)");
}
@Test
public void indexEarliestFrom() throws Exception {
assertEval("()", "EARLIEST 2 FROM ()");
assertEval("null", "EARLIEST 2 FROM (1,2)");
}
@Test
public void indexLatestFrom() throws Exception {
assertEval("()", "LATEST 2 FROM ()");
assertEval("null", "LATEST 2 FROM (1,2)");
}
@Test
public void interval() throws Exception {
assertEval("null", "INTERVAL (3,4)");
assertEval("null", "INTERVAL 3");
assertEval("null", "INTERVAL ()");
assertEval("null", "INTERVAL (1990-03-01,1990-03-02)");
| // Path: src/arden/runtime/ArdenList.java
// public final class ArdenList extends ArdenValue {
// public final static ArdenList EMPTY = new ArdenList(new ArdenValue[0]);
//
// public final ArdenValue[] values;
//
// public ArdenList(ArdenValue[] values) {
// this.values = values;
// }
//
// @Override
// public ArdenValue setTime(long newPrimaryTime) {
// ArdenValue[] newValues = new ArdenValue[values.length];
// for (int i = 0; i < values.length; i++)
// newValues[i] = values[i].setTime(newPrimaryTime);
// return new ArdenList(newValues);
// }
//
// @Override
// public ArdenValue[] getElements() {
// return values;
// }
//
// @Override
// public String toString() {
// StringBuilder b = new StringBuilder();
// b.append('(');
// if (values.length == 1) {
// b.append(',');
// b.append(values[0].toString());
// } else if (values.length > 1) {
// b.append(values[0].toString());
// for (int i = 1; i < values.length; i++) {
// b.append(',');
// b.append(values[i].toString());
// }
// }
// b.append(')');
// return b.toString();
// }
//
// @Override
// public boolean equals(Object obj) {
// if (!(obj instanceof ArdenList))
// return false;
// ArdenList list = (ArdenList) obj;
// if (list.values.length != values.length)
// return false;
// for (int i = 0; i < values.length; i++) {
// if (!values[i].equals(list.values[i]))
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = 1;
// for (ArdenValue val : values) {
// result *= 27;
// result += val.hashCode();
// }
// return result;
// }
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/tests/TransformationTests.java
import arden.runtime.ArdenNumber;
import arden.runtime.ArdenValue;
import org.junit.Test;
import arden.runtime.ArdenList;
}
@Test
public void indexMaximumFrom() throws Exception {
assertEval("(2,3)", "INDEX MAXIMUM 2 FROM (11,14,13,12)");
assertEval("(1,2,5)", "INDEX MAXIMUM 3 FROM (3,5,1,2,4,2)");
assertEval("null", "INDEX MAX 2 FROM (3, \"asdf\")");
assertEval("(,1)", "INDEX MAXIMUM 2 FROM 3");
assertEval("()", "INDEX MAXIMUM 0 FROM (2,3)");
}
@Test
public void indexEarliestFrom() throws Exception {
assertEval("()", "EARLIEST 2 FROM ()");
assertEval("null", "EARLIEST 2 FROM (1,2)");
}
@Test
public void indexLatestFrom() throws Exception {
assertEval("()", "LATEST 2 FROM ()");
assertEval("null", "LATEST 2 FROM (1,2)");
}
@Test
public void interval() throws Exception {
assertEval("null", "INTERVAL (3,4)");
assertEval("null", "INTERVAL 3");
assertEval("null", "INTERVAL ()");
assertEval("null", "INTERVAL (1990-03-01,1990-03-02)");
| ArdenValue[] arg = { ArdenNumber.create(1, 1000), ArdenNumber.create(5, 1500), ArdenNumber.create(100, 500) }; |
dgrunwald/arden2bytecode | src/arden/tests/TransformationTests.java | // Path: src/arden/runtime/ArdenList.java
// public final class ArdenList extends ArdenValue {
// public final static ArdenList EMPTY = new ArdenList(new ArdenValue[0]);
//
// public final ArdenValue[] values;
//
// public ArdenList(ArdenValue[] values) {
// this.values = values;
// }
//
// @Override
// public ArdenValue setTime(long newPrimaryTime) {
// ArdenValue[] newValues = new ArdenValue[values.length];
// for (int i = 0; i < values.length; i++)
// newValues[i] = values[i].setTime(newPrimaryTime);
// return new ArdenList(newValues);
// }
//
// @Override
// public ArdenValue[] getElements() {
// return values;
// }
//
// @Override
// public String toString() {
// StringBuilder b = new StringBuilder();
// b.append('(');
// if (values.length == 1) {
// b.append(',');
// b.append(values[0].toString());
// } else if (values.length > 1) {
// b.append(values[0].toString());
// for (int i = 1; i < values.length; i++) {
// b.append(',');
// b.append(values[i].toString());
// }
// }
// b.append(')');
// return b.toString();
// }
//
// @Override
// public boolean equals(Object obj) {
// if (!(obj instanceof ArdenList))
// return false;
// ArdenList list = (ArdenList) obj;
// if (list.values.length != values.length)
// return false;
// for (int i = 0; i < values.length; i++) {
// if (!values[i].equals(list.values[i]))
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = 1;
// for (ArdenValue val : values) {
// result *= 27;
// result += val.hashCode();
// }
// return result;
// }
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.runtime.ArdenNumber;
import arden.runtime.ArdenValue;
import org.junit.Test;
import arden.runtime.ArdenList; |
@Test
public void indexMaximumFrom() throws Exception {
assertEval("(2,3)", "INDEX MAXIMUM 2 FROM (11,14,13,12)");
assertEval("(1,2,5)", "INDEX MAXIMUM 3 FROM (3,5,1,2,4,2)");
assertEval("null", "INDEX MAX 2 FROM (3, \"asdf\")");
assertEval("(,1)", "INDEX MAXIMUM 2 FROM 3");
assertEval("()", "INDEX MAXIMUM 0 FROM (2,3)");
}
@Test
public void indexEarliestFrom() throws Exception {
assertEval("()", "EARLIEST 2 FROM ()");
assertEval("null", "EARLIEST 2 FROM (1,2)");
}
@Test
public void indexLatestFrom() throws Exception {
assertEval("()", "LATEST 2 FROM ()");
assertEval("null", "LATEST 2 FROM (1,2)");
}
@Test
public void interval() throws Exception {
assertEval("null", "INTERVAL (3,4)");
assertEval("null", "INTERVAL 3");
assertEval("null", "INTERVAL ()");
assertEval("null", "INTERVAL (1990-03-01,1990-03-02)");
ArdenValue[] arg = { ArdenNumber.create(1, 1000), ArdenNumber.create(5, 1500), ArdenNumber.create(100, 500) }; | // Path: src/arden/runtime/ArdenList.java
// public final class ArdenList extends ArdenValue {
// public final static ArdenList EMPTY = new ArdenList(new ArdenValue[0]);
//
// public final ArdenValue[] values;
//
// public ArdenList(ArdenValue[] values) {
// this.values = values;
// }
//
// @Override
// public ArdenValue setTime(long newPrimaryTime) {
// ArdenValue[] newValues = new ArdenValue[values.length];
// for (int i = 0; i < values.length; i++)
// newValues[i] = values[i].setTime(newPrimaryTime);
// return new ArdenList(newValues);
// }
//
// @Override
// public ArdenValue[] getElements() {
// return values;
// }
//
// @Override
// public String toString() {
// StringBuilder b = new StringBuilder();
// b.append('(');
// if (values.length == 1) {
// b.append(',');
// b.append(values[0].toString());
// } else if (values.length > 1) {
// b.append(values[0].toString());
// for (int i = 1; i < values.length; i++) {
// b.append(',');
// b.append(values[i].toString());
// }
// }
// b.append(')');
// return b.toString();
// }
//
// @Override
// public boolean equals(Object obj) {
// if (!(obj instanceof ArdenList))
// return false;
// ArdenList list = (ArdenList) obj;
// if (list.values.length != values.length)
// return false;
// for (int i = 0; i < values.length; i++) {
// if (!values[i].equals(list.values[i]))
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = 1;
// for (ArdenValue val : values) {
// result *= 27;
// result += val.hashCode();
// }
// return result;
// }
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/tests/TransformationTests.java
import arden.runtime.ArdenNumber;
import arden.runtime.ArdenValue;
import org.junit.Test;
import arden.runtime.ArdenList;
@Test
public void indexMaximumFrom() throws Exception {
assertEval("(2,3)", "INDEX MAXIMUM 2 FROM (11,14,13,12)");
assertEval("(1,2,5)", "INDEX MAXIMUM 3 FROM (3,5,1,2,4,2)");
assertEval("null", "INDEX MAX 2 FROM (3, \"asdf\")");
assertEval("(,1)", "INDEX MAXIMUM 2 FROM 3");
assertEval("()", "INDEX MAXIMUM 0 FROM (2,3)");
}
@Test
public void indexEarliestFrom() throws Exception {
assertEval("()", "EARLIEST 2 FROM ()");
assertEval("null", "EARLIEST 2 FROM (1,2)");
}
@Test
public void indexLatestFrom() throws Exception {
assertEval("()", "LATEST 2 FROM ()");
assertEval("null", "LATEST 2 FROM (1,2)");
}
@Test
public void interval() throws Exception {
assertEval("null", "INTERVAL (3,4)");
assertEval("null", "INTERVAL 3");
assertEval("null", "INTERVAL ()");
assertEval("null", "INTERVAL (1990-03-01,1990-03-02)");
ArdenValue[] arg = { ArdenNumber.create(1, 1000), ArdenNumber.create(5, 1500), ArdenNumber.create(100, 500) }; | assertEvalWithArgument("(0.5 seconds,-1 seconds)", "INTERVAL arg", new ArdenList(arg), new TestContext()); |
dgrunwald/arden2bytecode | src/arden/compiler/MetadataCompiler.java | // Path: src/arden/runtime/LibraryMetadata.java
// public class LibraryMetadata {
// private String purpose;
// private String explanation;
// private final ArrayList<String> keywords = new ArrayList<String>();
// private String citations;
// private String links;
//
// public void setPurpose(String purpose) {
// this.purpose = purpose;
// }
//
// public String getPurpose() {
// return purpose;
// }
//
// public void setExplanation(String explanation) {
// this.explanation = explanation;
// }
//
// public String getExplanation() {
// return explanation;
// }
//
// public List<String> getKeywords() {
// return keywords;
// }
//
// public void setCitations(String citations) {
// this.citations = citations;
// }
//
// public String getCitations() {
// return citations;
// }
//
// public void setLinks(String links) {
// this.links = links;
// }
//
// public String getLinks() {
// return links;
// }
// }
//
// Path: src/arden/runtime/MaintenanceMetadata.java
// public class MaintenanceMetadata {
// private String title;
// private String mlmName;
// private String ardenVersion;
// private String version;
// private String institution;
// private String author;
// private String specialist;
// private Date date;
// private String validation;
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setMlmName(String mlmName) {
// this.mlmName = mlmName;
// }
//
// public String getMlmName() {
// return mlmName;
// }
//
// public void setArdenVersion(String ardenVersion) {
// this.ardenVersion = ardenVersion;
// }
//
// public String getArdenVersion() {
// return ardenVersion;
// }
//
// public void setVersion(String version) {
// this.version = version;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setInstitution(String institution) {
// this.institution = institution;
// }
//
// public String getInstitution() {
// return institution;
// }
//
// public void setAuthor(String author) {
// this.author = author;
// }
//
// public String getAuthor() {
// return author;
// }
//
// public void setSpecialist(String specialist) {
// this.specialist = specialist;
// }
//
// public String getSpecialist() {
// return specialist;
// }
//
// public void setDate(Date date) {
// this.date = date;
// }
//
// public Date getDate() {
// return date;
// }
//
// public void setValidation(String validation) {
// this.validation = validation;
// }
//
// public String getValidation() {
// return validation;
// }
// }
| import arden.compiler.node.*;
import arden.runtime.LibraryMetadata;
import arden.runtime.MaintenanceMetadata;
import java.util.Date;
import arden.compiler.analysis.DepthFirstAdapter; | // arden2bytecode
// Copyright (c) 2010, Daniel Grunwald
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the owner nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package arden.compiler;
/**
* Collects metadata from the source tree.
*
* @author Daniel Grunwald
*
*/
final class MetadataCompiler extends DepthFirstAdapter {
final MaintenanceMetadata maintenance = new MaintenanceMetadata(); | // Path: src/arden/runtime/LibraryMetadata.java
// public class LibraryMetadata {
// private String purpose;
// private String explanation;
// private final ArrayList<String> keywords = new ArrayList<String>();
// private String citations;
// private String links;
//
// public void setPurpose(String purpose) {
// this.purpose = purpose;
// }
//
// public String getPurpose() {
// return purpose;
// }
//
// public void setExplanation(String explanation) {
// this.explanation = explanation;
// }
//
// public String getExplanation() {
// return explanation;
// }
//
// public List<String> getKeywords() {
// return keywords;
// }
//
// public void setCitations(String citations) {
// this.citations = citations;
// }
//
// public String getCitations() {
// return citations;
// }
//
// public void setLinks(String links) {
// this.links = links;
// }
//
// public String getLinks() {
// return links;
// }
// }
//
// Path: src/arden/runtime/MaintenanceMetadata.java
// public class MaintenanceMetadata {
// private String title;
// private String mlmName;
// private String ardenVersion;
// private String version;
// private String institution;
// private String author;
// private String specialist;
// private Date date;
// private String validation;
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setMlmName(String mlmName) {
// this.mlmName = mlmName;
// }
//
// public String getMlmName() {
// return mlmName;
// }
//
// public void setArdenVersion(String ardenVersion) {
// this.ardenVersion = ardenVersion;
// }
//
// public String getArdenVersion() {
// return ardenVersion;
// }
//
// public void setVersion(String version) {
// this.version = version;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setInstitution(String institution) {
// this.institution = institution;
// }
//
// public String getInstitution() {
// return institution;
// }
//
// public void setAuthor(String author) {
// this.author = author;
// }
//
// public String getAuthor() {
// return author;
// }
//
// public void setSpecialist(String specialist) {
// this.specialist = specialist;
// }
//
// public String getSpecialist() {
// return specialist;
// }
//
// public void setDate(Date date) {
// this.date = date;
// }
//
// public Date getDate() {
// return date;
// }
//
// public void setValidation(String validation) {
// this.validation = validation;
// }
//
// public String getValidation() {
// return validation;
// }
// }
// Path: src/arden/compiler/MetadataCompiler.java
import arden.compiler.node.*;
import arden.runtime.LibraryMetadata;
import arden.runtime.MaintenanceMetadata;
import java.util.Date;
import arden.compiler.analysis.DepthFirstAdapter;
// arden2bytecode
// Copyright (c) 2010, Daniel Grunwald
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the owner nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package arden.compiler;
/**
* Collects metadata from the source tree.
*
* @author Daniel Grunwald
*
*/
final class MetadataCompiler extends DepthFirstAdapter {
final MaintenanceMetadata maintenance = new MaintenanceMetadata(); | final LibraryMetadata library = new LibraryMetadata(); |
dgrunwald/arden2bytecode | src/arden/tests/ExpressionTests.java | // Path: src/arden/runtime/ArdenBoolean.java
// public final class ArdenBoolean extends ArdenValue {
// public static final ArdenBoolean TRUE = new ArdenBoolean(true, NOPRIMARYTIME);
// public static final ArdenBoolean FALSE = new ArdenBoolean(false, NOPRIMARYTIME);
//
// public final boolean value;
//
// private ArdenBoolean(boolean value, long primaryTime) {
// super(primaryTime);
// this.value = value;
// }
//
// public static ArdenBoolean create(boolean value, long primaryTime) {
// if (primaryTime == NOPRIMARYTIME)
// return value ? TRUE : FALSE;
// else
// return new ArdenBoolean(value, primaryTime);
// }
//
// @Override
// public ArdenValue setTime(long newPrimaryTime) {
// return create(value, newPrimaryTime);
// }
//
// @Override
// public boolean isTrue() {
// return value;
// }
//
// @Override
// public boolean isFalse() {
// return !value;
// }
//
// @Override
// public String toString() {
// return value ? "true" : "false";
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj instanceof ArdenBoolean)
// return value == ((ArdenBoolean) obj).value;
// else
// return false;
// }
//
// @Override
// public int hashCode() {
// return value ? 42 : 23;
// }
// }
| import org.junit.Test;
import arden.runtime.ArdenBoolean;
import arden.runtime.ArdenNull;
import arden.runtime.ArdenNumber;
import java.util.GregorianCalendar;
import org.junit.Assert; | // arden2bytecode
// Copyright (c) 2010, Daniel Grunwald
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the owner nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package arden.tests;
public class ExpressionTests extends ExpressionTestBase {
@Test
public void NullConstant() throws Exception {
Assert.assertSame(ArdenNull.INSTANCE, evalExpression("null"));
}
@Test
public void TheNullConstant() throws Exception {
Assert.assertSame(ArdenNull.INSTANCE, evalExpression("the null"));
}
@Test
public void BooleanTrue() throws Exception { | // Path: src/arden/runtime/ArdenBoolean.java
// public final class ArdenBoolean extends ArdenValue {
// public static final ArdenBoolean TRUE = new ArdenBoolean(true, NOPRIMARYTIME);
// public static final ArdenBoolean FALSE = new ArdenBoolean(false, NOPRIMARYTIME);
//
// public final boolean value;
//
// private ArdenBoolean(boolean value, long primaryTime) {
// super(primaryTime);
// this.value = value;
// }
//
// public static ArdenBoolean create(boolean value, long primaryTime) {
// if (primaryTime == NOPRIMARYTIME)
// return value ? TRUE : FALSE;
// else
// return new ArdenBoolean(value, primaryTime);
// }
//
// @Override
// public ArdenValue setTime(long newPrimaryTime) {
// return create(value, newPrimaryTime);
// }
//
// @Override
// public boolean isTrue() {
// return value;
// }
//
// @Override
// public boolean isFalse() {
// return !value;
// }
//
// @Override
// public String toString() {
// return value ? "true" : "false";
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj instanceof ArdenBoolean)
// return value == ((ArdenBoolean) obj).value;
// else
// return false;
// }
//
// @Override
// public int hashCode() {
// return value ? 42 : 23;
// }
// }
// Path: src/arden/tests/ExpressionTests.java
import org.junit.Test;
import arden.runtime.ArdenBoolean;
import arden.runtime.ArdenNull;
import arden.runtime.ArdenNumber;
import java.util.GregorianCalendar;
import org.junit.Assert;
// arden2bytecode
// Copyright (c) 2010, Daniel Grunwald
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the owner nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package arden.tests;
public class ExpressionTests extends ExpressionTestBase {
@Test
public void NullConstant() throws Exception {
Assert.assertSame(ArdenNull.INSTANCE, evalExpression("null"));
}
@Test
public void TheNullConstant() throws Exception {
Assert.assertSame(ArdenNull.INSTANCE, evalExpression("the null"));
}
@Test
public void BooleanTrue() throws Exception { | Assert.assertSame(ArdenBoolean.TRUE, evalExpression("true")); |
dgrunwald/arden2bytecode | src/arden/compiler/ReadPhraseCompiler.java | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.runtime.BinaryOperator;
import arden.runtime.DatabaseQuery;
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue; | // from_of_func_op =
// {mini} minimum
// | {min} min
// | {maxi} maximum
// | {max} max
// | {last} last
// | {fir} first
// | {ear} earliest
// | {lat} latest;
if (node instanceof AMiniFromOfFuncOp || node instanceof AMinFromOfFuncOp) {
return "minimum";
} else if (node instanceof AMaxiFromOfFuncOp || node instanceof AMaxFromOfFuncOp) {
return "maximum";
} else if (node instanceof ALastFromOfFuncOp) {
return "last";
} else if (node instanceof AFirFromOfFuncOp) {
return "first";
} else if (node instanceof AEarFromOfFuncOp) {
return "earliest";
} else if (node instanceof ALatFromOfFuncOp) {
return "latest";
} else {
throw new RuntimeException("unknown from_of_func_op");
}
}
/** Adds the PFromOfFuncOp to the DatabaseQuery on the evaluation stack */
private void handleTransformationOp(PFromOfFuncOp node, PExprFactor number) {
// stack: query
number.apply(new ExpressionCompiler(context)); | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/compiler/ReadPhraseCompiler.java
import arden.runtime.BinaryOperator;
import arden.runtime.DatabaseQuery;
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue;
// from_of_func_op =
// {mini} minimum
// | {min} min
// | {maxi} maximum
// | {max} max
// | {last} last
// | {fir} first
// | {ear} earliest
// | {lat} latest;
if (node instanceof AMiniFromOfFuncOp || node instanceof AMinFromOfFuncOp) {
return "minimum";
} else if (node instanceof AMaxiFromOfFuncOp || node instanceof AMaxFromOfFuncOp) {
return "maximum";
} else if (node instanceof ALastFromOfFuncOp) {
return "last";
} else if (node instanceof AFirFromOfFuncOp) {
return "first";
} else if (node instanceof AEarFromOfFuncOp) {
return "earliest";
} else if (node instanceof ALatFromOfFuncOp) {
return "latest";
} else {
throw new RuntimeException("unknown from_of_func_op");
}
}
/** Adds the PFromOfFuncOp to the DatabaseQuery on the evaluation stack */
private void handleTransformationOp(PFromOfFuncOp node, PExprFactor number) {
// stack: query
number.apply(new ExpressionCompiler(context)); | context.writer.invokeStatic(Compiler.getRuntimeHelper("getPrimitiveIntegerValue", ArdenValue.class)); |
dgrunwald/arden2bytecode | src/arden/compiler/ReadPhraseCompiler.java | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.runtime.BinaryOperator;
import arden.runtime.DatabaseQuery;
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue; | // | {fir} first
// | {ear} earliest
// | {lat} latest;
if (node instanceof AMiniFromOfFuncOp || node instanceof AMinFromOfFuncOp) {
return "minimum";
} else if (node instanceof AMaxiFromOfFuncOp || node instanceof AMaxFromOfFuncOp) {
return "maximum";
} else if (node instanceof ALastFromOfFuncOp) {
return "last";
} else if (node instanceof AFirFromOfFuncOp) {
return "first";
} else if (node instanceof AEarFromOfFuncOp) {
return "earliest";
} else if (node instanceof ALatFromOfFuncOp) {
return "latest";
} else {
throw new RuntimeException("unknown from_of_func_op");
}
}
/** Adds the PFromOfFuncOp to the DatabaseQuery on the evaluation stack */
private void handleTransformationOp(PFromOfFuncOp node, PExprFactor number) {
// stack: query
number.apply(new ExpressionCompiler(context));
context.writer.invokeStatic(Compiler.getRuntimeHelper("getPrimitiveIntegerValue", ArdenValue.class));
// stack: query, number
// now emit code like:
// (number >= 0) ? query.op(number) : DatabaseQuery.NULL;
context.writer.dup();
// stack: query, number, number | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/compiler/ReadPhraseCompiler.java
import arden.runtime.BinaryOperator;
import arden.runtime.DatabaseQuery;
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue;
// | {fir} first
// | {ear} earliest
// | {lat} latest;
if (node instanceof AMiniFromOfFuncOp || node instanceof AMinFromOfFuncOp) {
return "minimum";
} else if (node instanceof AMaxiFromOfFuncOp || node instanceof AMaxFromOfFuncOp) {
return "maximum";
} else if (node instanceof ALastFromOfFuncOp) {
return "last";
} else if (node instanceof AFirFromOfFuncOp) {
return "first";
} else if (node instanceof AEarFromOfFuncOp) {
return "earliest";
} else if (node instanceof ALatFromOfFuncOp) {
return "latest";
} else {
throw new RuntimeException("unknown from_of_func_op");
}
}
/** Adds the PFromOfFuncOp to the DatabaseQuery on the evaluation stack */
private void handleTransformationOp(PFromOfFuncOp node, PExprFactor number) {
// stack: query
number.apply(new ExpressionCompiler(context));
context.writer.invokeStatic(Compiler.getRuntimeHelper("getPrimitiveIntegerValue", ArdenValue.class));
// stack: query, number
// now emit code like:
// (number >= 0) ? query.op(number) : DatabaseQuery.NULL;
context.writer.dup();
// stack: query, number, number | Label elseLabel = new Label(); |
dgrunwald/arden2bytecode | src/arden/compiler/ActionCompiler.java | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue; | // | {cdel} call_phrase delay expr
// | {write} write expr
// | {wrtat} write expr at identifier
// | {return} return expr
// | {assign1} identifier_becomes expr
// | {assign2} time_becomes expr
// | {assign3} identifier_becomes new_object_phrase
@Override
public void caseAEmptyActionStatement(AEmptyActionStatement node) {
}
@Override
public void caseAIfActionStatement(AIfActionStatement node) {
// action_statement = {if} if action_if_then_else2
context.writer.sequencePoint(node.getIf().getLine());
node.getActionIfThenElse2().apply(this);
}
@Override
public void caseAForActionStatement(AForActionStatement node) {
// action_statement =
// {for} for identifier in expr do action_block semicolon enddo
compileForStatement(context, node.getFor(), node.getIdentifier(), node.getExpr(), node.getActionBlock(), this);
}
public static void compileForStatement(CompilerContext context, TFor tFor, TIdentifier identifier,
PExpr collectionExpr, Switchable block, Switch blockCompiler) {
context.writer.sequencePoint(tFor.getLine());
collectionExpr.apply(new ExpressionCompiler(context));
try { | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/compiler/ActionCompiler.java
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue;
// | {cdel} call_phrase delay expr
// | {write} write expr
// | {wrtat} write expr at identifier
// | {return} return expr
// | {assign1} identifier_becomes expr
// | {assign2} time_becomes expr
// | {assign3} identifier_becomes new_object_phrase
@Override
public void caseAEmptyActionStatement(AEmptyActionStatement node) {
}
@Override
public void caseAIfActionStatement(AIfActionStatement node) {
// action_statement = {if} if action_if_then_else2
context.writer.sequencePoint(node.getIf().getLine());
node.getActionIfThenElse2().apply(this);
}
@Override
public void caseAForActionStatement(AForActionStatement node) {
// action_statement =
// {for} for identifier in expr do action_block semicolon enddo
compileForStatement(context, node.getFor(), node.getIdentifier(), node.getExpr(), node.getActionBlock(), this);
}
public static void compileForStatement(CompilerContext context, TFor tFor, TIdentifier identifier,
PExpr collectionExpr, Switchable block, Switch blockCompiler) {
context.writer.sequencePoint(tFor.getLine());
collectionExpr.apply(new ExpressionCompiler(context));
try { | context.writer.invokeInstance(ArdenValue.class.getMethod("getElements")); |
dgrunwald/arden2bytecode | src/arden/compiler/ActionCompiler.java | // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
| import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue; | // {for} for identifier in expr do action_block semicolon enddo
compileForStatement(context, node.getFor(), node.getIdentifier(), node.getExpr(), node.getActionBlock(), this);
}
public static void compileForStatement(CompilerContext context, TFor tFor, TIdentifier identifier,
PExpr collectionExpr, Switchable block, Switch blockCompiler) {
context.writer.sequencePoint(tFor.getLine());
collectionExpr.apply(new ExpressionCompiler(context));
try {
context.writer.invokeInstance(ArdenValue.class.getMethod("getElements"));
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
int arrayVar = context.allocateVariable();
context.writer.storeVariable(arrayVar);
int loopIndexVar = context.allocateVariable();
context.writer.loadIntegerConstant(0);
context.writer.storeIntVariable(loopIndexVar);
String varName = identifier.getText();
if (context.codeGenerator.getVariable(varName) != null)
throw new RuntimeCompilerException(identifier, "A variable with the name '" + varName
+ "' is already defined at this location.");
ForLoopVariable newLoopVariable = new ForLoopVariable(identifier, context.allocateVariable());
context.codeGenerator.addVariable(newLoopVariable);
context.writer.defineLocalVariable(newLoopVariable.variableIndex, varName, ArdenValue.class);
| // Path: src/arden/codegenerator/Label.java
// public final class Label {
// /** Target position (byte index where the label is pointing to), -1=not yet set */
// int markedPosition = -1;
// /** Stack size at target position, -1=currently unknown */
// int stackSize = -1;
// /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
// boolean allowJumps = true;
// }
//
// Path: src/arden/runtime/ArdenValue.java
// public abstract class ArdenValue {
// public static final long NOPRIMARYTIME = Long.MIN_VALUE;
// public final long primaryTime;
//
// protected ArdenValue() {
// this.primaryTime = NOPRIMARYTIME;
// }
//
// protected ArdenValue(long primaryTime) {
// this.primaryTime = primaryTime;
// }
//
// /**
// * Creates a copy of this value with the primary time set to newPrimaryTime.
// */
// public abstract ArdenValue setTime(long newPrimaryTime);
//
// /**
// * Returns whether this value is 'true' in a boolean context. Returns 'true'
// * for boolean true; false for everything else (even for the list ",true")
// */
// public boolean isTrue() {
// return false;
// }
//
// /**
// * Returns whether this value is 'false' in a boolean context. Returns
// * 'true' for boolean false; returns 'false' for everything else (boolean
// * true or null)
// */
// public boolean isFalse() {
// return false;
// }
//
// /** Gets the elements that a FOR loop will iterate through */
// public ArdenValue[] getElements() {
// return new ArdenValue[] { this };
// }
//
// /**
// * Compares this ArdenValue with another. Does not implement Comparable
// * interface because we have an additional return value MIN_VALUE with
// * special meaning.
// *
// * @return Returns Integer.MIN_VALUE if the types don't match or the type is
// * not ordered. Returns -1 if this is less than rhs. Returns 0 if
// * this is equal to rhs. Returns 1 if this is larger than rhs.
// */
// public int compareTo(ArdenValue rhs) {
// return Integer.MIN_VALUE;
// }
// }
// Path: src/arden/compiler/ActionCompiler.java
import arden.codegenerator.Label;
import arden.compiler.node.*;
import arden.runtime.ArdenValue;
// {for} for identifier in expr do action_block semicolon enddo
compileForStatement(context, node.getFor(), node.getIdentifier(), node.getExpr(), node.getActionBlock(), this);
}
public static void compileForStatement(CompilerContext context, TFor tFor, TIdentifier identifier,
PExpr collectionExpr, Switchable block, Switch blockCompiler) {
context.writer.sequencePoint(tFor.getLine());
collectionExpr.apply(new ExpressionCompiler(context));
try {
context.writer.invokeInstance(ArdenValue.class.getMethod("getElements"));
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
int arrayVar = context.allocateVariable();
context.writer.storeVariable(arrayVar);
int loopIndexVar = context.allocateVariable();
context.writer.loadIntegerConstant(0);
context.writer.storeIntVariable(loopIndexVar);
String varName = identifier.getText();
if (context.codeGenerator.getVariable(varName) != null)
throw new RuntimeCompilerException(identifier, "A variable with the name '" + varName
+ "' is already defined at this location.");
ForLoopVariable newLoopVariable = new ForLoopVariable(identifier, context.allocateVariable());
context.codeGenerator.addVariable(newLoopVariable);
context.writer.defineLocalVariable(newLoopVariable.variableIndex, varName, ArdenValue.class);
| Label loopCondition = new Label(); |
dgrunwald/arden2bytecode | src/arden/tests/StringOperators.java | // Path: src/arden/compiler/CompilerException.java
// public class CompilerException extends Exception {
// private static final long serialVersionUID = -4674298085134149649L;
//
// private final int line, pos;
//
// public CompilerException(ParserException innerException) {
// super(innerException);
// if (innerException.getToken() != null) {
// this.line = innerException.getToken().getLine();
// this.pos = innerException.getToken().getPos();
// } else {
// this.line = 0;
// this.pos = 0;
// }
// }
//
// public CompilerException(LexerException innerException) {
// super(innerException);
// this.line = 0;
// this.pos = 0;
// }
//
// CompilerException(RuntimeCompilerException innerException) {
// super(innerException.getMessage(), innerException);
// this.line = innerException.line;
// this.pos = innerException.pos;
// }
//
// public CompilerException(String message, int pos, int line) {
// super(message);
// this.line = line;
// this.pos = pos;
// }
//
// /** Gets the line number where the compile error occurred. */
// public int getLine() {
// return line;
// }
//
// /** Gets the line position (column) where the compile error occurred. */
// public int getPos() {
// return pos;
// }
// }
//
// Path: src/arden/runtime/ArdenString.java
// public final class ArdenString extends ArdenValue {
// public final String value;
//
// public ArdenString(String value) {
// this.value = value;
// }
//
// public ArdenString(String value, long primaryTime) {
// super(primaryTime);
// this.value = value;
// }
//
// @Override
// public ArdenValue setTime(long newPrimaryTime) {
// return new ArdenString(value, newPrimaryTime);
// }
//
// @Override
// public String toString() {
// StringBuilder b = new StringBuilder();
// b.append('"');
// for (int i = 0; i < value.length(); i++) {
// char c = value.charAt(i);
// b.append(c);
// if (c == '"')
// b.append('"'); // double "
// }
// b.append('"');
// return b.toString();
// }
//
// @Override
// public boolean equals(Object obj) {
// return (obj instanceof ArdenString) && value.equals(((ArdenString) obj).value);
// }
//
// @Override
// public int hashCode() {
// return value.hashCode();
// }
//
// @Override
// public int compareTo(ArdenValue rhs) {
// if (rhs instanceof ArdenString) {
// return Integer.signum(value.compareTo(((ArdenString) rhs).value));
// } else {
// return Integer.MIN_VALUE;
// }
// }
// }
| import org.junit.Assert;
import org.junit.Test;
import arden.compiler.CompilerException;
import arden.runtime.ArdenString;
import java.lang.reflect.InvocationTargetException;
import java.util.Locale; | // arden2bytecode
// Copyright (c) 2010, Daniel Grunwald
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the owner nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package arden.tests;
public class StringOperators extends ExpressionTestBase {
private void assertEvalString(String expectedString, String code) throws CompilerException,
InvocationTargetException { | // Path: src/arden/compiler/CompilerException.java
// public class CompilerException extends Exception {
// private static final long serialVersionUID = -4674298085134149649L;
//
// private final int line, pos;
//
// public CompilerException(ParserException innerException) {
// super(innerException);
// if (innerException.getToken() != null) {
// this.line = innerException.getToken().getLine();
// this.pos = innerException.getToken().getPos();
// } else {
// this.line = 0;
// this.pos = 0;
// }
// }
//
// public CompilerException(LexerException innerException) {
// super(innerException);
// this.line = 0;
// this.pos = 0;
// }
//
// CompilerException(RuntimeCompilerException innerException) {
// super(innerException.getMessage(), innerException);
// this.line = innerException.line;
// this.pos = innerException.pos;
// }
//
// public CompilerException(String message, int pos, int line) {
// super(message);
// this.line = line;
// this.pos = pos;
// }
//
// /** Gets the line number where the compile error occurred. */
// public int getLine() {
// return line;
// }
//
// /** Gets the line position (column) where the compile error occurred. */
// public int getPos() {
// return pos;
// }
// }
//
// Path: src/arden/runtime/ArdenString.java
// public final class ArdenString extends ArdenValue {
// public final String value;
//
// public ArdenString(String value) {
// this.value = value;
// }
//
// public ArdenString(String value, long primaryTime) {
// super(primaryTime);
// this.value = value;
// }
//
// @Override
// public ArdenValue setTime(long newPrimaryTime) {
// return new ArdenString(value, newPrimaryTime);
// }
//
// @Override
// public String toString() {
// StringBuilder b = new StringBuilder();
// b.append('"');
// for (int i = 0; i < value.length(); i++) {
// char c = value.charAt(i);
// b.append(c);
// if (c == '"')
// b.append('"'); // double "
// }
// b.append('"');
// return b.toString();
// }
//
// @Override
// public boolean equals(Object obj) {
// return (obj instanceof ArdenString) && value.equals(((ArdenString) obj).value);
// }
//
// @Override
// public int hashCode() {
// return value.hashCode();
// }
//
// @Override
// public int compareTo(ArdenValue rhs) {
// if (rhs instanceof ArdenString) {
// return Integer.signum(value.compareTo(((ArdenString) rhs).value));
// } else {
// return Integer.MIN_VALUE;
// }
// }
// }
// Path: src/arden/tests/StringOperators.java
import org.junit.Assert;
import org.junit.Test;
import arden.compiler.CompilerException;
import arden.runtime.ArdenString;
import java.lang.reflect.InvocationTargetException;
import java.util.Locale;
// arden2bytecode
// Copyright (c) 2010, Daniel Grunwald
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the owner nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package arden.tests;
public class StringOperators extends ExpressionTestBase {
private void assertEvalString(String expectedString, String code) throws CompilerException,
InvocationTargetException { | ArdenString s = (ArdenString) evalExpression(code); |
naver/arcus-spring | src/main/java/com/navercorp/arcus/spring/ArcusTemplate.java | // Path: src/main/java/com/navercorp/arcus/spring/callback/ArcusCallBack.java
// @Deprecated
// public interface ArcusCallBack<T> {
// public Future<T> doInArcus(ArcusClient arcusClient);
// }
| import com.navercorp.arcus.spring.callback.ArcusCallBack;
import net.spy.memcached.ArcusClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
| /*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2011-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring;
@Deprecated
public class ArcusTemplate {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private ArcusClient arcusClient;
public ArcusTemplate(ArcusClient arcusClient) {
this.arcusClient = arcusClient;
}
| // Path: src/main/java/com/navercorp/arcus/spring/callback/ArcusCallBack.java
// @Deprecated
// public interface ArcusCallBack<T> {
// public Future<T> doInArcus(ArcusClient arcusClient);
// }
// Path: src/main/java/com/navercorp/arcus/spring/ArcusTemplate.java
import com.navercorp.arcus.spring.callback.ArcusCallBack;
import net.spy.memcached.ArcusClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2011-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring;
@Deprecated
public class ArcusTemplate {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private ArcusClient arcusClient;
public ArcusTemplate(ArcusClient arcusClient) {
this.arcusClient = arcusClient;
}
| public <T> T execute(final ArcusCallBack<T> methodCall) {
|
naver/arcus-spring | src/test/java/com/navercorp/arcus/spring/ArcusTemplateTest.java | // Path: src/main/java/com/navercorp/arcus/spring/callback/AsycGetMethod.java
// @Deprecated
// public class AsycGetMethod implements ArcusCallBack<Object> {
//
// private String key;
//
// public AsycGetMethod(String key) {
// this.key = key;
// }
//
// @Override
// public Future<Object> doInArcus(ArcusClient arcusClient) {
// return arcusClient.asyncGet(key);
// }
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/callback/SetMethod.java
// @Deprecated
// public class SetMethod implements ArcusCallBack<Boolean> {
// private String key;
// private String value;
// private int expSeconds;
//
// public SetMethod(String key, int expSeconds, String value) {
// this.key = key;
// this.value = value;
// this.expSeconds = expSeconds;
// }
//
// @Override
// public Future<Boolean> doInArcus(ArcusClient arcusClient) {
// return arcusClient.set(key, expSeconds, value);
// }
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/callback/ArusCallBackFactory.java
// @Deprecated
// public class ArusCallBackFactory {
//
// public static AsycGetMethod asyncGet(String key) {
// return new AsycGetMethod(key);
// }
//
// public static SetMethod set(String key, int expSeconds, String value) {
// return new SetMethod(key, expSeconds, value);
// }
//
// public static DeleteMethod delete(String key) {
// return new DeleteMethod(key);
// }
// }
| import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import com.navercorp.arcus.spring.callback.AsycGetMethod;
import com.navercorp.arcus.spring.callback.SetMethod;
import net.spy.memcached.ArcusClientPool;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.concurrent.TimeUnit;
import static com.navercorp.arcus.spring.callback.ArusCallBackFactory.*;
| /*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2011-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring;
@Deprecated
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/arcus_spring_arcusTemplete_test.xml")
public class ArcusTemplateTest {
@Autowired
private ArcusClientPool client;
String key = "sample:testKey";
ArcusTemplate arcus;
@Before
public void setUp() {
arcus = new ArcusTemplate(client.getClient());
}
@Test
public void valueShouldBeSetAndGot() throws Exception {
// given
String value = "setTest";
// when
Boolean worked = arcus.execute(set(key, 300, value));
String valueGot = (String) arcus.execute(asyncGet(key));
assertThat(worked, is(true));
assertThat(valueGot, is(value));
}
@Test
public void valueShouldBeSetAndDelete() throws Exception {
// given
String value = "setAndDeleteTest";
| // Path: src/main/java/com/navercorp/arcus/spring/callback/AsycGetMethod.java
// @Deprecated
// public class AsycGetMethod implements ArcusCallBack<Object> {
//
// private String key;
//
// public AsycGetMethod(String key) {
// this.key = key;
// }
//
// @Override
// public Future<Object> doInArcus(ArcusClient arcusClient) {
// return arcusClient.asyncGet(key);
// }
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/callback/SetMethod.java
// @Deprecated
// public class SetMethod implements ArcusCallBack<Boolean> {
// private String key;
// private String value;
// private int expSeconds;
//
// public SetMethod(String key, int expSeconds, String value) {
// this.key = key;
// this.value = value;
// this.expSeconds = expSeconds;
// }
//
// @Override
// public Future<Boolean> doInArcus(ArcusClient arcusClient) {
// return arcusClient.set(key, expSeconds, value);
// }
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/callback/ArusCallBackFactory.java
// @Deprecated
// public class ArusCallBackFactory {
//
// public static AsycGetMethod asyncGet(String key) {
// return new AsycGetMethod(key);
// }
//
// public static SetMethod set(String key, int expSeconds, String value) {
// return new SetMethod(key, expSeconds, value);
// }
//
// public static DeleteMethod delete(String key) {
// return new DeleteMethod(key);
// }
// }
// Path: src/test/java/com/navercorp/arcus/spring/ArcusTemplateTest.java
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import com.navercorp.arcus.spring.callback.AsycGetMethod;
import com.navercorp.arcus.spring.callback.SetMethod;
import net.spy.memcached.ArcusClientPool;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.concurrent.TimeUnit;
import static com.navercorp.arcus.spring.callback.ArusCallBackFactory.*;
/*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2011-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring;
@Deprecated
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/arcus_spring_arcusTemplete_test.xml")
public class ArcusTemplateTest {
@Autowired
private ArcusClientPool client;
String key = "sample:testKey";
ArcusTemplate arcus;
@Before
public void setUp() {
arcus = new ArcusTemplate(client.getClient());
}
@Test
public void valueShouldBeSetAndGot() throws Exception {
// given
String value = "setTest";
// when
Boolean worked = arcus.execute(set(key, 300, value));
String valueGot = (String) arcus.execute(asyncGet(key));
assertThat(worked, is(true));
assertThat(valueGot, is(value));
}
@Test
public void valueShouldBeSetAndDelete() throws Exception {
// given
String value = "setAndDeleteTest";
| Boolean setWorked = arcus.execute(new SetMethod(key, 300, value));
|
naver/arcus-spring | src/test/java/com/navercorp/arcus/spring/ArcusTemplateTest.java | // Path: src/main/java/com/navercorp/arcus/spring/callback/AsycGetMethod.java
// @Deprecated
// public class AsycGetMethod implements ArcusCallBack<Object> {
//
// private String key;
//
// public AsycGetMethod(String key) {
// this.key = key;
// }
//
// @Override
// public Future<Object> doInArcus(ArcusClient arcusClient) {
// return arcusClient.asyncGet(key);
// }
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/callback/SetMethod.java
// @Deprecated
// public class SetMethod implements ArcusCallBack<Boolean> {
// private String key;
// private String value;
// private int expSeconds;
//
// public SetMethod(String key, int expSeconds, String value) {
// this.key = key;
// this.value = value;
// this.expSeconds = expSeconds;
// }
//
// @Override
// public Future<Boolean> doInArcus(ArcusClient arcusClient) {
// return arcusClient.set(key, expSeconds, value);
// }
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/callback/ArusCallBackFactory.java
// @Deprecated
// public class ArusCallBackFactory {
//
// public static AsycGetMethod asyncGet(String key) {
// return new AsycGetMethod(key);
// }
//
// public static SetMethod set(String key, int expSeconds, String value) {
// return new SetMethod(key, expSeconds, value);
// }
//
// public static DeleteMethod delete(String key) {
// return new DeleteMethod(key);
// }
// }
| import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import com.navercorp.arcus.spring.callback.AsycGetMethod;
import com.navercorp.arcus.spring.callback.SetMethod;
import net.spy.memcached.ArcusClientPool;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.concurrent.TimeUnit;
import static com.navercorp.arcus.spring.callback.ArusCallBackFactory.*;
| /*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2011-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring;
@Deprecated
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/arcus_spring_arcusTemplete_test.xml")
public class ArcusTemplateTest {
@Autowired
private ArcusClientPool client;
String key = "sample:testKey";
ArcusTemplate arcus;
@Before
public void setUp() {
arcus = new ArcusTemplate(client.getClient());
}
@Test
public void valueShouldBeSetAndGot() throws Exception {
// given
String value = "setTest";
// when
Boolean worked = arcus.execute(set(key, 300, value));
String valueGot = (String) arcus.execute(asyncGet(key));
assertThat(worked, is(true));
assertThat(valueGot, is(value));
}
@Test
public void valueShouldBeSetAndDelete() throws Exception {
// given
String value = "setAndDeleteTest";
Boolean setWorked = arcus.execute(new SetMethod(key, 300, value));
assertThat(setWorked, is(true));
// when
Boolean deleteWorked = arcus.execute(delete(key));
// then
assertThat(deleteWorked, is(true));
| // Path: src/main/java/com/navercorp/arcus/spring/callback/AsycGetMethod.java
// @Deprecated
// public class AsycGetMethod implements ArcusCallBack<Object> {
//
// private String key;
//
// public AsycGetMethod(String key) {
// this.key = key;
// }
//
// @Override
// public Future<Object> doInArcus(ArcusClient arcusClient) {
// return arcusClient.asyncGet(key);
// }
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/callback/SetMethod.java
// @Deprecated
// public class SetMethod implements ArcusCallBack<Boolean> {
// private String key;
// private String value;
// private int expSeconds;
//
// public SetMethod(String key, int expSeconds, String value) {
// this.key = key;
// this.value = value;
// this.expSeconds = expSeconds;
// }
//
// @Override
// public Future<Boolean> doInArcus(ArcusClient arcusClient) {
// return arcusClient.set(key, expSeconds, value);
// }
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/callback/ArusCallBackFactory.java
// @Deprecated
// public class ArusCallBackFactory {
//
// public static AsycGetMethod asyncGet(String key) {
// return new AsycGetMethod(key);
// }
//
// public static SetMethod set(String key, int expSeconds, String value) {
// return new SetMethod(key, expSeconds, value);
// }
//
// public static DeleteMethod delete(String key) {
// return new DeleteMethod(key);
// }
// }
// Path: src/test/java/com/navercorp/arcus/spring/ArcusTemplateTest.java
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import com.navercorp.arcus.spring.callback.AsycGetMethod;
import com.navercorp.arcus.spring.callback.SetMethod;
import net.spy.memcached.ArcusClientPool;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.concurrent.TimeUnit;
import static com.navercorp.arcus.spring.callback.ArusCallBackFactory.*;
/*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2011-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring;
@Deprecated
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/arcus_spring_arcusTemplete_test.xml")
public class ArcusTemplateTest {
@Autowired
private ArcusClientPool client;
String key = "sample:testKey";
ArcusTemplate arcus;
@Before
public void setUp() {
arcus = new ArcusTemplate(client.getClient());
}
@Test
public void valueShouldBeSetAndGot() throws Exception {
// given
String value = "setTest";
// when
Boolean worked = arcus.execute(set(key, 300, value));
String valueGot = (String) arcus.execute(asyncGet(key));
assertThat(worked, is(true));
assertThat(valueGot, is(value));
}
@Test
public void valueShouldBeSetAndDelete() throws Exception {
// given
String value = "setAndDeleteTest";
Boolean setWorked = arcus.execute(new SetMethod(key, 300, value));
assertThat(setWorked, is(true));
// when
Boolean deleteWorked = arcus.execute(delete(key));
// then
assertThat(deleteWorked, is(true));
| String valueGot = (String) arcus.execute(new AsycGetMethod(key));
|
naver/arcus-spring | src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheTest.java | // Path: src/main/java/com/navercorp/arcus/spring/cache/front/ArcusFrontCache.java
// public interface ArcusFrontCache {
//
// Object get(String key);
// void set(String key, Object value, int expireTime);
// void delete(String key);
// void clear();
//
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/concurrent/KeyLockProvider.java
// public interface KeyLockProvider {
//
// ReadWriteLock getLockForKey(Object key);
//
// }
| import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
import com.navercorp.arcus.spring.cache.front.ArcusFrontCache;
import com.navercorp.arcus.spring.concurrent.KeyLockProvider;
import net.spy.memcached.ArcusClientPool;
import net.spy.memcached.internal.GetFuture;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.transcoders.SerializingTranscoder;
import net.spy.memcached.transcoders.Transcoder;
import org.junit.Before;
import org.junit.Test;
import org.springframework.cache.Cache;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit; | /*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2021 JaM2in Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring.cache;
public class ArcusCacheTest {
private static final ArcusStringKey ARCUS_STRING_KEY = new ArcusStringKey("KEY");
private static final Object VALUE = "VALUE";
private static final int EXPIRE_SECONDS = 100;
private static final int FRONT_EXPIRE_SECONDS = 50;
private static final Transcoder<Object> OPERATION_TRANSCODER = new SerializingTranscoder();
private ArcusCache arcusCache;
private ArcusClientPool arcusClientPool; | // Path: src/main/java/com/navercorp/arcus/spring/cache/front/ArcusFrontCache.java
// public interface ArcusFrontCache {
//
// Object get(String key);
// void set(String key, Object value, int expireTime);
// void delete(String key);
// void clear();
//
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/concurrent/KeyLockProvider.java
// public interface KeyLockProvider {
//
// ReadWriteLock getLockForKey(Object key);
//
// }
// Path: src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheTest.java
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
import com.navercorp.arcus.spring.cache.front.ArcusFrontCache;
import com.navercorp.arcus.spring.concurrent.KeyLockProvider;
import net.spy.memcached.ArcusClientPool;
import net.spy.memcached.internal.GetFuture;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.transcoders.SerializingTranscoder;
import net.spy.memcached.transcoders.Transcoder;
import org.junit.Before;
import org.junit.Test;
import org.springframework.cache.Cache;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
/*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2021 JaM2in Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring.cache;
public class ArcusCacheTest {
private static final ArcusStringKey ARCUS_STRING_KEY = new ArcusStringKey("KEY");
private static final Object VALUE = "VALUE";
private static final int EXPIRE_SECONDS = 100;
private static final int FRONT_EXPIRE_SECONDS = 50;
private static final Transcoder<Object> OPERATION_TRANSCODER = new SerializingTranscoder();
private ArcusCache arcusCache;
private ArcusClientPool arcusClientPool; | private ArcusFrontCache arcusFrontCache; |
naver/arcus-spring | src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheTest.java | // Path: src/main/java/com/navercorp/arcus/spring/cache/front/ArcusFrontCache.java
// public interface ArcusFrontCache {
//
// Object get(String key);
// void set(String key, Object value, int expireTime);
// void delete(String key);
// void clear();
//
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/concurrent/KeyLockProvider.java
// public interface KeyLockProvider {
//
// ReadWriteLock getLockForKey(Object key);
//
// }
| import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
import com.navercorp.arcus.spring.cache.front.ArcusFrontCache;
import com.navercorp.arcus.spring.concurrent.KeyLockProvider;
import net.spy.memcached.ArcusClientPool;
import net.spy.memcached.internal.GetFuture;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.transcoders.SerializingTranscoder;
import net.spy.memcached.transcoders.Transcoder;
import org.junit.Before;
import org.junit.Test;
import org.springframework.cache.Cache;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit; | /*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2021 JaM2in Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring.cache;
public class ArcusCacheTest {
private static final ArcusStringKey ARCUS_STRING_KEY = new ArcusStringKey("KEY");
private static final Object VALUE = "VALUE";
private static final int EXPIRE_SECONDS = 100;
private static final int FRONT_EXPIRE_SECONDS = 50;
private static final Transcoder<Object> OPERATION_TRANSCODER = new SerializingTranscoder();
private ArcusCache arcusCache;
private ArcusClientPool arcusClientPool;
private ArcusFrontCache arcusFrontCache;
private String arcusKey;
private Callable<?> valueLoader; | // Path: src/main/java/com/navercorp/arcus/spring/cache/front/ArcusFrontCache.java
// public interface ArcusFrontCache {
//
// Object get(String key);
// void set(String key, Object value, int expireTime);
// void delete(String key);
// void clear();
//
// }
//
// Path: src/main/java/com/navercorp/arcus/spring/concurrent/KeyLockProvider.java
// public interface KeyLockProvider {
//
// ReadWriteLock getLockForKey(Object key);
//
// }
// Path: src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheTest.java
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
import com.navercorp.arcus.spring.cache.front.ArcusFrontCache;
import com.navercorp.arcus.spring.concurrent.KeyLockProvider;
import net.spy.memcached.ArcusClientPool;
import net.spy.memcached.internal.GetFuture;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.transcoders.SerializingTranscoder;
import net.spy.memcached.transcoders.Transcoder;
import org.junit.Before;
import org.junit.Test;
import org.springframework.cache.Cache;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
/*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2021 JaM2in Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring.cache;
public class ArcusCacheTest {
private static final ArcusStringKey ARCUS_STRING_KEY = new ArcusStringKey("KEY");
private static final Object VALUE = "VALUE";
private static final int EXPIRE_SECONDS = 100;
private static final int FRONT_EXPIRE_SECONDS = 50;
private static final Transcoder<Object> OPERATION_TRANSCODER = new SerializingTranscoder();
private ArcusCache arcusCache;
private ArcusClientPool arcusClientPool;
private ArcusFrontCache arcusFrontCache;
private String arcusKey;
private Callable<?> valueLoader; | private KeyLockProvider keyLockProvider; |
naver/arcus-spring | src/main/java/com/navercorp/arcus/spring/cache/ArcusCacheConfiguration.java | // Path: src/main/java/com/navercorp/arcus/spring/cache/front/ArcusFrontCache.java
// public interface ArcusFrontCache {
//
// Object get(String key);
// void set(String key, Object value, int expireTime);
// void delete(String key);
// void clear();
//
// }
| import com.navercorp.arcus.spring.cache.front.ArcusFrontCache;
import net.spy.memcached.transcoders.Transcoder;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert; | /*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2019-2021 JaM2in Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring.cache;
public class ArcusCacheConfiguration implements InitializingBean {
private String serviceId;
private String prefix;
private int expireSeconds;
private int frontExpireSeconds;
private long timeoutMilliSeconds = ArcusCache.DEFAULT_TIMEOUT_MILLISECONDS;
private Transcoder<Object> operationTranscoder; | // Path: src/main/java/com/navercorp/arcus/spring/cache/front/ArcusFrontCache.java
// public interface ArcusFrontCache {
//
// Object get(String key);
// void set(String key, Object value, int expireTime);
// void delete(String key);
// void clear();
//
// }
// Path: src/main/java/com/navercorp/arcus/spring/cache/ArcusCacheConfiguration.java
import com.navercorp.arcus.spring.cache.front.ArcusFrontCache;
import net.spy.memcached.transcoders.Transcoder;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
/*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2019-2021 JaM2in Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring.cache;
public class ArcusCacheConfiguration implements InitializingBean {
private String serviceId;
private String prefix;
private int expireSeconds;
private int frontExpireSeconds;
private long timeoutMilliSeconds = ArcusCache.DEFAULT_TIMEOUT_MILLISECONDS;
private Transcoder<Object> operationTranscoder; | private ArcusFrontCache arcusFrontCache; |
naver/arcus-spring | src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheConfig.java | // Path: src/main/java/com/navercorp/arcus/spring/ArcusClientFactoryBean.java
// public class ArcusClientFactoryBean implements FactoryBean<ArcusClientPool>,
// DisposableBean, InitializingBean {
//
// private ArcusClientPool client;
// private String url;
// private String serviceCode;
// private int poolSize = 4;
// private int frontCacheExpireTime = DefaultConnectionFactory.DEFAULT_FRONTCACHE_EXPIRETIME;
// private int maxFrontCacheElements = DefaultConnectionFactory.DEFAULT_MAX_FRONTCACHE_ELEMENTS;
// private boolean frontCacheCopyOnRead = DefaultConnectionFactory.DEFAULT_FRONT_CACHE_COPY_ON_READ;
// private boolean frontCacheCopyOnWrite = DefaultConnectionFactory.DEFAULT_FRONT_CACHE_COPY_ON_WRITE;
// private int timeoutExceptionThreshold = 100;
// private long maxReconnectDelay = DefaultConnectionFactory.DEFAULT_MAX_RECONNECT_DELAY;
//
// /**
// * global transcoder for key/value store.
// */
// private Transcoder<Object> globalTranscoder;
//
// public void setPoolSize(int poolSize) {
// this.poolSize = poolSize;
// }
//
// public void setFrontCacheExpireTime(int frontCacheExpireTime) {
// this.frontCacheExpireTime = frontCacheExpireTime;
// }
//
// public void setMaxFrontCacheElements(int maxFrontCacheElements) {
// this.maxFrontCacheElements = maxFrontCacheElements;
// }
//
// public void setFrontCacheCopyOnRead(boolean copyOnRead) {
// this.frontCacheCopyOnRead = copyOnRead;
// }
//
// public void setFrontCacheCopyOnWrite(boolean copyOnWrite) {
// this.frontCacheCopyOnWrite = copyOnWrite;
// }
//
// public void setGlobalTranscoder(Transcoder<Object> tc) {
// this.globalTranscoder = tc;
// }
//
// public void setTimeoutExceptionThreshold(int timeoutExceptionThreshold) {
// this.timeoutExceptionThreshold = timeoutExceptionThreshold;
// }
//
// public void setMaxReconnectDelay(long maxReconnectDelay) {
// this.maxReconnectDelay = maxReconnectDelay;
// }
//
// public void setUrl(String url) {
// this.url = url;
// }
//
// public void setServiceCode(String serviceCode) {
// this.serviceCode = serviceCode;
// }
//
// @Override
// public void destroy() {
// if (this.client != null) {
// this.client.shutdown();
// }
// }
//
// @Override
// public ArcusClientPool getObject() {
// ConnectionFactoryBuilder cfb = new ConnectionFactoryBuilder();
// cfb.setFrontCacheExpireTime(frontCacheExpireTime);
// cfb.setTimeoutExceptionThreshold(timeoutExceptionThreshold);
// cfb.setFrontCacheCopyOnRead(frontCacheCopyOnRead);
// cfb.setFrontCacheCopyOnWrite(frontCacheCopyOnWrite);
// cfb.setMaxReconnectDelay(maxReconnectDelay);
// if (maxFrontCacheElements > 0) {
// cfb.setMaxFrontCacheElements(maxFrontCacheElements);
// }
// if (globalTranscoder != null) {
// cfb.setTranscoder(globalTranscoder);
// }
// client = ArcusClient.createArcusClientPool(url, serviceCode, cfb,
// poolSize);
// return client;
// }
//
// @Override
// public Class<?> getObjectType() {
// return ArcusClientPool.class;
// }
//
// @Override
// public boolean isSingleton() {
// return true;
// }
//
// @Override
// public void afterPropertiesSet() {
// Assert.notNull(this.url, "Url property must be provided.");
// Assert.notNull(this.serviceCode,
// "ServiceCode property must be provided.");
// Assert.isTrue(this.poolSize > 0,
// "PoolSize property must be larger than 0.");
// Assert.isTrue(this.timeoutExceptionThreshold > 0,
// "TimeoutExceptionThreshold must be larger than 0.");
// Assert.isTrue(this.maxReconnectDelay > 0,
// "MaxReconnectDelay must be larger than 0.");
// }
// }
| import com.navercorp.arcus.spring.ArcusClientFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; | /*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2011-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring.cache;
@Deprecated
@Configuration
public class ArcusCacheConfig {
static String ADMIN = "127.0.0.1:2181";
static String SERVICE_CODE = "test";
static String PREFIX = "arcusCache";
static int POOLSIZE = 4;
static long TIMEOUT = 100;
@Bean | // Path: src/main/java/com/navercorp/arcus/spring/ArcusClientFactoryBean.java
// public class ArcusClientFactoryBean implements FactoryBean<ArcusClientPool>,
// DisposableBean, InitializingBean {
//
// private ArcusClientPool client;
// private String url;
// private String serviceCode;
// private int poolSize = 4;
// private int frontCacheExpireTime = DefaultConnectionFactory.DEFAULT_FRONTCACHE_EXPIRETIME;
// private int maxFrontCacheElements = DefaultConnectionFactory.DEFAULT_MAX_FRONTCACHE_ELEMENTS;
// private boolean frontCacheCopyOnRead = DefaultConnectionFactory.DEFAULT_FRONT_CACHE_COPY_ON_READ;
// private boolean frontCacheCopyOnWrite = DefaultConnectionFactory.DEFAULT_FRONT_CACHE_COPY_ON_WRITE;
// private int timeoutExceptionThreshold = 100;
// private long maxReconnectDelay = DefaultConnectionFactory.DEFAULT_MAX_RECONNECT_DELAY;
//
// /**
// * global transcoder for key/value store.
// */
// private Transcoder<Object> globalTranscoder;
//
// public void setPoolSize(int poolSize) {
// this.poolSize = poolSize;
// }
//
// public void setFrontCacheExpireTime(int frontCacheExpireTime) {
// this.frontCacheExpireTime = frontCacheExpireTime;
// }
//
// public void setMaxFrontCacheElements(int maxFrontCacheElements) {
// this.maxFrontCacheElements = maxFrontCacheElements;
// }
//
// public void setFrontCacheCopyOnRead(boolean copyOnRead) {
// this.frontCacheCopyOnRead = copyOnRead;
// }
//
// public void setFrontCacheCopyOnWrite(boolean copyOnWrite) {
// this.frontCacheCopyOnWrite = copyOnWrite;
// }
//
// public void setGlobalTranscoder(Transcoder<Object> tc) {
// this.globalTranscoder = tc;
// }
//
// public void setTimeoutExceptionThreshold(int timeoutExceptionThreshold) {
// this.timeoutExceptionThreshold = timeoutExceptionThreshold;
// }
//
// public void setMaxReconnectDelay(long maxReconnectDelay) {
// this.maxReconnectDelay = maxReconnectDelay;
// }
//
// public void setUrl(String url) {
// this.url = url;
// }
//
// public void setServiceCode(String serviceCode) {
// this.serviceCode = serviceCode;
// }
//
// @Override
// public void destroy() {
// if (this.client != null) {
// this.client.shutdown();
// }
// }
//
// @Override
// public ArcusClientPool getObject() {
// ConnectionFactoryBuilder cfb = new ConnectionFactoryBuilder();
// cfb.setFrontCacheExpireTime(frontCacheExpireTime);
// cfb.setTimeoutExceptionThreshold(timeoutExceptionThreshold);
// cfb.setFrontCacheCopyOnRead(frontCacheCopyOnRead);
// cfb.setFrontCacheCopyOnWrite(frontCacheCopyOnWrite);
// cfb.setMaxReconnectDelay(maxReconnectDelay);
// if (maxFrontCacheElements > 0) {
// cfb.setMaxFrontCacheElements(maxFrontCacheElements);
// }
// if (globalTranscoder != null) {
// cfb.setTranscoder(globalTranscoder);
// }
// client = ArcusClient.createArcusClientPool(url, serviceCode, cfb,
// poolSize);
// return client;
// }
//
// @Override
// public Class<?> getObjectType() {
// return ArcusClientPool.class;
// }
//
// @Override
// public boolean isSingleton() {
// return true;
// }
//
// @Override
// public void afterPropertiesSet() {
// Assert.notNull(this.url, "Url property must be provided.");
// Assert.notNull(this.serviceCode,
// "ServiceCode property must be provided.");
// Assert.isTrue(this.poolSize > 0,
// "PoolSize property must be larger than 0.");
// Assert.isTrue(this.timeoutExceptionThreshold > 0,
// "TimeoutExceptionThreshold must be larger than 0.");
// Assert.isTrue(this.maxReconnectDelay > 0,
// "MaxReconnectDelay must be larger than 0.");
// }
// }
// Path: src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheConfig.java
import com.navercorp.arcus.spring.ArcusClientFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/*
* arcus-spring - Arcus as a caching provider for the Spring Cache Abstraction
* Copyright 2011-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.arcus.spring.cache;
@Deprecated
@Configuration
public class ArcusCacheConfig {
static String ADMIN = "127.0.0.1:2181";
static String SERVICE_CODE = "test";
static String PREFIX = "arcusCache";
static int POOLSIZE = 4;
static long TIMEOUT = 100;
@Bean | public ArcusClientFactoryBean arcusClientFactory() { |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/AdminRequestController.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
| import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import eu.cloudscale.showcase.db.model.IItem; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/admin")
public class AdminRequestController extends AController
{
@RequestMapping(value="", method=RequestMethod.GET)
public String get(@RequestParam( value="I_ID", required=false) Integer itemId, HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(BestSellersController.class, request);
if ( itemId != null)
{ | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/AdminRequestController.java
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import eu.cloudscale.showcase.db.model.IItem;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/admin")
public class AdminRequestController extends AController
{
@RequestMapping(value="", method=RequestMethod.GET)
public String get(@RequestParam( value="I_ID", required=false) Integer itemId, HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(BestSellersController.class, request);
if ( itemId != null)
{ | IItem item = service.findItemById(itemId); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAddress.java
// public interface IAddress
// {
//
// public Integer getAddrId();
//
// public void setAddrId(Integer addrId);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public String getAddrStreet1();
//
// public void setAddrStreet1(String addrStreet1);
//
// public String getAddrStreet2();
//
// public void setAddrStreet2(String addrStreet2);
//
// public String getAddrCity();
//
// public void setAddrCity(String addrCity);
//
// public String getAddrState();
//
// public void setAddrState(String addrState);
//
// public String getAddrZip();
//
// public void setAddrZip(String addrZip);
//
// public Set<ICustomer> getCustomers();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
| import java.util.List;
import eu.cloudscale.showcase.db.model.IAddress;
import eu.cloudscale.showcase.db.model.ICustomer; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao;
public interface ICustomerDao extends IDao<ICustomer>
{
public ICustomer findById(Integer id);
public ICustomer getUserBy(String username, String password);
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IAddress.java
// public interface IAddress
// {
//
// public Integer getAddrId();
//
// public void setAddrId(Integer addrId);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public String getAddrStreet1();
//
// public void setAddrStreet1(String addrStreet1);
//
// public String getAddrStreet2();
//
// public void setAddrStreet2(String addrStreet2);
//
// public String getAddrCity();
//
// public void setAddrCity(String addrCity);
//
// public String getAddrState();
//
// public void setAddrState(String addrState);
//
// public String getAddrZip();
//
// public void setAddrZip(String addrZip);
//
// public Set<ICustomer> getCustomers();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
import java.util.List;
import eu.cloudscale.showcase.db.model.IAddress;
import eu.cloudscale.showcase.db.model.ICustomer;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao;
public interface ICustomerDao extends IDao<ICustomer>
{
public ICustomer findById(Integer id);
public ICustomer getUserBy(String username, String password);
| public List<ICustomer> findByAddress(IAddress addrId); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/dao/IOrdersDao.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
| import eu.cloudscale.showcase.db.model.ICustomer;
import eu.cloudscale.showcase.db.model.IOrders; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao;
public interface IOrdersDao extends IDao<IOrders>
{ | // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IOrdersDao.java
import eu.cloudscale.showcase.db.model.ICustomer;
import eu.cloudscale.showcase.db.model.IOrders;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao;
public interface IOrdersDao extends IDao<IOrders>
{ | public IOrders getMostRecentOrder(ICustomer customer); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/Author.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAuthor.java
// public interface IAuthor
// {
//
// public Integer getAId();
//
// public void setAId(Integer AId);
//
// public String getAFname();
//
// public void setAFname(String AFname);
//
// public String getALname();
//
// public void setALname(String ALname);
//
// public String getAMname();
//
// public void setAMname(String AMname);
//
// public Date getADob();
//
// public void setADob(Date ADob);
//
// public String getABio();
//
// public void setABio(String ABio);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
| import eu.cloudscale.showcase.db.model.IAuthor;
import eu.cloudscale.showcase.db.model.IItem;
import static javax.persistence.GenerationType.IDENTITY;
import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Author generated by hbm2java
*/
@Entity
@Table( name = "author", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAuthor.java
// public interface IAuthor
// {
//
// public Integer getAId();
//
// public void setAId(Integer AId);
//
// public String getAFname();
//
// public void setAFname(String AFname);
//
// public String getALname();
//
// public void setALname(String ALname);
//
// public String getAMname();
//
// public void setAMname(String AMname);
//
// public Date getADob();
//
// public void setADob(Date ADob);
//
// public String getABio();
//
// public void setABio(String ABio);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/Author.java
import eu.cloudscale.showcase.db.model.IAuthor;
import eu.cloudscale.showcase.db.model.IItem;
import static javax.persistence.GenerationType.IDENTITY;
import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Author generated by hbm2java
*/
@Entity
@Table( name = "author", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) | public class Author implements IAuthor, Serializable |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/Author.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAuthor.java
// public interface IAuthor
// {
//
// public Integer getAId();
//
// public void setAId(Integer AId);
//
// public String getAFname();
//
// public void setAFname(String AFname);
//
// public String getALname();
//
// public void setALname(String ALname);
//
// public String getAMname();
//
// public void setAMname(String AMname);
//
// public Date getADob();
//
// public void setADob(Date ADob);
//
// public String getABio();
//
// public void setABio(String ABio);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
| import eu.cloudscale.showcase.db.model.IAuthor;
import eu.cloudscale.showcase.db.model.IItem;
import static javax.persistence.GenerationType.IDENTITY;
import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Author generated by hbm2java
*/
@Entity
@Table( name = "author", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Author implements IAuthor, Serializable
{
private static final long serialVersionUID = 1L;
private Integer aId;
private String AFname;
private String ALname;
private String AMname;
private Date ADob;
private String ABio;
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IAuthor.java
// public interface IAuthor
// {
//
// public Integer getAId();
//
// public void setAId(Integer AId);
//
// public String getAFname();
//
// public void setAFname(String AFname);
//
// public String getALname();
//
// public void setALname(String ALname);
//
// public String getAMname();
//
// public void setAMname(String AMname);
//
// public Date getADob();
//
// public void setADob(Date ADob);
//
// public String getABio();
//
// public void setABio(String ABio);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/Author.java
import eu.cloudscale.showcase.db.model.IAuthor;
import eu.cloudscale.showcase.db.model.IItem;
import static javax.persistence.GenerationType.IDENTITY;
import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Author generated by hbm2java
*/
@Entity
@Table( name = "author", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Author implements IAuthor, Serializable
{
private static final long serialVersionUID = 1L;
private Integer aId;
private String AFname;
private String ALname;
private String AMname;
private Date ADob;
private String ABio;
| private Set<IItem> items = new HashSet<IItem>( 0 ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/ShoppingCartLineDaoImpl.java | // Path: src/main/java/eu/cloudscale/showcase/db/common/ContextHelper.java
// public class ContextHelper
// {
// private static GenericXmlApplicationContext ctx = null;
//
// public static GenericXmlApplicationContext getApplicationContext()
// {
// if( ctx == null)
// {
// ctx = new GenericXmlApplicationContext();
// ctx.load("classpath:app-context.xml");
// ctx.refresh();
// }
//
// return ctx;
// }
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/mongo/ShoppingCartLine.java
// @Component
// @Document( collection = "shoppingCartLine" )
// public class ShoppingCartLine implements IShoppingCartLine, Serializable
// {
// // @Autowired
// // @Qualifier("service")
// // private IService service;
//
// private static final long serialVersionUID = 767045854888711002L;
//
// @Id
// private ObjectId id;
//
// @Indexed
// private Integer sclId;
//
// private Integer item;
//
// private Integer sclQty;
//
// private Integer shoppingCart;
//
// public ShoppingCartLine()
// {
// }
//
//
// public ObjectId getId()
// {
// return id;
// }
//
// public void setId(ObjectId id)
// {
// this.id = id;
// }
//
// @Override
// public IShoppingCart getShoppingCart()
// {
// return DatabaseHelper.getDatabase().findShoppingCartById( shoppingCart );
// }
//
// @Override
// public void setShoppingCart(IShoppingCart shoppingCart)
// {
// this.shoppingCart = shoppingCart.getScId();
// }
//
// @Override
// public Integer getSclId()
// {
// return this.sclId;
// }
//
// @Override
// public void setSclId(Integer sclScId)
// {
// this.sclId = sclScId;
// }
//
// @Override
// public IItem getItem()
// {
// IItem item = DatabaseHelper.getDatabase().findItemById( this.item );
// return item;
// }
//
// @Override
// public void setItem(IItem item)
// {
// this.item = item.getIId();
// }
//
// @Override
// public Integer getSclQty()
// {
// return this.sclQty;
// }
//
// @Override
// public void setSclQty(Integer sclQty)
// {
// this.sclQty = sclQty;
// }
// }
| import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import eu.cloudscale.showcase.db.common.ContextHelper;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.mongo.ShoppingCartLine; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.mongo.impl;
@Repository("mongoShoppingCartLineDao")
public class ShoppingCartLineDaoImpl extends DaoImpl<IShoppingCartLine> implements IShoppingCartLineDao
{
public ShoppingCartLineDaoImpl()
{
// super( (MongoTemplate) ContextHelper.getApplicationContext().getBean( "mongoTemplate" ) );
}
// public ShoppingCartLineDaoImpl(MongoTemplate mongoOps)
// {
// super(mongoOps);
// }
@Override
public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId)
{ | // Path: src/main/java/eu/cloudscale/showcase/db/common/ContextHelper.java
// public class ContextHelper
// {
// private static GenericXmlApplicationContext ctx = null;
//
// public static GenericXmlApplicationContext getApplicationContext()
// {
// if( ctx == null)
// {
// ctx = new GenericXmlApplicationContext();
// ctx.load("classpath:app-context.xml");
// ctx.refresh();
// }
//
// return ctx;
// }
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/mongo/ShoppingCartLine.java
// @Component
// @Document( collection = "shoppingCartLine" )
// public class ShoppingCartLine implements IShoppingCartLine, Serializable
// {
// // @Autowired
// // @Qualifier("service")
// // private IService service;
//
// private static final long serialVersionUID = 767045854888711002L;
//
// @Id
// private ObjectId id;
//
// @Indexed
// private Integer sclId;
//
// private Integer item;
//
// private Integer sclQty;
//
// private Integer shoppingCart;
//
// public ShoppingCartLine()
// {
// }
//
//
// public ObjectId getId()
// {
// return id;
// }
//
// public void setId(ObjectId id)
// {
// this.id = id;
// }
//
// @Override
// public IShoppingCart getShoppingCart()
// {
// return DatabaseHelper.getDatabase().findShoppingCartById( shoppingCart );
// }
//
// @Override
// public void setShoppingCart(IShoppingCart shoppingCart)
// {
// this.shoppingCart = shoppingCart.getScId();
// }
//
// @Override
// public Integer getSclId()
// {
// return this.sclId;
// }
//
// @Override
// public void setSclId(Integer sclScId)
// {
// this.sclId = sclScId;
// }
//
// @Override
// public IItem getItem()
// {
// IItem item = DatabaseHelper.getDatabase().findItemById( this.item );
// return item;
// }
//
// @Override
// public void setItem(IItem item)
// {
// this.item = item.getIId();
// }
//
// @Override
// public Integer getSclQty()
// {
// return this.sclQty;
// }
//
// @Override
// public void setSclQty(Integer sclQty)
// {
// this.sclQty = sclQty;
// }
// }
// Path: src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/ShoppingCartLineDaoImpl.java
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import eu.cloudscale.showcase.db.common.ContextHelper;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.mongo.ShoppingCartLine;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.mongo.impl;
@Repository("mongoShoppingCartLineDao")
public class ShoppingCartLineDaoImpl extends DaoImpl<IShoppingCartLine> implements IShoppingCartLineDao
{
public ShoppingCartLineDaoImpl()
{
// super( (MongoTemplate) ContextHelper.getApplicationContext().getBean( "mongoTemplate" ) );
}
// public ShoppingCartLineDaoImpl(MongoTemplate mongoOps)
// {
// super(mongoOps);
// }
@Override
public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId)
{ | IShoppingCartLine scl = mongoOps.findOne( Query.query( Criteria.where( "shoppingCart" ).is( shoppingId ).andOperator( Criteria.where( "item" ).is( itemId ) )), ShoppingCartLine.class ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
| import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.model.ICustomer;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/order-display")
public class OrderDisplayController extends AController
{
@SuppressWarnings( {"unchecked", "rawtypes" } )
@RequestMapping(method=RequestMethod.GET)
public String get(HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(OrderDisplayController.class, request);
if( session == null )
session = request.getSession(true);
Integer customerId = null;
try
{
customerId = Integer.parseInt( request.getParameter("C_ID") );
}
catch(Exception e) {}
Integer shoppingId = null;
try
{
shoppingId = Integer.parseInt( request.getParameter("SHOPPING_ID") );
}
catch(Exception e) {}
String uname = request.getParameter("username");
String passwd = request.getParameter("password");
ArrayList<String> errors = new ArrayList<String>();
| // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.model.ICustomer;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/order-display")
public class OrderDisplayController extends AController
{
@SuppressWarnings( {"unchecked", "rawtypes" } )
@RequestMapping(method=RequestMethod.GET)
public String get(HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(OrderDisplayController.class, request);
if( session == null )
session = request.getSession(true);
Integer customerId = null;
try
{
customerId = Integer.parseInt( request.getParameter("C_ID") );
}
catch(Exception e) {}
Integer shoppingId = null;
try
{
shoppingId = Integer.parseInt( request.getParameter("SHOPPING_ID") );
}
catch(Exception e) {}
String uname = request.getParameter("username");
String passwd = request.getParameter("password");
ArrayList<String> errors = new ArrayList<String>();
| IOrders order = null; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
| import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.model.ICustomer;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/order-display")
public class OrderDisplayController extends AController
{
@SuppressWarnings( {"unchecked", "rawtypes" } )
@RequestMapping(method=RequestMethod.GET)
public String get(HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(OrderDisplayController.class, request);
if( session == null )
session = request.getSession(true);
Integer customerId = null;
try
{
customerId = Integer.parseInt( request.getParameter("C_ID") );
}
catch(Exception e) {}
Integer shoppingId = null;
try
{
shoppingId = Integer.parseInt( request.getParameter("SHOPPING_ID") );
}
catch(Exception e) {}
String uname = request.getParameter("username");
String passwd = request.getParameter("password");
ArrayList<String> errors = new ArrayList<String>();
IOrders order = null; | // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.model.ICustomer;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/order-display")
public class OrderDisplayController extends AController
{
@SuppressWarnings( {"unchecked", "rawtypes" } )
@RequestMapping(method=RequestMethod.GET)
public String get(HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(OrderDisplayController.class, request);
if( session == null )
session = request.getSession(true);
Integer customerId = null;
try
{
customerId = Integer.parseInt( request.getParameter("C_ID") );
}
catch(Exception e) {}
Integer shoppingId = null;
try
{
shoppingId = Integer.parseInt( request.getParameter("SHOPPING_ID") );
}
catch(Exception e) {}
String uname = request.getParameter("username");
String passwd = request.getParameter("password");
ArrayList<String> errors = new ArrayList<String>();
IOrders order = null; | List<IOrderLine> orderLines = null; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
| import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.model.ICustomer;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders; | HttpSession session = super.getHttpSession(OrderDisplayController.class, request);
if( session == null )
session = request.getSession(true);
Integer customerId = null;
try
{
customerId = Integer.parseInt( request.getParameter("C_ID") );
}
catch(Exception e) {}
Integer shoppingId = null;
try
{
shoppingId = Integer.parseInt( request.getParameter("SHOPPING_ID") );
}
catch(Exception e) {}
String uname = request.getParameter("username");
String passwd = request.getParameter("password");
ArrayList<String> errors = new ArrayList<String>();
IOrders order = null;
List<IOrderLine> orderLines = null;
if (uname != null && passwd != null)
{
| // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/OrderDisplayController.java
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.model.ICustomer;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders;
HttpSession session = super.getHttpSession(OrderDisplayController.class, request);
if( session == null )
session = request.getSession(true);
Integer customerId = null;
try
{
customerId = Integer.parseInt( request.getParameter("C_ID") );
}
catch(Exception e) {}
Integer shoppingId = null;
try
{
shoppingId = Integer.parseInt( request.getParameter("SHOPPING_ID") );
}
catch(Exception e) {}
String uname = request.getParameter("username");
String passwd = request.getParameter("password");
ArrayList<String> errors = new ArrayList<String>();
IOrders order = null;
List<IOrderLine> orderLines = null;
if (uname != null && passwd != null)
{
| ICustomer customer = service.getUserBy( uname, passwd); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartLineDaoImpl.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCartLine.java
// @Entity
// @Table( name = "shopping_cart_line", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
// public class ShoppingCartLine implements IShoppingCartLine
// {
// private Integer sclId;
//
// private IItem item;
//
// private Integer sclQty;
//
// private IShoppingCart shoppingCart;
//
// public ShoppingCartLine()
// {
// }
//
// @ManyToOne( targetEntity=ShoppingCart.class, fetch = FetchType.LAZY )
// @JoinColumn( name = "SCL_SC_ID", nullable = false )
// @Override
// public IShoppingCart getShoppingCart()
// {
// return shoppingCart;
// }
//
// @Override
// public void setShoppingCart(IShoppingCart shoppingCart)
// {
// this.shoppingCart = shoppingCart;
// }
//
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SCL_ID", unique = true, nullable = false )
// @Override
// public Integer getSclId()
// {
// return this.sclId;
// }
//
// @Override
// public void setSclId( Integer sclScId )
// {
// this.sclId = sclScId;
// }
//
// @ManyToOne( targetEntity=Item.class, fetch = FetchType.EAGER )
// @JoinColumn( name = "SCL_I_ID", nullable = false )
// @Override
// public IItem getItem()
// {
// return this.item;
// }
//
// @Override
// public void setItem(IItem item)
// {
// this.item = item;
// }
//
// @Column( name = "SCL_QTY" )
// @Override
// public Integer getSclQty()
// {
// return this.sclQty;
// }
//
// @Override
// public void setSclQty(Integer sclQty)
// {
// this.sclQty = sclQty;
// }
// }
| import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCartLine; | Query q1 = getCurrentSession().createQuery( hql );
q1.setMaxResults( 1 );
q1.setParameter( "scId", scId);
List<Long> res = q1.list();
if( res != null && res.get(0) == 0 )
return true;
return false;
}
@SuppressWarnings( "unchecked" )
@Override
public List<Object[]> findBySCId(Integer shoppingId)
{
String hql = "SELECT SCL, I FROM ShoppingCartLine as SCL, Item as I WHERE SCL.item.IId = I.IId AND SCL.shoppingCart.scId = :scId";
Query q1 = getCurrentSession().createQuery( hql );
q1.setMaxResults( 1 );
q1.setParameter( "scId", shoppingId);
List<Object[]> res = q1.list();
if( res.isEmpty() )
return null;
return res;
}
@Override
public IShoppingCartLine getObject()
{ | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCartLine.java
// @Entity
// @Table( name = "shopping_cart_line", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
// public class ShoppingCartLine implements IShoppingCartLine
// {
// private Integer sclId;
//
// private IItem item;
//
// private Integer sclQty;
//
// private IShoppingCart shoppingCart;
//
// public ShoppingCartLine()
// {
// }
//
// @ManyToOne( targetEntity=ShoppingCart.class, fetch = FetchType.LAZY )
// @JoinColumn( name = "SCL_SC_ID", nullable = false )
// @Override
// public IShoppingCart getShoppingCart()
// {
// return shoppingCart;
// }
//
// @Override
// public void setShoppingCart(IShoppingCart shoppingCart)
// {
// this.shoppingCart = shoppingCart;
// }
//
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SCL_ID", unique = true, nullable = false )
// @Override
// public Integer getSclId()
// {
// return this.sclId;
// }
//
// @Override
// public void setSclId( Integer sclScId )
// {
// this.sclId = sclScId;
// }
//
// @ManyToOne( targetEntity=Item.class, fetch = FetchType.EAGER )
// @JoinColumn( name = "SCL_I_ID", nullable = false )
// @Override
// public IItem getItem()
// {
// return this.item;
// }
//
// @Override
// public void setItem(IItem item)
// {
// this.item = item;
// }
//
// @Column( name = "SCL_QTY" )
// @Override
// public Integer getSclQty()
// {
// return this.sclQty;
// }
//
// @Override
// public void setSclQty(Integer sclQty)
// {
// this.sclQty = sclQty;
// }
// }
// Path: src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartLineDaoImpl.java
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCartLine;
Query q1 = getCurrentSession().createQuery( hql );
q1.setMaxResults( 1 );
q1.setParameter( "scId", scId);
List<Long> res = q1.list();
if( res != null && res.get(0) == 0 )
return true;
return false;
}
@SuppressWarnings( "unchecked" )
@Override
public List<Object[]> findBySCId(Integer shoppingId)
{
String hql = "SELECT SCL, I FROM ShoppingCartLine as SCL, Item as I WHERE SCL.item.IId = I.IId AND SCL.shoppingCart.scId = :scId";
Query q1 = getCurrentSession().createQuery( hql );
q1.setMaxResults( 1 );
q1.setParameter( "scId", shoppingId);
List<Object[]> res = q1.list();
if( res.isEmpty() )
return null;
return res;
}
@Override
public IShoppingCartLine getObject()
{ | return new ShoppingCartLine(); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCartLine.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCartLine generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCartLine.java
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCartLine generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) | public class ShoppingCartLine implements IShoppingCartLine |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCartLine.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCartLine generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ShoppingCartLine implements IShoppingCartLine
{
private Integer sclId;
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCartLine.java
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCartLine generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ShoppingCartLine implements IShoppingCartLine
{
private Integer sclId;
| private IItem item; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCartLine.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCartLine generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ShoppingCartLine implements IShoppingCartLine
{
private Integer sclId;
private IItem item;
private Integer sclQty;
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCartLine.java
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCartLine generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ShoppingCartLine implements IShoppingCartLine
{
private Integer sclId;
private IItem item;
private Integer sclQty;
| private IShoppingCart shoppingCart; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/common/DatabaseHelper.java | // Path: src/main/java/eu/cloudscale/showcase/db/services/IService.java
// public interface IService
// {
//
// public List getNewProducts(String category);
//
// public IShoppingCart doCart(IShoppingCart sc, Integer itemId,
// List<Integer> ids, List<Integer> quantities);
//
// public BuyConfirmResult doBuyConfirm(Integer shoppingId, Integer customerId,
// String ccType, long ccNumber, String ccName, Date ccExpiry,
// String shipping, String street1, String street2, String city,
// String state, String zip, String country);
//
// public BuyConfirmResult doBuyConfirm(Integer shoppingId, Integer customerId,
// String ccType, Long ccNumber, String ccName, Date ccExpiry,
// String shipping);
//
// public List<IItem> searchByAuthor(String keyword);
//
// public List<IItem> searchByTitle(String keyword);
//
// public List<IItem> searchBySubject(String keyword);
//
// public List<Object[]> getBestSellers(String category);
//
// public IShoppingCart createEmptyCart();
//
// public IShoppingCart findShoppingCartById(Integer shoppingId);
//
// public List<IItem> getPromotional();
//
// boolean countryExist(String country);
//
// public ICustomer getUserBy(String uname, String passwd);
//
// public ICustomer getCustomerObject();
//
// public IAddress getAddressObject();
//
// public ICountry getCountryByName(String country);
//
// public void saveAddress(IAddress address);
//
// public void saveCustomer(ICustomer customer);
//
// public ICustomer findCustomerById(Integer customerId);
//
// public IOrders getMostRecentOrder(ICustomer customer);
//
// public List<IOrderLine> findAllOrderLineByOrder(IOrders order);
//
// public IItem findItemById(Integer itemId);
//
// List findAllShoppingCartLinesBySC(IShoppingCart shoppingCart);
//
// ICcXacts findCcXactsById(Integer ccXactId);
//
// IOrderLine findOrderLineById(Integer olId);
//
// IAuthor findAuthorById(Integer cxAuthId);
//
// IOrders findOrdersById(Integer cxOId);
//
// List<ICustomer> findCustomerByAddress(IAddress address);
//
// ICountry getCountryById(Integer coId);
//
// IAddress findAddressById(Integer addrId);
//
// public void saveItem(IItem item);
//
// }
| import eu.cloudscale.showcase.db.services.IService; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.common;
public class DatabaseHelper
{
| // Path: src/main/java/eu/cloudscale/showcase/db/services/IService.java
// public interface IService
// {
//
// public List getNewProducts(String category);
//
// public IShoppingCart doCart(IShoppingCart sc, Integer itemId,
// List<Integer> ids, List<Integer> quantities);
//
// public BuyConfirmResult doBuyConfirm(Integer shoppingId, Integer customerId,
// String ccType, long ccNumber, String ccName, Date ccExpiry,
// String shipping, String street1, String street2, String city,
// String state, String zip, String country);
//
// public BuyConfirmResult doBuyConfirm(Integer shoppingId, Integer customerId,
// String ccType, Long ccNumber, String ccName, Date ccExpiry,
// String shipping);
//
// public List<IItem> searchByAuthor(String keyword);
//
// public List<IItem> searchByTitle(String keyword);
//
// public List<IItem> searchBySubject(String keyword);
//
// public List<Object[]> getBestSellers(String category);
//
// public IShoppingCart createEmptyCart();
//
// public IShoppingCart findShoppingCartById(Integer shoppingId);
//
// public List<IItem> getPromotional();
//
// boolean countryExist(String country);
//
// public ICustomer getUserBy(String uname, String passwd);
//
// public ICustomer getCustomerObject();
//
// public IAddress getAddressObject();
//
// public ICountry getCountryByName(String country);
//
// public void saveAddress(IAddress address);
//
// public void saveCustomer(ICustomer customer);
//
// public ICustomer findCustomerById(Integer customerId);
//
// public IOrders getMostRecentOrder(ICustomer customer);
//
// public List<IOrderLine> findAllOrderLineByOrder(IOrders order);
//
// public IItem findItemById(Integer itemId);
//
// List findAllShoppingCartLinesBySC(IShoppingCart shoppingCart);
//
// ICcXacts findCcXactsById(Integer ccXactId);
//
// IOrderLine findOrderLineById(Integer olId);
//
// IAuthor findAuthorById(Integer cxAuthId);
//
// IOrders findOrdersById(Integer cxOId);
//
// List<ICustomer> findCustomerByAddress(IAddress address);
//
// ICountry getCountryById(Integer coId);
//
// IAddress findAddressById(Integer addrId);
//
// public void saveItem(IItem item);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/common/DatabaseHelper.java
import eu.cloudscale.showcase.db.services.IService;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.common;
public class DatabaseHelper
{
| public static IService getDatabase() |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/IDao.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
| import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
| // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/IDao.java
import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
| public IItemDao getItemDao(); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/IDao.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
| import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
public IItemDao getItemDao();
| // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/IDao.java
import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
public IItemDao getItemDao();
| public IShoppingCartLineDao getShoppingCartLineDao(); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/IDao.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
| import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
public IItemDao getItemDao();
public IShoppingCartLineDao getShoppingCartLineDao();
| // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/IDao.java
import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
public IItemDao getItemDao();
public IShoppingCartLineDao getShoppingCartLineDao();
| public IShoppingCartDao getShoppingCartDao(); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/IDao.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
| import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
public IItemDao getItemDao();
public IShoppingCartLineDao getShoppingCartLineDao();
public IShoppingCartDao getShoppingCartDao();
| // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/IDao.java
import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
public IItemDao getItemDao();
public IShoppingCartLineDao getShoppingCartLineDao();
public IShoppingCartDao getShoppingCartDao();
| public IAddressDao getAddressDao(); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/IDao.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
| import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
public IItemDao getItemDao();
public IShoppingCartLineDao getShoppingCartLineDao();
public IShoppingCartDao getShoppingCartDao();
public IAddressDao getAddressDao();
| // Path: src/main/java/eu/cloudscale/showcase/db/dao/IAddressDao.java
// public interface IAddressDao extends IDao<IAddress>
// {
// public List<IAddress> findAll();
//
// public IAddress findById(int id);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICustomerDao.java
// public interface ICustomerDao extends IDao<ICustomer>
// {
//
// public ICustomer findById(Integer id);
//
// public ICustomer getUserBy(String username, String password);
//
// public List<ICustomer> findByAddress(IAddress addrId);
//
//
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartLineDao.java
// public interface IShoppingCartLineDao extends IDao<IShoppingCartLine>
// {
//
// public IShoppingCartLine getBySCandItem(Integer shoppingId, int itemId);
//
// public void delete(IShoppingCartLine bySCandItem);
//
// public boolean isCartEmpty(int scId);
//
// public List<Object[]> findBySCId(Integer shoppingId);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/IDao.java
import eu.cloudscale.showcase.db.dao.IAddressDao;
import eu.cloudscale.showcase.db.dao.ICustomerDao;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.dao.IShoppingCartLineDao;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public interface IDao
{
public IItemDao getItemDao();
public IShoppingCartLineDao getShoppingCartLineDao();
public IShoppingCartDao getShoppingCartDao();
public IAddressDao getAddressDao();
| public ICustomerDao getCustomerDao(); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/ProductDetailServlet.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
| import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.model.IItem; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/product-detail")
public class ProductDetailServlet extends AController
{
@RequestMapping(method = RequestMethod.GET)
public String get(
@RequestParam(value= "I_ID", required=false) Integer itemId,
@RequestParam(value = "C_ID", required=false ) Integer customerId,
@RequestParam(value = "SHOPPING_ID", required=false) Integer shoppingId,
HttpServletRequest request,
Locale locale,
Model model)
{
HttpSession session = super.getHttpSession(ProductDetailServlet.class, request);
| // Path: src/main/java/eu/cloudscale/showcase/db/dao/IItemDao.java
// public interface IItemDao extends IDao<IItem>
// {
// public List<IItem> findAll();
// public IItem findById(int id);
// public List<IItem> getPromotional();
// public List<IItem> getNewProducts(String category);
// public List<Object[]> getBestSellers(String category);
// public IItem getRandomItem();
// public IItem getObject();
// public List<IItem> findAllByAuthor(IAuthor author);
// public List<IItem> findAllByTitle(String keyword);
// public List<IItem> findAllBySubject(String keyword);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/ProductDetailServlet.java
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import eu.cloudscale.showcase.db.dao.IItemDao;
import eu.cloudscale.showcase.db.model.IItem;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/product-detail")
public class ProductDetailServlet extends AController
{
@RequestMapping(method = RequestMethod.GET)
public String get(
@RequestParam(value= "I_ID", required=false) Integer itemId,
@RequestParam(value = "C_ID", required=false ) Integer customerId,
@RequestParam(value = "SHOPPING_ID", required=false) Integer shoppingId,
HttpServletRequest request,
Locale locale,
Model model)
{
HttpSession session = super.getHttpSession(ProductDetailServlet.class, request);
| IItem item = service.findItemById(itemId); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/OrderLine.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* OrderLine generated by hbm2java
*/
@Entity
@Table( name = "order_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/OrderLine.java
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* OrderLine generated by hbm2java
*/
@Entity
@Table( name = "order_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
| public class OrderLine implements IOrderLine |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/OrderLine.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* OrderLine generated by hbm2java
*/
@Entity
@Table( name = "order_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class OrderLine implements IOrderLine
{
private Integer id;
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/OrderLine.java
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* OrderLine generated by hbm2java
*/
@Entity
@Table( name = "order_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class OrderLine implements IOrderLine
{
private Integer id;
| private IOrders orders; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/OrderLine.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* OrderLine generated by hbm2java
*/
@Entity
@Table( name = "order_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class OrderLine implements IOrderLine
{
private Integer id;
private IOrders orders;
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/OrderLine.java
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IOrders;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* OrderLine generated by hbm2java
*/
@Entity
@Table( name = "order_line", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class OrderLine implements IOrderLine
{
private Integer id;
private IOrders orders;
| private IItem item; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/CountryDaoImpl.java | // Path: src/main/java/eu/cloudscale/showcase/db/common/ContextHelper.java
// public class ContextHelper
// {
// private static GenericXmlApplicationContext ctx = null;
//
// public static GenericXmlApplicationContext getApplicationContext()
// {
// if( ctx == null)
// {
// ctx = new GenericXmlApplicationContext();
// ctx.load("classpath:app-context.xml");
// ctx.refresh();
// }
//
// return ctx;
// }
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICountryDao.java
// public interface ICountryDao extends IDao<ICountry>
// {
//
// public ICountry findById(int id);
//
// public ICountry getByName(String country);
//
// public void createTable();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/mongo/Country.java
// @Document( collection = "country" )
// public class Country implements ICountry, Serializable
// {
//
// /**
// *
// */
// private static final long serialVersionUID = 2938841459454938022L;
//
// @Id
// private ObjectId id;
//
// @Indexed
// private Integer coId;
//
// @Indexed
// private String coName;
//
// private Double coExchange;
//
// private String coCurrency;
//
// public Country()
// {
// }
//
// public ObjectId getId()
// {
// return id;
// }
//
// public void setId(ObjectId id)
// {
// this.id = id;
// }
//
// @Override
// public Integer getCoId()
// {
// return this.coId;
// }
//
// @Override
// public void setCoId(Integer coId)
// {
// this.coId = coId;
// }
//
// @Override
// public String getCoName()
// {
// return this.coName;
// }
//
// @Override
// public void setCoName(String coName)
// {
// this.coName = coName;
// }
//
// @Override
// public Double getCoExchange()
// {
// return this.coExchange;
// }
//
// @Override
// public void setCoExchange(Double coExchange)
// {
// this.coExchange = coExchange;
// }
//
// @Override
// public String getCoCurrency()
// {
// return this.coCurrency;
// }
//
// @Override
// public void setCoCurrency(String coCurrency)
// {
// this.coCurrency = coCurrency;
// }
//
// }
| import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import eu.cloudscale.showcase.db.common.ContextHelper;
import eu.cloudscale.showcase.db.dao.ICountryDao;
import eu.cloudscale.showcase.db.model.ICountry;
import eu.cloudscale.showcase.db.model.mongo.Country; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.mongo.impl;
@Repository("mongoCountryDao")
public class CountryDaoImpl extends DaoImpl<ICountry> implements ICountryDao
{
public CountryDaoImpl()
{
// super( (MongoTemplate) ContextHelper.getApplicationContext().getBean( "mongoTemplate" ) );
}
@Override
public ICountry findById(int id)
{ | // Path: src/main/java/eu/cloudscale/showcase/db/common/ContextHelper.java
// public class ContextHelper
// {
// private static GenericXmlApplicationContext ctx = null;
//
// public static GenericXmlApplicationContext getApplicationContext()
// {
// if( ctx == null)
// {
// ctx = new GenericXmlApplicationContext();
// ctx.load("classpath:app-context.xml");
// ctx.refresh();
// }
//
// return ctx;
// }
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/dao/ICountryDao.java
// public interface ICountryDao extends IDao<ICountry>
// {
//
// public ICountry findById(int id);
//
// public ICountry getByName(String country);
//
// public void createTable();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/mongo/Country.java
// @Document( collection = "country" )
// public class Country implements ICountry, Serializable
// {
//
// /**
// *
// */
// private static final long serialVersionUID = 2938841459454938022L;
//
// @Id
// private ObjectId id;
//
// @Indexed
// private Integer coId;
//
// @Indexed
// private String coName;
//
// private Double coExchange;
//
// private String coCurrency;
//
// public Country()
// {
// }
//
// public ObjectId getId()
// {
// return id;
// }
//
// public void setId(ObjectId id)
// {
// this.id = id;
// }
//
// @Override
// public Integer getCoId()
// {
// return this.coId;
// }
//
// @Override
// public void setCoId(Integer coId)
// {
// this.coId = coId;
// }
//
// @Override
// public String getCoName()
// {
// return this.coName;
// }
//
// @Override
// public void setCoName(String coName)
// {
// this.coName = coName;
// }
//
// @Override
// public Double getCoExchange()
// {
// return this.coExchange;
// }
//
// @Override
// public void setCoExchange(Double coExchange)
// {
// this.coExchange = coExchange;
// }
//
// @Override
// public String getCoCurrency()
// {
// return this.coCurrency;
// }
//
// @Override
// public void setCoCurrency(String coCurrency)
// {
// this.coCurrency = coCurrency;
// }
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/dao/mongo/impl/CountryDaoImpl.java
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import eu.cloudscale.showcase.db.common.ContextHelper;
import eu.cloudscale.showcase.db.dao.ICountryDao;
import eu.cloudscale.showcase.db.model.ICountry;
import eu.cloudscale.showcase.db.model.mongo.Country;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.mongo.impl;
@Repository("mongoCountryDao")
public class CountryDaoImpl extends DaoImpl<ICountry> implements ICountryDao
{
public CountryDaoImpl()
{
// super( (MongoTemplate) ContextHelper.getApplicationContext().getBean( "mongoTemplate" ) );
}
@Override
public ICountry findById(int id)
{ | return mongoOps.findOne( Query.query( Criteria.where( "coId" ).is(id) ), Country.class ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/Item.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAuthor.java
// public interface IAuthor
// {
//
// public Integer getAId();
//
// public void setAId(Integer AId);
//
// public String getAFname();
//
// public void setAFname(String AFname);
//
// public String getALname();
//
// public void setALname(String ALname);
//
// public String getAMname();
//
// public void setAMname(String AMname);
//
// public Date getADob();
//
// public void setADob(Date ADob);
//
// public String getABio();
//
// public void setABio(String ABio);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Index;
import eu.cloudscale.showcase.db.model.IAuthor;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IShoppingCartLine; | private Integer IRelated3;
private Integer IRelated4;
private Integer IRelated5;
private String IThumbnail;
private String IImage;
private Double ISrp;
private Double ICost;
private Date IAvail;
private Integer IStock;
private String IIsbn;
private String IPage;
private String IBacking;
private String IDimension;
private double IRandom;
private Set<IOrderLine> orderLines = new HashSet<IOrderLine>( 0 );
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IAuthor.java
// public interface IAuthor
// {
//
// public Integer getAId();
//
// public void setAId(Integer AId);
//
// public String getAFname();
//
// public void setAFname(String AFname);
//
// public String getALname();
//
// public void setALname(String ALname);
//
// public String getAMname();
//
// public void setAMname(String AMname);
//
// public Date getADob();
//
// public void setADob(Date ADob);
//
// public String getABio();
//
// public void setABio(String ABio);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IItem.java
// public interface IItem
// {
//
// public Integer getIId();
//
// public void setIDimension(String IDimension);
//
// public String getIDimension();
//
// public void setIBacking(String IBacking);
//
// public String getIBacking();
//
// public void setIPage(String IPage);
//
// public String getIPage();
//
// public void setIIsbn(String IIsbn);
//
// public String getIIsbn();
//
// public void setIStock(Integer IStock);
//
// public Integer getIStock();
//
// public void setIAvail(Date IAvail);
//
// public Date getIAvail();
//
// public void setICost(Double i_COST);
//
// public Double getICost();
//
// public void setISrp(Double i_SRP);
//
// public Double getISrp();
//
// public void setIImage(String IImage);
//
// public String getIImage();
//
// public void setIThumbnail(String IThumbnail);
//
// public String getIThumbnail();
//
// public void setIRelated5(Integer IRelated5);
//
// public Integer getIRelated5();
//
// public void setIRelated4(Integer IRelated4);
//
// public Integer getIRelated4();
//
// public void setIRelated3(Integer IRelated3);
//
// public Integer getIRelated3();
//
// public void setIRelated2(Integer IRelated2);
//
// public Integer getIRelated2();
//
// public void setIRelated1(Integer IRelated1);
//
// public Integer getIRelated1();
//
// public void setIDesc(String IDesc);
//
// public String getIDesc();
//
// public void setISubject(String ISubject);
//
// public String getISubject();
//
// public void setIPublisher(String IPublisher);
//
// public String getIPublisher();
//
// public void setIPubDate(Date IPubDate);
//
// public Date getIPubDate();
//
// public void setITitle(String ITitle);
//
// public String getITitle();
//
// public void setAuthor(IAuthor author);
//
// public IAuthor getAuthor();
//
// public void setIId(Integer IId);
//
// public double getIRandom();
//
// public void setIRandom(double num);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IOrderLine.java
// public interface IOrderLine
// {
//
// public Integer getOlId();
//
// public void setOlId(Integer olId);
//
// public IOrders getOrders();
//
// public void setOrders(IOrders orders);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getOlQty();
//
// public void setOlQty(Integer olQty);
//
// public Double getOlDiscount();
//
// public void setOlDiscount(Double oL_DISCOUNT);
//
// public String getOlComment();
//
// public void setOlComment(String olComment);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/Item.java
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Index;
import eu.cloudscale.showcase.db.model.IAuthor;
import eu.cloudscale.showcase.db.model.IItem;
import eu.cloudscale.showcase.db.model.IOrderLine;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
private Integer IRelated3;
private Integer IRelated4;
private Integer IRelated5;
private String IThumbnail;
private String IImage;
private Double ISrp;
private Double ICost;
private Date IAvail;
private Integer IStock;
private String IIsbn;
private String IPage;
private String IBacking;
private String IDimension;
private double IRandom;
private Set<IOrderLine> orderLines = new HashSet<IOrderLine>( 0 );
| private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/Country.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAddress.java
// public interface IAddress
// {
//
// public Integer getAddrId();
//
// public void setAddrId(Integer addrId);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public String getAddrStreet1();
//
// public void setAddrStreet1(String addrStreet1);
//
// public String getAddrStreet2();
//
// public void setAddrStreet2(String addrStreet2);
//
// public String getAddrCity();
//
// public void setAddrCity(String addrCity);
//
// public String getAddrState();
//
// public void setAddrState(String addrState);
//
// public String getAddrZip();
//
// public void setAddrZip(String addrZip);
//
// public Set<ICustomer> getCustomers();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
// public interface ICcXacts
// {
//
// public Integer getId();
//
// public void setId(Integer id);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public IOrders getOrders();
//
// public String getCxType();
//
// public void setCxType(String cxType);
//
// public Integer getCxNum();
//
// public void setCxNum(Integer cxNum);
//
// public String getCxName();
//
// public void setCxName(String cxName);
//
// public Date getCxExpiry();
//
// public void setCxExpiry(Date cxExpiry);
//
// public String getCxAuthId();
//
// public void setCxAuthId(String cxAuthId);
//
// public Double getCxXactAmt();
//
// public void setCxXactAmt(Double o_TOTAL);
//
// public Date getCxXactDate();
//
// public void setCxXactDate(Date cxXactDate);
//
// public void setOrders(IOrders orders);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IAddress;
import eu.cloudscale.showcase.db.model.ICcXacts;
import eu.cloudscale.showcase.db.model.ICountry; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Country generated by hbm2java
*/
@Entity
@Table( name = "country", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAddress.java
// public interface IAddress
// {
//
// public Integer getAddrId();
//
// public void setAddrId(Integer addrId);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public String getAddrStreet1();
//
// public void setAddrStreet1(String addrStreet1);
//
// public String getAddrStreet2();
//
// public void setAddrStreet2(String addrStreet2);
//
// public String getAddrCity();
//
// public void setAddrCity(String addrCity);
//
// public String getAddrState();
//
// public void setAddrState(String addrState);
//
// public String getAddrZip();
//
// public void setAddrZip(String addrZip);
//
// public Set<ICustomer> getCustomers();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
// public interface ICcXacts
// {
//
// public Integer getId();
//
// public void setId(Integer id);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public IOrders getOrders();
//
// public String getCxType();
//
// public void setCxType(String cxType);
//
// public Integer getCxNum();
//
// public void setCxNum(Integer cxNum);
//
// public String getCxName();
//
// public void setCxName(String cxName);
//
// public Date getCxExpiry();
//
// public void setCxExpiry(Date cxExpiry);
//
// public String getCxAuthId();
//
// public void setCxAuthId(String cxAuthId);
//
// public Double getCxXactAmt();
//
// public void setCxXactAmt(Double o_TOTAL);
//
// public Date getCxXactDate();
//
// public void setCxXactDate(Date cxXactDate);
//
// public void setOrders(IOrders orders);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/Country.java
import static javax.persistence.GenerationType.IDENTITY;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IAddress;
import eu.cloudscale.showcase.db.model.ICcXacts;
import eu.cloudscale.showcase.db.model.ICountry;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Country generated by hbm2java
*/
@Entity
@Table( name = "country", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) | public class Country implements ICountry |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/Country.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAddress.java
// public interface IAddress
// {
//
// public Integer getAddrId();
//
// public void setAddrId(Integer addrId);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public String getAddrStreet1();
//
// public void setAddrStreet1(String addrStreet1);
//
// public String getAddrStreet2();
//
// public void setAddrStreet2(String addrStreet2);
//
// public String getAddrCity();
//
// public void setAddrCity(String addrCity);
//
// public String getAddrState();
//
// public void setAddrState(String addrState);
//
// public String getAddrZip();
//
// public void setAddrZip(String addrZip);
//
// public Set<ICustomer> getCustomers();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
// public interface ICcXacts
// {
//
// public Integer getId();
//
// public void setId(Integer id);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public IOrders getOrders();
//
// public String getCxType();
//
// public void setCxType(String cxType);
//
// public Integer getCxNum();
//
// public void setCxNum(Integer cxNum);
//
// public String getCxName();
//
// public void setCxName(String cxName);
//
// public Date getCxExpiry();
//
// public void setCxExpiry(Date cxExpiry);
//
// public String getCxAuthId();
//
// public void setCxAuthId(String cxAuthId);
//
// public Double getCxXactAmt();
//
// public void setCxXactAmt(Double o_TOTAL);
//
// public Date getCxXactDate();
//
// public void setCxXactDate(Date cxXactDate);
//
// public void setOrders(IOrders orders);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IAddress;
import eu.cloudscale.showcase.db.model.ICcXacts;
import eu.cloudscale.showcase.db.model.ICountry; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Country generated by hbm2java
*/
@Entity
@Table( name = "country", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Country implements ICountry
{
private Integer coId;
private String coName;
private Double coExchange;
private String coCurrency;
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IAddress.java
// public interface IAddress
// {
//
// public Integer getAddrId();
//
// public void setAddrId(Integer addrId);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public String getAddrStreet1();
//
// public void setAddrStreet1(String addrStreet1);
//
// public String getAddrStreet2();
//
// public void setAddrStreet2(String addrStreet2);
//
// public String getAddrCity();
//
// public void setAddrCity(String addrCity);
//
// public String getAddrState();
//
// public void setAddrState(String addrState);
//
// public String getAddrZip();
//
// public void setAddrZip(String addrZip);
//
// public Set<ICustomer> getCustomers();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
// public interface ICcXacts
// {
//
// public Integer getId();
//
// public void setId(Integer id);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public IOrders getOrders();
//
// public String getCxType();
//
// public void setCxType(String cxType);
//
// public Integer getCxNum();
//
// public void setCxNum(Integer cxNum);
//
// public String getCxName();
//
// public void setCxName(String cxName);
//
// public Date getCxExpiry();
//
// public void setCxExpiry(Date cxExpiry);
//
// public String getCxAuthId();
//
// public void setCxAuthId(String cxAuthId);
//
// public Double getCxXactAmt();
//
// public void setCxXactAmt(Double o_TOTAL);
//
// public Date getCxXactDate();
//
// public void setCxXactDate(Date cxXactDate);
//
// public void setOrders(IOrders orders);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/Country.java
import static javax.persistence.GenerationType.IDENTITY;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IAddress;
import eu.cloudscale.showcase.db.model.ICcXacts;
import eu.cloudscale.showcase.db.model.ICountry;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Country generated by hbm2java
*/
@Entity
@Table( name = "country", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Country implements ICountry
{
private Integer coId;
private String coName;
private Double coExchange;
private String coCurrency;
| private Set<IAddress> addresses = new HashSet<IAddress>( 0 ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/Country.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IAddress.java
// public interface IAddress
// {
//
// public Integer getAddrId();
//
// public void setAddrId(Integer addrId);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public String getAddrStreet1();
//
// public void setAddrStreet1(String addrStreet1);
//
// public String getAddrStreet2();
//
// public void setAddrStreet2(String addrStreet2);
//
// public String getAddrCity();
//
// public void setAddrCity(String addrCity);
//
// public String getAddrState();
//
// public void setAddrState(String addrState);
//
// public String getAddrZip();
//
// public void setAddrZip(String addrZip);
//
// public Set<ICustomer> getCustomers();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
// public interface ICcXacts
// {
//
// public Integer getId();
//
// public void setId(Integer id);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public IOrders getOrders();
//
// public String getCxType();
//
// public void setCxType(String cxType);
//
// public Integer getCxNum();
//
// public void setCxNum(Integer cxNum);
//
// public String getCxName();
//
// public void setCxName(String cxName);
//
// public Date getCxExpiry();
//
// public void setCxExpiry(Date cxExpiry);
//
// public String getCxAuthId();
//
// public void setCxAuthId(String cxAuthId);
//
// public Double getCxXactAmt();
//
// public void setCxXactAmt(Double o_TOTAL);
//
// public Date getCxXactDate();
//
// public void setCxXactDate(Date cxXactDate);
//
// public void setOrders(IOrders orders);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
| import static javax.persistence.GenerationType.IDENTITY;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IAddress;
import eu.cloudscale.showcase.db.model.ICcXacts;
import eu.cloudscale.showcase.db.model.ICountry; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Country generated by hbm2java
*/
@Entity
@Table( name = "country", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Country implements ICountry
{
private Integer coId;
private String coName;
private Double coExchange;
private String coCurrency;
private Set<IAddress> addresses = new HashSet<IAddress>( 0 );
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IAddress.java
// public interface IAddress
// {
//
// public Integer getAddrId();
//
// public void setAddrId(Integer addrId);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public String getAddrStreet1();
//
// public void setAddrStreet1(String addrStreet1);
//
// public String getAddrStreet2();
//
// public void setAddrStreet2(String addrStreet2);
//
// public String getAddrCity();
//
// public void setAddrCity(String addrCity);
//
// public String getAddrState();
//
// public void setAddrState(String addrState);
//
// public String getAddrZip();
//
// public void setAddrZip(String addrZip);
//
// public Set<ICustomer> getCustomers();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICcXacts.java
// public interface ICcXacts
// {
//
// public Integer getId();
//
// public void setId(Integer id);
//
// public ICountry getCountry();
//
// public void setCountry(ICountry country);
//
// public IOrders getOrders();
//
// public String getCxType();
//
// public void setCxType(String cxType);
//
// public Integer getCxNum();
//
// public void setCxNum(Integer cxNum);
//
// public String getCxName();
//
// public void setCxName(String cxName);
//
// public Date getCxExpiry();
//
// public void setCxExpiry(Date cxExpiry);
//
// public String getCxAuthId();
//
// public void setCxAuthId(String cxAuthId);
//
// public Double getCxXactAmt();
//
// public void setCxXactAmt(Double o_TOTAL);
//
// public Date getCxXactDate();
//
// public void setCxXactDate(Date cxXactDate);
//
// public void setOrders(IOrders orders);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/Country.java
import static javax.persistence.GenerationType.IDENTITY;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import eu.cloudscale.showcase.db.model.IAddress;
import eu.cloudscale.showcase.db.model.ICcXacts;
import eu.cloudscale.showcase.db.model.ICountry;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* Country generated by hbm2java
*/
@Entity
@Table( name = "country", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Country implements ICountry
{
private Integer coId;
private String coName;
private Double coExchange;
private String coCurrency;
private Set<IAddress> addresses = new HashSet<IAddress>( 0 );
| private Set<ICcXacts> ccXactses = new HashSet<ICcXacts>( 0 ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/AController.java | // Path: src/main/java/eu/cloudscale/showcase/db/common/DatabaseHelper.java
// public class DatabaseHelper
// {
//
// public static IService getDatabase()
// {
//
// IService db = (IService) ContextHelper.getApplicationContext().getBean( "service" );
// if (db == null)
// {
// System.out.println("Service is null");
// }
// return db;
//
// }
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/services/IService.java
// public interface IService
// {
//
// public List getNewProducts(String category);
//
// public IShoppingCart doCart(IShoppingCart sc, Integer itemId,
// List<Integer> ids, List<Integer> quantities);
//
// public BuyConfirmResult doBuyConfirm(Integer shoppingId, Integer customerId,
// String ccType, long ccNumber, String ccName, Date ccExpiry,
// String shipping, String street1, String street2, String city,
// String state, String zip, String country);
//
// public BuyConfirmResult doBuyConfirm(Integer shoppingId, Integer customerId,
// String ccType, Long ccNumber, String ccName, Date ccExpiry,
// String shipping);
//
// public List<IItem> searchByAuthor(String keyword);
//
// public List<IItem> searchByTitle(String keyword);
//
// public List<IItem> searchBySubject(String keyword);
//
// public List<Object[]> getBestSellers(String category);
//
// public IShoppingCart createEmptyCart();
//
// public IShoppingCart findShoppingCartById(Integer shoppingId);
//
// public List<IItem> getPromotional();
//
// boolean countryExist(String country);
//
// public ICustomer getUserBy(String uname, String passwd);
//
// public ICustomer getCustomerObject();
//
// public IAddress getAddressObject();
//
// public ICountry getCountryByName(String country);
//
// public void saveAddress(IAddress address);
//
// public void saveCustomer(ICustomer customer);
//
// public ICustomer findCustomerById(Integer customerId);
//
// public IOrders getMostRecentOrder(ICustomer customer);
//
// public List<IOrderLine> findAllOrderLineByOrder(IOrders order);
//
// public IItem findItemById(Integer itemId);
//
// List findAllShoppingCartLinesBySC(IShoppingCart shoppingCart);
//
// ICcXacts findCcXactsById(Integer ccXactId);
//
// IOrderLine findOrderLineById(Integer olId);
//
// IAuthor findAuthorById(Integer cxAuthId);
//
// IOrders findOrdersById(Integer cxOId);
//
// List<ICustomer> findCustomerByAddress(IAddress address);
//
// ICountry getCountryById(Integer coId);
//
// IAddress findAddressById(Integer addrId);
//
// public void saveItem(IItem item);
//
// }
| import java.io.IOException;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.ui.Model;
import eu.cloudscale.showcase.db.common.DatabaseHelper;
import eu.cloudscale.showcase.db.services.IService; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
public abstract class AController
{
@Autowired
@Qualifier("service") | // Path: src/main/java/eu/cloudscale/showcase/db/common/DatabaseHelper.java
// public class DatabaseHelper
// {
//
// public static IService getDatabase()
// {
//
// IService db = (IService) ContextHelper.getApplicationContext().getBean( "service" );
// if (db == null)
// {
// System.out.println("Service is null");
// }
// return db;
//
// }
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/services/IService.java
// public interface IService
// {
//
// public List getNewProducts(String category);
//
// public IShoppingCart doCart(IShoppingCart sc, Integer itemId,
// List<Integer> ids, List<Integer> quantities);
//
// public BuyConfirmResult doBuyConfirm(Integer shoppingId, Integer customerId,
// String ccType, long ccNumber, String ccName, Date ccExpiry,
// String shipping, String street1, String street2, String city,
// String state, String zip, String country);
//
// public BuyConfirmResult doBuyConfirm(Integer shoppingId, Integer customerId,
// String ccType, Long ccNumber, String ccName, Date ccExpiry,
// String shipping);
//
// public List<IItem> searchByAuthor(String keyword);
//
// public List<IItem> searchByTitle(String keyword);
//
// public List<IItem> searchBySubject(String keyword);
//
// public List<Object[]> getBestSellers(String category);
//
// public IShoppingCart createEmptyCart();
//
// public IShoppingCart findShoppingCartById(Integer shoppingId);
//
// public List<IItem> getPromotional();
//
// boolean countryExist(String country);
//
// public ICustomer getUserBy(String uname, String passwd);
//
// public ICustomer getCustomerObject();
//
// public IAddress getAddressObject();
//
// public ICountry getCountryByName(String country);
//
// public void saveAddress(IAddress address);
//
// public void saveCustomer(ICustomer customer);
//
// public ICustomer findCustomerById(Integer customerId);
//
// public IOrders getMostRecentOrder(ICustomer customer);
//
// public List<IOrderLine> findAllOrderLineByOrder(IOrders order);
//
// public IItem findItemById(Integer itemId);
//
// List findAllShoppingCartLinesBySC(IShoppingCart shoppingCart);
//
// ICcXacts findCcXactsById(Integer ccXactId);
//
// IOrderLine findOrderLineById(Integer olId);
//
// IAuthor findAuthorById(Integer cxAuthId);
//
// IOrders findOrdersById(Integer cxOId);
//
// List<ICustomer> findCustomerByAddress(IAddress address);
//
// ICountry getCountryById(Integer coId);
//
// IAddress findAddressById(Integer addrId);
//
// public void saveItem(IItem item);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/AController.java
import java.io.IOException;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.ui.Model;
import eu.cloudscale.showcase.db.common.DatabaseHelper;
import eu.cloudscale.showcase.db.services.IService;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
public abstract class AController
{
@Autowired
@Qualifier("service") | protected IService service; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/ShoppingCartController.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
// @Entity
// @Table( name = "shopping_cart", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//
// public class ShoppingCart implements IShoppingCart
// {
// private Integer scId;
//
// private Date scTime;
//
// private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 );
//
// public ShoppingCart()
// {
// }
//
// public ShoppingCart(Date scTime)
// {
// this.scTime = scTime;
// }
//
// @OneToMany( targetEntity=ShoppingCartLine.class, fetch = FetchType.LAZY, mappedBy = "shoppingCart" )
// public Set<IShoppingCartLine> getShoppingCartLines()
// {
// return shoppingCartLines;
// }
//
// public void setShoppingCartLines(Set<IShoppingCartLine> shoppingCartLines)
// {
// this.shoppingCartLines = shoppingCartLines;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SC_ID", unique = true, nullable = false )
// @Override
// public Integer getScId()
// {
// return this.scId;
// }
//
// @Override
// public void setScId(Integer scId)
// {
// this.scId = scId;
// }
//
// @Temporal( TemporalType.TIMESTAMP )
// @Column( name = "SC_TIME", length = 19 )
// @Override
// public Date getScTime()
// {
// return this.scTime;
// }
//
// @Override
// public void setScTime(Date scTime)
// {
// this.scTime = scTime;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/shopping-cart")
public class ShoppingCartController extends AController
{
@RequestMapping(value="", method=RequestMethod.GET)
public String get(HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(ShoppingCartController.class, request);
ArrayList<String> errors = new ArrayList<String>();
Integer itemId = null;
Integer customerId = null;
Integer shoppingId = null;
if( request.getParameter( "I_ID" ) != null )
{
itemId = Integer.parseInt(request.getParameter( "I_ID" ));
}
if( request.getParameter( "C_ID" ) != null )
{
customerId = Integer.parseInt(request.getParameter( "C_ID" ));
}
if( request.getParameter( "SHOPPING_ID" ) != null )
{
shoppingId = Integer.parseInt(request.getParameter( "SHOPPING_ID" ));
}
String addFlag = request.getParameter("ADD_FLAG"); | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
// @Entity
// @Table( name = "shopping_cart", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//
// public class ShoppingCart implements IShoppingCart
// {
// private Integer scId;
//
// private Date scTime;
//
// private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 );
//
// public ShoppingCart()
// {
// }
//
// public ShoppingCart(Date scTime)
// {
// this.scTime = scTime;
// }
//
// @OneToMany( targetEntity=ShoppingCartLine.class, fetch = FetchType.LAZY, mappedBy = "shoppingCart" )
// public Set<IShoppingCartLine> getShoppingCartLines()
// {
// return shoppingCartLines;
// }
//
// public void setShoppingCartLines(Set<IShoppingCartLine> shoppingCartLines)
// {
// this.shoppingCartLines = shoppingCartLines;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SC_ID", unique = true, nullable = false )
// @Override
// public Integer getScId()
// {
// return this.scId;
// }
//
// @Override
// public void setScId(Integer scId)
// {
// this.scId = scId;
// }
//
// @Temporal( TemporalType.TIMESTAMP )
// @Column( name = "SC_TIME", length = 19 )
// @Override
// public Date getScTime()
// {
// return this.scTime;
// }
//
// @Override
// public void setScTime(Date scTime)
// {
// this.scTime = scTime;
// }
//
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/ShoppingCartController.java
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping("/shopping-cart")
public class ShoppingCartController extends AController
{
@RequestMapping(value="", method=RequestMethod.GET)
public String get(HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(ShoppingCartController.class, request);
ArrayList<String> errors = new ArrayList<String>();
Integer itemId = null;
Integer customerId = null;
Integer shoppingId = null;
if( request.getParameter( "I_ID" ) != null )
{
itemId = Integer.parseInt(request.getParameter( "I_ID" ));
}
if( request.getParameter( "C_ID" ) != null )
{
customerId = Integer.parseInt(request.getParameter( "C_ID" ));
}
if( request.getParameter( "SHOPPING_ID" ) != null )
{
shoppingId = Integer.parseInt(request.getParameter( "SHOPPING_ID" ));
}
String addFlag = request.getParameter("ADD_FLAG"); | IShoppingCart sc = service.findShoppingCartById( shoppingId ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/ShoppingCartController.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
// @Entity
// @Table( name = "shopping_cart", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//
// public class ShoppingCart implements IShoppingCart
// {
// private Integer scId;
//
// private Date scTime;
//
// private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 );
//
// public ShoppingCart()
// {
// }
//
// public ShoppingCart(Date scTime)
// {
// this.scTime = scTime;
// }
//
// @OneToMany( targetEntity=ShoppingCartLine.class, fetch = FetchType.LAZY, mappedBy = "shoppingCart" )
// public Set<IShoppingCartLine> getShoppingCartLines()
// {
// return shoppingCartLines;
// }
//
// public void setShoppingCartLines(Set<IShoppingCartLine> shoppingCartLines)
// {
// this.shoppingCartLines = shoppingCartLines;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SC_ID", unique = true, nullable = false )
// @Override
// public Integer getScId()
// {
// return this.scId;
// }
//
// @Override
// public void setScId(Integer scId)
// {
// this.scId = scId;
// }
//
// @Temporal( TemporalType.TIMESTAMP )
// @Column( name = "SC_TIME", length = 19 )
// @Override
// public Date getScTime()
// {
// return this.scTime;
// }
//
// @Override
// public void setScTime(Date scTime)
// {
// this.scTime = scTime;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart; | curr_I_IDstr = request.getParameter("I_ID_" + i);
}
try
{
IShoppingCart cart = service.doCart(sc, itemId, ids, quantities);
model.addAttribute( "cart", cart);
}
catch(Exception e)
{
System.out.println("[EXCEPTION] ShoppingCartController.java");
System.out.println("ADD_FLAG = " + addFlag + ", itemId = " + itemId + ", customerId = " + customerId + ", shoppingId = " + shoppingId + ", sc = " + sc.getScId());
e.printStackTrace();
System.out.println("----------------------------------------------------------------------");
}
// model.addAttribute( "subTotal", getSubTotal(cart.getShoppingCartLines()));
String customerRegistration = getCustomerRegistrationURL(customerId, sc.getScId());
model.addAttribute( "checkoutUrl", customerRegistration);
if( customerId != null )
model.addAttribute("customerId", customerId);
}
model.addAttribute("errors", errors);
setupFrontend(model, sc.getScId(), customerId);
return "shopping-cart";
}
| // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
// @Entity
// @Table( name = "shopping_cart", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//
// public class ShoppingCart implements IShoppingCart
// {
// private Integer scId;
//
// private Date scTime;
//
// private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 );
//
// public ShoppingCart()
// {
// }
//
// public ShoppingCart(Date scTime)
// {
// this.scTime = scTime;
// }
//
// @OneToMany( targetEntity=ShoppingCartLine.class, fetch = FetchType.LAZY, mappedBy = "shoppingCart" )
// public Set<IShoppingCartLine> getShoppingCartLines()
// {
// return shoppingCartLines;
// }
//
// public void setShoppingCartLines(Set<IShoppingCartLine> shoppingCartLines)
// {
// this.shoppingCartLines = shoppingCartLines;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SC_ID", unique = true, nullable = false )
// @Override
// public Integer getScId()
// {
// return this.scId;
// }
//
// @Override
// public void setScId(Integer scId)
// {
// this.scId = scId;
// }
//
// @Temporal( TemporalType.TIMESTAMP )
// @Column( name = "SC_TIME", length = 19 )
// @Override
// public Date getScTime()
// {
// return this.scTime;
// }
//
// @Override
// public void setScTime(Date scTime)
// {
// this.scTime = scTime;
// }
//
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/ShoppingCartController.java
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart;
curr_I_IDstr = request.getParameter("I_ID_" + i);
}
try
{
IShoppingCart cart = service.doCart(sc, itemId, ids, quantities);
model.addAttribute( "cart", cart);
}
catch(Exception e)
{
System.out.println("[EXCEPTION] ShoppingCartController.java");
System.out.println("ADD_FLAG = " + addFlag + ", itemId = " + itemId + ", customerId = " + customerId + ", shoppingId = " + shoppingId + ", sc = " + sc.getScId());
e.printStackTrace();
System.out.println("----------------------------------------------------------------------");
}
// model.addAttribute( "subTotal", getSubTotal(cart.getShoppingCartLines()));
String customerRegistration = getCustomerRegistrationURL(customerId, sc.getScId());
model.addAttribute( "checkoutUrl", customerRegistration);
if( customerId != null )
model.addAttribute("customerId", customerId);
}
model.addAttribute("errors", errors);
setupFrontend(model, sc.getScId(), customerId);
return "shopping-cart";
}
| private double getSubTotal(Set<IShoppingCartLine> shoppingCartLines) |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartDaoImpl.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
// @Entity
// @Table( name = "shopping_cart", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//
// public class ShoppingCart implements IShoppingCart
// {
// private Integer scId;
//
// private Date scTime;
//
// private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 );
//
// public ShoppingCart()
// {
// }
//
// public ShoppingCart(Date scTime)
// {
// this.scTime = scTime;
// }
//
// @OneToMany( targetEntity=ShoppingCartLine.class, fetch = FetchType.LAZY, mappedBy = "shoppingCart" )
// public Set<IShoppingCartLine> getShoppingCartLines()
// {
// return shoppingCartLines;
// }
//
// public void setShoppingCartLines(Set<IShoppingCartLine> shoppingCartLines)
// {
// this.shoppingCartLines = shoppingCartLines;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SC_ID", unique = true, nullable = false )
// @Override
// public Integer getScId()
// {
// return this.scId;
// }
//
// @Override
// public void setScId(Integer scId)
// {
// this.scId = scId;
// }
//
// @Temporal( TemporalType.TIMESTAMP )
// @Column( name = "SC_TIME", length = 19 )
// @Override
// public Date getScTime()
// {
// return this.scTime;
// }
//
// @Override
// public void setScTime(Date scTime)
// {
// this.scTime = scTime;
// }
//
// }
| import java.util.Date;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.hibernate.impl;
@Repository
public class ShoppingCartDaoImpl extends DaoImpl<IShoppingCart> implements IShoppingCartDao
{
@Autowired
public ShoppingCartDaoImpl(SessionFactory sessionFactory)
{
super(sessionFactory);
}
@SuppressWarnings( "rawtypes" )
@Override
// @Transactional(readOnly=true)
public IShoppingCart findById(Integer shoppingId)
{
Session session = getCurrentSession();
String hql = "SELECT SC FROM ShoppingCart as SC WHERE SC.scId = :scId";
Query query = session.createQuery(hql);
query.setParameter( "scId", shoppingId );
List res = query.list();
if( res.isEmpty() )
{
// System.out.println("results are empty! " + query.getQueryString());
return null;
}
| // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
// @Entity
// @Table( name = "shopping_cart", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//
// public class ShoppingCart implements IShoppingCart
// {
// private Integer scId;
//
// private Date scTime;
//
// private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 );
//
// public ShoppingCart()
// {
// }
//
// public ShoppingCart(Date scTime)
// {
// this.scTime = scTime;
// }
//
// @OneToMany( targetEntity=ShoppingCartLine.class, fetch = FetchType.LAZY, mappedBy = "shoppingCart" )
// public Set<IShoppingCartLine> getShoppingCartLines()
// {
// return shoppingCartLines;
// }
//
// public void setShoppingCartLines(Set<IShoppingCartLine> shoppingCartLines)
// {
// this.shoppingCartLines = shoppingCartLines;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SC_ID", unique = true, nullable = false )
// @Override
// public Integer getScId()
// {
// return this.scId;
// }
//
// @Override
// public void setScId(Integer scId)
// {
// this.scId = scId;
// }
//
// @Temporal( TemporalType.TIMESTAMP )
// @Column( name = "SC_TIME", length = 19 )
// @Override
// public Date getScTime()
// {
// return this.scTime;
// }
//
// @Override
// public void setScTime(Date scTime)
// {
// this.scTime = scTime;
// }
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartDaoImpl.java
import java.util.Date;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.hibernate.impl;
@Repository
public class ShoppingCartDaoImpl extends DaoImpl<IShoppingCart> implements IShoppingCartDao
{
@Autowired
public ShoppingCartDaoImpl(SessionFactory sessionFactory)
{
super(sessionFactory);
}
@SuppressWarnings( "rawtypes" )
@Override
// @Transactional(readOnly=true)
public IShoppingCart findById(Integer shoppingId)
{
Session session = getCurrentSession();
String hql = "SELECT SC FROM ShoppingCart as SC WHERE SC.scId = :scId";
Query query = session.createQuery(hql);
query.setParameter( "scId", shoppingId );
List res = query.list();
if( res.isEmpty() )
{
// System.out.println("results are empty! " + query.getQueryString());
return null;
}
| ShoppingCart sc = (ShoppingCart) res.get( 0 ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartDaoImpl.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
// @Entity
// @Table( name = "shopping_cart", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//
// public class ShoppingCart implements IShoppingCart
// {
// private Integer scId;
//
// private Date scTime;
//
// private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 );
//
// public ShoppingCart()
// {
// }
//
// public ShoppingCart(Date scTime)
// {
// this.scTime = scTime;
// }
//
// @OneToMany( targetEntity=ShoppingCartLine.class, fetch = FetchType.LAZY, mappedBy = "shoppingCart" )
// public Set<IShoppingCartLine> getShoppingCartLines()
// {
// return shoppingCartLines;
// }
//
// public void setShoppingCartLines(Set<IShoppingCartLine> shoppingCartLines)
// {
// this.shoppingCartLines = shoppingCartLines;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SC_ID", unique = true, nullable = false )
// @Override
// public Integer getScId()
// {
// return this.scId;
// }
//
// @Override
// public void setScId(Integer scId)
// {
// this.scId = scId;
// }
//
// @Temporal( TemporalType.TIMESTAMP )
// @Column( name = "SC_TIME", length = 19 )
// @Override
// public Date getScTime()
// {
// return this.scTime;
// }
//
// @Override
// public void setScTime(Date scTime)
// {
// this.scTime = scTime;
// }
//
// }
| import java.util.Date;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.hibernate.impl;
@Repository
public class ShoppingCartDaoImpl extends DaoImpl<IShoppingCart> implements IShoppingCartDao
{
@Autowired
public ShoppingCartDaoImpl(SessionFactory sessionFactory)
{
super(sessionFactory);
}
@SuppressWarnings( "rawtypes" )
@Override
// @Transactional(readOnly=true)
public IShoppingCart findById(Integer shoppingId)
{
Session session = getCurrentSession();
String hql = "SELECT SC FROM ShoppingCart as SC WHERE SC.scId = :scId";
Query query = session.createQuery(hql);
query.setParameter( "scId", shoppingId );
List res = query.list();
if( res.isEmpty() )
{
// System.out.println("results are empty! " + query.getQueryString());
return null;
}
ShoppingCart sc = (ShoppingCart) res.get( 0 );
Hibernate.initialize( sc.getShoppingCartLines() );
return sc;
}
@SuppressWarnings( "unchecked" )
@Override
// @Transactional(readOnly=true) | // Path: src/main/java/eu/cloudscale/showcase/db/dao/IShoppingCartDao.java
// public interface IShoppingCartDao extends IDao<IShoppingCart>
// {
// // public Integer createEmptyCart();
//
// public IShoppingCart findById(Integer shoppingId);
//
// public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart);
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
// @Entity
// @Table( name = "shopping_cart", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//
// public class ShoppingCart implements IShoppingCart
// {
// private Integer scId;
//
// private Date scTime;
//
// private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 );
//
// public ShoppingCart()
// {
// }
//
// public ShoppingCart(Date scTime)
// {
// this.scTime = scTime;
// }
//
// @OneToMany( targetEntity=ShoppingCartLine.class, fetch = FetchType.LAZY, mappedBy = "shoppingCart" )
// public Set<IShoppingCartLine> getShoppingCartLines()
// {
// return shoppingCartLines;
// }
//
// public void setShoppingCartLines(Set<IShoppingCartLine> shoppingCartLines)
// {
// this.shoppingCartLines = shoppingCartLines;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "SC_ID", unique = true, nullable = false )
// @Override
// public Integer getScId()
// {
// return this.scId;
// }
//
// @Override
// public void setScId(Integer scId)
// {
// this.scId = scId;
// }
//
// @Temporal( TemporalType.TIMESTAMP )
// @Column( name = "SC_TIME", length = 19 )
// @Override
// public Date getScTime()
// {
// return this.scTime;
// }
//
// @Override
// public void setScTime(Date scTime)
// {
// this.scTime = scTime;
// }
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/ShoppingCartDaoImpl.java
import java.util.Date;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import eu.cloudscale.showcase.db.dao.IShoppingCartDao;
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import eu.cloudscale.showcase.db.model.hibernate.ShoppingCart;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.hibernate.impl;
@Repository
public class ShoppingCartDaoImpl extends DaoImpl<IShoppingCart> implements IShoppingCartDao
{
@Autowired
public ShoppingCartDaoImpl(SessionFactory sessionFactory)
{
super(sessionFactory);
}
@SuppressWarnings( "rawtypes" )
@Override
// @Transactional(readOnly=true)
public IShoppingCart findById(Integer shoppingId)
{
Session session = getCurrentSession();
String hql = "SELECT SC FROM ShoppingCart as SC WHERE SC.scId = :scId";
Query query = session.createQuery(hql);
query.setParameter( "scId", shoppingId );
List res = query.list();
if( res.isEmpty() )
{
// System.out.println("results are empty! " + query.getQueryString());
return null;
}
ShoppingCart sc = (ShoppingCart) res.get( 0 );
Hibernate.initialize( sc.getShoppingCartLines() );
return sc;
}
@SuppressWarnings( "unchecked" )
@Override
// @Transactional(readOnly=true) | public List<IShoppingCartLine> findAllBySC(IShoppingCart shoppingCart) |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CountryDaoImpl.java | // Path: src/main/java/eu/cloudscale/showcase/db/dao/ICountryDao.java
// public interface ICountryDao extends IDao<ICountry>
// {
//
// public ICountry findById(int id);
//
// public ICountry getByName(String country);
//
// public void createTable();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/Country.java
// @Entity
// @Table( name = "country", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
// public class Country implements ICountry
// {
//
// private Integer coId;
//
// private String coName;
//
// private Double coExchange;
//
// private String coCurrency;
//
// private Set<IAddress> addresses = new HashSet<IAddress>( 0 );
//
// private Set<ICcXacts> ccXactses = new HashSet<ICcXacts>( 0 );
//
// public Country()
// {
// }
//
// public Country(String coName, Double coExchange, String coCurrency,
// Set<IAddress> addresses, Set<ICcXacts> ccXactses)
// {
// this.coName = coName;
// this.coExchange = coExchange;
// this.coCurrency = coCurrency;
// this.addresses = addresses;
// this.ccXactses = ccXactses;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "CO_ID", unique = true, nullable = false )
// @Override
// public Integer getCoId()
// {
// return this.coId;
// }
//
// @Override
// public void setCoId(Integer coId)
// {
// this.coId = coId;
// }
//
// @Column( name = "CO_NAME", length = 50 )
// @Override
// public String getCoName()
// {
// return this.coName;
// }
//
// @Override
// public void setCoName(String coName)
// {
// this.coName = coName;
// }
//
// @Column( name = "CO_EXCHANGE", precision = 22, scale = 0 )
// @Override
// public Double getCoExchange()
// {
// return this.coExchange;
// }
//
// @Override
// public void setCoExchange(Double coExchange)
// {
// this.coExchange = coExchange;
// }
//
// @Column( name = "CO_CURRENCY", length = 18 )
// @Override
// public String getCoCurrency()
// {
// return this.coCurrency;
// }
//
// @Override
// public void setCoCurrency(String coCurrency)
// {
// this.coCurrency = coCurrency;
// }
//
// @OneToMany( targetEntity=Address.class, fetch = FetchType.LAZY, mappedBy = "country" )
// public Set<IAddress> getAddresses()
// {
// return this.addresses;
// }
//
// public void setAddresses(Set<IAddress> addresses)
// {
// this.addresses = addresses;
// }
//
// @OneToMany( targetEntity=CcXacts.class, fetch = FetchType.LAZY, mappedBy = "country" )
// public Set<ICcXacts> getCcXactses()
// {
// return this.ccXactses;
// }
//
// public void setCcXactses(Set<ICcXacts> ccXactses)
// {
// this.ccXactses = ccXactses;
// }
//
// }
| import java.util.List;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import eu.cloudscale.showcase.db.dao.ICountryDao;
import eu.cloudscale.showcase.db.model.ICountry;
import eu.cloudscale.showcase.db.model.hibernate.Country; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.hibernate.impl;
@Repository
//@Transactional(readOnly=true)
public class CountryDaoImpl extends DaoImpl<ICountry> implements ICountryDao
{
private String tableName = "country";
public CountryDaoImpl()
{
// super( (SessionFactory) ContextHelper.getApplicationContext().getBean( "sessionFactory" ) );
}
@Autowired
public CountryDaoImpl(SessionFactory sessionFactory)
{
super( sessionFactory );
}
@Override
public ICountry findById(int id)
{
// String hql = "FROM Country C WHERE C.coId = :coId";
// Query q = this.session.createQuery(hql);
// q.setParameter("coId", id);
// List<Country> res = (List<Country>) q.list();
// return res.get(0); | // Path: src/main/java/eu/cloudscale/showcase/db/dao/ICountryDao.java
// public interface ICountryDao extends IDao<ICountry>
// {
//
// public ICountry findById(int id);
//
// public ICountry getByName(String country);
//
// public void createTable();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/ICountry.java
// public interface ICountry
// {
//
// public Integer getCoId();
//
// public void setCoId(Integer coId);
//
// public String getCoName();
//
// public void setCoName(String coName);
//
// public Double getCoExchange();
//
// public void setCoExchange(Double coExchange);
//
// public String getCoCurrency();
//
// public void setCoCurrency(String coCurrency);
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/Country.java
// @Entity
// @Table( name = "country", catalog = "tpcw" )
// @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
// public class Country implements ICountry
// {
//
// private Integer coId;
//
// private String coName;
//
// private Double coExchange;
//
// private String coCurrency;
//
// private Set<IAddress> addresses = new HashSet<IAddress>( 0 );
//
// private Set<ICcXacts> ccXactses = new HashSet<ICcXacts>( 0 );
//
// public Country()
// {
// }
//
// public Country(String coName, Double coExchange, String coCurrency,
// Set<IAddress> addresses, Set<ICcXacts> ccXactses)
// {
// this.coName = coName;
// this.coExchange = coExchange;
// this.coCurrency = coCurrency;
// this.addresses = addresses;
// this.ccXactses = ccXactses;
// }
//
// @Id
// @GeneratedValue( strategy = IDENTITY )
// @Column( name = "CO_ID", unique = true, nullable = false )
// @Override
// public Integer getCoId()
// {
// return this.coId;
// }
//
// @Override
// public void setCoId(Integer coId)
// {
// this.coId = coId;
// }
//
// @Column( name = "CO_NAME", length = 50 )
// @Override
// public String getCoName()
// {
// return this.coName;
// }
//
// @Override
// public void setCoName(String coName)
// {
// this.coName = coName;
// }
//
// @Column( name = "CO_EXCHANGE", precision = 22, scale = 0 )
// @Override
// public Double getCoExchange()
// {
// return this.coExchange;
// }
//
// @Override
// public void setCoExchange(Double coExchange)
// {
// this.coExchange = coExchange;
// }
//
// @Column( name = "CO_CURRENCY", length = 18 )
// @Override
// public String getCoCurrency()
// {
// return this.coCurrency;
// }
//
// @Override
// public void setCoCurrency(String coCurrency)
// {
// this.coCurrency = coCurrency;
// }
//
// @OneToMany( targetEntity=Address.class, fetch = FetchType.LAZY, mappedBy = "country" )
// public Set<IAddress> getAddresses()
// {
// return this.addresses;
// }
//
// public void setAddresses(Set<IAddress> addresses)
// {
// this.addresses = addresses;
// }
//
// @OneToMany( targetEntity=CcXacts.class, fetch = FetchType.LAZY, mappedBy = "country" )
// public Set<ICcXacts> getCcXactses()
// {
// return this.ccXactses;
// }
//
// public void setCcXactses(Set<ICcXacts> ccXactses)
// {
// this.ccXactses = ccXactses;
// }
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/dao/hibernate/impl/CountryDaoImpl.java
import java.util.List;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import eu.cloudscale.showcase.db.dao.ICountryDao;
import eu.cloudscale.showcase.db.model.ICountry;
import eu.cloudscale.showcase.db.model.hibernate.Country;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.dao.hibernate.impl;
@Repository
//@Transactional(readOnly=true)
public class CountryDaoImpl extends DaoImpl<ICountry> implements ICountryDao
{
private String tableName = "country";
public CountryDaoImpl()
{
// super( (SessionFactory) ContextHelper.getApplicationContext().getBean( "sessionFactory" ) );
}
@Autowired
public CountryDaoImpl(SessionFactory sessionFactory)
{
super( sessionFactory );
}
@Override
public ICountry findById(int id)
{
// String hql = "FROM Country C WHERE C.coId = :coId";
// Query q = this.session.createQuery(hql);
// q.setParameter("coId", id);
// List<Country> res = (List<Country>) q.list();
// return res.get(0); | return (ICountry) getCurrentSession().get( Country.class, id ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/BuyConfirmController.java | // Path: src/main/java/eu/cloudscale/showcase/db/BuyConfirmResult.java
// public class BuyConfirmResult
// {
// public IOrders order;
// public IShoppingCart cart;
//
// public BuyConfirmResult(IOrders order2, IShoppingCart sc)
// {
// order = order2;
// cart = sc;
// }
//
//
// public IOrders getOrder()
// {
// return order;
// }
//
//
// public void setOrder(IOrders order)
// {
// this.order = order;
// }
//
//
// public IShoppingCart getCart()
// {
// return cart;
// }
//
//
// public void setCart(IShoppingCart cart)
// {
// this.cart = cart;
// }
//
// }
| import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.BuyConfirmResult; | }
String customerIdString = request.getParameter( "C_ID" );
Integer customerId = null;
if( customerIdString != null && !customerIdString.isEmpty() )
{
customerId = Integer.parseInt( customerIdString );
}
String ccType = request.getParameter( "CC_TYPE" );
String ccNumber_str = request.getParameter( "CC_NUMBER" );
Long ccNumber = null;
if( !ccNumber_str.isEmpty() )
ccNumber = Long.parseLong( ccNumber_str );
SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
String ccName = request.getParameter( "CC_NAME" );
Date ccExpiry = null;
try
{
ccExpiry = sdf.parse(request.getParameter( "CC_EXPIRY" ));
}
catch ( ParseException e )
{
e.printStackTrace();
}
String shipping = request.getParameter( "SHIPPING" );
String street1 = request.getParameter( "street1" );
| // Path: src/main/java/eu/cloudscale/showcase/db/BuyConfirmResult.java
// public class BuyConfirmResult
// {
// public IOrders order;
// public IShoppingCart cart;
//
// public BuyConfirmResult(IOrders order2, IShoppingCart sc)
// {
// order = order2;
// cart = sc;
// }
//
//
// public IOrders getOrder()
// {
// return order;
// }
//
//
// public void setOrder(IOrders order)
// {
// this.order = order;
// }
//
//
// public IShoppingCart getCart()
// {
// return cart;
// }
//
//
// public void setCart(IShoppingCart cart)
// {
// this.cart = cart;
// }
//
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/BuyConfirmController.java
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import eu.cloudscale.showcase.db.BuyConfirmResult;
}
String customerIdString = request.getParameter( "C_ID" );
Integer customerId = null;
if( customerIdString != null && !customerIdString.isEmpty() )
{
customerId = Integer.parseInt( customerIdString );
}
String ccType = request.getParameter( "CC_TYPE" );
String ccNumber_str = request.getParameter( "CC_NUMBER" );
Long ccNumber = null;
if( !ccNumber_str.isEmpty() )
ccNumber = Long.parseLong( ccNumber_str );
SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
String ccName = request.getParameter( "CC_NAME" );
Date ccExpiry = null;
try
{
ccExpiry = sdf.parse(request.getParameter( "CC_EXPIRY" ));
}
catch ( ParseException e )
{
e.printStackTrace();
}
String shipping = request.getParameter( "SHIPPING" );
String street1 = request.getParameter( "street1" );
| BuyConfirmResult res = null; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/BuyConfirmResult.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
| import eu.cloudscale.showcase.db.model.IOrders;
import eu.cloudscale.showcase.db.model.IShoppingCart; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public class BuyConfirmResult
{ | // Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/BuyConfirmResult.java
import eu.cloudscale.showcase.db.model.IOrders;
import eu.cloudscale.showcase.db.model.IShoppingCart;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public class BuyConfirmResult
{ | public IOrders order; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/BuyConfirmResult.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
| import eu.cloudscale.showcase.db.model.IOrders;
import eu.cloudscale.showcase.db.model.IShoppingCart; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public class BuyConfirmResult
{
public IOrders order; | // Path: src/main/java/eu/cloudscale/showcase/db/model/IOrders.java
// public interface IOrders
// {
//
// public Integer getOId();
//
// public void setOId(Integer OId);
//
// IAddress getAddressByOShipAddrId();
//
// void setAddressByOShipAddrId(IAddress addressByOShipAddrId);
//
// ICustomer getCustomer();
//
// void setCustomer(ICustomer customer);
//
// IAddress getAddressByOBillAddrId();
//
// void setAddressByOBillAddrId(IAddress addressByOBillAddrId);
//
//
// void setOStatus(String OStatus);
//
// String getOStatus();
//
// void setOShipDate(Date OShipDate);
//
// Date getOShipDate();
//
// void setOShipType(String OShipType);
//
// String getOShipType();
//
// void setOTotal(double o_TOTAL);
//
// Double getOTotal();
//
// void setOTax(Double o_TAX);
//
// Double getOTax();
//
// void setOSubTotal(Double o_SUB_TOTAL);
//
// Double getOSubTotal();
//
// void setODate(Date ODate);
//
// Date getODate();
//
// public Set<IOrderLine> getOrderLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/BuyConfirmResult.java
import eu.cloudscale.showcase.db.model.IOrders;
import eu.cloudscale.showcase.db.model.IShoppingCart;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db;
public class BuyConfirmResult
{
public IOrders order; | public IShoppingCart cart; |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
| import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCart generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCart generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
| public class ShoppingCart implements IShoppingCart |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
| import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCart generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ShoppingCart implements IShoppingCart
{
private Integer scId;
private Date scTime;
| // Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCart.java
// public interface IShoppingCart
// {
//
// public void setScTime(Date scTime);
//
// public Date getScTime();
//
// public void setScId(Integer scId);
//
// public Integer getScId();
//
// public Set<IShoppingCartLine> getShoppingCartLines();
//
// }
//
// Path: src/main/java/eu/cloudscale/showcase/db/model/IShoppingCartLine.java
// public interface IShoppingCartLine
// {
//
// public IShoppingCart getShoppingCart();
//
// public void setShoppingCart(IShoppingCart shoppingCart);
//
// public Integer getSclId();
//
// public void setSclId(Integer sclScId);
//
// public IItem getItem();
//
// public void setItem(IItem item);
//
// public Integer getSclQty();
//
// public void setSclQty(Integer sclQty);
//
// }
// Path: src/main/java/eu/cloudscale/showcase/db/model/hibernate/ShoppingCart.java
import eu.cloudscale.showcase.db.model.IShoppingCart;
import eu.cloudscale.showcase.db.model.IShoppingCartLine;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.db.model.hibernate;
// Generated May 16, 2013 3:07:18 PM by Hibernate Tools 4.0.0
/**
* ShoppingCart generated by hbm2java
*/
@Entity
@Table( name = "shopping_cart", catalog = "tpcw" )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ShoppingCart implements IShoppingCart
{
private Integer scId;
private Date scTime;
| private Set<IShoppingCartLine> shoppingCartLines = new HashSet<IShoppingCartLine>( 0 ); |
CloudScale-Project/CloudStore | src/main/java/eu/cloudscale/showcase/servlets/CustomerRegistrationController.java | // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
| import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import eu.cloudscale.showcase.db.model.ICustomer; | /*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping( "/customer-registration" )
public class CustomerRegistrationController extends AController
{
@RequestMapping( "" )
public String get(
@RequestParam( value = "C_ID", required = false ) Integer customerId,
@RequestParam( value = "SHOPPING_ID", required = false ) Integer shoppingId,
HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(CustomerRegistrationController.class, request);
| // Path: src/main/java/eu/cloudscale/showcase/db/model/ICustomer.java
// public interface ICustomer
// {
//
// public Integer getCId();
//
// public void setCId(Integer CId);
//
// public IAddress getAddress();
//
// public void setAddress(IAddress address);
//
// public String getCUname();
//
// public void setCUname(String CUname);
//
// public String getCPasswd();
//
// public void setCPasswd(String CPasswd);
//
// public String getCFname();
//
// public void setCFname(String CFname);
//
// public String getCLname();
//
// public void setCLname(String CLname);
//
// public String getCPhone();
//
// public void setCData(String CData);
//
// public String getCData();
//
// public void setCBirthdate(Date CBirthdate);
//
// public Date getCBirthdate();
//
// public void setCYtdPmt(Double c_YTD_PMT);
//
// public Double getCYtdPmt();
//
// public void setCBalance(Double c_BALANCE);
//
// public Double getCBalance();
//
// public void setCDiscount(double c_DISCOUNT);
//
// public Double getCDiscount();
//
// public void setCExpiration(Date CExpiration);
//
// public Date getCExpiration();
//
// public void setCLogin(Date CLogin);
//
// public Date getCLogin();
//
// public void setCLastVisit(Date CLastVisit);
//
// public Date getCLastVisit();
//
// public void setCSince(Date CSince);
//
// public Date getCSince();
//
// public void setCEmail(String CEmail);
//
// public String getCEmail();
//
// public void setCPhone(String CPhone);
// }
// Path: src/main/java/eu/cloudscale/showcase/servlets/CustomerRegistrationController.java
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import eu.cloudscale.showcase.db.model.ICustomer;
/*******************************************************************************
* Copyright (c) 2015 XLAB d.o.o.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* @author XLAB d.o.o.
*******************************************************************************/
package eu.cloudscale.showcase.servlets;
@Controller
@RequestMapping( "/customer-registration" )
public class CustomerRegistrationController extends AController
{
@RequestMapping( "" )
public String get(
@RequestParam( value = "C_ID", required = false ) Integer customerId,
@RequestParam( value = "SHOPPING_ID", required = false ) Integer shoppingId,
HttpServletRequest request, Model model)
{
HttpSession session = super.getHttpSession(CustomerRegistrationController.class, request);
| ICustomer customer = null; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.