@Test public void testEquals() throws Exception { LoggingObjectInterface parent = new LoggingObject( new SimpleLoggingObject( "parent", LoggingObjectType.JOB, null ) ); LoggingObject loggingObject1 = new LoggingObject( "test" ); loggingObject1.setFilename( "fileName" ); loggingObject1.setParent( parent ); loggingObject1.setObjectName( "job1" ); LoggingObject loggingObject2 = new LoggingObject( "test" ); loggingObject2.setFilename( "fileName" ); loggingObject2.setParent( parent ); loggingObject2.setObjectName( "job2" ); Assert.assertFalse( loggingObject1.equals( loggingObject2 ) ); }
@Override public boolean equals( Object obj ) { if ( !( obj instanceof LoggingObject ) ) { return false; } if ( obj == this ) { return true; } try { LoggingObject loggingObject = (LoggingObject) obj; boolean sameCarteFamily = ( getContainerObjectId() == null && loggingObject.getContainerObjectId() == null ) || ( getContainerObjectId() != null && loggingObject.getContainerObjectId() != null && getContainerObjectId() .equals( loggingObject.getContainerObjectId() ) ); if ( sameCarteFamily && loggingObject.getObjectId() != null && loggingObject.getObjectId().equals( getObjectId() ) ) { return true; } boolean sameParents = loggingObject.getParent() == null && this.getParent() == null || loggingObject.getParent() != null && this.getParent() != null && loggingObject.getParent().equals( this.getParent() ); if ( sameCarteFamily && !Utils.isEmpty( loggingObject.getFilename() ) && loggingObject.getFilename().equals( getFilename() ) && sameParents && StringUtils.equals( loggingObject.getObjectName(), getObjectName() ) ) { return true; } if ( !sameCarteFamily || ( loggingObject.getObjectName() == null && getObjectName() != null ) || ( loggingObject.getObjectName() != null && getObjectName() == null ) ) { return false; } if ( sameCarteFamily && ( ( loggingObject.getObjectName() == null && getObjectName() == null ) || ( loggingObject .getObjectName().equals( getObjectName() ) ) ) && loggingObject.getObjectType().equals( getObjectType() ) ) { if ( !Utils.isEmpty( getObjectCopy() ) && !getObjectCopy().equals( loggingObject.getObjectCopy() ) ) { return false; } LoggingObjectInterface parent1 = loggingObject.getParent(); LoggingObjectInterface parent2 = getParent(); if ( ( parent1 != null && parent2 == null ) || ( parent1 == null && parent2 != null ) ) { return false; } if ( parent1 == null && parent2 == null ) { return true; } if ( parent1.equals( parent2 ) ) { return true; } } } catch ( Exception e ) { e.printStackTrace(); } return false; }
LoggingObject implements LoggingObjectInterface { @Override public boolean equals( Object obj ) { if ( !( obj instanceof LoggingObject ) ) { return false; } if ( obj == this ) { return true; } try { LoggingObject loggingObject = (LoggingObject) obj; boolean sameCarteFamily = ( getContainerObjectId() == null && loggingObject.getContainerObjectId() == null ) || ( getContainerObjectId() != null && loggingObject.getContainerObjectId() != null && getContainerObjectId() .equals( loggingObject.getContainerObjectId() ) ); if ( sameCarteFamily && loggingObject.getObjectId() != null && loggingObject.getObjectId().equals( getObjectId() ) ) { return true; } boolean sameParents = loggingObject.getParent() == null && this.getParent() == null || loggingObject.getParent() != null && this.getParent() != null && loggingObject.getParent().equals( this.getParent() ); if ( sameCarteFamily && !Utils.isEmpty( loggingObject.getFilename() ) && loggingObject.getFilename().equals( getFilename() ) && sameParents && StringUtils.equals( loggingObject.getObjectName(), getObjectName() ) ) { return true; } if ( !sameCarteFamily || ( loggingObject.getObjectName() == null && getObjectName() != null ) || ( loggingObject.getObjectName() != null && getObjectName() == null ) ) { return false; } if ( sameCarteFamily && ( ( loggingObject.getObjectName() == null && getObjectName() == null ) || ( loggingObject .getObjectName().equals( getObjectName() ) ) ) && loggingObject.getObjectType().equals( getObjectType() ) ) { if ( !Utils.isEmpty( getObjectCopy() ) && !getObjectCopy().equals( loggingObject.getObjectCopy() ) ) { return false; } LoggingObjectInterface parent1 = loggingObject.getParent(); LoggingObjectInterface parent2 = getParent(); if ( ( parent1 != null && parent2 == null ) || ( parent1 == null && parent2 != null ) ) { return false; } if ( parent1 == null && parent2 == null ) { return true; } if ( parent1.equals( parent2 ) ) { return true; } } } catch ( Exception e ) { e.printStackTrace(); } return false; } }
LoggingObject implements LoggingObjectInterface { @Override public boolean equals( Object obj ) { if ( !( obj instanceof LoggingObject ) ) { return false; } if ( obj == this ) { return true; } try { LoggingObject loggingObject = (LoggingObject) obj; boolean sameCarteFamily = ( getContainerObjectId() == null && loggingObject.getContainerObjectId() == null ) || ( getContainerObjectId() != null && loggingObject.getContainerObjectId() != null && getContainerObjectId() .equals( loggingObject.getContainerObjectId() ) ); if ( sameCarteFamily && loggingObject.getObjectId() != null && loggingObject.getObjectId().equals( getObjectId() ) ) { return true; } boolean sameParents = loggingObject.getParent() == null && this.getParent() == null || loggingObject.getParent() != null && this.getParent() != null && loggingObject.getParent().equals( this.getParent() ); if ( sameCarteFamily && !Utils.isEmpty( loggingObject.getFilename() ) && loggingObject.getFilename().equals( getFilename() ) && sameParents && StringUtils.equals( loggingObject.getObjectName(), getObjectName() ) ) { return true; } if ( !sameCarteFamily || ( loggingObject.getObjectName() == null && getObjectName() != null ) || ( loggingObject.getObjectName() != null && getObjectName() == null ) ) { return false; } if ( sameCarteFamily && ( ( loggingObject.getObjectName() == null && getObjectName() == null ) || ( loggingObject .getObjectName().equals( getObjectName() ) ) ) && loggingObject.getObjectType().equals( getObjectType() ) ) { if ( !Utils.isEmpty( getObjectCopy() ) && !getObjectCopy().equals( loggingObject.getObjectCopy() ) ) { return false; } LoggingObjectInterface parent1 = loggingObject.getParent(); LoggingObjectInterface parent2 = getParent(); if ( ( parent1 != null && parent2 == null ) || ( parent1 == null && parent2 != null ) ) { return false; } if ( parent1 == null && parent2 == null ) { return true; } if ( parent1.equals( parent2 ) ) { return true; } } } catch ( Exception e ) { e.printStackTrace(); } return false; } LoggingObject( Object object ); }
LoggingObject implements LoggingObjectInterface { @Override public boolean equals( Object obj ) { if ( !( obj instanceof LoggingObject ) ) { return false; } if ( obj == this ) { return true; } try { LoggingObject loggingObject = (LoggingObject) obj; boolean sameCarteFamily = ( getContainerObjectId() == null && loggingObject.getContainerObjectId() == null ) || ( getContainerObjectId() != null && loggingObject.getContainerObjectId() != null && getContainerObjectId() .equals( loggingObject.getContainerObjectId() ) ); if ( sameCarteFamily && loggingObject.getObjectId() != null && loggingObject.getObjectId().equals( getObjectId() ) ) { return true; } boolean sameParents = loggingObject.getParent() == null && this.getParent() == null || loggingObject.getParent() != null && this.getParent() != null && loggingObject.getParent().equals( this.getParent() ); if ( sameCarteFamily && !Utils.isEmpty( loggingObject.getFilename() ) && loggingObject.getFilename().equals( getFilename() ) && sameParents && StringUtils.equals( loggingObject.getObjectName(), getObjectName() ) ) { return true; } if ( !sameCarteFamily || ( loggingObject.getObjectName() == null && getObjectName() != null ) || ( loggingObject.getObjectName() != null && getObjectName() == null ) ) { return false; } if ( sameCarteFamily && ( ( loggingObject.getObjectName() == null && getObjectName() == null ) || ( loggingObject .getObjectName().equals( getObjectName() ) ) ) && loggingObject.getObjectType().equals( getObjectType() ) ) { if ( !Utils.isEmpty( getObjectCopy() ) && !getObjectCopy().equals( loggingObject.getObjectCopy() ) ) { return false; } LoggingObjectInterface parent1 = loggingObject.getParent(); LoggingObjectInterface parent2 = getParent(); if ( ( parent1 != null && parent2 == null ) || ( parent1 == null && parent2 != null ) ) { return false; } if ( parent1 == null && parent2 == null ) { return true; } if ( parent1.equals( parent2 ) ) { return true; } } } catch ( Exception e ) { e.printStackTrace(); } return false; } LoggingObject( Object object ); @Override boolean equals( Object obj ); @Override String getObjectName(); void setObjectName( String name ); @Override RepositoryDirectoryInterface getRepositoryDirectory(); void setRepositoryDirectory( RepositoryDirectory repositoryDirectory ); @Override String getFilename(); void setFilename( String filename ); @Override ObjectId getObjectId(); void setObjectId( ObjectId objectId ); @Override ObjectRevision getObjectRevision(); void setObjectRevision( ObjectRevision objectRevision ); @Override String getLogChannelId(); void setLogChannelId( String logChannelId ); @Override LoggingObjectInterface getParent(); void setParent( LoggingObjectInterface parent ); @Override LoggingObjectType getObjectType(); void setObjectType( LoggingObjectType objectType ); @Override String getObjectCopy(); void setObjectCopy( String objectCopy ); @Override LogLevel getLogLevel(); void setLogLevel( LogLevel logLevel ); @Override String getContainerObjectId(); void setCarteObjectId( String carteObjectId ); @Override Date getRegistrationDate(); void setRegistrationDate( Date registrationDate ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); }
LoggingObject implements LoggingObjectInterface { @Override public boolean equals( Object obj ) { if ( !( obj instanceof LoggingObject ) ) { return false; } if ( obj == this ) { return true; } try { LoggingObject loggingObject = (LoggingObject) obj; boolean sameCarteFamily = ( getContainerObjectId() == null && loggingObject.getContainerObjectId() == null ) || ( getContainerObjectId() != null && loggingObject.getContainerObjectId() != null && getContainerObjectId() .equals( loggingObject.getContainerObjectId() ) ); if ( sameCarteFamily && loggingObject.getObjectId() != null && loggingObject.getObjectId().equals( getObjectId() ) ) { return true; } boolean sameParents = loggingObject.getParent() == null && this.getParent() == null || loggingObject.getParent() != null && this.getParent() != null && loggingObject.getParent().equals( this.getParent() ); if ( sameCarteFamily && !Utils.isEmpty( loggingObject.getFilename() ) && loggingObject.getFilename().equals( getFilename() ) && sameParents && StringUtils.equals( loggingObject.getObjectName(), getObjectName() ) ) { return true; } if ( !sameCarteFamily || ( loggingObject.getObjectName() == null && getObjectName() != null ) || ( loggingObject.getObjectName() != null && getObjectName() == null ) ) { return false; } if ( sameCarteFamily && ( ( loggingObject.getObjectName() == null && getObjectName() == null ) || ( loggingObject .getObjectName().equals( getObjectName() ) ) ) && loggingObject.getObjectType().equals( getObjectType() ) ) { if ( !Utils.isEmpty( getObjectCopy() ) && !getObjectCopy().equals( loggingObject.getObjectCopy() ) ) { return false; } LoggingObjectInterface parent1 = loggingObject.getParent(); LoggingObjectInterface parent2 = getParent(); if ( ( parent1 != null && parent2 == null ) || ( parent1 == null && parent2 != null ) ) { return false; } if ( parent1 == null && parent2 == null ) { return true; } if ( parent1.equals( parent2 ) ) { return true; } } } catch ( Exception e ) { e.printStackTrace(); } return false; } LoggingObject( Object object ); @Override boolean equals( Object obj ); @Override String getObjectName(); void setObjectName( String name ); @Override RepositoryDirectoryInterface getRepositoryDirectory(); void setRepositoryDirectory( RepositoryDirectory repositoryDirectory ); @Override String getFilename(); void setFilename( String filename ); @Override ObjectId getObjectId(); void setObjectId( ObjectId objectId ); @Override ObjectRevision getObjectRevision(); void setObjectRevision( ObjectRevision objectRevision ); @Override String getLogChannelId(); void setLogChannelId( String logChannelId ); @Override LoggingObjectInterface getParent(); void setParent( LoggingObjectInterface parent ); @Override LoggingObjectType getObjectType(); void setObjectType( LoggingObjectType objectType ); @Override String getObjectCopy(); void setObjectCopy( String objectCopy ); @Override LogLevel getLogLevel(); void setLogLevel( LogLevel logLevel ); @Override String getContainerObjectId(); void setCarteObjectId( String carteObjectId ); @Override Date getRegistrationDate(); void setRegistrationDate( Date registrationDate ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging );  }