You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/06/19 10:40:13 UTC
svn commit: r1686374 - in /directory/studio/trunk/plugins:
ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/
ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/
ldifeditor/src/main/java/org/apache/dire...
Author: elecharny
Date: Fri Jun 19 08:40:12 2015
New Revision: 1686374
URL: http://svn.apache.org/r1686374
Log:
o Many cleanups in the LDIF parser/editor :
o LdifFile.getContainers now only return a List<LdifContainer>
o Some code format
o Using the for (T t: ts ) instea dof for ( int i = 0...
o Removed useless 'this.'
o LdifContainer now implements LdifPart, and the subclasses don't anymore
o Removal of methods when they are just calling the super method and do nothing else
o Added some missing Headers
o Adding a few missing Javadoc
Modified:
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationLdifWizardPage.java
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationModifyWizardPage.java
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifOutlinePage.java
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifAnnotationUpdater.java
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifFoldingRegionUpdater.java
directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifDamagerRepairer.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEOFPart.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEnumeration.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifFile.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifPart.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeAddRecord.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModDnRecord.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModifyRecord.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeRecord.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifCommentContainer.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifContainer.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifModSpec.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifSepContainer.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifChangeTypeLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifCommentLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifControlLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDeloldrdnLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifLineBase.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecSepLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecTypeLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewrdnLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewsuperiorLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNonEmptyLineBase.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifSepLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifValueLineBase.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifVersionLine.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifParser.java
directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifToken.java
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationLdifWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationLdifWizardPage.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationLdifWizardPage.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationLdifWizardPage.java Fri Jun 19 08:40:12 2015
@@ -21,6 +21,8 @@
package org.apache.directory.studio.ldapbrowser.ui.wizards;
+import java.util.List;
+
import org.apache.directory.studio.common.ui.widgets.WidgetModifyEvent;
import org.apache.directory.studio.common.ui.widgets.WidgetModifyListener;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
@@ -69,19 +71,22 @@ public class BatchOperationLdifWizardPag
private void validate()
{
-
LdifFile model = ldifEditorWidget.getLdifModel();
- LdifContainer[] containers = model.getContainers();
- if ( containers.length == 0 )
+ List<LdifContainer> containers = model.getContainers();
+
+ if ( containers.size() == 0 )
{
setPageComplete( false );
+
return;
}
- for ( int i = 0; i < containers.length; i++ )
+
+ for ( LdifContainer ldifContainer : containers )
{
- if ( !containers[i].isValid() )
+ if ( !ldifContainer.isValid() )
{
setPageComplete( false );
+
return;
}
}
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationModifyWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationModifyWizardPage.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationModifyWizardPage.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationModifyWizardPage.java Fri Jun 19 08:40:12 2015
@@ -21,6 +21,8 @@
package org.apache.directory.studio.ldapbrowser.ui.wizards;
+import java.util.List;
+
import org.apache.directory.studio.common.ui.widgets.WidgetModifyEvent;
import org.apache.directory.studio.common.ui.widgets.WidgetModifyListener;
import org.apache.directory.studio.ldapbrowser.common.widgets.ModWidget;
@@ -120,19 +122,20 @@ public class BatchOperationModifyWizardP
LdifFile model = new LdifParser().parse( dummyLdif );
- LdifContainer[] containers = model.getContainers();
+ List<LdifContainer> containers = model.getContainers();
- if ( containers.length == 0 )
+ if ( containers.size() == 0 )
{
setPageComplete( false );
return;
}
- for ( int i = 0; i < containers.length; i++ )
+ for ( LdifContainer ldifContainer : containers )
{
- if ( !containers[i].isValid() )
+ if ( !ldifContainer.isValid() )
{
setPageComplete( false );
+
return;
}
}
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java Fri Jun 19 08:40:12 2015
@@ -137,18 +137,19 @@ public class LdifDocumentProvider extend
// get containers to replace (from changeOffset till
// changeOffset+replacedTextLength, check end of record)
List<LdifContainer> oldContainerList = new ArrayList<LdifContainer>();
- LdifContainer[] containers = this.ldifModel.getContainers();
- for ( int i = 0; i < containers.length; i++ )
+ List<LdifContainer> containers = ldifModel.getContainers();
+
+ for ( int i = 0; i < containers.size(); i++ )
{
+ LdifContainer ldifContainer = containers.get( i );
- Region containerRegion = new Region( containers[i].getOffset(), containers[i].getLength() );
+ Region containerRegion = new Region( containers.get( i ).getOffset(), containers.get( i ).getLength() );
- boolean changeOffsetAtEOF = i == containers.length - 1
+ boolean changeOffsetAtEOF = i == containers.size() - 1
&& changeOffset >= containerRegion.getOffset() + containerRegion.getLength();
if ( TextUtilities.overlaps( containerRegion, changeRegion ) || changeOffsetAtEOF )
{
-
// remember index
int index = i;
@@ -156,9 +157,11 @@ public class LdifDocumentProvider extend
i--;
for ( ; i >= 0; i-- )
{
- if ( !containers[i].isValid() || !( containers[i] instanceof LdifRecord ) )
+ ldifContainer = containers.get( i );
+
+ if ( !ldifContainer.isValid() || !( ldifContainer instanceof LdifRecord ) )
{
- oldContainerList.add( 0, containers[i] );
+ oldContainerList.add( 0, ldifContainer );
}
else
{
@@ -168,12 +171,14 @@ public class LdifDocumentProvider extend
// add all overlapping containers
i = index;
- for ( ; i < containers.length; i++ )
+ for ( ; i < containers.size(); i++ )
{
- containerRegion = new Region( containers[i].getOffset(), containers[i].getLength() );
+ ldifContainer = containers.get( i );
+ containerRegion = new Region( ldifContainer.getOffset(), ldifContainer.getLength() );
+
if ( TextUtilities.overlaps( containerRegion, changeRegion ) || changeOffsetAtEOF )
{
- oldContainerList.add( containers[i] );
+ oldContainerList.add( ldifContainer );
}
else
{
@@ -182,12 +187,14 @@ public class LdifDocumentProvider extend
}
// add invalid containers and non-records after overlap
- for ( ; i < containers.length; i++ )
+ for ( ; i < containers.size(); i++ )
{
- if ( !containers[i].isValid() || !( containers[i] instanceof LdifRecord )
+ ldifContainer = containers.get( i );
+
+ if ( !ldifContainer.isValid() || !( ldifContainer instanceof LdifRecord )
|| !( oldContainerList.get( oldContainerList.size() - 1 ) instanceof LdifRecord ) )
{
- oldContainerList.add( containers[i] );
+ oldContainerList.add( ldifContainer );
}
else
{
@@ -196,6 +203,7 @@ public class LdifDocumentProvider extend
}
}
}
+
LdifContainer[] oldContainers = ( LdifContainer[] ) oldContainerList
.toArray( new LdifContainer[oldContainerList.size()] );
int oldCount = oldContainers.length;
@@ -210,11 +218,11 @@ public class LdifDocumentProvider extend
// parse partion content to containers (offset=0)
LdifFile newModel = this.ldifParser.parse( textToParse );
- LdifContainer[] newContainers = newModel.getContainers();
+ List<LdifContainer> newContainers = newModel.getContainers();
// replace old containers with new containers
// must adjust offsets of all following containers in model
- this.ldifModel.replace( oldContainers, newContainers );
+ ldifModel.replace( oldContainers, newContainers );
}
catch ( Exception e )
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifOutlinePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifOutlinePage.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifOutlinePage.java (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifOutlinePage.java Fri Jun 19 08:40:12 2015
@@ -440,6 +440,7 @@ public class LdifOutlinePage extends Con
*/
public Image getImage( Object element )
{
+
// Record
if ( element instanceof LdifContentRecord )
{
@@ -448,10 +449,12 @@ public class LdifOutlinePage extends Con
LdifContentRecord record = ( LdifContentRecord ) element;
LdifDnLine dnLine = record.getDnLine();
+
if ( dnLine != null )
{
String dn = dnLine.getUnfoldedDn();
- if ( dn != null && "".equals( dn ) ) //$NON-NLS-1$
+
+ if ( ( dn != null ) && ( dn.length() == 0 ) ) //$NON-NLS-1$
{
// Root DSE
return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_ENTRY_ROOT );
@@ -490,7 +493,6 @@ public class LdifOutlinePage extends Con
{
return LdifEditorActivator.getDefault().getImage( LdifEditorConstants.IMG_LDIF_RENAME );
}
-
// List of AttrValLine
else if ( element instanceof List && ( ( List ) element ).get( 0 ) instanceof LdifAttrValLine )
{
@@ -499,14 +501,23 @@ public class LdifOutlinePage extends Con
else if ( element instanceof LdifModSpec )
{
LdifModSpec modSpec = ( LdifModSpec ) element;
+
if ( modSpec.isAdd() )
+ {
return LdifEditorActivator.getDefault().getImage( LdifEditorConstants.IMG_LDIF_MOD_ADD );
+ }
else if ( modSpec.isReplace() )
+ {
return LdifEditorActivator.getDefault().getImage( LdifEditorConstants.IMG_LDIF_MOD_REPLACE );
+ }
else if ( modSpec.isDelete() )
+ {
return LdifEditorActivator.getDefault().getImage( LdifEditorConstants.IMG_LDIF_MOD_DELETE );
+ }
else
+ {
return null;
+ }
}
// AttrValLine
@@ -514,7 +525,6 @@ public class LdifOutlinePage extends Con
{
return LdifEditorActivator.getDefault().getImage( LdifEditorConstants.IMG_LDIF_VALUE );
}
-
else
{
return null;
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifAnnotationUpdater.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifAnnotationUpdater.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifAnnotationUpdater.java (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifAnnotationUpdater.java Fri Jun 19 08:40:12 2015
@@ -28,7 +28,6 @@ import org.apache.directory.studio.ldife
import org.apache.directory.studio.ldifparser.model.LdifFile;
import org.apache.directory.studio.ldifparser.model.LdifPart;
import org.apache.directory.studio.ldifparser.model.container.LdifContainer;
-
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
@@ -64,16 +63,21 @@ class LdifAnnotationUpdater
public void updateAnnotations()
{
-
LdifFile model = editor.getLdifModel();
ISourceViewer viewer = ( ISourceViewer ) editor.getAdapter( ISourceViewer.class );
+
if ( viewer == null )
+ {
return;
+ }
IDocument document = viewer.getDocument();
IAnnotationModel annotationModel = viewer.getAnnotationModel();
+
if ( document == null || annotationModel == null || model == null )
+ {
return;
+ }
if ( annotationModel instanceof IAnnotationModelExtension )
{
@@ -81,46 +85,43 @@ class LdifAnnotationUpdater
List<Position> positionList = new ArrayList<Position>();
- LdifContainer[] containers = model.getContainers();
- for ( int i = 0; i < containers.length; i++ )
+ List<LdifContainer> containers = model.getContainers();
+
+ for ( LdifContainer ldifContainer : containers )
{
- LdifContainer container = containers[i];
-
// LdifPart errorPart = null;
int errorOffset = -1;
int errorLength = -1;
- StringBuffer errorText = null;
+ StringBuilder errorText = null;
- LdifPart[] parts = container.getParts();
+ LdifPart[] parts = ldifContainer.getParts();
- for ( int k = 0; k < parts.length; k++ )
+ for ( LdifPart ldifPart : parts )
{
- LdifPart part = parts[k];
-
- if ( !part.isValid() )
+ if ( !ldifPart.isValid() )
{
if ( errorOffset == -1 )
{
// errorPart = part;
- errorOffset = part.getOffset();
- errorLength = part.getLength();
- errorText = new StringBuffer();
- errorText.append( part.toRawString() );
+ errorOffset = ldifPart.getOffset();
+ errorLength = ldifPart.getLength();
+ errorText = new StringBuilder();
+ errorText.append( ldifPart.toRawString() );
}
else
{
- errorLength += part.getLength();
- errorText.append( part.toRawString() );
+ errorLength += ldifPart.getLength();
+ errorText.append( ldifPart.toRawString() );
}
}
}
- if ( errorOffset == -1 && !container.isValid() )
+ if ( errorOffset == -1 && !ldifContainer.isValid() )
{
- errorOffset = container.getOffset();
- errorLength = container.getLength();
- errorText = new StringBuffer();
- errorText.append( container.toRawString() );
+ errorOffset = ldifContainer.getOffset();
+ errorLength = ldifContainer.getLength();
+ errorText = new StringBuilder();
+ errorText.append( ldifContainer.toRawString() );
}
if ( errorOffset > -1 )
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifFoldingRegionUpdater.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifFoldingRegionUpdater.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifFoldingRegionUpdater.java (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/reconciler/LdifFoldingRegionUpdater.java Fri Jun 19 08:40:12 2015
@@ -165,7 +165,7 @@ public class LdifFoldingRegionUpdater im
private Map<Position, ProjectionAnnotation> createFoldingRegions( LdifFile model, IDocument document ) throws BadLocationException
{
Map<Position, ProjectionAnnotation> positionToAnnotationMap = new HashMap<Position, ProjectionAnnotation>();
- LdifContainer[] containers = model.getContainers();
+ List<LdifContainer> containers = model.getContainers();
boolean ENABLE_FOLDING = LdifEditorActivator.getDefault().getPreferenceStore().getBoolean(
LdifEditorConstants.PREFERENCE_LDIFEDITOR_FOLDING_ENABLE );
@@ -178,17 +178,16 @@ public class LdifFoldingRegionUpdater im
if ( ENABLE_FOLDING )
{
- for ( int i = 0; i < containers.length; i++ )
+ for ( LdifContainer ldifContainer : containers )
{
- LdifContainer container = containers[i];
- int containerStartLine = document.getLineOfOffset( container.getOffset() );
+ int containerStartLine = document.getLineOfOffset( ldifContainer.getOffset() );
int containerEndLine = -1;
- LdifPart[] parts = container.getParts();
+ LdifPart[] parts = ldifContainer.getParts();
for ( int j = parts.length - 1; j >= 0; j-- )
{
if ( containerEndLine == -1
- && ( !( parts[j] instanceof LdifSepLine ) || ( container instanceof LdifCommentContainer && j < parts.length - 1 ) ) )
+ && ( !( parts[j] instanceof LdifSepLine ) || ( ldifContainer instanceof LdifCommentContainer && j < parts.length - 1 ) ) )
{
containerEndLine = document.getLineOfOffset( parts[j].getOffset() + parts[j].getLength() - 1 );
// break;
@@ -215,7 +214,7 @@ public class LdifFoldingRegionUpdater im
int end = document.getLineOffset( containerEndLine ) + document.getLineLength( containerEndLine );
Position position = new Position( start, end - start );
ProjectionAnnotation annotation = new ProjectionAnnotation( FOLD_RECORDS
- || ( FOLD_COMMENTS && container instanceof LdifCommentContainer ) );
+ || ( FOLD_COMMENTS && ldifContainer instanceof LdifCommentContainer ) );
positionToAnnotationMap.put( position, annotation );
}
}
Modified: directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifDamagerRepairer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifDamagerRepairer.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifDamagerRepairer.java (original)
+++ directory/studio/trunk/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifDamagerRepairer.java Fri Jun 19 08:40:12 2015
@@ -71,9 +71,10 @@ import org.eclipse.swt.graphics.RGB;
public class LdifDamagerRepairer implements IPresentationDamager, IPresentationRepairer
{
-
private ILdifEditor editor;
+ private Map<String, Object> textAttributeKeyToValueMap;
+
// private IDocument document;
@@ -101,27 +102,24 @@ public class LdifDamagerRepairer impleme
{
LdifFile ldifModel = this.editor.getLdifModel();
- LdifContainer[] allContainers = ldifModel.getContainers();
+ List<LdifContainer> allContainers = ldifModel.getContainers();
List<LdifContainer> containerList = new ArrayList<LdifContainer>();
- for ( int i = 0; i < allContainers.length; i++ )
+ for ( LdifContainer ldifContainer : allContainers )
{
- LdifContainer container = allContainers[i];
- Region containerRegion = new Region( container.getOffset(), container.getLength() );
+ Region containerRegion = new Region( ldifContainer.getOffset(), ldifContainer.getLength() );
if ( TextUtilities.overlaps( containerRegion, damage ) )
{
- containerList.add( container );
+ containerList.add( ldifContainer );
}
}
+
LdifContainer[] containers = ( LdifContainer[] ) containerList
.toArray( new LdifContainer[containerList.size()] );
this.highlight( containers, presentation, damage );
}
- private Map textAttributeKeyToValueMap;
-
-
private TextAttribute geTextAttribute( String key )
{
IPreferenceStore store = LdifEditorActivator.getDefault().getPreferenceStore();
@@ -168,7 +166,7 @@ public class LdifDamagerRepairer impleme
{
if ( textAttributeKeyToValueMap == null )
{
- textAttributeKeyToValueMap = new HashMap();
+ textAttributeKeyToValueMap = new HashMap<String, Object>();
}
textAttributeKeyToValueMap.put( key + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_RGB_SUFFIX, rgb );
textAttributeKeyToValueMap.put( key + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_STYLE_SUFFIX,
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEOFPart.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEOFPart.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEOFPart.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEOFPart.java Fri Jun 19 08:40:12 2015
@@ -30,6 +30,7 @@ import org.apache.directory.studio.ldifp
*/
public final class LdifEOFPart implements LdifPart
{
+ /** The offset of this part */
private int offset;
@@ -41,7 +42,7 @@ public final class LdifEOFPart implement
public final int getOffset()
{
- return this.offset;
+ return offset;
}
@@ -89,7 +90,6 @@ public final class LdifEOFPart implement
public final void adjustOffset( int adjust )
{
- this.offset += adjust;
+ offset += adjust;
}
-
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEnumeration.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEnumeration.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEnumeration.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifEnumeration.java Fri Jun 19 08:40:12 2015
@@ -24,9 +24,13 @@ package org.apache.directory.studio.ldif
import org.apache.directory.studio.ldifparser.model.container.LdifContainer;
+/**
+ * A LdifContainer enumeration.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
public interface LdifEnumeration
{
-
/**
* @return true if this enumeration has more elements.
*/
@@ -38,5 +42,4 @@ public interface LdifEnumeration
* @return the next LDIF container or null if hasNext() returns false.
*/
public LdifContainer next() throws Exception;
-
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifFile.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifFile.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifFile.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifFile.java Fri Jun 19 08:40:12 2015
@@ -29,13 +29,12 @@ import java.util.List;
import org.apache.directory.studio.ldifparser.LdifFormatParameters;
import org.apache.directory.studio.ldifparser.model.container.LdifChangeRecord;
import org.apache.directory.studio.ldifparser.model.container.LdifContainer;
-import org.apache.directory.studio.ldifparser.model.container.LdifContentRecord;
import org.apache.directory.studio.ldifparser.model.container.LdifModSpec;
import org.apache.directory.studio.ldifparser.model.container.LdifRecord;
/**
- * A LDIF file, as we manipulate it in Studio.
+ * A LDIF file, as we manipulate it in Studio. It's a list of LdifContainer.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@@ -46,6 +45,9 @@ public class LdifFile implements Seriali
/** The list of container constituting this LDIF file */
private List<LdifContainer> containerList = new ArrayList<LdifContainer>();
+
+ /** A flag which is set if a LdifChange is added into the LdifFile */
+ private boolean hasChanges = false;
/**
@@ -63,15 +65,7 @@ public class LdifFile implements Seriali
*/
public boolean isContentType()
{
- for ( LdifContainer container : containerList )
- {
- if ( container instanceof LdifRecord )
- {
- return container instanceof LdifContentRecord;
- }
- }
-
- return false;
+ return !hasChanges;
}
@@ -82,49 +76,37 @@ public class LdifFile implements Seriali
*/
public boolean isChangeType()
{
- for ( LdifContainer container : containerList )
- {
- if ( container instanceof LdifRecord )
- {
- return container instanceof LdifChangeRecord;
- }
- }
-
- return false;
- }
-
-
- public void addContainer( LdifContainer container )
- {
- containerList.add( container );
+ return hasChanges;
}
/**
+ * Add a new LdifContainer to the LdifFile
*
- * @return all container, includes version, comments, records and
- * unknown
+ * @param container The added LdifContainer
*/
- public LdifContainer[] getContainers()
+ public void addContainer( LdifContainer container )
{
- return containerList.toArray( new LdifContainer[containerList.size()] );
+ containerList.add( container );
+
+ if ( container instanceof LdifChangeRecord )
+ {
+ hasChanges = true;
+ }
}
/**
- *
- * @return all container, includes version, comments, records and
- * unknown
+ * @return A list of LdifContainers, including version, comments, records and unknown
*/
- private List<LdifContainer> getContainerList()
+ public List<LdifContainer> getContainers()
{
return containerList;
}
/**
- * @return only records (even invalid), no version, comments, and
- * unknown
+ * @return An array of LdifRecords (even invalid), no LdifVersion, LdifComments, or LdifUnknown
*/
public LdifRecord[] getRecords()
{
@@ -143,8 +125,7 @@ public class LdifFile implements Seriali
/**
- *
- * @return the last container or null
+ * @return the last LdifContainer, or null
*/
public LdifContainer getLastContainer()
{
@@ -212,7 +193,7 @@ public class LdifFile implements Seriali
return null;
}
- List<LdifContainer> containers = model.getContainerList();
+ List<LdifContainer> containers = model.getContainers();
if ( containers.size() > 0 )
{
@@ -269,7 +250,7 @@ public class LdifFile implements Seriali
}
List<LdifContainer> containerList = new ArrayList<LdifContainer>();
- List<LdifContainer> containers = model.getContainerList();
+ List<LdifContainer> containers = model.getContainers();
if ( containers.size() > 0 )
{
@@ -296,14 +277,14 @@ public class LdifFile implements Seriali
return null;
}
- LdifContainer[] containers = model.getContainers();
+ List<LdifContainer> containers = model.getContainers();
return getParts( containers, offset, length );
}
- public static LdifPart[] getParts( LdifContainer[] containers, int offset, int length )
+ public static LdifPart[] getParts( List<LdifContainer> containers, int offset, int length )
{
if ( ( containers == null ) || ( offset < 0 ) )
{
@@ -331,8 +312,10 @@ public class LdifFile implements Seriali
if ( ldifPart instanceof LdifModSpec )
{
LdifModSpec spec = ( LdifModSpec ) ldifPart;
- partList.addAll( Arrays.asList( getParts( new LdifContainer[]
- { spec }, offset, length ) ) );
+ List<LdifContainer> newLdifContainer = new ArrayList<LdifContainer>();
+ newLdifContainer.add( spec );
+
+ partList.addAll( Arrays.asList( getParts( newLdifContainer, offset, length ) ) );
}
else
{
@@ -391,7 +374,7 @@ public class LdifFile implements Seriali
}
- public void replace( LdifContainer[] oldContainers, LdifContainer[] newContainers )
+ public void replace( LdifContainer[] oldContainers, List<LdifContainer> newContainers )
{
// find index
int index = 0;
@@ -418,18 +401,20 @@ public class LdifFile implements Seriali
// add new containers
int insertLength = 0;
+ int pos = 0;
- for ( int i = 0; i < newContainers.length; i++ )
+ for ( LdifContainer ldifContainer : newContainers )
{
- newContainers[i].adjustOffset( removeOffset );
- insertLength += newContainers[i].getLength();
- containerList.add( index + i, newContainers[i] );
+ ldifContainer.adjustOffset( removeOffset );
+ insertLength += ldifContainer.getLength();
+ containerList.add( index + pos, ldifContainer );
+ pos++;
}
// adjust offset of following containers
int adjust = insertLength - removeLength;
- for ( int i = index + newContainers.length; i < containerList.size(); i++ )
+ for ( int i = index + newContainers.size(); i < containerList.size(); i++ )
{
LdifContainer container = containerList.get( i );
container.adjustOffset( adjust );
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifPart.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifPart.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifPart.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/LdifPart.java Fri Jun 19 08:40:12 2015
@@ -43,6 +43,11 @@ public interface LdifPart
public int getLength();
+ /**
+ * Tells if the part is valid or not
+ *
+ * @return <code>true</code> if the part is valid.
+ */
public boolean isValid();
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeAddRecord.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeAddRecord.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeAddRecord.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeAddRecord.java Fri Jun 19 08:40:12 2015
@@ -24,6 +24,7 @@ package org.apache.directory.studio.ldif
import java.util.ArrayList;
import java.util.List;
+import org.apache.directory.studio.ldifparser.model.LdifPart;
import org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifChangeTypeLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine;
@@ -57,7 +58,7 @@ public class LdifChangeAddRecord extends
{
List<LdifAttrValLine> ldifAttrValLines = new ArrayList<LdifAttrValLine>();
- for ( Object part : ldifParts )
+ for ( LdifPart part : ldifParts )
{
if ( part instanceof LdifAttrValLine )
{
@@ -85,7 +86,7 @@ public class LdifChangeAddRecord extends
return false;
}
- for ( Object part : ldifParts )
+ for ( LdifPart part : ldifParts )
{
if ( part instanceof LdifAttrValLine )
{
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModDnRecord.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModDnRecord.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModDnRecord.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModDnRecord.java Fri Jun 19 08:40:12 2015
@@ -21,6 +21,7 @@
package org.apache.directory.studio.ldifparser.model.container;
+import org.apache.directory.studio.ldifparser.model.LdifPart;
import org.apache.directory.studio.ldifparser.model.lines.LdifChangeTypeLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifDeloldrdnLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine;
@@ -76,7 +77,7 @@ public class LdifChangeModDnRecord exten
public LdifNewrdnLine getNewrdnLine()
{
- for ( Object part : ldifParts )
+ for ( LdifPart part : ldifParts )
{
if ( part instanceof LdifNewrdnLine )
{
@@ -138,11 +139,11 @@ public class LdifChangeModDnRecord exten
public String getInvalidString()
{
- if ( this.getNewrdnLine() == null )
+ if ( getNewrdnLine() == null )
{
return "Missing new Rdn";
}
- else if ( this.getDeloldrdnLine() == null )
+ else if ( getDeloldrdnLine() == null )
{
return "Missing delete old Rdn";
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModifyRecord.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModifyRecord.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModifyRecord.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeModifyRecord.java Fri Jun 19 08:40:12 2015
@@ -24,6 +24,7 @@ package org.apache.directory.studio.ldif
import java.util.ArrayList;
import java.util.List;
+import org.apache.directory.studio.ldifparser.model.LdifPart;
import org.apache.directory.studio.ldifparser.model.lines.LdifChangeTypeLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine;
@@ -56,7 +57,7 @@ public class LdifChangeModifyRecord exte
{
List<LdifModSpec> ldifModSpecs = new ArrayList<LdifModSpec>();
- for ( Object part : ldifParts )
+ for ( LdifPart part : ldifParts )
{
if ( part instanceof LdifModSpec )
{
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeRecord.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeRecord.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeRecord.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifChangeRecord.java Fri Jun 19 08:40:12 2015
@@ -112,13 +112,12 @@ public class LdifChangeRecord extends Ld
public boolean isValid()
{
- return this.isAbstractValid();
+ return isAbstractValid();
}
public String getInvalidString()
{
-
if ( getChangeTypeLine() == null )
{
return "Missing changetype line";
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifCommentContainer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifCommentContainer.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifCommentContainer.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifCommentContainer.java Fri Jun 19 08:40:12 2015
@@ -50,11 +50,6 @@ public class LdifCommentContainer extend
public boolean isValid()
{
- if ( !super.isAbstractValid() )
- {
- return false;
- }
-
- return true;
+ return super.isAbstractValid();
}
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifContainer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifContainer.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifContainer.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifContainer.java Fri Jun 19 08:40:12 2015
@@ -36,7 +36,7 @@ import org.apache.directory.studio.ldifp
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class LdifContainer
+public abstract class LdifContainer implements LdifPart
{
/** The contained Ldif Parts */
protected List<LdifPart> ldifParts = new ArrayList<LdifPart>();
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifModSpec.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifModSpec.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifModSpec.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifModSpec.java Fri Jun 19 08:40:12 2015
@@ -35,7 +35,7 @@ import org.apache.directory.studio.ldifp
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LdifModSpec extends LdifContainer implements LdifPart
+public class LdifModSpec extends LdifContainer
{
public LdifModSpec( LdifModSpecTypeLine modSpecTypeLine )
{
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifSepContainer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifSepContainer.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifSepContainer.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/container/LdifSepContainer.java Fri Jun 19 08:40:12 2015
@@ -50,11 +50,6 @@ public class LdifSepContainer extends Ld
public boolean isValid()
{
- if ( !super.isAbstractValid() )
- {
- return false;
- }
-
- return true;
+ return super.isAbstractValid();
}
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLine.java Fri Jun 19 08:40:12 2015
@@ -51,7 +51,7 @@ public class LdifAttrValLine extends Ldi
public String getInvalidString()
{
- if ( this.getUnfoldedAttributeDescription().length() == 0 )
+ if ( getUnfoldedAttributeDescription().length() == 0 )
{
return "Missing attribute name";
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifChangeTypeLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifChangeTypeLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifChangeTypeLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifChangeTypeLine.java Fri Jun 19 08:40:12 2015
@@ -61,12 +61,6 @@ public class LdifChangeTypeLine extends
}
- public String toRawString()
- {
- return super.toRawString();
- }
-
-
public boolean isAdd()
{
return getUnfoldedChangeType().equals( "add" ); //$NON-NLS-1$
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifCommentLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifCommentLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifCommentLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifCommentLine.java Fri Jun 19 08:40:12 2015
@@ -26,11 +26,6 @@ import org.apache.directory.studio.ldifp
public class LdifCommentLine extends LdifNonEmptyLineBase
{
- protected LdifCommentLine()
- {
- }
-
-
public LdifCommentLine( int offset, String rawComment, String rawNewLine )
{
super( offset, rawComment, rawNewLine );
@@ -49,24 +44,6 @@ public class LdifCommentLine extends Ldi
}
- public String toRawString()
- {
- return super.toRawString();
- }
-
-
- public boolean isValid()
- {
- return super.isValid();
- }
-
-
- public String getInvalidString()
- {
- return super.getInvalidString();
- }
-
-
public static LdifCommentLine create( String comment )
{
return new LdifCommentLine( 0, comment, LdifParserConstants.LINE_SEPARATOR );
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifControlLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifControlLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifControlLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifControlLine.java Fri Jun 19 08:40:12 2015
@@ -34,11 +34,6 @@ public class LdifControlLine extends Ldi
private String rawControlValue;
- protected LdifControlLine()
- {
- }
-
-
public LdifControlLine( int offset, String rawControlSpec, String rawControlType, String rawOid,
String rawCriticality, String rawControlValueType, String rawControlValue, String rawNewLine )
{
@@ -87,76 +82,76 @@ public class LdifControlLine extends Ldi
public String getRawCriticality()
{
- return getNonNull( this.rawCriticality );
+ return getNonNull( rawCriticality );
}
public String getUnfoldedCriticality()
{
- return unfold( this.getRawCriticality() );
+ return unfold( getRawCriticality() );
}
public boolean isCritical()
{
- return this.getUnfoldedCriticality().endsWith( "true" ); //$NON-NLS-1$
+ return getUnfoldedCriticality().endsWith( "true" ); //$NON-NLS-1$
}
public String getRawControlValueType()
{
- return getNonNull( this.rawControlValueType );
+ return getNonNull( rawControlValueType );
}
public String getUnfoldedControlValueType()
{
- return unfold( this.getRawControlValueType() );
+ return unfold( getRawControlValueType() );
}
public String getRawControlValue()
{
- return getNonNull( this.rawControlValue );
+ return getNonNull( rawControlValue );
}
public String getUnfoldedControlValue()
{
- return unfold( this.getRawControlValue() );
+ return unfold( getRawControlValue() );
}
public String toRawString()
{
- return this.getRawControlSpec() + this.getRawControlType() + this.getRawOid() + this.getRawCriticality()
- + this.getRawControlValueType() + this.getRawControlValue() + this.getRawNewLine();
+ return getRawControlSpec() + getRawControlType() + getRawOid() + getRawCriticality()
+ + getRawControlValueType() + getRawControlValue() + getRawNewLine();
}
public boolean isValid()
{
- return this.getUnfoldedControlSpec().length() > 0
- && this.getUnfoldedControlType().length() > 0
- && this.getUnfoldedOid().length() > 0
- && ( this.rawCriticality == null || this.getUnfoldedCriticality().endsWith( "true" ) || this //$NON-NLS-1$
+ return getUnfoldedControlSpec().length() > 0
+ && getUnfoldedControlType().length() > 0
+ && getUnfoldedOid().length() > 0
+ && ( rawCriticality == null || getUnfoldedCriticality().endsWith( "true" ) || this //$NON-NLS-1$
.getUnfoldedCriticality().endsWith( "false" ) ) //$NON-NLS-1$
- && ( ( this.rawControlValueType == null && this.rawControlValue == null ) || ( this.rawControlValueType != null && this.rawControlValue != null ) )
- && this.getUnfoldedNewLine().length() > 0;
+ && ( ( rawControlValueType == null && rawControlValue == null ) || ( rawControlValueType != null && rawControlValue != null ) )
+ && getUnfoldedNewLine().length() > 0;
}
public String getInvalidString()
{
- if ( this.getUnfoldedControlSpec().length() == 0 )
+ if ( getUnfoldedControlSpec().length() == 0 )
{
return "Missing 'control'";
}
- else if ( this.getUnfoldedOid().length() == 0 )
+ else if ( getUnfoldedOid().length() == 0 )
{
return "Missing OID";
}
- else if ( ( this.rawCriticality != null && !this.getUnfoldedCriticality().endsWith( "true" ) && !this //$NON-NLS-1$
+ else if ( ( rawCriticality != null && !getUnfoldedCriticality().endsWith( "true" ) && !this //$NON-NLS-1$
.getUnfoldedCriticality().endsWith( "false" ) ) ) //$NON-NLS-1$
{
return "Invalid criticality, must be 'true' or 'false'";
@@ -192,13 +187,13 @@ public class LdifControlLine extends Ldi
public final Object getControlValueAsObject()
{
- if ( this.isControlValueTypeSafe() )
+ if ( isControlValueTypeSafe() )
{
- return this.getUnfoldedControlValue();
+ return getUnfoldedControlValue();
}
- else if ( this.isControlValueTypeBase64() )
+ else if ( isControlValueTypeBase64() )
{
- return LdifUtils.base64decodeToByteArray( this.getUnfoldedControlValue() );
+ return LdifUtils.base64decodeToByteArray( getUnfoldedControlValue() );
}
else
{
@@ -209,13 +204,13 @@ public class LdifControlLine extends Ldi
public boolean isControlValueTypeBase64()
{
- return this.getUnfoldedControlValueType().startsWith( "::" ); //$NON-NLS-1$
+ return getUnfoldedControlValueType().startsWith( "::" ); //$NON-NLS-1$
}
public boolean isControlValueTypeSafe()
{
- return this.getUnfoldedControlValueType().startsWith( ":" ) && !this.isControlValueTypeBase64(); //$NON-NLS-1$
+ return getUnfoldedControlValueType().startsWith( ":" ) && !isControlValueTypeBase64(); //$NON-NLS-1$
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDeloldrdnLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDeloldrdnLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDeloldrdnLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDeloldrdnLine.java Fri Jun 19 08:40:12 2015
@@ -26,11 +26,6 @@ import org.apache.directory.studio.ldifp
public class LdifDeloldrdnLine extends LdifValueLineBase
{
- protected LdifDeloldrdnLine()
- {
- }
-
-
public LdifDeloldrdnLine( int offset, String rawDeleteOldrdnSpec, String rawValueType, String rawDeleteOldrdn,
String rawNewLine )
{
@@ -64,20 +59,16 @@ public class LdifDeloldrdnLine extends L
public boolean isDeleteOldRdn()
{
- return "1".equals( this.getUnfoldedDeleteOldrdn() ); //$NON-NLS-1$
- }
-
-
- public String toRawString()
- {
- return super.toRawString();
+ return "1".equals( getUnfoldedDeleteOldrdn() ); //$NON-NLS-1$
}
public boolean isValid()
{
if ( !super.isValid() )
+ {
return false;
+ }
return ( "0".equals( getUnfoldedDeleteOldrdn() ) || "1".equals( getUnfoldedDeleteOldrdn() ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -85,7 +76,7 @@ public class LdifDeloldrdnLine extends L
public String getInvalidString()
{
- if ( this.getUnfoldedDeleteOldrdnSpec().length() == 0 )
+ if ( getUnfoldedDeleteOldrdnSpec().length() == 0 )
{
return "Missing delete old Rdn spec 'deleteoldrdn'";
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java Fri Jun 19 08:40:12 2015
@@ -28,11 +28,6 @@ import org.apache.directory.studio.ldifp
public class LdifDnLine extends LdifValueLineBase
{
- protected LdifDnLine()
- {
- }
-
-
public LdifDnLine( int offset, String rawDnSpec, String rawValueType, String rawDn, String rawNewLine )
{
super( offset, rawDnSpec, rawValueType, rawDn, rawNewLine );
@@ -63,12 +58,6 @@ public class LdifDnLine extends LdifValu
}
- public String toRawString()
- {
- return super.toRawString();
- }
-
-
public boolean isValid()
{
return super.isValid() && Dn.isValid( getValueAsString() );
@@ -77,11 +66,11 @@ public class LdifDnLine extends LdifValu
public String getInvalidString()
{
- if ( this.getUnfoldedDnSpec().length() == 0 )
+ if ( getUnfoldedDnSpec().length() == 0 )
{
return "Missing Dn spec 'dn'";
}
- else if ( this.getUnfoldedDn().length() == 0 )
+ else if ( getUnfoldedDn().length() == 0 )
{
return "Missing Dn";
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifLineBase.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifLineBase.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifLineBase.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifLineBase.java Fri Jun 19 08:40:12 2015
@@ -33,64 +33,64 @@ import org.apache.directory.studio.ldifp
*/
public abstract class LdifLineBase implements LdifPart
{
+ /** The position of this LdifPart in the Ldif */
+ protected int offset;
protected String rawNewLine;
- protected int offset;
-
protected LdifLineBase()
{
+ super();
}
protected LdifLineBase( int offset, String rawNewLine )
{
- super();
- this.rawNewLine = rawNewLine;
this.offset = offset;
+ this.rawNewLine = rawNewLine;
}
- public final String getRawNewLine()
+ public final int getOffset()
{
- return getNonNull( this.rawNewLine );
+ return offset;
}
-
- public String getUnfoldedNewLine()
+
+ public final String getRawNewLine()
{
- return unfold( this.getRawNewLine() );
+ return getNonNull( rawNewLine );
}
- public final void adjustOffset( int adjust )
+ public String getUnfoldedNewLine()
{
- this.offset += adjust;
+ return unfold( getRawNewLine() );
}
- public final int getOffset()
+ public final void adjustOffset( int adjust )
{
- return this.offset;
+ offset += adjust;
}
public final int getLength()
{
- return this.toRawString().length();
+ return toRawString().length();
}
public boolean isValid()
{
- return this.rawNewLine != null;
+ return rawNewLine != null;
}
public String getInvalidString()
{
- if ( this.rawNewLine == null )
+ if ( rawNewLine == null )
{
return "Missing new line";
}
@@ -103,7 +103,7 @@ public abstract class LdifLineBase imple
public String toRawString()
{
- return this.getRawNewLine();
+ return getRawNewLine();
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecSepLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecSepLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecSepLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecSepLine.java Fri Jun 19 08:40:12 2015
@@ -26,11 +26,6 @@ import org.apache.directory.studio.ldifp
public class LdifModSpecSepLine extends LdifNonEmptyLineBase
{
- protected LdifModSpecSepLine()
- {
- }
-
-
public LdifModSpecSepLine( int offset, String rawMinus, String rawNewLine )
{
super( offset, rawMinus, rawNewLine );
@@ -49,21 +44,15 @@ public class LdifModSpecSepLine extends
}
- public String toRawString()
- {
- return super.toRawString();
- }
-
-
public boolean isValid()
{
- return super.isValid() && this.getUnfoldedMinus().equals( "-" ); //$NON-NLS-1$
+ return super.isValid() && getUnfoldedMinus().equals( "-" ); //$NON-NLS-1$
}
public String getInvalidString()
{
- if ( !this.getUnfoldedMinus().equals( "-" ) ) //$NON-NLS-1$
+ if ( !getUnfoldedMinus().equals( "-" ) ) //$NON-NLS-1$
{
return "Missing '-'";
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecTypeLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecTypeLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecTypeLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifModSpecTypeLine.java Fri Jun 19 08:40:12 2015
@@ -26,11 +26,6 @@ import org.apache.directory.studio.ldifp
public class LdifModSpecTypeLine extends LdifValueLineBase
{
- protected LdifModSpecTypeLine()
- {
- }
-
-
public LdifModSpecTypeLine( int offset, String rawModType, String rawValueType, String rawAttributeDescription,
String rawNewLine )
{
@@ -62,47 +57,41 @@ public class LdifModSpecTypeLine extends
}
- public String toRawString()
- {
- return super.toRawString();
- }
-
-
public boolean isAdd()
{
- return this.getUnfoldedModType().equals( "add" ); //$NON-NLS-1$
+ return getUnfoldedModType().equals( "add" ); //$NON-NLS-1$
}
public boolean isReplace()
{
- return this.getUnfoldedModType().equals( "replace" ); //$NON-NLS-1$
+ return getUnfoldedModType().equals( "replace" ); //$NON-NLS-1$
}
public boolean isDelete()
{
- return this.getUnfoldedModType().equals( "delete" ); //$NON-NLS-1$
+ return getUnfoldedModType().equals( "delete" ); //$NON-NLS-1$
}
public boolean isValid()
{
- return super.isValid() && ( this.isAdd() || this.isReplace() || this.isDelete() );
+ return super.isValid() && ( isAdd() || isReplace() || isDelete() );
}
public String getInvalidString()
{
- if ( this.getUnfoldedModType().length() == 0 )
+ if ( getUnfoldedModType().length() == 0 )
{
return "Missing modification type 'add', 'replace' or 'delete'";
}
- else if ( !this.isAdd() && !this.isReplace() && !this.isDelete() )
+ else if ( !isAdd() && !isReplace() && !isDelete() )
{
return "Invalid modification type, expected 'add', 'replace' or 'delete'";
}
- else if ( this.getUnfoldedAttributeDescription().length() == 0 )
+ else if ( getUnfoldedAttributeDescription().length() == 0 )
{
return "Missing attribute";
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewrdnLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewrdnLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewrdnLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewrdnLine.java Fri Jun 19 08:40:12 2015
@@ -27,11 +27,6 @@ import org.apache.directory.studio.ldifp
public class LdifNewrdnLine extends LdifValueLineBase
{
- protected LdifNewrdnLine()
- {
- }
-
-
public LdifNewrdnLine( int offset, String rawNewrdnSpec, String rawValueType, String rawNewrdn, String rawNewLine )
{
super( offset, rawNewrdnSpec, rawValueType, rawNewrdn, rawNewLine );
@@ -62,25 +57,13 @@ public class LdifNewrdnLine extends Ldif
}
- public String toRawString()
- {
- return super.toRawString();
- }
-
-
- public boolean isValid()
- {
- return super.isValid();
- }
-
-
public String getInvalidString()
{
- if ( this.getUnfoldedNewrdnSpec().length() == 0 )
+ if ( getUnfoldedNewrdnSpec().length() == 0 )
{
return "Missing new Rdn spec 'newrdn'";
}
- else if ( this.getUnfoldedNewrdn().length() == 0 )
+ else if ( getUnfoldedNewrdn().length() == 0 )
{
return "Missing new Rdn";
}
@@ -102,7 +85,5 @@ public class LdifNewrdnLine extends Ldif
{
return new LdifNewrdnLine( 0, "newrdn", ":", newrdn, LdifParserConstants.LINE_SEPARATOR ); //$NON-NLS-1$ //$NON-NLS-2$
}
-
}
-
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewsuperiorLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewsuperiorLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewsuperiorLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNewsuperiorLine.java Fri Jun 19 08:40:12 2015
@@ -27,11 +27,6 @@ import org.apache.directory.studio.ldifp
public class LdifNewsuperiorLine extends LdifValueLineBase
{
- protected LdifNewsuperiorLine()
- {
- }
-
-
public LdifNewsuperiorLine( int offset, String rawNewSuperiorSpec, String rawValueType, String rawNewSuperiorDn,
String rawNewLine )
{
@@ -63,25 +58,13 @@ public class LdifNewsuperiorLine extends
}
- public String toRawString()
- {
- return super.toRawString();
- }
-
-
- public boolean isValid()
- {
- return super.isValid();
- }
-
-
public String getInvalidString()
{
- if ( this.getUnfoldedNewSuperiorSpec().length() == 0 )
+ if ( getUnfoldedNewSuperiorSpec().length() == 0 )
{
return "Missing new superior spec 'newsuperior'";
}
- else if ( this.getUnfoldedNewSuperiorDn().length() == 0 )
+ else if ( getUnfoldedNewSuperiorDn().length() == 0 )
{
return "Missing new superior Dn";
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNonEmptyLineBase.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNonEmptyLineBase.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNonEmptyLineBase.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifNonEmptyLineBase.java Fri Jun 19 08:40:12 2015
@@ -41,25 +41,25 @@ public abstract class LdifNonEmptyLineBa
public String getRawLineStart()
{
- return getNonNull( this.rawLineStart );
+ return getNonNull( rawLineStart );
}
public String getUnfoldedLineStart()
{
- return unfold( this.getRawLineStart() );
+ return unfold( getRawLineStart() );
}
public boolean isValid()
{
- return super.isValid() && this.rawLineStart != null;
+ return super.isValid() && rawLineStart != null;
}
public String getInvalidString()
{
- if ( this.rawLineStart == null )
+ if ( rawLineStart == null )
{
return "Missing line start";
}
@@ -72,7 +72,7 @@ public abstract class LdifNonEmptyLineBa
public String toRawString()
{
- return this.getRawLineStart() + this.getRawNewLine();
+ return getRawLineStart() + getRawNewLine();
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifSepLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifSepLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifSepLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifSepLine.java Fri Jun 19 08:40:12 2015
@@ -26,11 +26,6 @@ import org.apache.directory.studio.ldifp
public class LdifSepLine extends LdifLineBase
{
- protected LdifSepLine()
- {
- }
-
-
public LdifSepLine( int offset, String rawNewLine )
{
super( offset, rawNewLine );
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifValueLineBase.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifValueLineBase.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifValueLineBase.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifValueLineBase.java Fri Jun 19 08:40:12 2015
@@ -52,31 +52,31 @@ public class LdifValueLineBase extends L
public String getRawValueType()
{
- return getNonNull( this.rawValueType );
+ return getNonNull( rawValueType );
}
public String getUnfoldedValueType()
{
- return unfold( this.getRawValueType() );
+ return unfold( getRawValueType() );
}
public String getRawValue()
{
- return getNonNull( this.rawValue );
+ return getNonNull( rawValue );
}
public String getUnfoldedValue()
{
- return unfold( this.getRawValue() );
+ return unfold( getRawValue() );
}
public String toRawString()
{
- return this.getRawLineStart() + this.getRawValueType() + this.getRawValue() + this.getRawNewLine();
+ return getRawLineStart() + getRawValueType() + getRawValue() + getRawNewLine();
}
@@ -121,17 +121,17 @@ public class LdifValueLineBase extends L
public boolean isValid()
{
- return super.isValid() && this.rawValueType != null && this.rawValue != null;
+ return super.isValid() && rawValueType != null && rawValue != null;
}
public String getInvalidString()
{
- if ( this.rawValueType == null )
+ if ( rawValueType == null )
{
return "Missing value type ':', '::' or ':<'";
}
- else if ( this.rawValue == null )
+ else if ( rawValue == null )
{
return "Missing value";
}
@@ -202,15 +202,15 @@ public class LdifValueLineBase extends L
*/
public final Object getValueAsObject()
{
- if ( this.isValueTypeSafe() )
+ if ( isValueTypeSafe() )
{
- return this.getUnfoldedValue();
+ return getUnfoldedValue();
}
- else if ( this.isValueTypeBase64() )
+ else if ( isValueTypeBase64() )
{
- return LdifUtils.base64decodeToByteArray( this.getUnfoldedValue() );
+ return LdifUtils.base64decodeToByteArray( getUnfoldedValue() );
}
- else if ( this.isValueTypeURL() )
+ else if ( isValueTypeURL() )
{
FileInputStream fis = null;
@@ -218,7 +218,7 @@ public class LdifValueLineBase extends L
{
try
{
- File file = new File( this.getUnfoldedValue() );
+ File file = new File( getUnfoldedValue() );
byte[] data = new byte[( int ) file.length()];
fis = new FileInputStream( file );
fis.read( data );
@@ -246,19 +246,19 @@ public class LdifValueLineBase extends L
public boolean isValueTypeURL()
{
- return this.getUnfoldedValueType().startsWith( ":<" ); //$NON-NLS-1$
+ return getUnfoldedValueType().startsWith( ":<" ); //$NON-NLS-1$
}
public boolean isValueTypeBase64()
{
- return this.getUnfoldedValueType().startsWith( "::" ); //$NON-NLS-1$
+ return getUnfoldedValueType().startsWith( "::" ); //$NON-NLS-1$
}
public boolean isValueTypeSafe()
{
- return this.getUnfoldedValueType().startsWith( ":" ) && !this.isValueTypeBase64() && !this.isValueTypeURL(); //$NON-NLS-1$
+ return getUnfoldedValueType().startsWith( ":" ) && !isValueTypeBase64() && !isValueTypeURL(); //$NON-NLS-1$
}
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifVersionLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifVersionLine.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifVersionLine.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifVersionLine.java Fri Jun 19 08:40:12 2015
@@ -26,11 +26,6 @@ import org.apache.directory.studio.ldifp
public class LdifVersionLine extends LdifValueLineBase
{
- protected LdifVersionLine()
- {
- }
-
-
public LdifVersionLine( int offset, String rawVersionSpec, String rawValueType, String rawVersion, String rawNewLine )
{
super( offset, rawVersionSpec, rawValueType, rawVersion, rawNewLine );
@@ -61,25 +56,13 @@ public class LdifVersionLine extends Ldi
}
- public String toRawString()
- {
- return super.toRawString();
- }
-
-
- public boolean isValid()
- {
- return super.isValid();
- }
-
-
public String getInvalidString()
{
- if ( this.getUnfoldedVersionSpec().length() == 0 )
+ if ( getUnfoldedVersionSpec().length() == 0 )
{
return "Missing version spec";
}
- else if ( this.getUnfoldedVersion().length() == 0 )
+ else if ( getUnfoldedVersion().length() == 0 )
{
return "Missing version";
}
@@ -94,5 +77,4 @@ public class LdifVersionLine extends Ldi
{
return new LdifVersionLine( 0, "version", ":", "1", LdifParserConstants.LINE_SEPARATOR ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-
}
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifParser.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifParser.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifParser.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifParser.java Fri Jun 19 08:40:12 2015
@@ -72,6 +72,12 @@ public class LdifParser
}
+ /**
+ * Parse a Ldif String. It will be stored in a LdifFile.
+ *
+ * @param ldif The String to parse
+ * @return The resulting LdifFile
+ */
public LdifFile parse( String ldif )
{
LdifFile model = new LdifFile();
@@ -142,10 +148,10 @@ public class LdifParser
footerParsed = true;
}
- LdifContainer[] containers = model.getContainers();
- containerList.addAll( Arrays.asList( containers ) );
+ List<LdifContainer> containers = model.getContainers();
+ containerList.addAll( containers );
- return !containerList.isEmpty() && !( containers[0] instanceof LdifEOFContainer );
+ return !containerList.isEmpty() && !( containers.get( 0 ) instanceof LdifEOFContainer );
}
else
{
Modified: directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifToken.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifToken.java?rev=1686374&r1=1686373&r2=1686374&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifToken.java (original)
+++ directory/studio/trunk/plugins/ldifparser/src/main/java/org/apache/directory/studio/ldifparser/parser/LdifToken.java Fri Jun 19 08:40:12 2015
@@ -23,7 +23,6 @@ package org.apache.directory.studio.ldif
public class LdifToken implements Comparable<LdifToken>
{
-
public static final int NEW = Integer.MIN_VALUE;
public static final int ERROR = -2;
@@ -110,7 +109,7 @@ public class LdifToken implements Compar
*/
public int getOffset()
{
- return this.offset;
+ return offset;
}
@@ -121,31 +120,31 @@ public class LdifToken implements Compar
*/
public int getLength()
{
- return this.value.length();
+ return value.length();
}
public int getType()
{
- return this.type;
+ return type;
}
public String getValue()
{
- return this.value;
+ return value;
}
public String toString()
{
- return "(type=" + this.type + ") " + "(offset=" + this.offset + ") " + "(length=" + this.getLength() + ") '" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- + this.value + "'"; //$NON-NLS-1$
+ return "(type=" + type + ") " + "(offset=" + offset + ") " + "(length=" + getLength() + ") '" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ + value + "'"; //$NON-NLS-1$
}
public int compareTo( LdifToken ldifToken )
{
- return this.offset - ldifToken.offset;
+ return offset - ldifToken.offset;
}
}