This commit is contained in:
Nunzio Andrea Galante 2017-09-01 15:24:42 +00:00
parent c69e116040
commit b29cce9580
1 changed files with 17 additions and 9 deletions

View File

@ -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<String> 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<String> 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("<notextile>./addAlgorithm.sh " + algorithm.getName() + " " + algorithm.getCategory() + " "
+ algorithm.getClazz() + " " + targetVRE + " " + algorithm_type + " N "
+ algorithm.getPackageURL() + " \"" + algorithm.getDescription() + "\" </notextile> | ");
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);