converted row limit to integer value

This commit is contained in:
jomu
2015-02-10 08:12:58 +00:00
parent 59f71fcbda
commit b0c77c8fd0
3 changed files with 46 additions and 22 deletions

View File

@ -64,13 +64,13 @@ public class SPList extends SPJaxbObject<List> {
}
/* *** queries *** */
public java.util.List<java.util.List<String>> getListItems(java.util.List<String> listColumnNames, String rowLimit) throws NoSuchAlgorithmException,
public java.util.List<java.util.List<String>> getListItems(java.util.List<String> listColumnNames, int rowLimit) throws NoSuchAlgorithmException,
KeyManagementException, JAXBException, MalformedURLException,
SAXException, ParserConfigurationException, IOException {
return getListItems(listColumnNames, rowLimit, null);
}
public java.util.List<java.util.List<String>> getListItems(java.util.List<String> listColumnNames, String rowLimit, String queryString) throws
public java.util.List<java.util.List<String>> getListItems(java.util.List<String> listColumnNames, int rowLimit, String queryString) throws
NoSuchAlgorithmException, KeyManagementException, JAXBException, MalformedURLException,
SAXException, ParserConfigurationException, IOException {
@ -85,9 +85,10 @@ public class SPList extends SPJaxbObject<List> {
}
QueryOptions queryOptions = new QueryOptions();
String webId = null;
String rowLimitString = Integer.toString(rowLimit);
GetListItemsResponse.GetListItemsResult result = getListsPort().
getListItems(getValue().name, viewName, query, viewFields, rowLimit, queryOptions, webId);
getListItems(getValue().name, viewName, query, viewFields, rowLimitString, queryOptions, webId);
java.util.List<java.util.List<String>> returnList = new LinkedList<>();
if (result != null && result.getContent() != null) {
@ -187,7 +188,7 @@ public class SPList extends SPJaxbObject<List> {
}
/* *** information & tools *** */
public Map<String, String> getLookupValueMap(String value, String rowLimit) throws NoSuchAlgorithmException,
public Map<String, String> getLookupValueMap(String value, int rowLimit) throws NoSuchAlgorithmException,
KeyManagementException, JAXBException, MalformedURLException, SAXException, ParserConfigurationException, IOException {
// get list values from sharepoint

View File

@ -50,7 +50,12 @@ public class SPUserGroup extends SPObject {
if (user == null) {
throw new SAXException("User not found");
}
getUserGroupPort().removeUserFromGroup(groupName, user.getUserLoginName());
if (userLoginName.startsWith("i:0#.w|")) {
getUserGroupPort().removeUserFromGroup(groupName, user.getUserLoginName());
} else {
getUserGroupPort().removeUserFromGroup(groupName, "i:0#.w|" + user.getUserLoginName());
}
}
public boolean isUserMemberOfGroup(String userLoginName, String groupName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException {
@ -78,6 +83,23 @@ public class SPUserGroup extends SPObject {
}
}
public SPUsers getUsersFromGroup(String groupName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
GetUserCollectionFromGroupResponse.GetUserCollectionFromGroupResult result = getUserGroupPort().getUserCollectionFromGroup(groupName);
if ((result != null) && (result.getContent() != null) && (!result.getContent().isEmpty())) {
Object value = result.getContent().get(0);
if (value instanceof Element) {
Element rootElement = (Element) value;
SPUsers users = new SPUsers(getContext());
String usersString = SPUsers.xmlToString(rootElement.getFirstChild());
users.setValue(usersString);
return users;
}
}
return null;
}
public String getUserId(String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
SPUser user = getUser(userLoginName);
if (user == null) {
@ -96,24 +118,25 @@ public class SPUserGroup extends SPObject {
}
}
// TODO does not return full object, how to refresh the object to get all attributes?
public SPUser getUserFromEmail(String emailAddress) throws JAXBException, ParserConfigurationException, SAXException, IOException,
NoSuchAlgorithmException, KeyManagementException {
String xml = "<Users><User Email=\"" + emailAddress + "\"/></Users>";
EmailXml emailXml = new GetUserLoginFromEmail.EmailXml();
EmailXml emailXml = new GetUserLoginFromEmail.EmailXml();
emailXml.getContent().add(SPJaxbObject.createSharePointCAMLNode(xml));
// Node userNode = user.createSharePointCAMLNode();
GetUserLoginFromEmailResponse.GetUserLoginFromEmailResult result = getUserGroupPort().getUserLoginFromEmail(emailXml);
if ((result != null) && (!result.getContent().isEmpty())) {
Object content = result.getContent().get(0);
if (content instanceof Element) {
Element rootElement = (Element) content;
Element rootElement = (Element) content;
SPUser user = new SPUser(getContext());
user.setValue(SPJaxbObject.xmlToString(rootElement.getFirstChild()));
return user;
}
}
return null;
}