/** * {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( other instanceof Tag ) { Tag ot = ( Tag ) other; if ( description != null && ot.getDescription() != null ) { return revision == ot.getRevision() && description.equals( ot.getDescription() ); } else if ( description == null && ot.getDescription() == null ) { return revision == ot.getRevision(); } } return false; }
/** * {@inheritDoc} */ @Override public Tag tag( String description ) { if ( ( latest != null ) && ( latest.getRevision() == currentRevision ) ) { return latest; } latest = new Tag( currentRevision, description ); tags.put( currentRevision, latest ); return latest; }
public long revert() throws LdapException { if ( changeLog == null || !changeLog.isEnabled() ) { throw new IllegalStateException( I18n.err( I18n.ERR_310 ) ); } Tag latest = changeLog.getLatest(); if ( null != latest ) { if ( latest.getRevision() < changeLog.getCurrentRevision() ) { return revert( latest.getRevision() ); } else { LOG.info( "Ignoring request to revert without changes since the latest tag." ); return changeLog.getCurrentRevision(); } } throw new IllegalStateException( I18n.err( I18n.ERR_311 ) ); }
/** * {@inheritDoc} */ @Override public Tag tag( long revision, String descrition ) { if ( tags.containsKey( revision ) ) { return tags.get( revision ); } latest = new Tag( revision, descrition ); tags.put( revision, latest ); return latest; }
@Override public void evaluate() throws Throwable { Tag tag = directoryService.getChangeLog().tag(); DSAnnotationProcessor.applyLdifs( description, directoryService ); LOG.debug( "Tagged change log: {}", tag ); try { base.evaluate(); } finally { if ( directoryService.getChangeLog().getCurrentRevision() > tag.getRevision() ) { LOG.debug( "Reverting to tag: {}", tag ); directoryService.revert( tag.getRevision() ); } else { LOG.debug( "No changes made, nothing to revert" ); } } } };
/** * {@inheritDoc} */ @Override public Tag tag( long revision ) { if ( tags.containsKey( revision ) ) { return tags.get( revision ); } latest = new Tag( revision, null ); tags.put( revision, latest ); return latest; }
String key = String.valueOf( tag.getRevision() ); if ( tag.getDescription() == null ) props.setProperty( key, tag.getDescription() );
/** * {@inheritDoc} */ @Override public Tag tag() { if ( ( latest != null ) && ( latest.getRevision() == currentRevision ) ) { return latest; } latest = new Tag( currentRevision, null ); tags.put( currentRevision, latest ); return latest; }
/** * {@inheritDoc} */ @Override public Tag tag( long revision, String description ) throws Exception { if ( revision < 0 ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_239 ) ); } if ( revision > store.getCurrentRevision() ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_240 ) ); } if ( store instanceof TaggableChangeLogStore ) { latest = ( ( TaggableChangeLogStore ) store ).tag( revision ); return latest; } latest = new Tag( revision, description ); return latest; }