*/
private void updateAcl( boolean newFile, RepositoryFile repositoryFile, RepositoryFileAcl repositoryFileAcl ) {
getLogger().debug( "File " + ( newFile ? "is new" : "already exists" ) );
if ( repositoryFileAcl != null
&& ( getImportSession().isApplyAclSettings() || getImportSession().isRetainOwnership() ) ) {
RepositoryFileAcl manifestAcl = repositoryFileAcl;
RepositoryFileAcl originalAcl = repository.getAcl( repositoryFile.getId() );
// Determine who will own this file
RepositoryFileSid newOwner;
if ( getImportSession().isRetainOwnership() ) {
if ( newFile ) {
getLogger().debug( "Getting Owner from Session" );
newOwner = new RepositoryFileSid( PentahoSessionHolder.getSession().getName(), RepositoryFileSid.Type.USER );
} else {
getLogger().debug( "Getting Owner from existing file" );
newOwner = originalAcl.getOwner();
}
} else {
getLogger().debug( "Getting Owner from Manifest" );
newOwner = manifestAcl.getOwner();
}
// Determine the Aces we will use for this file
RepositoryFileAcl useAclForPermissions; // The ACL we will use the permissions from
if ( getImportSession().isApplyAclSettings() && ( getImportSession().isOverwriteAclSettings() || newFile ) ) {
getLogger().debug( "Getting permissions from Manifest" );
useAclForPermissions = manifestAcl;
} else {
if ( newFile ) {
getLogger().debug( "Getting permissions from Default settings" );
useAclForPermissions = getDefaultAcl( repositoryFile );
} else {
getLogger().debug( "Getting permissions from existing file" );
useAclForPermissions = originalAcl;
}
}
// Make the new Acl if it has changed from the orignal
if ( !newOwner.equals( originalAcl.getOwner() ) || !useAclForPermissions.equals( originalAcl ) ) {
RepositoryFileAcl updatedAcl =
new RepositoryFileAcl( repositoryFile.getId(), newOwner, useAclForPermissions.isEntriesInheriting(),
useAclForPermissions.getAces() );
repository.updateAcl( updatedAcl );
}
}
}