mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
initial rework for new enhancement
This commit is contained in:
@@ -3,6 +3,8 @@ package com.avaje.tests.model.basic;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.avaje.ebean.BeanState;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.event.BeanPersistListener;
|
||||
import com.avaje.ebean.event.BulkTableEvent;
|
||||
@@ -11,56 +13,58 @@ import com.avaje.ebean.event.ServerConfigStartup;
|
||||
|
||||
public class MyEBasicConfigStartup implements ServerConfigStartup {
|
||||
|
||||
public void onStart(ServerConfig serverConfig) {
|
||||
|
||||
serverConfig.add(new EbasicPersistList());
|
||||
serverConfig.add(new EbasicBulkListener());
|
||||
public void onStart(ServerConfig serverConfig) {
|
||||
|
||||
serverConfig.add(new EbasicPersistList());
|
||||
serverConfig.add(new EbasicBulkListener());
|
||||
}
|
||||
|
||||
public static class EbasicBulkListener implements BulkTableEventListener {
|
||||
|
||||
final Set<String> s = new HashSet<String>();
|
||||
|
||||
EbasicBulkListener() {
|
||||
s.add("e_basic");
|
||||
}
|
||||
|
||||
public static class EbasicBulkListener implements BulkTableEventListener {
|
||||
|
||||
final Set<String> s = new HashSet<String>();
|
||||
|
||||
EbasicBulkListener() {
|
||||
s.add("e_basic");
|
||||
}
|
||||
public Set<String> registeredTables() {
|
||||
return s;
|
||||
}
|
||||
|
||||
public Set<String> registeredTables() {
|
||||
return s;
|
||||
}
|
||||
public void process(BulkTableEvent bulkTableEvent) {
|
||||
System.out.println("-- " + bulkTableEvent);
|
||||
}
|
||||
|
||||
public void process(BulkTableEvent bulkTableEvent) {
|
||||
System.out.println("-- "+bulkTableEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class EbasicPersistList implements BeanPersistListener<EBasic> {
|
||||
}
|
||||
|
||||
public boolean inserted(EBasic bean) {
|
||||
System.out.println("-- EBasic inserted "+bean.getId());
|
||||
return false;
|
||||
}
|
||||
public static class EbasicPersistList implements BeanPersistListener<EBasic> {
|
||||
|
||||
public boolean updated(EBasic bean, Set<String> updatedProperties) {
|
||||
System.out.println("-- EBasic updated "+bean.getId());
|
||||
return false;
|
||||
}
|
||||
public boolean inserted(EBasic bean) {
|
||||
System.out.println("-- EBasic inserted " + bean.getId());
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean deleted(EBasic bean) {
|
||||
System.out.println("-- EBasic deleted "+bean.getId());
|
||||
return false;
|
||||
}
|
||||
public boolean updated(EBasic bean) {
|
||||
BeanState beanState = Ebean.getBeanState(bean);
|
||||
Set<String> updatedProperties = beanState.getChangedProps();
|
||||
System.out.println("-- EBasic updated " + bean.getId());
|
||||
return false;
|
||||
}
|
||||
|
||||
public void remoteInsert(Object id) {
|
||||
}
|
||||
public boolean deleted(EBasic bean) {
|
||||
System.out.println("-- EBasic deleted " + bean.getId());
|
||||
return false;
|
||||
}
|
||||
|
||||
public void remoteUpdate(Object id) {
|
||||
}
|
||||
public void remoteInsert(Object id) {
|
||||
}
|
||||
|
||||
public void remoteUpdate(Object id) {
|
||||
}
|
||||
|
||||
public void remoteDelete(Object id) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void remoteDelete(Object id) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ public class PFile extends BasicDomain {
|
||||
private PFileContent fileContent;
|
||||
|
||||
/** Another persistent file. */
|
||||
@OneToOne(cascade=CascadeType.ALL)
|
||||
private PFileContent fileContent2;
|
||||
|
||||
@OneToOne(cascade=CascadeType.ALL)
|
||||
private PFileContent fileContent2;
|
||||
|
||||
public PFile() {
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ public class PFile extends BasicDomain {
|
||||
super();
|
||||
this.name = name;
|
||||
this.fileContent = fileContent;
|
||||
//this.persistentFileContent.setPersistentFile(this);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -36,20 +35,20 @@ public class PFile extends BasicDomain {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public PFileContent getFileContent() {
|
||||
return fileContent;
|
||||
}
|
||||
public PFileContent getFileContent() {
|
||||
return fileContent;
|
||||
}
|
||||
|
||||
public void setFileContent(PFileContent fileContent) {
|
||||
this.fileContent = fileContent;
|
||||
}
|
||||
public void setFileContent(PFileContent fileContent) {
|
||||
this.fileContent = fileContent;
|
||||
}
|
||||
|
||||
public PFileContent getFileContent2() {
|
||||
return fileContent2;
|
||||
}
|
||||
public PFileContent getFileContent2() {
|
||||
return fileContent2;
|
||||
}
|
||||
|
||||
public void setFileContent2(PFileContent fileContent2) {
|
||||
this.fileContent2 = fileContent2;
|
||||
}
|
||||
public void setFileContent2(PFileContent fileContent2) {
|
||||
this.fileContent2 = fileContent2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user