/** * {@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; }
/** * {@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 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; }
String key = String.valueOf( tag.getRevision() );
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 ) ); }
@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" ); } } } };