update project. deepcopy on contact.

This commit is contained in:
2026-02-20 13:16:07 -05:00
parent cff27c3424
commit ba8ab3046c
16 changed files with 39 additions and 19 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6 -6
View File
@@ -1,13 +1,13 @@
arguments= arguments=--init-script /home/sherwinp/.config/VSCodium/User/globalStorage/redhat.java/1.50.0/config_linux/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle --init-script /home/sherwinp/.config/VSCodium/User/globalStorage/redhat.java/1.50.0/config_linux/org.eclipse.osgi/58/0/.cp/gradle/protobuf/init.gradle
auto.sync=false auto.sync=true
build.scans.enabled=false build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir= connection.project.dir=
eclipse.preferences.version=1 eclipse.preferences.version=1
gradle.user.home= gradle.user.home=
java.home= java.home=/usr/lib/jvm/java-25-openjdk
jvm.arguments= jvm.arguments=
offline.mode=false offline.mode=false
override.workspace.settings=false override.workspace.settings=true
show.console.view=false show.console.view=true
show.executions.view=false show.executions.view=true
+4 -4
View File
@@ -56,17 +56,17 @@ dependencies {
jar { jar {
manifest { manifest {
attributes 'Main-Class': application.mainClass attributes 'Main-Class': 'edu.bookocontacts.AppSceneView'
} }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
} }
tasks.named('jar') { tasks.named('jar') {
manifest { manifest {
attributes('Automatic-Module-Name':group, attributes('Automatic-Module-Name': 'edu.bookocontacts',
'Implementation-Title': group, 'Implementation-Title': 'edu.bookocontacts',
'Implementation-Version': 1.0, 'Implementation-Version': 1.0,
'Main-Class': application.mainClass, 'Main-Class': 'edu.bookocontacts.AppSceneView',
'Class-Path': '. edu.bookocontacts edu.bookocontacts.model javafx.base javafx.controls' ) 'Class-Path': '. edu.bookocontacts edu.bookocontacts.model javafx.base javafx.controls' )
} }
} }
BIN
View File
Binary file not shown.
+3 -2
View File
@@ -16,7 +16,8 @@ Tests with ASPECTJ:
gradlew.bat run gradlew.bat run
/ or on linux: / or on linux:
sh ./gradlew edu.addressbook.view:run sh ./gradlew edu.addressbook.view:run
AspectJ Referee component will call the Game plays.
AspectJ component runtime, and compile time weaving is used.
schema schema
@@ -36,7 +37,7 @@ INSERT INTO CONTACT (ID, FIRST_NAME, LAST_NAME, PHONE_NUMBER, EMAIL_ADDRESS, MAI
VALUES VALUES
(8,"Ramon", "Razone", "443-310-8764","Raz@home.com",NULL), (8,"Ramon", "Razone", "443-310-8764","Raz@home.com",NULL),
(9,"Manny", "Zonie", "443-350-6764","Zonie@home.com","7000 Hause Ln, People City,MN, 34090"), (9,"Manny", "Zonie", "443-350-6764","Zonie@home.com","7000 Hause Ln, People City,MN, 34090"),
(10,"Von", "Ray", "443-210-9764","RayVon@home.com",""); (10,"Von", "Ray", "443-210-9764","RayVon@home.com","8000 House Ln, Plains City,PA 34090");
UPDATE CONTACT SET MAIL_ADDRESS=NULL WHERE ID=8; UPDATE CONTACT SET MAIL_ADDRESS=NULL WHERE ID=8;
@@ -13,7 +13,7 @@ public aspect StorageMonitor {
Logger logger = LoggerFactory.getLogger(Contact.class); Logger logger = LoggerFactory.getLogger(Contact.class);
logger.info(String.format("Checking: %s. ", ob)); logger.info(String.format("AspectJ-Check: %s. ", ob));
return ob; return ob;
} }
@@ -13,6 +13,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import edu.bookocontacts.model.Contact; import edu.bookocontacts.model.Contact;
import edu.bookocontacts.model.EnumStatus;
import edu.bookocontacts.model.Factory; import edu.bookocontacts.model.Factory;
import edu.bookocontacts.model.PhoneNumber; import edu.bookocontacts.model.PhoneNumber;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
@@ -146,11 +147,15 @@ public class ViewController implements Initializable {
Optional<Contact> result = dialog.showAndWait(); Optional<Contact> result = dialog.showAndWait();
if (result.isPresent()) { if (result.isPresent()) {
log("result is present."); log("result is present.");
// add to storage // update storage
Contact updatedContact = (Contact) result.get(); Contact updatedContact = (Contact) result.get();
try { try {
updatedContact.setId(ct.getId()); updatedContact.setId(ct.getId());
ct.save(); updatedContact.setStatus(EnumStatus.UPDATED);
updatedContact.save();
ct.copy(updatedContact);
} catch (Exception ex) { } catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage()); logger.log(Level.WARNING, ex.getMessage());
} }
@@ -13,7 +13,7 @@ public class Contact {
private PhoneNumber phone_number; private PhoneNumber phone_number;
private EmailAddress email_address; private EmailAddress email_address;
private MailAddress mailing_address; private MailAddress mailing_address;
EnumStatus status = EnumStatus.STORED; EnumStatus status = null;
public Contact() { public Contact() {
this("", ""); this("", "");
@@ -75,6 +75,16 @@ public class Contact {
} }
} }
public void copy(Contact ct){
this.id = ct.id;
this.first_name = ct.first_name;
this.last_name = ct.last_name;
this.phone_number = ct.phone_number;
this.email_address = ct.email_address;
this.mailing_address = ct.mailing_address;
this.status = ct.status;
}
@Override @Override
public String toString() { public String toString() {
@@ -89,7 +99,7 @@ public class Contact {
public void save() throws IOException { public void save() throws IOException {
Factory.save(this); Factory.save(this);
this.status = EnumStatus.STORED; this.status = EnumStatus.INSTORE;
} }
public void markDeleted() { public void markDeleted() {
@@ -104,6 +114,10 @@ public class Contact {
this.id = id; this.id = id;
} }
public void setStatus(EnumStatus es){
this.status = es;
}
public String getName() { public String getName() {
return this.first_name + " " + last_name; return this.first_name + " " + last_name;
} }
@@ -47,7 +47,7 @@ public final class DATASET {
new EmailAddress(rs.getString("EMAIL_ADDRESS")), new EmailAddress(rs.getString("EMAIL_ADDRESS")),
new PhoneNumber(rs.getString("PHONE_NUMBER")), new PhoneNumber(rs.getString("PHONE_NUMBER")),
new MailAddress(rs.getString("MAIL_ADDRESS"))); new MailAddress(rs.getString("MAIL_ADDRESS")));
ct.status = EnumStatus.STORED; ct.status = EnumStatus.INSTORE;
list.add(ct); list.add(ct);
} }
@@ -1,5 +1,5 @@
package edu.bookocontacts.model; package edu.bookocontacts.model;
public enum EnumStatus { public enum EnumStatus {
STORED,NEW,DELETED; INSTORE,NEW,UPDATED,DELETED;
} }