Subversion Repositories XServices

Compare Revisions

Ignore whitespace Rev 194 → Rev 195

/xservices/trunk/src/java/net/brutex/xservices/ws/StringService.java
16,8 → 16,6
 
package net.brutex.xservices.ws;
 
import java.util.ArrayList;
 
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
81,4 → 79,13
@WebParam(name="string") @XmlElement(required=true) String paramString)
throws XServicesFault;
@WebMethod(operationName="handleStringLists")
@WSDLDocumentation("Tokenizes all strings and then adds/removes tokens to/ from basestring")
public abstract String handleStringLists(
@WebParam(name="basestring") @XmlElement(required=true) String paramBaseString,
@WebParam(name="addstring") @XmlElement(required=true) String paramAddString,
@WebParam(name="removestring") @XmlElement(required=true) String paramRemoveString,
@WebParam(name="delimiter") @XmlElement(required=true) String delimiter)
throws XServicesFault;
}
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/StringServiceImpl.java
16,7 → 16,8
 
package net.brutex.xservices.ws.impl;
 
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
106,6 → 107,30
return value;
}
 
public String handleStringLists(String basestring, String addstring, String removestring, String delimiter) throws XServicesFault {
StringTokenizer base = new StringTokenizer(basestring, delimiter);
StringTokenizer add = new StringTokenizer(addstring, delimiter);
StringTokenizer remove = new StringTokenizer(removestring, delimiter);
HashSet<String> hset = new HashSet<String>();
String result = new String();
while(base.hasMoreTokens()) {
hset.add(base.nextToken().toString() );
}
while(add.hasMoreTokens()) {
hset.add(add.nextToken().toString() );
}
while(remove.hasMoreTokens()) {
hset.remove(remove.nextToken().toString() );
}
Iterator<String> hsetit = hset.iterator();
while(hsetit.hasNext()) {
result = result.concat(hsetit.next().toString() + delimiter);
}
return result;
}
 
private int getFlags(String flags) {
int allflags = 0;
if (flags.contains("i")) {