@Test public void doPurgeUtilDateBeforeTest() throws PurgeDeletionException { IUnifiedRepository mockRepo = mock( IUnifiedRepository.class ); final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap( mockRepo ); UnifiedRepositoryPurgeService purgeService = getPurgeService( mockRepo ); PurgeUtilitySpecification spec = new PurgeUtilitySpecification(); spec.setBeforeDate( getDate( "01/02/2006" ) ); spec.setPath( "/" ); purgeService.doDeleteRevisions( spec ); verifyDateBeforeDeletion( versionListMap, mockRepo, "1", spec.getBeforeDate() ); verifyDateBeforeDeletion( versionListMap, mockRepo, "2", spec.getBeforeDate() ); }
public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); static DefaultUnifiedRepositoryWebService repoWs; }