This commit is contained in:
2026-01-08 16:08:52 -05:00
parent d724c734c3
commit 7e2dfdf784
13 changed files with 68 additions and 128 deletions

20
.vscode/launch.json vendored
View File

@@ -4,6 +4,23 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{
"type": "java",
"name": "ApiController",
"request": "launch",
"mainClass": "edu.inventorym.ApiController",
"projectName": "Ui"
},
{
"type": "java",
"name": "Application",
"request": "launch",
"mainClass": "edu.inventorym.Application",
"projectName": "Ui",
"noDebug": false,
"__progressId": "ac782dee-a961-4892-9b94-9090bfdfcbda",
"__origin": "internal"
},
{ {
"type": "java", "type": "java",
"name": "ApplicationView", "name": "ApplicationView",
@@ -11,7 +28,6 @@
"mainClass": "edu.inventorym.ApplicationView", "mainClass": "edu.inventorym.ApplicationView",
"projectName": "UiView", "projectName": "UiView",
"vmArgs": " --module-path /home/sherwinp/workspace/javafx-sdk/lib --add-modules ALL-MODULE-PATH --enable-native-access=javafx.web,javafx.controls,javafx.media,javafx.graphics -Dcom.sun.management.jmxremote=false -Djava.awt.headless=true -XX:+DisableAttachMechanism" "vmArgs": " --module-path /home/sherwinp/workspace/javafx-sdk/lib --add-modules ALL-MODULE-PATH --enable-native-access=javafx.web,javafx.controls,javafx.media,javafx.graphics -Dcom.sun.management.jmxremote=false -Djava.awt.headless=true -XX:+DisableAttachMechanism"
}, }
] ]
} }

8
Api/.gitignore vendored
View File

@@ -1,8 +0,0 @@
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build
# Ignore bin
bin

View File

@@ -1,36 +0,0 @@
/*
* This file was generated by the Gradle 'init' task.
*
*/
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'java'
id 'application'
}
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
sourceCompatibility = JavaVersion.toVersion("25")
targetCompatibility = JavaVersion.toVersion("25")
}
application {
// Define the main class for the application.
mainClass = 'edu.inventorym.Api'
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
implementation 'jakarta.json.bind:jakarta.json.bind-api:3.0.1'
implementation project(':Model')
}

View File

@@ -1,23 +0,0 @@
[
{
"email": "kate@museum.com",
"id": "4659170390",
"nameFirst": "Kate",
"nameLast": "Demsey",
"phone": "310-676-4844"
},
{
"email": "jim@homedeco.com",
"id": "3722574478",
"nameFirst": "Jim",
"nameLast": "Gumbly",
"phone": "203-676-4844"
},
{
"email": "evan@homedeco.com",
"id": "3611023109",
"nameFirst": "Evan",
"nameLast": "Hao",
"phone": "203-676-8943"
}
]

View File

@@ -1,2 +0,0 @@
[
]

View File

@@ -1,31 +0,0 @@
[
{
"completed": "2025-12-24T17:58:48.979740808-05:00[America/New_York]",
"created": "2025-12-24T17:58:48.979723067-05:00[America/New_York]",
"customerId": "4659170390",
"customerInventoryList": [
{
"Author": "Dave Janson",
"author": "Dave Janson",
"created": "2025-10-30T13:47:16.4766896-04:00[America/New_York]",
"description": "East Market Square find. Local Author.",
"id": "1829220534",
"price": 92.0,
"title": "Windy Rowing",
"type": "DRAWING"
},
{
"Author": "Dave Janson",
"author": "Dave Janson",
"created": "2025-10-30T13:47:16.4766896-04:00[America/New_York]",
"description": "East Market Square find. Local Author.",
"id": "1829220534",
"price": 92.0,
"title": "Windy Rowing",
"type": "DRAWING"
}
],
"id": "LRlFXsGy8F0Vq6caT5hYKQ",
"totalPrice": 184.0
}
]

View File

@@ -36,11 +36,16 @@ configurations {
} }
dependencies { dependencies {
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.17'
implementation 'io.netty:netty-common:4.2.8.Final' implementation 'io.netty:netty-common:4.2.8.Final'
implementation 'org.springframework.boot:spring-boot-starter-webflux:4.0.0' implementation 'org.springframework.boot:spring-boot-starter-webflux:4.0.0'
implementation 'org.springdoc:springdoc-openapi-starter-webflux-api:3.0.0' implementation 'org.springdoc:springdoc-openapi-starter-webflux-api:3.0.0'
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:3.0.0' implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:3.0.0'
implementation 'jakarta.json.bind:jakarta.json.bind-api:3.0.1' implementation 'jakarta.json.bind:jakarta.json.bind-api:3.0.1'
implementation project(':Model') implementation project(':Model')
} }

View File

