From 84b8777c2bcd120b5eda27ef95604c2c464fd19e Mon Sep 17 00:00:00 2001 From: Robin Bygrave Date: Fri, 31 Jul 2015 21:41:28 +1200 Subject: [PATCH] No effective change - code cleanup - BeanPropertyAssoc cleanup --- .../server/deploy/BeanPropertyAssoc.java | 47 ++++--------------- .../server/deploy/BeanPropertyAssocMany.java | 2 +- .../server/deploy/BeanPropertyAssocOne.java | 2 +- 3 files changed, 10 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssoc.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssoc.java index a5dfd71bb..69bc64934 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssoc.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssoc.java @@ -73,7 +73,7 @@ public abstract class BeanPropertyAssoc extends BeanProperty { /** * Construct the property. */ - public BeanPropertyAssoc(BeanDescriptorMap owner, BeanDescriptor descriptor, DeployBeanPropertyAssoc deploy) { + public BeanPropertyAssoc(BeanDescriptor descriptor, DeployBeanPropertyAssoc deploy) { super(descriptor, deploy); this.extraWhere = InternString.intern(deploy.getExtraWhere()); this.isOuterJoin = deploy.isOuterJoin(); @@ -172,18 +172,9 @@ public abstract class BeanPropertyAssoc extends BeanProperty { } public boolean isSaveRecurseSkippable(Object bean) { - if (!saveRecurseSkippable){ - // we have to saveRecurse even if the bean is not dirty - // as this bean has cascade save on some of its properties - return false; - } - if (bean instanceof EntityBean){ - return !((EntityBean)bean)._ebean_getIntercept().isNewOrDirty(); - } else { - // we don't know so we say no - return false; - } - } + + return saveRecurseSkippable && bean instanceof EntityBean && !((EntityBean) bean)._ebean_getIntercept().isNewOrDirty(); + } /** * Return true if save can be skipped for unmodified bean(s) of this @@ -198,13 +189,6 @@ public abstract class BeanPropertyAssoc extends BeanProperty { return saveRecurseSkippable; } - /** - * Similar to isSaveRecurseSkippable but in terms of delete. - */ - public boolean isDeleteRecurseSkippable() { - return deleteRecurseSkippable; - } - /** * Return true if the unique id properties are all not null for this bean. */ @@ -241,34 +225,19 @@ public abstract class BeanPropertyAssoc extends BeanProperty { return extraWhere; } - /** - * Return if this association should use an Outer join. - */ - public boolean isOuterJoin() { - return isOuterJoin; - } - /** * Return true if this association is updateable. */ public boolean isUpdateable() { - if (tableJoin.columns().length > 0) { - return tableJoin.columns()[0].isUpdateable(); - } - - return true; - } + return tableJoin.columns().length <= 0 || tableJoin.columns()[0].isUpdateable(); + } /** * Return true if this association is insertable. */ public boolean isInsertable() { - if (tableJoin.columns().length > 0) { - return tableJoin.columns()[0].isInsertable(); - } - - return true; - } + return tableJoin.columns().length <= 0 || tableJoin.columns()[0].isInsertable(); + } /** * return the join to use for the bean. diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssocMany.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssocMany.java index e89c5134c..dbbe402eb 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssocMany.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssocMany.java @@ -102,7 +102,7 @@ public class BeanPropertyAssocMany extends BeanPropertyAssoc { * Create this property. */ public BeanPropertyAssocMany(BeanDescriptorMap owner, BeanDescriptor descriptor, DeployBeanPropertyAssocMany deploy) { - super(owner, descriptor, deploy); + super(descriptor, deploy); this.unidirectional = deploy.isUnidirectional(); this.manyToMany = deploy.isManyToMany(); this.manyType = deploy.getManyType(); diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssocOne.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssocOne.java index a98c71da3..994d6b25e 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssocOne.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssocOne.java @@ -68,7 +68,7 @@ public class BeanPropertyAssocOne extends BeanPropertyAssoc { public BeanPropertyAssocOne(BeanDescriptorMap owner, BeanDescriptor descriptor, DeployBeanPropertyAssocOne deploy) { - super(owner, descriptor, deploy); + super(descriptor, deploy); importedPrimaryKey = deploy.isImportedPrimaryKey(); oneToOne = deploy.isOneToOne();