protected void setConflictAttributes ( Change change ) throws IllegalArgumentException { // default values change . setAcceptStatus ( change . getImportedStatus ( ) ) ; change . setAcceptValue ( change . getImportedValue ( ) ) ; if ( useMasterValueFromFile ) { change . setAcceptMasterValue ( change . getImportedMasterValue ( ) ) ; } else { change . setAcceptMasterValue ( change . getDbMasterValue ( ) ) ; } switch ( change . getType ( ) ) { case Change . TYPE_NO_CHANGE : break ; case Change . TYPE_MASTER_VALUE_CHANGED : change . setConflicting ( true ) ; change . setAcceptable ( true ) ; // ...in contrast to the original specifiaction by JH change . setAccept ( false ) ; break ; case Change . TYPE_IMPORTED_STATUS_OLDER : change . setConflicting ( true ) ; change . setAcceptable ( true ) ; change . setAccept ( true ) ; break ; case Change . TYPE_IMPORTED_STATUS_NEWER : change . setConflicting ( false ) ; change . setAcceptable ( true ) ; change . setAccept ( true ) ; break ; case Change . TYPE_LANGUAGE_ADDITION : change . setConflicting ( true ) ; change . setAcceptable ( false ) ; // only the developer should be able to add languages break ; case Change . TYPE_MASTER_LANGUAGE_ADDITION : change . setConflicting ( true ) ; change . setAcceptable ( false ) ; // only the developer should be able to add languages break ; case Change . TYPE_VALUE_CHANGED : case Change . TYPE_VALUE_AND_STATUS_CHANGED : // default values change . setConflicting ( false ) ; change . setAcceptable ( true ) ; change . setAccept ( true ) ; // proceed according to the "old status" / "new status" matrix Status importedStatus = change . getImportedStatus ( ) ; Status dbStatus = change . getDbStatus ( ) ; if ( dbStatus == Status . SPECIAL ) { change . setConflicting ( true ) ; change . setAcceptable ( false ) ; } else if ( dbStatus == Status . INITIAL ) { if ( importedStatus == Status . INITIAL ) { change . setAcceptStatus ( Status . TRANSLATED ) ; } else if ( importedStatus == Status . SPECIAL ) { change . setConflicting ( true ) ; change . setAcceptable ( false ) ; change . setAcceptStatus ( Status . TRANSLATED ) ; } } else if ( dbStatus == Status . TRANSLATED ) { if ( importedStatus == Status . INITIAL || importedStatus == Status . SPECIAL ) { change . setConflicting ( true ) ; change . setAcceptStatus ( Status . TRANSLATED ) ; } } else if ( dbStatus == Status . VERIFIED ) { change . setConflicting ( true ) ; if ( importedStatus == Status . VERIFIED ) { change . setAccept ( false ) ; } } break ; case Change . TYPE_KEY_ADDITION : change . setConflicting ( true ) ; change . setAcceptable ( false ) ; // only the developer should be able to add keys break ; default : throw new IllegalArgumentException ( "Unknown change type: " + change . getType ( ) ) ; } }
Determines whether a change is conflicting acceptable and to be accepted and sets the values to be accepted . This routine is the only one dealing with the mentioned conflict attributes . It may be overridden to change the conflict specification .