@@ -6,6 +6,12 @@ package edu.inventorym;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import edu.inventorym.model.Customer; import edu.inventorym.model.Customer;
import edu.inventorym.model.CustomerManager; import edu.inventorym.model.CustomerManager;
import edu.inventorym.model.Drawing; import edu.inventorym.model.Drawing;
@@ -18,22 +24,17 @@ import edu.inventorym.model.Sculpture;
import edu.inventorym.model.Transaction; import edu.inventorym.model.Transaction;
import edu.inventorym.model.TransactionList; import edu.inventorym.model.TransactionList;
import edu.inventorym.model.TransactionManager; import edu.inventorym.model.TransactionManager;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
public interface Api { @RestController
@RequestMapping("/api")
public static void main(String[] args) { public interface ApiController { // SINGLETON
callerInterface();
}
static void callerInterface() {
// @Comment
/*
* 1. Add new art object to the inventory. Your manager must check that the art
* is not already in the inventory before adding
*/
@Operation(summary = "Get status Inventory Loaded", description = "Returns status Inventory Loaded.")
@ApiResponse(responseCode = "200", description = "loaded")
@GetMapping
public static ResponseEntity<String> getInventory() {
/* Inventory pieces */ /* Inventory pieces */
InventoryManager.getInstance().load(); InventoryManager.getInstance().load();
if (InventoryManager.getInstance().INVENTORY.isEmpty()) { if (InventoryManager.getInstance().INVENTORY.isEmpty()) {
@@ -45,6 +46,16 @@ public interface Api {
InventoryManager.getInstance().add(make(new Sculpture())); InventoryManager.getInstance().add(make(new Sculpture()));
InventoryManager.getInstance().add(make(new Sculpture())); InventoryManager.getInstance().add(make(new Sculpture()));
} }
return new ResponseEntity<>("Resource loaded!", HttpStatus.OK);
}
static void callerInterface() {
// @Comment
/*
* 1. Add new art object to the inventory. Your manager must check that the art
* is not already in the inventory before adding
*/
/* Customers */ /* Customers */
CustomerManager.getInstance().load(); CustomerManager.getInstance().load();
if (CustomerManager.getInstance().CUSTOMERS.isEmpty()) { if (CustomerManager.getInstance().CUSTOMERS.isEmpty()) {
@@ -75,7 +86,7 @@ public interface Api {
System.out.println("\n"); System.out.println("\n");
if (imgr.INVENTORY.isEmpty()) { if (imgr.INVENTORY.isEmpty()) {
System.out.println(String.format("%s: No Inventoried Art Piecies Available !!!. ", Api.class)); System.out.println(String.format("%s: No Inventoried Art Piecies Available !!!. ", ApiController.class));
return; return;
} }
@@ -98,7 +109,7 @@ public interface Api {
*/ */
tmgr.compute(tran); tmgr.compute(tran);
tmgr.complete(tran); tmgr.complete(tran);
//tmgr.remove(tran); // tmgr.remove(tran);
/* /*
* 7. Format and return transaction data in print format * 7. Format and return transaction data in print format
*/ */

View File

@@ -4,6 +4,8 @@
*/ */
package edu.inventorym; package edu.inventorym;
import java.util.concurrent.CompletableFuture;
import org.springframework.boot.WebApplicationType; import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
@@ -17,18 +19,21 @@ import io.swagger.v3.oas.annotations.info.Info;
@EnableWebFlux @EnableWebFlux
@SpringBootApplication @SpringBootApplication
@OpenAPIDefinition(info = @Info(title = "Model API", version = "3.0.0", description = "Documentation Model API v1.0")) @OpenAPIDefinition(info = @Info(title = "Model API", version = "3.0.0", description = "Documentation Model API v1.0"))
public class Application { public class BackendService {
public static void main(String[] args) { public static final void BackendServiceStart(String[] args){
CompletableFuture.runAsync(() -> {
// Long-running background operation
new SpringApplicationBuilder() new SpringApplicationBuilder()
.profiles("dev") .profiles("dev")
.web(WebApplicationType.REACTIVE) .web(WebApplicationType.REACTIVE)
.sources(Application.class, Controller.class) .sources(BackendService.class, Controller.class, ApiController.class)
.run(args); .run(args);
});
} }
@Bean @Bean
public NettyReactiveWebServerFactory nettyServerFactory() { public static final NettyReactiveWebServerFactory nettyServerFactory() {
NettyReactiveWebServerFactory factory = new NettyReactiveWebServerFactory(); NettyReactiveWebServerFactory factory = new NettyReactiveWebServerFactory();
return factory; return factory;
} }

View File

@@ -55,18 +55,21 @@ javafx {
dependencies { dependencies {
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.17'
//https://mvnrepository.com/artifact/com.google.code.gson/gson //https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation 'com.google.code.gson:gson:2.13.2' implementation 'com.google.code.gson:gson:2.13.2'
implementation 'org.openjfx:javafx-base:25.0.1' implementation 'org.openjfx:javafx-base:25.0.1'
implementation 'org.openjfx:javafx-fxml:25.0.1' implementation 'org.openjfx:javafx-fxml:25.0.1'
implementation 'org.openjfx:javafx-controls:25.0.1' implementation 'org.openjfx:javafx-controls:25.0.1'
implementation 'org.openjfx:javafx-graphics:25.0.1' implementation 'org.openjfx:javafx-graphics:25.0.1'
implementation 'org.openjfx:javafx-web:25.0.1' implementation 'org.openjfx:javafx-web:25.0.1'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.17'
implementation project(':Model') implementation project(':Model')
implementation project(':Api') implementation project(':Ui')
} }

View File

@@ -43,6 +43,7 @@ public class ApplicationView extends Application {
} }
public static void main(String[] args) { public static void main(String[] args) {
BackendService.BackendServiceStart(args);
launch(args); launch(args);
} }
} }

View File

@@ -6,6 +6,5 @@ plugins {
rootProject.name = 'inventorym' rootProject.name = 'inventorym'
include('Model') include('Model')
include('Api')
include('Ui') include('Ui')
include('UiView') include('UiView')