@ -3,6 +3,8 @@
* /
* /
package org.gcube.portlets.user.workspace ;
package org.gcube.portlets.user.workspace ;
import java.util.Iterator ;
import org.gcube.common.encryption.StringEncrypter ;
import org.gcube.common.encryption.StringEncrypter ;
import org.gcube.common.scope.api.ScopeProvider ;
import org.gcube.common.scope.api.ScopeProvider ;
import org.gcube.portlets.user.workspace.server.util.StringUtil ;
import org.gcube.portlets.user.workspace.server.util.StringUtil ;
@ -16,7 +18,9 @@ import org.gcube.portlets.user.workspace.server.util.StringUtil;
* /
* /
public class TestEncodeDecodeBase64 {
public class TestEncodeDecodeBase64 {
public static final String CHAR_FOR_SEARCHING_WITH_EXACTLY_MATCH = "\"" ; //is double quote
static final String SCOPE = "/gcube" ;
static final String SCOPE = "/gcube" ;
private static final String JCR_WILDCARD_TO_SEARCH = "%" ;
// static String folderId = "e7b6bc31-8c35-4398-a7fd-492e391e17d2";
// static String folderId = "e7b6bc31-8c35-4398-a7fd-492e391e17d2";
static String folderId = "ce4866ee-8079-4acf-bcd6-1c9dd786eb73" ;
static String folderId = "ce4866ee-8079-4acf-bcd6-1c9dd786eb73" ;
@ -33,6 +37,25 @@ public class TestEncodeDecodeBase64 {
public static void main ( String [ ] args ) {
public static void main ( String [ ] args ) {
try {
try {
String [ ] listTexts = new String [ ] { "data" , "data%" , "\"mydata\"" } ;
for ( String text : listTexts ) {
System . out . println ( "\n\nInput searched text is: " + text ) ;
String toSearch = text ;
if ( toSearch . startsWith ( CHAR_FOR_SEARCHING_WITH_EXACTLY_MATCH ) & & toSearch . endsWith ( CHAR_FOR_SEARCHING_WITH_EXACTLY_MATCH ) ) {
System . out . println ( "Detected intent of exactly mathing, the searched text is between " + CHAR_FOR_SEARCHING_WITH_EXACTLY_MATCH + " char" ) ;
toSearch = toSearch . substring ( 1 , toSearch . length ( ) - 1 ) ;
System . out . println ( "the searched text for exactly mathing is: " + toSearch ) ;
} else {
toSearch = String . format ( "%s%s%s" , JCR_WILDCARD_TO_SEARCH , toSearch , JCR_WILDCARD_TO_SEARCH ) ;
System . out . println ( "prepending and appending the wildcard " + JCR_WILDCARD_TO_SEARCH + ", changed the input text to: " + toSearch ) ;
}
System . out . println ( "backend searched text is: " + toSearch ) ;
}
/ *
ScopeProvider . instance . set ( SCOPE ) ;
ScopeProvider . instance . set ( SCOPE ) ;
System . out . println ( "Folder Id: " + folderId ) ;
System . out . println ( "Folder Id: " + folderId ) ;
encode ( ) ;
encode ( ) ;
@ -42,6 +65,7 @@ public class TestEncodeDecodeBase64 {
System . out . println ( "Encrypt/Decript works!" ) ;
System . out . println ( "Encrypt/Decript works!" ) ;
else
else
System . out . println ( "Encrypt/Decript doesn't work!" ) ;
System . out . println ( "Encrypt/Decript doesn't work!" ) ;
* /
}
}
catch ( Exception e ) {
catch ( Exception e ) {
// TODO Auto-generated catch block
// TODO Auto-generated catch block