source : databaseSources) {
+ Sources sourceName = source.getName();
+ sourcesList.add(sourceName.getOrigName().toLowerCase());
+ }
}
}
diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java
index d15c32d..7c3d9b3 100644
--- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java
+++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java
@@ -9,7 +9,6 @@ import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
@@ -66,7 +65,7 @@ public abstract class HelperMethods {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(HelperMethods.class);
private static final String APPLICATION_ID_CATALOGUE_MANAGER = "org.gcube.datacatalogue.ProductCatalogue";
- private static final String NOTIFICATION_MESSAGE = "Dear members,
The record 'PRODUCT_TITLE' has been just published by USER_FULLNAME.
You can find it here: PRODUCT_URL
";
+ private static final String NOTIFICATION_MESSAGE = "Dear members,\nThe record 'PRODUCT_TITLE' has been just published by USER_FULLNAME.\nYou can find it here: PRODUCT_URL\n";
private static final String SOCIAL_SERVICE_APPLICATION_TOKEN = "/2/tokens/generate-application-token/";
private static final String SOCIAL_SERVICE_WRITE_APPLICATION_POST = "/2/posts/write-post-app/";
private static final String MEDIATYPE_JSON = "application/json";
@@ -350,26 +349,33 @@ public abstract class HelperMethods {
}
return result;
}
-
- /**
- * Strip out HTML code
- * @param html
- * @return
- * @throws UnsupportedEncodingException
- */
- public static String removeHTML(String html) {
+
+ public static String removeHTML(String html, boolean removeAscii) {
if(html == null || html.isEmpty())
return html;
// remove html and clean
String withoutHTML = Jsoup.parse(html).text();
withoutHTML = Jsoup.clean(withoutHTML, Whitelist.basic());
-
+ if(removeAscii) {
// remove non ascii chars ...
- withoutHTML = withoutHTML.replaceAll("[^\\p{ASCII}]", " ");
+ withoutHTML = withoutHTML.replaceAll("[^\\p{ASCII}]", " ");
+ }
return withoutHTML;
}
-
+
+ /**
+ * Strip out HTML code
+ * @param html
+ * @return
+ * @throws UnsupportedEncodingException
+ */
+ /*
+ public static String removeHTML(String html) {
+ return removeHTML(html, true);
+ }
+ */
+
/**
* Send notification to vre members about the created product by writing a post.
* @param productName the title of the product
diff --git a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java
index 307ba20..00d21ca 100644
--- a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java
+++ b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java
@@ -374,7 +374,7 @@ public class JTests {
public void removeHTML() throws Exception{
String toTest = "Based on the results of the MP operation[] asdkljlasdklsa . - * ; for 2015–17 in its 2013 meeting and the outcome of the review of exceptional circumstances in its 2015 meeting, the ESC recommended that there is no need to revise the Extended Commission’s 2013 TAC decision regarding the TAC for 2016–17. The recommended annual TAC for the years 2016-2017 is 14,647.4t.
";
- HelperMethods.removeHTML(toTest);
+ HelperMethods.removeHTML(toTest, false);
}