updated to complete
This commit is contained in:
39
Model/build.gradle
Normal file
39
Model/build.gradle
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
|
||||
id 'java-library'
|
||||
id 'application'
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Apply a specific Java toolchain to ease working on different environments.
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(25)
|
||||
}
|
||||
}
|
||||
|
||||
group = 'edu.inventorym'
|
||||
version = '1.0.0'
|
||||
|
||||
application {
|
||||
// Define the main class for the application.
|
||||
mainClass = 'edu.inventorym.TransactionManager'
|
||||
}
|
||||
|
||||
repositories {
|
||||
// Use Maven Central for resolving dependencies.
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'jakarta.json.bind:jakarta.json.bind-api:3.0.1'
|
||||
implementation 'org.eclipse:yasson:3.0.4'
|
||||
|
||||
}
|
||||
|
||||
114
Model/src/main/java/edu/inventorym/model/Address.java
Normal file
114
Model/src/main/java/edu/inventorym/model/Address.java
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public final class Address{
|
||||
|
||||
String street;
|
||||
String city;
|
||||
String state;
|
||||
String zip;
|
||||
|
||||
/** not used
|
||||
*
|
||||
*/
|
||||
|
||||
public Address() {
|
||||
}
|
||||
|
||||
public Address(String street, String city, String state, String zip) {
|
||||
this.street = street;
|
||||
this.city = city;
|
||||
this.state = state;
|
||||
this.zip = zip;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getZip() {
|
||||
return zip;
|
||||
}
|
||||
|
||||
public void setZip(String zip) {
|
||||
this.zip = zip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((street == null) ? 0 : street.hashCode());
|
||||
result = prime * result + ((city == null) ? 0 : city.hashCode());
|
||||
result = prime * result + ((state == null) ? 0 : state.hashCode());
|
||||
result = prime * result + ((zip == null) ? 0 : zip.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Address other = (Address) obj;
|
||||
if (street == null) {
|
||||
if (other.street != null)
|
||||
return false;
|
||||
} else if (!street.equals(other.street))
|
||||
return false;
|
||||
if (city == null) {
|
||||
if (other.city != null)
|
||||
return false;
|
||||
} else if (!city.equals(other.city))
|
||||
return false;
|
||||
if (state == null) {
|
||||
if (other.state != null)
|
||||
return false;
|
||||
} else if (!state.equals(other.state))
|
||||
return false;
|
||||
if (zip == null) {
|
||||
if (other.zip != null)
|
||||
return false;
|
||||
} else if (!zip.equals(other.zip))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{ \"Address\":{");
|
||||
sb.append("\"street\": \"" + street + "\",");
|
||||
sb.append("\"city\": \"" + city + "\",");
|
||||
sb.append("\"state\": \"" + state + "\",");
|
||||
sb.append("\"zip\": \"" + zip + "\"");
|
||||
sb.append("}}");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
82
Model/src/main/java/edu/inventorym/model/Customer.java
Normal file
82
Model/src/main/java/edu/inventorym/model/Customer.java
Normal file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
public class Customer {
|
||||
protected String id;
|
||||
protected ZonedDateTime updated;
|
||||
String phone;
|
||||
Address mailing;
|
||||
String email;
|
||||
String nameFirst;
|
||||
String nameLast;
|
||||
|
||||
public Customer(String nameFirst, String nameLast, String phone, String email) {
|
||||
this.nameFirst = nameFirst;
|
||||
this.nameLast = nameLast;
|
||||
this.phone = phone;
|
||||
this.email = email;
|
||||
this.updated = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public Customer(){}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
this.updated = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
this.updated = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public Address getMailing() {
|
||||
return mailing;
|
||||
}
|
||||
|
||||
public void setMailing(Address mailing) {
|
||||
this.mailing = mailing;
|
||||
this.updated = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
this.updated = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public String getNameFirst() {
|
||||
return nameFirst;
|
||||
}
|
||||
|
||||
public void setNameFirst(String nameFirst) {
|
||||
this.nameFirst = nameFirst;
|
||||
this.updated = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public String getNameLast() {
|
||||
return nameLast;
|
||||
}
|
||||
|
||||
public void setNameLast(String nameLast) {
|
||||
this.nameLast = nameLast;
|
||||
this.updated = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
}
|
||||
14
Model/src/main/java/edu/inventorym/model/CustomerList.java
Normal file
14
Model/src/main/java/edu/inventorym/model/CustomerList.java
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CustomerList extends ArrayList<Customer> {
|
||||
public CustomerList() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class CustomerManager {
|
||||
|
||||
final static CustomerManager INSTANCE = new CustomerManager();
|
||||
|
||||
public static CustomerManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public CustomerList CUSTOMERS = new CustomerList();
|
||||
|
||||
public boolean add(Customer c) throws InvalidRecordDataException{
|
||||
check(c);
|
||||
return CUSTOMERS.add(c);
|
||||
}
|
||||
|
||||
void check(Customer c) throws InvalidRecordDataException{
|
||||
|
||||
}
|
||||
|
||||
public Customer findById(String id){
|
||||
return null;
|
||||
}
|
||||
|
||||
public Customer findByEmail(String email){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
134
Model/src/main/java/edu/inventorym/model/DataRepository.java
Normal file
134
Model/src/main/java/edu/inventorym/model/DataRepository.java
Normal file
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.math.BigInteger;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.json.Json;
|
||||
import jakarta.json.JsonArray;
|
||||
import jakarta.json.bind.Jsonb;
|
||||
import jakarta.json.bind.JsonbBuilder;
|
||||
import jakarta.json.bind.JsonbConfig;
|
||||
|
||||
public class DataRepository {
|
||||
final static DataRepository INSTANCE = new DataRepository();
|
||||
|
||||
public static DataRepository getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
final public static String generateRandomID(int byteLength) {
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
byte[] bytes = new byte[byteLength];
|
||||
secureRandom.nextBytes(bytes);
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
|
||||
}
|
||||
|
||||
final public static String generateRandom10DigitID() {
|
||||
int count = 32;
|
||||
SecureRandom rnd = new SecureRandom();
|
||||
BigInteger randomCountLength = BigInteger.valueOf(1000009000L);
|
||||
|
||||
BigInteger val1 = new BigInteger(count, rnd);
|
||||
BigInteger val2 = randomCountLength.add(val1);
|
||||
return String.format("%010d", val2);
|
||||
}
|
||||
|
||||
public static void WalkFileSystemTree(final InventoryManager manager) throws IOException {
|
||||
}
|
||||
|
||||
public static void WalkFileSystemTree(final CustomerManager manager) throws IOException {
|
||||
}
|
||||
|
||||
public static void WalkFileSystemTree(final TransactionManager manager) throws IOException {
|
||||
}
|
||||
|
||||
|
||||
static void serialize_deserialize(){
|
||||
String jsonResponse = "";
|
||||
try{
|
||||
// Deserialize the JSON string to a Java RpcResponse object
|
||||
Jsonb jsonb = JsonbBuilder.create();
|
||||
jsonResponse = jsonb.toJson((InventoryPiece)new Drawing());
|
||||
|
||||
System.out.println("json string: " + jsonResponse);
|
||||
|
||||
|
||||
InventoryPiece response = jsonb.fromJson(jsonResponse, Drawing.class);
|
||||
|
||||
System.out.println("Result: " + response);
|
||||
System.out.println("ID: " + response.getId());
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try{
|
||||
// Configure pretty-printing and other settings
|
||||
JsonbConfig config = new JsonbConfig()
|
||||
.withFormatting(true); // Enable pretty-printing
|
||||
Jsonb jsonb = JsonbBuilder.create(config);
|
||||
|
||||
// Serialize using the custom configuration
|
||||
String prettyJsonString = jsonb.toJson(new Drawing());
|
||||
|
||||
System.out.println("json string: " + prettyJsonString);
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
List<Drawing> rpcs = new ArrayList<Drawing>();
|
||||
rpcs.add(new Drawing());
|
||||
rpcs.add(new Drawing());
|
||||
rpcs.add(new Drawing());
|
||||
|
||||
// Create Jsonb and serialize
|
||||
Jsonb jsonb = JsonbBuilder.create();
|
||||
String result = jsonb.toJson(rpcs);
|
||||
|
||||
|
||||
// Deserialize back
|
||||
rpcs = jsonb.fromJson(result,
|
||||
new ArrayList<Drawing>() {}
|
||||
.getClass()
|
||||
.getGenericSuperclass());
|
||||
|
||||
System.out.println( rpcs );
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static <T> List<T> mapJsonToObjectList(String body, Class<T> baseClass) {
|
||||
try (var reader = Json.createReader(new StringReader(body));
|
||||
Jsonb jsonb = JsonbBuilder.create()){
|
||||
JsonArray jsonArray = reader.readArray();
|
||||
|
||||
return jsonArray.stream()
|
||||
.map(jsonValue -> jsonb.fromJson(jsonValue.toString(), baseClass))
|
||||
.toList();
|
||||
} catch (Exception e) {
|
||||
return (List<T>) new ArrayList<Drawing>();
|
||||
}
|
||||
}
|
||||
|
||||
public final static class getRepositoryConfig {
|
||||
public final static String getPath() {
|
||||
String home = System.getenv("HOME") != null ? System.getenv("HOME")
|
||||
: System.getenv("HOMEDRIVE") + System.getenv("HOMEPATH");
|
||||
return home.replace('\\', '/') + "/workspace/reservationsystem/src/resources/db";
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Model/src/main/java/edu/inventorym/model/Drawing.java
Normal file
16
Model/src/main/java/edu/inventorym/model/Drawing.java
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class Drawing extends InventoryPiece {
|
||||
|
||||
public String style;
|
||||
public String technique;
|
||||
public String category;
|
||||
|
||||
public Drawing() {
|
||||
super(InventoryType.DRAWING);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class InvalidArtOperationException extends RuntimeException {
|
||||
public InvalidArtOperationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InvalidArtOperationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public InvalidArtOperationException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class InvalidRecordDataException extends RuntimeException {
|
||||
public InvalidRecordDataException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InvalidRecordDataException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public InvalidRecordDataException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class InvalidTransOperationException extends RuntimeException {
|
||||
public InvalidTransOperationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InvalidTransOperationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public InvalidTransOperationException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class InvalidTransactionException extends RuntimeException {
|
||||
public InvalidTransactionException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InvalidTransactionException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public InvalidTransactionException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
13
Model/src/main/java/edu/inventorym/model/InventoryList.java
Normal file
13
Model/src/main/java/edu/inventorym/model/InventoryList.java
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class InventoryList extends ArrayList<InventoryPiece> {
|
||||
public InventoryList() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class InventoryManager {
|
||||
|
||||
final static InventoryManager INSTANCE = new InventoryManager();
|
||||
|
||||
public static InventoryManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public InventoryList INVENTORY = new InventoryList();
|
||||
|
||||
private InventoryManager() {
|
||||
}
|
||||
|
||||
public Set<InventoryType> getArtPieceTypes() {
|
||||
return EnumSet.allOf(InventoryType.class);
|
||||
}
|
||||
|
||||
public void add(InventoryPiece iPiece) {
|
||||
INVENTORY.add(iPiece);
|
||||
}
|
||||
|
||||
public InventoryPiece find(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public InventoryPiece update(InventoryPiece iPiece) {
|
||||
return iPiece;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
}
|
||||
|
||||
public void loadAll(){
|
||||
try {
|
||||
DataRepository.WalkFileSystemTree(INSTANCE);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(InventoryPiece iPiece) {
|
||||
|
||||
//int i = find(iPiece);
|
||||
//INVENTORY.remove(i)
|
||||
//*** multiple quantiies of iPiece */
|
||||
};
|
||||
|
||||
}
|
||||
92
Model/src/main/java/edu/inventorym/model/InventoryPiece.java
Normal file
92
Model/src/main/java/edu/inventorym/model/InventoryPiece.java
Normal file
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
import jakarta.json.bind.annotation.JsonbProperty;
|
||||
import jakarta.json.bind.annotation.JsonbTransient;
|
||||
import jakarta.json.bind.annotation.JsonbDateFormat;
|
||||
|
||||
public abstract class InventoryPiece {
|
||||
public String id;
|
||||
public float price;
|
||||
public ZonedDateTime created;
|
||||
public String title;
|
||||
|
||||
/**
|
||||
* max 500 characters
|
||||
*/
|
||||
public String description;
|
||||
|
||||
public String Author;
|
||||
|
||||
InventoryType iventoryType;
|
||||
|
||||
public InventoryPiece(InventoryType iventoryType) {
|
||||
this.iventoryType = iventoryType;
|
||||
this.created = ZonedDateTime.now();
|
||||
this.id = DataRepository.generateRandom10DigitID();
|
||||
}
|
||||
|
||||
public InventoryPiece() {
|
||||
}
|
||||
|
||||
public Boolean isArt(InventoryPiece piece) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.iventoryType.toString();
|
||||
};
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public float getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(float price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public ZonedDateTime getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(ZonedDateTime created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return Author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
Author = author;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public enum InventoryType {
|
||||
PAINTING, DRAWING, PRINT, SCULPTURE
|
||||
}
|
||||
18
Model/src/main/java/edu/inventorym/model/Painting.java
Normal file
18
Model/src/main/java/edu/inventorym/model/Painting.java
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class Painting extends InventoryPiece {
|
||||
int height;
|
||||
int width;
|
||||
String style;
|
||||
String technique;
|
||||
String category;
|
||||
|
||||
public Painting (){
|
||||
super(InventoryType.PAINTING);
|
||||
}
|
||||
|
||||
}
|
||||
36
Model/src/main/java/edu/inventorym/model/Print.java
Normal file
36
Model/src/main/java/edu/inventorym/model/Print.java
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class Print extends InventoryPiece {
|
||||
|
||||
String openEditionType;
|
||||
String category;
|
||||
|
||||
public Print(){
|
||||
super(InventoryType.PRINT);
|
||||
}
|
||||
|
||||
public Print(String openEditionType, String category) {
|
||||
this.openEditionType = openEditionType;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getOpenEditionType() {
|
||||
return openEditionType;
|
||||
}
|
||||
|
||||
public void setOpenEditionType(String openEditionType) {
|
||||
this.openEditionType = openEditionType;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
16
Model/src/main/java/edu/inventorym/model/Sculpture.java
Normal file
16
Model/src/main/java/edu/inventorym/model/Sculpture.java
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public class Sculpture extends InventoryPiece {
|
||||
|
||||
String material;
|
||||
float weight;
|
||||
|
||||
public Sculpture (){
|
||||
super(InventoryType.SCULPTURE);
|
||||
}
|
||||
|
||||
}
|
||||
49
Model/src/main/java/edu/inventorym/model/Transaction.java
Normal file
49
Model/src/main/java/edu/inventorym/model/Transaction.java
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
import jakarta.json.JsonArray;
|
||||
|
||||
public class Transaction {
|
||||
String id;
|
||||
ZonedDateTime created = ZonedDateTime.now();
|
||||
ZonedDateTime completed = null;
|
||||
String customerId;
|
||||
Address shipToAddress;
|
||||
InventoryList customerInventoryList;
|
||||
JsonArray attributes;
|
||||
|
||||
public Transaction() {
|
||||
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ZonedDateTime getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(ZonedDateTime created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public ZonedDateTime getCompleted() {
|
||||
return completed;
|
||||
}
|
||||
|
||||
public void setCompleted(ZonedDateTime completed) {
|
||||
this.completed = completed;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TransactionList extends ArrayList<Transaction> {
|
||||
public TransactionList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Transaction e) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.add(e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
public class TransactionManager {
|
||||
|
||||
final static TransactionManager INSTANCE = new TransactionManager();
|
||||
|
||||
public static TransactionManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public TransactionList TRANSACTIONS = new TransactionList();
|
||||
|
||||
public Transaction TransactRequest(Customer customer, InventoryList iPieces, Transaction transacted) {
|
||||
return transacted;
|
||||
}
|
||||
|
||||
public void compute(Transaction tran, TransactionOperationEnum operation) {
|
||||
|
||||
}
|
||||
|
||||
public void compute(Transaction tran) {
|
||||
|
||||
}
|
||||
|
||||
public void complete(Transaction tran) {
|
||||
|
||||
}
|
||||
|
||||
public TransactionList findByCustomerEmail(String email) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public TransactionList findByTransactionId(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public TransactionList findByTransactionDate(ZonedDateTime completed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void remove(Transaction tran) {
|
||||
|
||||
}
|
||||
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'save'");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
edu.inventorym
|
||||
*/
|
||||
package edu.inventorym.model;
|
||||
|
||||
public enum TransactionOperationEnum {
|
||||
Completed,
|
||||
Draft,
|
||||
Pricing,
|
||||
Removed,
|
||||
Shipping
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user