Minor - re-formatting only (fix tabs to spaces)

- noted via REPO-1390

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@131866 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2016-10-28 14:35:42 +00:00
parent 96953c1bb7
commit 0e7a674d41
4 changed files with 374 additions and 376 deletions

View File

@@ -68,14 +68,14 @@ public interface Sites
String getSiteRole(String siteId, String personId);
String PARAM_PERMANENT = "permanent";
String PARAM_SKIP_ADDTOFAVORITES = "skipAddToFavorites";
String PARAM_SKIP_SURF_CONFIGURATION = "skipConfiguration";
String PARAM_SKIP_ADDTOFAVORITES = "skipAddToFavorites";
String PARAM_SKIP_SURF_CONFIGURATION = "skipConfiguration";
String PARAM_SITE_ID = "id";
String PARAM_SITE_TITLE = "title";
String PARAM_SITE_DESCRIPTION = "description";
String PARAM_SITE_ID = "id";
String PARAM_SITE_TITLE = "title";
String PARAM_SITE_DESCRIPTION = "description";
String PARAM_SITE_ROLE = "role";
String PARAM_SITE_ROLE = "role";
String PARAM_VISIBILITY = "visibility";
String PARAM_PRESET = "preset";
}

View File

@@ -26,7 +26,6 @@
package org.alfresco.rest.api.model;
import org.alfresco.rest.framework.resource.UniqueId;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteVisibility;
@@ -38,80 +37,80 @@ import org.alfresco.service.cmr.site.SiteVisibility;
*/
public class Site implements Comparable<Site>
{
public static final String ROLE = "role";
public static final String ROLE = "role";
protected String id; // site id (aka short name)
protected String guid; // site nodeId
protected String title;
protected String description;
protected SiteVisibility visibility;
protected String id; // site id (aka short name)
protected String guid; // site nodeId
protected String title;
protected String description;
protected SiteVisibility visibility;
protected String preset;
protected String role;
protected String role;
public Site()
{
}
public Site()
{
}
public Site(SiteInfo siteInfo, String role)
{
if(siteInfo == null)
{
throw new IllegalArgumentException("Must provide siteInfo");
}
this.id = siteInfo.getShortName();
this.guid = siteInfo.getNodeRef().getId();
this.title = siteInfo.getTitle();
this.description = siteInfo.getDescription();
this.visibility = siteInfo.getVisibility();
public Site(SiteInfo siteInfo, String role)
{
if (siteInfo == null)
{
throw new IllegalArgumentException("Must provide siteInfo");
}
this.id = siteInfo.getShortName();
this.guid = siteInfo.getNodeRef().getId();
this.title = siteInfo.getTitle();
this.description = siteInfo.getDescription();
this.visibility = siteInfo.getVisibility();
this.preset = siteInfo.getSitePreset();
this.role = role;
}
this.role = role;
}
@UniqueId
public String getId()
{
return id;
}
@UniqueId
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public void setId(String id)
{
this.id = id;
}
public String getGuid()
{
return guid;
}
public String getGuid()
{
return guid;
}
public void setGuid(String guid)
{
this.guid = guid;
}
public void setGuid(String guid)
{
this.guid = guid;
}
public String getTitle()
{
return title;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getDescription()
{
return description;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public SiteVisibility getVisibility()
{
return visibility;
}
public SiteVisibility getVisibility()
{
return visibility;
}
public void setVisibility(SiteVisibility visibility)
{
@@ -138,50 +137,49 @@ public class Site implements Comparable<Site>
this.role = role;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
Site other = (Site) obj;
return id.equals(other.id);
}
@Override
public int compareTo(Site site)
{
return id.compareTo(site.getId());
}
Site other = (Site) obj;
return id.equals(other.id);
}
@Override
public int hashCode()
public int compareTo(Site site)
{
final int prime = 31;
int result = 1;
result = prime * result
+ ((id == null) ? 0 : id.hashCode());
return result;
}
return id.compareTo(site.getId());
}
@Override
public String toString()
{
return "Site [id=" + id + ", guid=" + guid + ", title=" + title
+ ", description=" + description + ", visibility=" + visibility
+ "]";
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result
+ ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public String toString()
{
return "Site [id=" + id + ", guid=" + guid + ", title=" + title
+ ", description=" + description + ", visibility=" + visibility
+ "]";
}
}

View File

@@ -29,27 +29,27 @@ import org.json.simple.JSONObject;
public interface Site extends JSONAble
{
Boolean getCreated();
Boolean getCreated();
Site withCreated(Boolean created);
String getGuid();
String getGuid();
Site withGuid(String guid);
String getNetworkId();
String getNetworkId();
Site withNetworkId(String networkId);
Boolean isCreated();
String getSiteId();
Boolean isCreated();
String getSiteId();
Site withSiteId(String siteId);
String getTitle();
String getTitle();
Site withTitle(String title);
String getDescription();
String getDescription();
Site withDescription(String description);
String getVisibility();
String getVisibility();
Site withVisibility(String visibility);
String getPreset();
Site withPreset(String preset);
String getType();
String getType();
Site withType(String type);
SiteRole getRole();
SiteRole getRole();
Site withRole(SiteRole role);
void expected(Object o);
JSONObject toJSON();
void expected(Object o);
JSONObject toJSON();
}

View File

@@ -40,90 +40,90 @@ import org.json.simple.JSONObject;
public class SiteImpl implements Serializable, Site, Comparable<SiteImpl>, ExpectedComparison
{
private static final long serialVersionUID = -3774392026234649419L;
private static final long serialVersionUID = -3774392026234649419L;
public static final String FIELD_SITE_ID = "siteId";
public static final String FIELD_CREATED = "created";
public static final String FIELD_HAS_MEMBERS = "hasMembers";
public static final String FIELD_SITE_ID = "siteId";
public static final String FIELD_CREATED = "created";
public static final String FIELD_HAS_MEMBERS = "hasMembers";
protected Boolean created = false;
protected String networkId;
protected String siteId;
protected String guid;
protected String title;
protected String description;
protected SiteRole role;
protected String visibility; // one of (PUBLIC,MODERATED,PRIVATE), defaults to PUBLIC
protected String networkId;
protected String siteId;
protected String guid;
protected String title;
protected String description;
protected SiteRole role;
protected String visibility; // one of (PUBLIC,MODERATED,PRIVATE), defaults to PUBLIC
protected String preset;
protected String type;
protected String type;
public SiteImpl()
{
}
public SiteImpl(String title, String visibility)
{
if (title == null)
{
throw new java.lang.IllegalArgumentException();
}
public SiteImpl(String title, String visibility)
{
if (title == null)
{
throw new java.lang.IllegalArgumentException();
}
if (visibility == null)
{
throw new java.lang.IllegalArgumentException();
}
this.title = title;
this.visibility = visibility;
}
if (visibility == null)
{
throw new java.lang.IllegalArgumentException();
}
this.title = title;
this.visibility = visibility;
}
public SiteImpl(String networkId, String siteId, String guid)
{
if (siteId == null)
{
throw new java.lang.IllegalArgumentException();
}
if (siteId == null)
{
throw new java.lang.IllegalArgumentException();
}
if (guid == null)
{
throw new java.lang.IllegalArgumentException();
}
this.networkId = networkId;
this.siteId = siteId;
this.guid = guid;
if (guid == null)
{
throw new java.lang.IllegalArgumentException();
}
this.networkId = networkId;
this.siteId = siteId;
this.guid = guid;
}
public SiteImpl(SiteInfo siteInfo, SiteRole siteRole, Boolean created)
{
this.siteId = siteInfo.getShortName();
this.description = siteInfo.getDescription();
this.title = siteInfo.getTitle();
this.visibility = siteInfo.getVisibility().toString();
this.created = created;
this.guid = siteInfo.getNodeRef().getId();
this.siteId = siteInfo.getShortName();
this.description = siteInfo.getDescription();
this.title = siteInfo.getTitle();
this.visibility = siteInfo.getVisibility().toString();
this.created = created;
this.guid = siteInfo.getNodeRef().getId();
}
public SiteImpl(String siteId, String title, String description, String visibility)
{
super();
this.siteId = siteId;
this.title = title;
this.description = description;
this.visibility = visibility;
}
public SiteImpl(String siteId, String title, String description, String visibility)
{
super();
this.siteId = siteId;
this.title = title;
this.description = description;
this.visibility = visibility;
}
public SiteImpl(String networkId, String siteId, String guid, String title, String description,
String visibility, String type, SiteRole siteRole)
{
super();
this.networkId = networkId;
this.siteId = siteId;
this.title = title;
this.description = description;
this.visibility = visibility;
this.type = type;
this.role = siteRole;
this.guid = guid;
}
public SiteImpl(String networkId, String siteId, String guid, String title, String description,
String visibility, String type, SiteRole siteRole)
{
super();
this.networkId = networkId;
this.siteId = siteId;
this.title = title;
this.description = description;
this.visibility = visibility;
this.type = type;
this.role = siteRole;
this.guid = guid;
}
@Override
public Site withCreated(Boolean created)
@@ -195,191 +195,191 @@ public class SiteImpl implements Serializable, Site, Comparable<SiteImpl>, Expec
return this;
}
@Override
public void expected(Object o)
{
assertTrue(o instanceof SiteImpl);
@Override
public void expected(Object o)
{
assertTrue(o instanceof SiteImpl);
SiteImpl site = (SiteImpl)o;
SiteImpl site = (SiteImpl)o;
AssertUtil.assertEquals("siteId", getSiteId(), site.getSiteId());
AssertUtil.assertEquals("guid", getGuid(), site.getGuid());
AssertUtil.assertEquals("title", getTitle(), site.getTitle());
AssertUtil.assertEquals("description", getDescription(), site.getDescription());
AssertUtil.assertEquals("visibility", getVisibility(), site.getVisibility());
AssertUtil.assertEquals("role", getRole(), site.getRole());
}
AssertUtil.assertEquals("siteId", getSiteId(), site.getSiteId());
AssertUtil.assertEquals("guid", getGuid(), site.getGuid());
AssertUtil.assertEquals("title", getTitle(), site.getTitle());
AssertUtil.assertEquals("description", getDescription(), site.getDescription());
AssertUtil.assertEquals("visibility", getVisibility(), site.getVisibility());
AssertUtil.assertEquals("role", getRole(), site.getRole());
}
public Boolean getCreated()
{
return created;
}
public Boolean getCreated()
{
return created;
}
public String getGuid()
{
return guid;
}
public String getGuid()
{
return guid;
}
public String getNetworkId()
{
return networkId;
}
public String getNetworkId()
{
return networkId;
}
public Boolean isCreated()
{
return created;
}
public Boolean isCreated()
{
return created;
}
public void setCreated(Boolean created)
{
this.created = created;
}
public void setCreated(Boolean created)
{
this.created = created;
}
public String getSiteId()
{
return siteId;
}
public String getSiteId()
{
return siteId;
}
public String getTitle()
{
return title;
}
public String getTitle()
{
return title;
}
public String getDescription()
{
return description;
}
public String getDescription()
{
return description;
}
public String getVisibility()
{
return visibility;
}
public String getVisibility()
{
return visibility;
}
public String getPreset()
{
return preset;
}
public String getType()
{
return type;
}
public String getType()
{
return type;
}
public void setNetworkId(String networkId)
{
this.networkId = networkId;
}
public void setNetworkId(String networkId)
{
this.networkId = networkId;
}
public void setSiteId(String siteId)
{
this.siteId = siteId;
}
public void setSiteId(String siteId)
{
this.siteId = siteId;
}
public void setGuid(String guid)
{
this.guid = guid;
}
public void setGuid(String guid)
{
this.guid = guid;
}
public void setTitle(String title)
{
this.title = title;
}
public void setTitle(String title)
{
this.title = title;
}
public void setDescription(String description)
{
this.description = description;
}
public void setDescription(String description)
{
this.description = description;
}
public void setVisibility(String visibility)
{
this.visibility = visibility;
}
public void setVisibility(String visibility)
{
this.visibility = visibility;
}
public void setPreset(String preset)
{
this.preset = preset;
}
public void setType(String type)
{
this.type = type;
}
public void setType(String type)
{
this.type = type;
}
public static Site parseSite(JSONObject jsonObject)
{
if (jsonObject == null)
{
return null;
}
public static Site parseSite(JSONObject jsonObject)
{
if (jsonObject == null)
{
return null;
}
String id = (String)jsonObject.get("id");
String guid = (String)jsonObject.get("guid");
String title = (String)jsonObject.get("title");
String description = (String)jsonObject.get("description");
String visibility = (String)jsonObject.get("visibility");
String roleStr = (String)jsonObject.get("role");
SiteRole role = null;
if(roleStr != null)
{
role = SiteRole.valueOf(roleStr);
}
SiteImpl site = new SiteImpl(null, id, guid, title, description, visibility, "st:site", role);
return site;
}
String id = (String)jsonObject.get("id");
String guid = (String)jsonObject.get("guid");
String title = (String)jsonObject.get("title");
String description = (String)jsonObject.get("description");
String visibility = (String)jsonObject.get("visibility");
String roleStr = (String)jsonObject.get("role");
SiteRole role = null;
if(roleStr != null)
{
role = SiteRole.valueOf(roleStr);
}
SiteImpl site = new SiteImpl(null, id, guid, title, description, visibility, "st:site", role);
return site;
}
public static ListResponse<Site> parseSites(JSONObject jsonObject)
{
List<Site> sites = new ArrayList<Site>();
public static ListResponse<Site> parseSites(JSONObject jsonObject)
{
List<Site> sites = new ArrayList<Site>();
JSONObject jsonList = (JSONObject)jsonObject.get("list");
assertNotNull(jsonList);
JSONObject jsonList = (JSONObject)jsonObject.get("list");
assertNotNull(jsonList);
JSONArray jsonEntries = (JSONArray)jsonList.get("entries");
assertNotNull(jsonEntries);
JSONArray jsonEntries = (JSONArray)jsonList.get("entries");
assertNotNull(jsonEntries);
for(int i = 0; i < jsonEntries.size(); i++)
{
JSONObject jsonEntry = (JSONObject)jsonEntries.get(i);
JSONObject entry = (JSONObject)jsonEntry.get("entry");
sites.add(parseSite(entry));
}
for(int i = 0; i < jsonEntries.size(); i++)
{
JSONObject jsonEntry = (JSONObject)jsonEntries.get(i);
JSONObject entry = (JSONObject)jsonEntry.get("entry");
sites.add(parseSite(entry));
}
ExpectedPaging paging = ExpectedPaging.parsePagination(jsonList);
ExpectedPaging paging = ExpectedPaging.parsePagination(jsonList);
ListResponse<Site> resp = new ListResponse<Site>(paging, sites);
return resp;
}
ListResponse<Site> resp = new ListResponse<Site>(paging, sites);
return resp;
}
@Override
public SiteRole getRole()
{
return role;
}
@Override
public SiteRole getRole()
{
return role;
}
public void setRole(SiteRole role)
{
this.role = role;
}
public void setRole(SiteRole role)
{
this.role = role;
}
@Override
public String toString()
{
return "Site [created=" + created + ", networkId=" + networkId
+ ", siteId=" + siteId + ", guid=" + guid + ", title=" + title
+ ", description=" + description + ", role=" + role
+ ", visibility=" + visibility + ", type=" + type + "]";
}
@Override
public String toString()
{
return "Site [created=" + created + ", networkId=" + networkId
+ ", siteId=" + siteId + ", guid=" + guid + ", title=" + title
+ ", description=" + description + ", role=" + role
+ ", visibility=" + visibility + ", type=" + type + "]";
}
@SuppressWarnings("unchecked")
public JSONObject toJSON()
{
JSONObject siteJson = new JSONObject();
if (getSiteId() != null)
@SuppressWarnings("unchecked")
public JSONObject toJSON()
{
JSONObject siteJson = new JSONObject();
if (getSiteId() != null)
{
siteJson.put("id", getSiteId());
}
if (getGuid() != null)
if (getGuid() != null)
{
siteJson.put("guid", getGuid());
}
@@ -399,48 +399,48 @@ public class SiteImpl implements Serializable, Site, Comparable<SiteImpl>, Expec
{
siteJson.put("preset", getPreset());
}
return siteJson;
}
return siteJson;
}
@Override
public int compareTo(SiteImpl site)
{
return siteId.compareTo(site.getSiteId());
}
@Override
public int compareTo(SiteImpl site)
{
return siteId.compareTo(site.getSiteId());
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result
+ ((networkId == null) ? 0 : networkId.hashCode());
result = prime * result + ((siteId == null) ? 0 : siteId.hashCode());
return result;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result
+ ((networkId == null) ? 0 : networkId.hashCode());
result = prime * result + ((siteId == null) ? 0 : siteId.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SiteImpl other = (SiteImpl) obj;
if (networkId == null)
{
if (other.networkId != null)
return false;
} else if (!networkId.equals(other.networkId))
return false;
if (siteId == null)
{
if (other.siteId != null)
return false;
} else if (!siteId.equals(other.siteId))
return false;
return true;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SiteImpl other = (SiteImpl) obj;
if (networkId == null)
{
if (other.networkId != null)
return false;
} else if (!networkId.equals(other.networkId))
return false;
if (siteId == null)
{
if (other.siteId != null)
return false;
} else if (!siteId.equals(other.siteId))
return false;
return true;
}
}