converted row limit to integer value
This commit is contained in:
@ -64,13 +64,13 @@ public class SPList extends SPJaxbObject<List> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* *** queries *** */
|
/* *** 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,
|
KeyManagementException, JAXBException, MalformedURLException,
|
||||||
SAXException, ParserConfigurationException, IOException {
|
SAXException, ParserConfigurationException, IOException {
|
||||||
return getListItems(listColumnNames, rowLimit, null);
|
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,
|
NoSuchAlgorithmException, KeyManagementException, JAXBException, MalformedURLException,
|
||||||
SAXException, ParserConfigurationException, IOException {
|
SAXException, ParserConfigurationException, IOException {
|
||||||
|
|
||||||
@ -85,9 +85,10 @@ public class SPList extends SPJaxbObject<List> {
|
|||||||
}
|
}
|
||||||
QueryOptions queryOptions = new QueryOptions();
|
QueryOptions queryOptions = new QueryOptions();
|
||||||
String webId = null;
|
String webId = null;
|
||||||
|
String rowLimitString = Integer.toString(rowLimit);
|
||||||
|
|
||||||
GetListItemsResponse.GetListItemsResult result = getListsPort().
|
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<>();
|
java.util.List<java.util.List<String>> returnList = new LinkedList<>();
|
||||||
if (result != null && result.getContent() != null) {
|
if (result != null && result.getContent() != null) {
|
||||||
@ -187,7 +188,7 @@ public class SPList extends SPJaxbObject<List> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* *** information & tools *** */
|
/* *** 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 {
|
KeyManagementException, JAXBException, MalformedURLException, SAXException, ParserConfigurationException, IOException {
|
||||||
|
|
||||||
// get list values from sharepoint
|
// get list values from sharepoint
|
||||||
|
|||||||
@ -50,7 +50,12 @@ public class SPUserGroup extends SPObject {
|
|||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new SAXException("User not found");
|
throw new SAXException("User not found");
|
||||||
}
|
}
|
||||||
|
if (userLoginName.startsWith("i:0#.w|")) {
|
||||||
getUserGroupPort().removeUserFromGroup(groupName, user.getUserLoginName());
|
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 {
|
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 {
|
public String getUserId(String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
|
||||||
SPUser user = getUser(userLoginName);
|
SPUser user = getUser(userLoginName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
@ -96,6 +118,7 @@ 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,
|
public SPUser getUserFromEmail(String emailAddress) throws JAXBException, ParserConfigurationException, SAXException, IOException,
|
||||||
NoSuchAlgorithmException, KeyManagementException {
|
NoSuchAlgorithmException, KeyManagementException {
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class SPListTest extends BaseTest {
|
|||||||
java.util.List<String> columns = new ArrayList<>();
|
java.util.List<String> columns = new ArrayList<>();
|
||||||
columns.add("Title");
|
columns.add("Title");
|
||||||
columns.add("ID");
|
columns.add("ID");
|
||||||
java.util.List<java.util.List<String>> countryCodes = list.getListItems(columns, "300");
|
java.util.List<java.util.List<String>> countryCodes = list.getListItems(columns, 300);
|
||||||
|
|
||||||
Map<String, String> data = new HashMap<>();
|
Map<String, String> data = new HashMap<>();
|
||||||
data.put("Title", "Test");
|
data.put("Title", "Test");
|
||||||
@ -101,10 +101,10 @@ public class SPListTest extends BaseTest {
|
|||||||
// columns.add("CountryCode");
|
// columns.add("CountryCode");
|
||||||
columns.add("Title");
|
columns.add("Title");
|
||||||
columns.add("ID");
|
columns.add("ID");
|
||||||
java.util.List<java.util.List<String>> smallList = list.getListItems(columns, "30");
|
java.util.List<java.util.List<String>> smallList = list.getListItems(columns, 30);
|
||||||
assertNotNull(smallList);
|
assertNotNull(smallList);
|
||||||
assertEquals("Size smallList", 30, smallList.size());
|
assertEquals("Size smallList", 30, smallList.size());
|
||||||
java.util.List<java.util.List<String>> bigList = list.getListItems(columns, "300");
|
java.util.List<java.util.List<String>> bigList = list.getListItems(columns, 300);
|
||||||
assertNotNull(bigList);
|
assertNotNull(bigList);
|
||||||
assertEquals("Size bigList", 249, bigList.size());
|
assertEquals("Size bigList", 249, bigList.size());
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ public class SPListTest extends BaseTest {
|
|||||||
+ "<Value Type=\"Text\">DE</Value>"
|
+ "<Value Type=\"Text\">DE</Value>"
|
||||||
+ "</Eq></Where></Query>";
|
+ "</Eq></Where></Query>";
|
||||||
|
|
||||||
java.util.List<java.util.List<String>> smallList = list.getListItems(columns, "30",queryString);
|
java.util.List<java.util.List<String>> smallList = list.getListItems(columns, 30, queryString);
|
||||||
// the list contains more than one item but title is a unique value, so it can only
|
// the list contains more than one item but title is a unique value, so it can only
|
||||||
// return one row if filtered to one country
|
// return one row if filtered to one country
|
||||||
assertNotNull(smallList);
|
assertNotNull(smallList);
|
||||||
@ -138,7 +138,7 @@ public class SPListTest extends BaseTest {
|
|||||||
public void testGetLookupValueMap() throws Exception {
|
public void testGetLookupValueMap() throws Exception {
|
||||||
SPLists instance = new SPLists(context);
|
SPLists instance = new SPLists(context);
|
||||||
SPList list = instance.getSpListByTitle("Questionnaire_Countries");
|
SPList list = instance.getSpListByTitle("Questionnaire_Countries");
|
||||||
Map<String, String> lookupValues = list.getLookupValueMap("Title", "0");
|
Map<String, String> lookupValues = list.getLookupValueMap("Title", 0);
|
||||||
System.out.println(lookupValues);
|
System.out.println(lookupValues);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user