diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java index 23ce156..f4b1c92 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java @@ -19,8 +19,11 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; ***REMOVED*** +import java.sql.Timestamp; import java.util.*; +import javax.ws.rs.core.NewCookie; + /** * Created by ggiammat on 5/9/17. */ @@ -378,17 +381,19 @@ public class SVNUpdater ***REMOVED*** svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); String lines[] = byteArrayOutputStream.toString().split("\\r?\\n"); - ***REMOVED*** check if the algorithm is already in the list (match the class - ***REMOVED*** name) + + List newContent = new LinkedList<>(Arrays.asList(lines)); + + ***REMOVED*** check if the algorithm is already in the list (match the class name) and delete the content for (String l : lines) ***REMOVED*** if (l.contains(algorithm.getClazz())) ***REMOVED*** - System.out.println("Not updating algorithm list beacuse already present"); - return; + newContent.remove(l); + ***REMOVED***System.out.println("Not updating algorithm list beacuse already present"); + ***REMOVED***return; ***REMOVED*** ***REMOVED*** - ***REMOVED*** the algorithm is not in the list. Add it - List newContent = new LinkedList<>(Arrays.asList(lines)); + ***REMOVED*** the algorithm is not in the list or must be overwritten cause some modification. Add it newContent.add(this.generateAlgorithmEntry(algorithm, targetVRE, category,algorithm_type, env)); ***REMOVED*** Collections.sort(newContent); @@ -425,6 +430,8 @@ public class SVNUpdater ***REMOVED*** ***REMOVED*** public String generateAlgorithmEntry(Algorithm algorithm, String targetVRE, String category, String algorithm_type,String env) ***REMOVED*** + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + StringBuffer sb = new StringBuffer("| "); sb.append(algorithm.getName() + " | "); sb.append(algorithm.getFullname() + " | "); @@ -433,7 +440,8 @@ public class SVNUpdater ***REMOVED*** sb.append("./addAlgorithm.sh " + algorithm.getName() + " " + algorithm.getCategory() + " " + algorithm.getClazz() + " " + targetVRE + " " + algorithm_type + " N " + algorithm.getPackageURL() + " \"" + algorithm.getDescription() + "\" | "); - sb.append("none |"); + sb.append("none | "); + sb.append(timestamp + " | "); return sb.toString(); ***REMOVED*** @@ -638,10 +646,10 @@ public class SVNUpdater ***REMOVED*** SVNUpdater c = new SVNUpdater(sc); ***REMOVED***File a = new File("/home/ngalante/Desktop/testCiro"); - File b = new File ("/home/ngalante/Desktop/testB"); + ***REMOVED***File b = new File ("/home/ngalante/Desktop/testB"); ***REMOVED***c.updateAlgorithmFiles(a); - c.updateAlgorithmFiles(b); + ***REMOVED***c.updateAlgorithmFiles(b);