Skip to content

Commit

Permalink
remove deprecated interface methods
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Feb 11, 2016
1 parent 45d4b9f commit c66498a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 154 deletions.
Expand Up @@ -62,7 +62,6 @@
* forget to update an inverse relationship. To turn this feature on, you must set the system default
* <code>er.extensions.ERXEnterpriseObject.updateInverseRelationships=true</code>.
*
* @property ERDebuggingEnabled
* @property er.extensions.ERXCustomObject.shouldTrimSpaces
*/
public class ERXCustomObject extends EOCustomObject implements ERXGuardedObjectInterface, ERXGeneratesPrimaryKeyInterface, ERXEnterpriseObject {
Expand Down Expand Up @@ -154,7 +153,7 @@ public void delete() {
*/
public void mightDelete() {
if (tranLogMightDelete.isDebugEnabled())
tranLogMightDelete.debug("Object:" + description());
tranLogMightDelete.debug("Object: " + this);
}

/* (non-Javadoc)
Expand All @@ -165,7 +164,7 @@ public void willDelete() throws NSValidation.ValidationException {
throw ERXValidationFactory.defaultFactory().createException(this, null, null, "ObjectCannotBeDeletedException");
}
if (tranLogWillDelete.isDebugEnabled())
tranLogWillDelete.debug("Object:" + description());
tranLogWillDelete.debug("Object: " + this);
}

/* (non-Javadoc)
Expand All @@ -183,7 +182,7 @@ public void willInsert() {
tranLogWillInsert.error("Found illegal value in to many "+key+" for "+this+": "+o);
}
}
tranLogWillInsert.debug("Object:" + description());
tranLogWillInsert.debug("Object: " + this);
}
if(shouldTrimSpaces())
trimSpaces();
Expand All @@ -205,7 +204,7 @@ public void willUpdate() {
}
}
if (tranLogWillUpdate.isDebugEnabled())
tranLogWillUpdate.debug("Object:" + description() + " changes: " + changesFromCommittedSnapshot());
tranLogWillUpdate.debug("Object: " + this + " changes: " + changesFromCommittedSnapshot());
}
if(shouldTrimSpaces())
trimSpaces();
Expand All @@ -221,21 +220,21 @@ public void flushCaches() {}
*/
public void didDelete(EOEditingContext ec) {
if (tranLogDidDelete.isDebugEnabled())
tranLogDidDelete.debug("Object:" + description());
tranLogDidDelete.debug("Object: " + this);
}
/* (non-Javadoc)
* @see er.extensions.ERXEnterpriseObject#didUpdate()
*/
public void didUpdate() {
if (tranLogDidUpdate.isDebugEnabled())
tranLogDidUpdate.debug("Object:" + description());
tranLogDidUpdate.debug("Object: " + this);
}
/* (non-Javadoc)
* @see er.extensions.ERXEnterpriseObject#didInsert()
*/
public void didInsert() {
if (tranLogDidInsert.isDebugEnabled())
tranLogDidInsert.debug("Object:" + description());
tranLogDidInsert.debug("Object: " + this);

//We're going to blow the primaryKey cache:
_primaryKey = null;
Expand All @@ -246,15 +245,15 @@ public void didInsert() {
*/
public void willRevert() {
if ( tranLogWillRevert.isDebugEnabled() )
tranLogWillRevert.debug("Object: " + description());
tranLogWillRevert.debug("Object: " + this);
}

/* (non-Javadoc)
* @see er.extensions.ERXEnterpriseObject#didRevert(com.webobjects.eocontrol.EOEditingContext)
*/
public void didRevert(EOEditingContext ec) {
if ( tranLogDidRevert.isDebugEnabled() )
tranLogDidRevert.debug("Object: " + description());
tranLogDidRevert.debug("Object: " + this);
flushCaches();
}

Expand Down Expand Up @@ -471,32 +470,6 @@ public NSArray primaryKeyAttributeNames() {
/** caches the primary key dictionary for the given object */
private NSDictionary<String, Object> _primaryKeyDictionary;

/**
* Implementation of the interface {@link ERXGeneratesPrimaryKeyInterface}.
* This implementation operates in the following fashion. If it is called
* passing in 'false' and it has not yet been saved to the database, meaning
* this object does not yet have a primary key assigned, then it will have the
* adaptor channel generate a primary key for it. Then when the object is saved
* to the database it will use the previously generated primary key instead of
* having the adaptor channel generate another primary key. If 'true' is passed in
* then this method will either return the previously generated primaryKey
* dictionary or null if it does not have one. Typically you should only call
* this method with the 'false' parameter seeing as unless you are doing something
* really funky you won't be dealing with this object when it is in the middle of
* a transaction. The delegate {@link ERXDatabaseContextDelegate} is the only class
* that should be calling this method and passing in 'true'.
* @param inTransaction boolean flag to tell the object if it is currently in the
* middle of a transaction.
* @return primary key dictionary for the current object, if the object does not have
* a primary key assigned yet and is not in the middle of a transaction then
* a new primary key dictionary is created, cached and returned.
* @deprecated use {@link #rawPrimaryKeyDictionary(boolean)} instead
*/
@Deprecated
public NSDictionary primaryKeyDictionary(boolean inTransaction) {
return rawPrimaryKeyDictionary(inTransaction);
}

/**
* Implementation of the interface {@link ERXGeneratesPrimaryKeyInterface}.
* This implementation operates in the following fashion. If it is called
Expand Down Expand Up @@ -615,12 +588,6 @@ public String toString() {
return "<" + getClass().getName() + " pk:\""+ pk + "\">";
}

/**
* @deprecated use {@link #toString()} instead
*/
@Deprecated
public String description() { return toString(); }

/* (non-Javadoc)
* @see er.extensions.ERXEnterpriseObject#toLongString()
*/
Expand Down Expand Up @@ -700,9 +667,8 @@ public Object validateValueForKey(Object value, String key) throws NSValidation.

/**
* This method performs a few checks before invoking
* super's implementation. If the property key:
* <b>ERDebuggingEnabled</b> is set to true then the method
* <code>checkConsistency</code> will be called on this object.
* super's implementation.
*
* @throws NSValidation.ValidationException if the object does not
* pass validation for saving to the database.
*/
Expand All @@ -714,11 +680,6 @@ public void validateForSave( ) throws NSValidation.ValidationException {
validation.warn("Calling validate for save on an eo: " + this + " that has been marked for deletion!");
}
super.validateForSave();
// FIXME: Should move all of the keys into on central place for easier management.
// Also might want to have a flag off of ERXApplication is debugging is enabled.
// FIXME: Should have a better flag than just ERDebuggingEnabled
if (ERXProperties.booleanForKey("ERDebuggingEnabled"))
checkConsistency();
}

/**
Expand Down Expand Up @@ -763,17 +724,6 @@ public void validateForDelete() throws NSValidation.ValidationException {
super.validateForDelete();
}

/* (non-Javadoc)
* @see er.extensions.ERXEnterpriseObject#checkConsistency()
*/
// CHECKME: This method was very useful at NS, might not be as useful here.
public void checkConsistency() throws NSValidation.ValidationException {}

/* (non-Javadoc)
* @see er.extensions.ERXEnterpriseObject#batchCheckConsistency()
*/
public void batchCheckConsistency() throws NSValidation.ValidationException {}

/**
* Overridden to support two-way relationship setting.
*/
Expand Down
Expand Up @@ -556,14 +556,6 @@ public abstract void removeObjectsFromPropertyWithKey(NSArray<? extends EOEnterp
public abstract ERXEnterpriseObject refetchObjectFromDBinEditingContext(
EOEditingContext ec);

/**
* Cover method to return <code>toString</code>.
* @return the results of calling toString.
* @deprecated use toString() instead
*/
@Deprecated
public abstract String description();

/**
* Returns the super classes implementation of toString
* which prints out the current key-value pairs for all
Expand Down Expand Up @@ -602,18 +594,6 @@ public abstract ERXEnterpriseObject refetchObjectFromDBinEditingContext(
* @return if the object is a new enterprise object.
*/
public abstract boolean isNewObject();

/**
* Debugging method that will be called on an object before it is
* saved to the database if the property key: <b>ERDebuggingEnabled</b>
* is enabled. This allows for adding in a bunch of expensive validation
* checks that should only be enabled in development and testing
* environments.
* @throws NSValidation.ValidationException if the object is not consistent
*/
@Deprecated
public abstract void checkConsistency()
throws NSValidation.ValidationException;

/**
* Toggles whether or not inverse relationships should be updates. This is
Expand Down
Expand Up @@ -18,15 +18,6 @@
*/
public interface ERXGeneratesPrimaryKeyInterface {

/**
* This method is called by the ERXDatabaseContextDelegate when
* in the middle of a transaction. This is signaled by passing in
* the boolean <code>true</code> into the method. If the object
* returns <code>null</code> then a new primary key is generated.
*/
@Deprecated
public NSDictionary primaryKeyDictionary(boolean inTransaction);

/**
* This method is called by the ERXDatabaseContextDelegate when
* in the middle of a transaction. This is signaled by passing in
Expand Down
Expand Up @@ -312,15 +312,15 @@ public void didCopyFromChildInEditingContext(ERXGenericRecord originalEO, EOEdit

public void mightDelete() {
if (tranLogMightDelete.isDebugEnabled())
tranLogMightDelete.debug("Object:" + description());
tranLogMightDelete.debug("Object: " + this);
}

public void willDelete() throws NSValidation.ValidationException {
if (canDelete() == false) {
throw ERXValidationFactory.defaultFactory().createException(this, null, null, "ObjectCannotBeDeletedException");
}
if (tranLogWillDelete.isDebugEnabled())
tranLogWillDelete.debug("Object:" + description());
tranLogWillDelete.debug("Object: " + this);
}

public void willInsert() {
Expand All @@ -336,7 +336,7 @@ public void willInsert() {
tranLogWillInsert.error("Found illegal value in to many " + key + " for " + this + ": " + o);
}
}
tranLogWillInsert.debug("Object:" + description());
tranLogWillInsert.debug("Object: " + this);
}
if (shouldTrimSpaces())
trimSpaces();
Expand All @@ -359,7 +359,7 @@ public void willUpdate() {
}
}
if (tranLogWillUpdate.isDebugEnabled())
tranLogWillUpdate.debug("Object:" + description() + " changes: " + changesFromCommittedSnapshot());
tranLogWillUpdate.debug("Object: " + this + " changes: " + changesFromCommittedSnapshot());
}
if (shouldTrimSpaces())
trimSpaces();
Expand Down Expand Up @@ -391,17 +391,17 @@ public void flushCaches() {

public void didDelete(EOEditingContext ec) {
if (tranLogDidDelete.isDebugEnabled())
tranLogDidDelete.debug("Object:" + description());
tranLogDidDelete.debug("Object: " + this);
}

public void didUpdate() {
if (tranLogDidUpdate.isDebugEnabled())
tranLogDidUpdate.debug("Object:" + description());
tranLogDidUpdate.debug("Object: " + this);
}

public void didInsert() {
if (tranLogDidInsert.isDebugEnabled())
tranLogDidInsert.debug("Object:" + description());
tranLogDidInsert.debug("Object: " + this);
_permanentGlobalID = null;

// We're going to blow the primaryKey cache:
Expand All @@ -410,12 +410,12 @@ public void didInsert() {

public void willRevert() {
if (tranLogWillRevert.isDebugEnabled())
tranLogWillRevert.debug("Object: " + description());
tranLogWillRevert.debug("Object: " + this);
}

public void didRevert(EOEditingContext ec) {
if (tranLogDidRevert.isDebugEnabled())
tranLogDidRevert.debug("Object: " + description());
tranLogDidRevert.debug("Object: " + this);
flushCaches();
}

Expand Down Expand Up @@ -646,36 +646,6 @@ public EOEntity entity() {
/** caches the primary key dictionary for the given object */
private NSDictionary<String, Object> _primaryKeyDictionary;

/**
* Implementation of the interface {@link ERXGeneratesPrimaryKeyInterface}.
* This implementation operates in the following fashion. If it is called
* passing in 'false' and it has not yet been saved to the database, meaning
* this object does not yet have a primary key assigned, then it will have
* the adaptor channel generate a primary key for it. Then when the object
* is saved to the database it will use the previously generated primary key
* instead of having the adaptor channel generate another primary key. If
* 'true' is passed in then this method will either return the previously
* generated primaryKey dictionary or null if it does not have one.
* Typically you should only call this method with the 'false' parameter
* seeing as unless you are doing something really funky you won't be
* dealing with this object when it is in the middle of a transaction. The
* delegate {@link ERXDatabaseContextDelegate} is the only class that should
* be calling this method and passing in 'true'.
*
* @param inTransaction
* boolean flag to tell the object if it is currently in the
* middle of a transaction.
* @return primary key dictionary for the current object, if the object does
* not have a primary key assigned yet and is not in the middle of a
* transaction then a new primary key dictionary is created, cached
* and returned.
* @deprecated use {@link #rawPrimaryKeyDictionary(boolean)} instead
*/
@Deprecated
public NSDictionary<String, Object> primaryKeyDictionary(boolean inTransaction) {
return rawPrimaryKeyDictionary(inTransaction);
}

/**
* Implementation of the interface {@link ERXGeneratesPrimaryKeyInterface}.
* This implementation operates in the following fashion. If it is called
Expand Down Expand Up @@ -1010,14 +980,6 @@ public String toString() {
.append(" pk:\"").append(primaryKey()).append("\">").toString();
}

/**
* @deprecated use {@link #toString()} instead
*/
@Deprecated
public String description() {
return toString();
}

public String toLongString() {
return super.toString();
}
Expand Down Expand Up @@ -1175,8 +1137,6 @@ protected boolean shouldSkipValidateForSave() {

/**
* This method performs a few checks before invoking super's implementation.
* If the property key: <b>ERDebuggingEnabled</b> is set to true then the
* method <code>checkConsistency</code> will be called on this object.
*
* @throws NSValidation.ValidationException
* if the object does not pass validation for saving to the
Expand All @@ -1195,13 +1155,6 @@ public void validateForSave() throws NSValidation.ValidationException {
validation.warn("Calling validate for save on an eo: " + this + " that has been marked for deletion!");
}
super.validateForSave();
// FIXME: Should move all of the keys into on central place for easier
// management.
// Also might want to have a flag off of ERXApplication is debugging is
// enabled.
// FIXME: Should have a better flag than just ERDebuggingEnabled
if (ERXProperties.booleanForKey("ERDebuggingEnabled"))
checkConsistency();
}

/**
Expand Down Expand Up @@ -1236,14 +1189,6 @@ public void validateForUpdate() throws NSValidation.ValidationException {
super.validateForUpdate();
}

@Deprecated
public void checkConsistency() throws NSValidation.ValidationException {
}

@Deprecated
public void batchCheckConsistency() throws NSValidation.ValidationException {
}

/**
* Overridden to support two-way relationship setting.
*/
Expand Down

0 comments on commit c66498a

Please sign in to comment.