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=
auto.sync=false
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=true
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=
java.home=/usr/lib/jvm/java-25-openjdk
jvm.arguments=
offline.mode=false
override.workspace.settings=false
show.console.view=false
show.executions.view=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
+4 -4
View File
@@ -56,17 +56,17 @@ dependencies {
jar {
manifest {
attributes 'Main-Class': application.mainClass
attributes 'Main-Class': 'edu.bookocontacts.AppSceneView'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.named('jar') {
manifest {
attributes('Automatic-Module-Name':group,
'Implementation-Title': group,
attributes('Automatic-Module-Name': 'edu.bookocontacts',
'Implementation-Title': 'edu.bookocontacts',
'Implementation-Version': 1.0,
'Main-Class': application.mainClass,
'Main-Class': 'edu.bookocontacts.AppSceneView',
'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
/ or on linux:
sh ./gradlew edu.addressbook.view:run
AspectJ Referee component will call the Game plays.
AspectJ component runtime, and compile time weaving is used.
schema
@@ -36,7 +37,7 @@ INSERT INTO CONTACT (ID, FIRST_NAME, LAST_NAME, PHONE_NUMBER, EMAIL_ADDRESS, MAI
VALUES
(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"),
(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;
@@ -13,7 +13,7 @@ public aspect StorageMonitor {
Logger logger = LoggerFactory.getLogger(Contact.class);
logger.info(String.format("Checking: %s. ", ob));
logger.info(String.format("AspectJ-Check: %s. ", ob));
return ob;
}
@@ -13,6 +13,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import edu.bookocontacts.model.Contact;
import edu.bookocontacts.model.EnumStatus;
import edu.bookocontacts.model.Factory;
import edu.bookocontacts.model.PhoneNumber;
import javafx.beans.value.ChangeListener;
@@ -146,11 +147,15 @@ public class ViewController implements Initializable {
Optional<Contact> result = dialog.showAndWait();
if (result.isPresent()) {
log("result is present.");
// add to storage
// update storage
Contact updatedContact = (Contact) result.get();
try {
updatedContact.setId(ct.getId());
ct.save();
updatedContact.setStatus(EnumStatus.UPDATED);
updatedContact.save();
ct.copy(updatedContact);
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
}
@@ -13,7 +13,7 @@ public class Contact {
private PhoneNumber phone_number;
private EmailAddress email_address;
private MailAddress mailing_address;
EnumStatus status = EnumStatus.STORED;
EnumStatus status = null;
public Contact() {
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
public String toString() {
@@ -89,7 +99,7 @@ public class Contact {
public void save() throws IOException {
Factory.save(this);
this.status = EnumStatus.STORED;
this.status = EnumStatus.INSTORE;
}
public void markDeleted() {
@@ -104,6 +114,10 @@ public class Contact {
this.id = id;
}
public void setStatus(EnumStatus es){
this.status = es;
}
public String getName() {
return this.first_name + " " + last_name;
}
@@ -47,7 +47,7 @@ public final class DATASET {
new EmailAddress(rs.getString("EMAIL_ADDRESS")),
new PhoneNumber(rs.getString("PHONE_NUMBER")),
new MailAddress(rs.getString("MAIL_ADDRESS")));
ct.status = EnumStatus.STORED;
ct.status = EnumStatus.INSTORE;
list.add(ct);
}
@@ -1,5 +1,5 @@
package edu.bookocontacts.model;
public enum EnumStatus {
STORED,NEW,DELETED;
INSTORE,NEW,UPDATED,DELETED;
}