Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1)

129004 adavis: REPO-243 People Live Search
      - First cut of this code
      - Includes a re-factor of the code used by GET /queries/live-search-nodes as there is much in common.
      - Still have some tests to write and there are bound to be comments from the review.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@129187 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Martin Muller
2016-08-05 13:49:15 +00:00
parent 15f33e6130
commit 83e9fdf964
10 changed files with 906 additions and 235 deletions

View File

@@ -25,26 +25,24 @@
*/
package org.alfresco.rest.api.tests.client.data;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
import java.text.Collator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.rest.api.tests.client.PublicApiClient.ExpectedPaging;
import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse;
import org.alfresco.service.namespace.QName;
import org.json.simple.JSONArray;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
import java.text.Collator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.rest.api.tests.client.PublicApiClient.ExpectedPaging;
import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse;
import org.alfresco.service.namespace.QName;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import com.sun.star.uno.RuntimeException;
public class Person implements Serializable, Comparable<Person>, ExpectedComparison
{
private static final long serialVersionUID = 3185698391792389751L;
@@ -107,7 +105,7 @@ public class Person implements Serializable, Comparable<Person>, ExpectedCompari
this.enabled = enabled;
}
public String getEmail() {
public String getUsername() {
return username;
}
@@ -203,7 +201,7 @@ public class Person implements Serializable, Comparable<Person>, ExpectedCompari
{
return "Person [" + (id != null ? "id=" + id + ", " : "")
+ (enabled != null ? "enabled=" + enabled + ", " : "")
+ (username != null ? "email=" + username + ", " : "")
+ (username != null ? "username=" + username + ", " : "")
+ (firstName != null ? "firstName=" + firstName + ", " : "")
+ (lastName != null ? "lastName=" + lastName + ", " : "")
+ (company != null ? "company=" + company + ", " : "")
@@ -246,7 +244,7 @@ public class Person implements Serializable, Comparable<Person>, ExpectedCompari
String instantMessageId = (String)jsonObject.get("instantMessageId");
String googleId = (String)jsonObject.get("googleId");
String skypeId = (String)jsonObject.get("skypeId");
String email = (String)jsonObject.get("email");
String username = (String)jsonObject.get("username");
String telephone = (String)jsonObject.get("telephone");
String mobile = (String)jsonObject.get("mobile");
String userId = (String)jsonObject.get("id");
@@ -265,16 +263,25 @@ public class Person implements Serializable, Comparable<Person>, ExpectedCompari
String postcode = (String)companyJSON.get("postcode");
String companyTelephone = (String)companyJSON.get("telephone");
String fax = (String)companyJSON.get("fax");
String companyEmail = (String)companyJSON.get("email");
company = new Company(organization, address1, address2, address3, postcode, companyTelephone, fax, companyEmail);
String companyEmail = (String)companyJSON.get("email");
if (organization != null ||
address2 != null ||
address3 != null ||
postcode != null ||
companyTelephone != null ||
fax != null ||
companyEmail != null)
{
company = new Company(organization, address1, address2, address3, postcode, companyTelephone, fax, companyEmail);
}
}
Person person = new Person(userId, email, enabled, firstName, lastName, company, skypeId, location, telephone, mobile, instantMessageId, googleId, description);
Person person = new Person(userId, username, enabled, firstName, lastName, company, skypeId, location, telephone, mobile, instantMessageId, googleId, description);
return person;
}
public Person restriced()
{
Person p = new Person(getId(), getEmail(), getEnabled(), getFirstName(), getLastName(), null, null, null, null, null, null, null, null);
Person p = new Person(getId(), getUsername(), getEnabled(), getFirstName(), getLastName(), null, null, null, null, null, null, null, null);
return p;
}