88import java .util .concurrent .Callable ;
99
1010import lombok .extern .slf4j .Slf4j ;
11+ import org .apache .commons .collections .CollectionUtils ;
1112import org .nrg .config .services .ConfigService ;
1213import org .nrg .framework .services .SerializerService ;
1314import org .nrg .mail .services .MailService ;
@@ -256,7 +257,7 @@ private void syncProjectResources() {
256257 ResourceUtils resourceUtils = new ResourceUtils (_projectSyncConfiguration );
257258
258259 List <Map <String , Object >> resourceRows = getProjectResourcesModifiedSinceLastSync ();
259- if (resourceRows == null || resourceRows . size () < 1 ) {
260+ if (! CollectionUtils . isEmpty ( resourceRows ) ) {
260261 return ;
261262 }
262263 String remoteProjectId = _projectSyncConfiguration .getProjectSyncConfigurationFromDB ().getSyncinfo ().getRemoteProjectId ();
@@ -268,7 +269,7 @@ private void syncProjectResources() {
268269 if (label != null && label .equalsIgnoreCase (XsyncUtils .PROJECT_SYNC_LOG_RESOURCE_LABEL )) {
269270 continue ;
270271 }
271- _log .debug ("Resource " + row . get ( "label" ) + " has been modfied since " + this .getLastSyncStartTime ());
272+ _log .debug ("Resource {} has been modified since {}" , row . get ( "label" ), this .getLastSyncStartTime ());
272273 if (_projectSyncConfiguration .isResourceToBeSynced (label )) {
273274 String status = (String ) row .get ("status" );
274275 if (_syncAll ) {
@@ -403,7 +404,6 @@ private void updateProjectResource(String localProjectArchivePath, String resour
403404 }
404405 }
405406
406-
407407 private List <Map <String , Object >> getSubjectsModifiedSinceLastSync () {
408408 //Any entity that is derived from the subject or linked to the subject
409409 //if modified, would result in an update in the last_modified column
@@ -423,7 +423,6 @@ private List<Map<String, Object>> getSubjectsSharedIntoProject() {
423423 return _jdbcTemplate .queryForList (query , _parameters );
424424 }
425425
426-
427426 /**
428427 * Append failed subjects.
429428 *
@@ -441,7 +440,7 @@ private List<Map<String, Object>> getQueryForFetchingSubjectsWhoseExperimentsMar
441440 MapSqlParameterSource parameters = new MapSqlParameterSource ();
442441 parameters .addValue ("project" , _projectId );
443442 boolean skipSubjectIdCheck = false ;
444- if (excludeIds .size () > 0 ) {
443+ if (! excludeIds .isEmpty () ) {
445444 parameters .addValue (QueryResultUtil .SUBJECT_IDS , excludeIds );
446445 } else {
447446 skipSubjectIdCheck = true ;
@@ -456,7 +455,7 @@ private List<Map<String, Object>> getProjectResourcesModifiedSinceLastSync() {
456455 }
457456
458457 private void syncSubject (XnatSubjectdata localSubject ) throws Exception {
459- _log .debug ("Exporting " + localSubject .getId ());
458+ _log .debug ("Exporting {}" , localSubject .getId ());
460459 SubjectDataSync remoteSubject = new SubjectDataSync (_manager , _xnatInfo , _queryResultUtil , (JdbcTemplate ) _jdbcTemplate .getJdbcOperations (),
461460 localSubject , _projectSyncConfiguration , _user , _syncAll , _observer , _serializer , _syncStatusService );
462461 remoteSubject .sync (true );
@@ -478,7 +477,7 @@ private void deleteSubject(String deletedSubjectLocalId, String deletedSubjectLa
478477 subject .setId (remoteId );
479478 ConflictCheckUtil .checkForConflict (subject , remoteId , _projectSyncConfiguration ,
480479 _jdbcTemplate , _queryResultUtil , _manager );
481- _log .debug ("Deleting subject " + subject . getId () + " from remote project " + subject .getProject ());
480+ _log .debug ("Deleting subject {} from remote project {}" , subject . getId (), subject .getProject ());
482481 try {
483482 RemoteConnectionHandler remoteConnectionHandler = new RemoteConnectionHandler (_jdbcTemplate , _queryResultUtil );
484483 RemoteConnection connection = remoteConnectionHandler .getConnection (_projectId , remoteUrl );
@@ -569,5 +568,4 @@ public String generateMappingReport(String reportFormat, String objectType) thro
569568 XsyncProjectReportGenerator reportGenerator = new XsyncProjectReportGenerator (_manager , _queryResultUtil , _jdbcTemplate , _projectSyncConfiguration , _serializer , _user );
570569 return reportGenerator .generateMappingReport (reportFormat , objectType );
571570 }
572-
573571}
0 commit comments