/** * This method tries to get an object from any of the scopes (invoking the <code>get(IntactObject)</code> method. * If it does not exist, it adds it to the SyncContext and returns the newly synced object. * @param intactObject The object to sync (if transient) * @return a synced object, which can be itself or a previously equal synced object */ public T syncIfTransient(T intactObject) { if (log.isDebugEnabled()) log.debug("\t\tSyncing "+intactObject.getClass().getSimpleName()+": "+intactObject.getShortLabel()); T refreshedObject = get(intactObject); if (refreshedObject != null) { if (log.isDebugEnabled()) log.debug("\t\t\tAlready synced: " + intactObject.getClass().getSimpleName() + "(" + intactObject.getShortLabel() + " - " + intactObject.getAc() + ")"); return refreshedObject; } if ( log.isDebugEnabled() ) { log.debug( "\t\t\tAdding to SyncContext. Key: "+ AnnotKeyGenerator.createKey(intactObject)); } SyncContext.getInstance().addToSynced(intactObject); return syncAttributes(intactObject); }