org.entityfs.impl
Interface EntityAttributeSetter

All Known Implementing Classes:
LastModificationTimeEntityAttributeSetter

public interface EntityAttributeSetter

This is used by EntityDelegate:s to set attributes on the target entity when an entity is copied with preserveAttrs set to true.

All attribute setters are run just after the target entity has been created, before all setup locks have been released. The only exception is for files, where some attribute setters can be run after the file data has been copied to the target file. See isRunAfterCopyingFileData().

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-core

Method Summary
 boolean isRunAfterCopyingFileData()
          If the entity attribute setter is used for setting attributes on a file, should it be run after the file data has been copied to the target file? If it should, it cannot require any other locks than a read lock on the source and a write lock on the target.
 void setAttributes(EntityImplementation source, EntityImplementation target)
          Set attributes on the target entity.
 

Method Detail

setAttributes

void setAttributes(EntityImplementation source,
                   EntityImplementation target)
Set attributes on the target entity. This is called when all setup locks are still locked, unless the target entity is a file and isRunAfterCopyingFileData() returns true. In that case the source entity is locked for reading and the target entity locked for writing.

Parameters:
source - The source entity. Locked for reading.
target - The target entity to set attributes on. Locked for writing.

isRunAfterCopyingFileData

boolean isRunAfterCopyingFileData()
If the entity attribute setter is used for setting attributes on a file, should it be run after the file data has been copied to the target file? If it should, it cannot require any other locks than a read lock on the source and a write lock on the target.

This can be used to set attributes that would otherwise be affected by the file data copying, such as a file's last modification time.

For entities other than files, this property has no effect.

Returns:
true if the attribute setter should be run after copying file data for a file.