#589 - ElasticSearch - DocStoreMode renamed from DocStoreEvent

This commit is contained in:
Robin Bygrave committed 2016-03-07 19:10:15 +13:00
1 parent 32bcd5e853
commit a0609b1726
15 files changed
+75 -108

No files matched your search

@@ -7,7 +7,7 @@ import com.avaje.ebean.SqlUpdate;
import com.avaje.ebean.Transaction;
import com.avaje.ebean.ValuePair;
import com.avaje.ebean.annotation.ConcurrencyMode;
import com.avaje.ebean.annotation.DocStoreEvent;
import com.avaje.ebean.annotation.DocStoreMode;
import com.avaje.ebean.bean.BeanCollection;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.bean.EntityBeanIntercept;
@@ -84,7 +84,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -367,7 +366,6 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
private final DocStoreBeanAdapter<T> docStoreAdapter;
private final String defaultSelectClause;
private final LinkedHashSet<String> defaultSelectClauseSet;
private SpiEbeanServer ebeanServer;
@@ -401,8 +399,6 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
this.changeLogFilter = deploy.getChangeLogFilter();
this.defaultSelectClause = deploy.getDefaultSelectClause();
this.defaultSelectClauseSet = deploy.parseDefaultSelectClause(defaultSelectClause);
this.idType = deploy.getIdType();
this.idTypePlatformDefault = deploy.isIdTypePlatformDefault();
this.idGenerator = deploy.getIdGenerator();
@@ -889,13 +885,6 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
return defaultSelectClause;
}
/**
* Return the default select clause already parsed into an ordered Set.
*/
public LinkedHashSet<String> getDefaultSelectClauseSet() {
return defaultSelectClauseSet;
}
/**
* Return true if this object is the root level object in its entity
* inheritance.
@@ -929,7 +918,7 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
* Return the doc store helper for this bean type.
*/
@Override
public BeanDocType docStore() {
public BeanDocType<T> docStore() {
return docStoreAdapter;
}
@@ -956,11 +945,11 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
}
/**
* Return the type of DocStoreEvent that should occur for this type of persist request
* Return the type of DocStoreMode that should occur for this type of persist request
* given the transactions requested mode.
*/
public DocStoreEvent getDocStoreEvent(PersistRequest.Type persistType, DocStoreEvent txnMode) {
return docStoreAdapter.getEvent(persistType, txnMode);
public DocStoreMode getDocStoreMode(PersistRequest.Type persistType, DocStoreMode txnMode) {
return docStoreAdapter.getMode(persistType, txnMode);
}
public void docStoreInsert(Object idValue, PersistRequestBean<T> persistRequest, DocStoreUpdateContext bulkUpdate) throws IOException {
@@ -1457,6 +1446,7 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
}
@Override
@SuppressWarnings("unchecked")
public T createBean() {
return (T)createEntityBean();
}
@@ -1464,6 +1454,7 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
/**
* Creates a new EntityBean.
*/
@SuppressWarnings("unchecked")
public EntityBean createEntityBean() {
try {
EntityBean bean = (EntityBean)prototypeEntityBean._ebean_newInstance();
@@ -2,7 +2,7 @@ package com.avaje.ebeaninternal.server.deploy.meta;
import com.avaje.ebean.annotation.ConcurrencyMode;
import com.avaje.ebean.annotation.DocStore;
import com.avaje.ebean.annotation.DocStoreEvent;
import com.avaje.ebean.annotation.DocStoreMode;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.config.TableName;
import com.avaje.ebean.config.dbplatform.IdGenerator;
@@ -34,7 +34,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -187,10 +186,10 @@ public class DeployBeanDescriptor<T> {
private String docStoreIndexType;
private DocStoreEvent docStorePersist;
private DocStoreEvent docStoreInsert;
private DocStoreEvent docStoreUpdate;
private DocStoreEvent docStoreDelete;
private DocStoreMode docStorePersist;
private DocStoreMode docStoreInsert;
private DocStoreMode docStoreUpdate;
private DocStoreMode docStoreDelete;
/**
* Construct the BeanDescriptor.
@@ -805,29 +804,6 @@ public class DeployBeanDescriptor<T> {
return selectClause.substring(0, selectClause.length() - 1);
}
/**
* Parse the include separating by comma or semicolon.
*/
public LinkedHashSet<String> parseDefaultSelectClause(String rawList) {
if (rawList == null) {
return null;
}
String[] res = rawList.split(",");
LinkedHashSet<String> set = new LinkedHashSet<String>(res.length + 3);
String temp;
for (int i = 0; i < res.length; i++) {
temp = res[i].trim();
if (temp.length() > 0) {
set.add(temp);
}
}
return set;
}
/**
* Return true if the primary key is a compound key or if it's database type
* is non-numeric (and hence not suitable for db identity or sequence.
@@ -1008,30 +984,30 @@ public class DeployBeanDescriptor<T> {
/**
* Return the DocStore index behavior for bean inserts.
*/
public DocStoreEvent getDocStoreInsertEvent() {
public DocStoreMode getDocStoreInsertEvent() {
return getDocStoreIndexEvent(docStoreInsert);
}
/**
* Return the DocStore index behavior for bean updates.
*/
public DocStoreEvent getDocStoreUpdateEvent() {
public DocStoreMode getDocStoreUpdateEvent() {
return getDocStoreIndexEvent(docStoreUpdate);
}
/**
* Return the DocStore index behavior for bean deletes.
*/
public DocStoreEvent getDocStoreDeleteEvent() {
public DocStoreMode getDocStoreDeleteEvent() {
return getDocStoreIndexEvent(docStoreDelete);
}
private DocStoreEvent getDocStoreIndexEvent(DocStoreEvent mostSpecific) {
private DocStoreMode getDocStoreIndexEvent(DocStoreMode mostSpecific) {
if (!docStoreMapped) {
return DocStoreEvent.IGNORE;
return DocStoreMode.IGNORE;
}
if (mostSpecific != DocStoreEvent.DEFAULT) return mostSpecific;
if (docStorePersist != DocStoreEvent.DEFAULT) return docStorePersist;
if (mostSpecific != DocStoreMode.DEFAULT) return mostSpecific;
if (docStorePersist != DocStoreMode.DEFAULT) return docStorePersist;
return serverConfig.getDocStoreConfig().getPersist();
}
}