mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged HEAD-QA to HEAD (4.2) (including moving test classes into separate folders)
51903 to 54309 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@54310 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
158
source/java/org/alfresco/rest/api/model/Activity.java
Normal file
158
source/java/org/alfresco/rest/api/model/Activity.java
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
|
||||
/**
|
||||
* Represents an activity feed entry.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Activity implements Comparable<Activity>
|
||||
{
|
||||
private Long id;
|
||||
private String networkId;
|
||||
private String siteId;
|
||||
private String feedPersonId;
|
||||
private String postPersonId;
|
||||
private Date postedAt;
|
||||
private String activityType;
|
||||
private Map<String, Object> activitySummary;
|
||||
|
||||
public Activity()
|
||||
{
|
||||
}
|
||||
|
||||
public Activity(Long id, String networkId, String siteId, String feedPersonId,
|
||||
String postPersonId, Date postedAt, String activityType, Map<String, Object> activitySummary)
|
||||
{
|
||||
super();
|
||||
this.id = id;
|
||||
this.networkId = networkId;
|
||||
this.siteId = siteId;
|
||||
this.feedPersonId = feedPersonId;
|
||||
this.postPersonId = postPersonId;
|
||||
this.postedAt = postedAt;
|
||||
this.activityType = activityType;
|
||||
this.activitySummary = activitySummary;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getNetworkId()
|
||||
{
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public String getSiteId()
|
||||
{
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public String getFeedPersonId()
|
||||
{
|
||||
return feedPersonId;
|
||||
}
|
||||
|
||||
public String getPostPersonId()
|
||||
{
|
||||
return postPersonId;
|
||||
}
|
||||
|
||||
public String getActivityType()
|
||||
{
|
||||
return activityType;
|
||||
}
|
||||
|
||||
public Date getPostedAt()
|
||||
{
|
||||
return postedAt;
|
||||
}
|
||||
|
||||
public Map<String, Object> getActivitySummary()
|
||||
{
|
||||
return activitySummary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.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;
|
||||
}
|
||||
|
||||
Activity other = (Activity) obj;
|
||||
return(id.equals(other.id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Activity activity)
|
||||
{
|
||||
long otherId = activity.getId();
|
||||
long diff = id - otherId;
|
||||
if(diff == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return diff < 0 ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Activity [id=" + id + ", siteId=" + siteId
|
||||
+ ", feedPersonId=" + feedPersonId + ", postPersonId=" + postPersonId
|
||||
+ ", postedAt=" + postedAt
|
||||
+ ", activityType=" + activityType + ", activitySummary="
|
||||
+ activitySummary + "]";
|
||||
}
|
||||
|
||||
}
|
168
source/java/org/alfresco/rest/api/model/Comment.java
Normal file
168
source/java/org/alfresco/rest/api/model/Comment.java
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.rest.api.people.PeopleEntityResource;
|
||||
import org.alfresco.rest.framework.resource.EmbeddedEntityResource;
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* A representation of a Comment in the system.
|
||||
*
|
||||
* @author Gethin James
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Comment
|
||||
{
|
||||
public static final QName PROP_COMMENT_CONTENT = QName.createQName("RestApi", "commentContent");
|
||||
|
||||
private String id;
|
||||
private String title;
|
||||
private String content;
|
||||
private Date createdAt;
|
||||
private String createdBy;
|
||||
private Date modifiedAt;
|
||||
private String modifiedBy;
|
||||
private Boolean edited;
|
||||
|
||||
// permissions
|
||||
private boolean canEdit;
|
||||
private boolean canDelete;
|
||||
|
||||
public Comment()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public Comment(String id, Map<QName, Serializable> nodeProps, boolean canEdit, boolean canDelete)
|
||||
{
|
||||
if(id == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.id = id;
|
||||
mapProperties(nodeProps);
|
||||
this.canEdit = canEdit;
|
||||
this.canDelete = canDelete;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean getCanEdit()
|
||||
{
|
||||
return canEdit;
|
||||
}
|
||||
|
||||
public boolean getCanDelete()
|
||||
{
|
||||
return canDelete;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
@EmbeddedEntityResource(propertyName = "createdBy", entityResource = PeopleEntityResource.class)
|
||||
public String getCreatedBy()
|
||||
{
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
@EmbeddedEntityResource(propertyName = "modifiedBy", entityResource = PeopleEntityResource.class)
|
||||
public String getModifiedBy()
|
||||
{
|
||||
return modifiedBy;
|
||||
}
|
||||
|
||||
public Date getModifiedAt()
|
||||
{
|
||||
return modifiedAt;
|
||||
}
|
||||
|
||||
public Boolean getEdited()
|
||||
{
|
||||
return edited;
|
||||
}
|
||||
|
||||
protected void mapProperties(Map<QName, Serializable> nodeProps)
|
||||
{
|
||||
String propTitle = (String) nodeProps.get(ContentModel.PROP_TITLE);
|
||||
if (propTitle != null)
|
||||
{
|
||||
title = propTitle;
|
||||
}
|
||||
|
||||
this.modifiedAt = (Date)nodeProps.get(ContentModel.PROP_MODIFIED);
|
||||
this.createdAt = (Date)nodeProps.get(ContentModel.PROP_CREATED);
|
||||
if(modifiedAt != null && createdAt != null)
|
||||
{
|
||||
long diff = modifiedAt.getTime() - createdAt.getTime();
|
||||
this.edited = Boolean.valueOf(diff >= 100); // logic is consistent with existing (Javascript) comments implementation
|
||||
}
|
||||
|
||||
this.createdBy = (String)nodeProps.get(ContentModel.PROP_CREATOR);
|
||||
this.modifiedBy = (String)nodeProps.get(ContentModel.PROP_MODIFIER);
|
||||
|
||||
this.content = (String)nodeProps.get(PROP_COMMENT_CONTENT);
|
||||
nodeProps.remove(PROP_COMMENT_CONTENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Comment [id=" + id + ", title=" + title
|
||||
+ ", content=" + content + ", createdAt=" + createdAt
|
||||
+ ", createdBy=" + createdBy + ", modifiedAt=" + modifiedAt
|
||||
+ ", modifiedBy=" + modifiedBy + ", edited=" + edited + "]";
|
||||
}
|
||||
|
||||
}
|
101
source/java/org/alfresco/rest/api/model/Company.java
Normal file
101
source/java/org/alfresco/rest/api/model/Company.java
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
/**
|
||||
* Represents a company
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Company
|
||||
{
|
||||
private String organization;
|
||||
private String address1;
|
||||
private String address2;
|
||||
private String address3;
|
||||
private String postcode;
|
||||
private String telephone;
|
||||
private String fax;
|
||||
private String email;
|
||||
|
||||
public Company(String organization, String address1, String address2, String address3,
|
||||
String postcode, String telephone, String fax, String email)
|
||||
{
|
||||
super();
|
||||
this.organization = organization;
|
||||
this.address1 = address1;
|
||||
this.address2 = address2;
|
||||
this.address3 = address3;
|
||||
this.postcode = postcode;
|
||||
this.telephone = telephone;
|
||||
this.fax = fax;
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getOrganization()
|
||||
{
|
||||
return organization;
|
||||
}
|
||||
|
||||
public String getAddress1()
|
||||
{
|
||||
return address1;
|
||||
}
|
||||
|
||||
public String getAddress2()
|
||||
{
|
||||
return address2;
|
||||
}
|
||||
|
||||
public String getAddress3()
|
||||
{
|
||||
return address3;
|
||||
}
|
||||
|
||||
public String getPostcode()
|
||||
{
|
||||
return postcode;
|
||||
}
|
||||
|
||||
public String getTelephone()
|
||||
{
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public String getFax()
|
||||
{
|
||||
return fax;
|
||||
}
|
||||
|
||||
public String getEmail()
|
||||
{
|
||||
return email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Company [address1=" + address1 + ", address2=" + address2
|
||||
+ ", address3=" + address3 + ", postcode=" + postcode
|
||||
+ ", telephone=" + telephone + ", fax=" + fax + ", email="
|
||||
+ email + "]";
|
||||
}
|
||||
|
||||
}
|
70
source/java/org/alfresco/rest/api/model/Document.java
Normal file
70
source/java/org/alfresco/rest/api/model/Document.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.data.Properties;
|
||||
import org.apache.chemistry.opencmis.commons.data.PropertyData;
|
||||
|
||||
/**
|
||||
* Representation of a document node.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Document extends Node
|
||||
{
|
||||
private String mimeType;
|
||||
private BigInteger sizeInBytes;
|
||||
private String versionLabel;
|
||||
|
||||
public Document()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public Document(NodeRef nodeRef, Properties properties)
|
||||
{
|
||||
super(nodeRef, properties);
|
||||
|
||||
Map<String, PropertyData<?>> props = properties.getProperties();
|
||||
this.mimeType = (String)getValue(props, PropertyIds.CONTENT_STREAM_MIME_TYPE);
|
||||
this.sizeInBytes = (BigInteger)getValue(props, PropertyIds.CONTENT_STREAM_LENGTH);
|
||||
this.versionLabel = (String)getValue(props, PropertyIds.VERSION_LABEL);
|
||||
}
|
||||
|
||||
public Document(NodeRef nodeRef, Map<QName, Serializable> nodeProps)
|
||||
{
|
||||
super(nodeRef, nodeProps);
|
||||
}
|
||||
|
||||
public String getMimeType()
|
||||
{
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
public BigInteger getSizeInBytes()
|
||||
{
|
||||
return sizeInBytes;
|
||||
}
|
||||
|
||||
public String getVersionLabel()
|
||||
{
|
||||
return versionLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Document [mimeType=" + mimeType + ", sizeInBytes="
|
||||
+ sizeInBytes + ", versionLabel=" + versionLabel + ", nodeRef="
|
||||
+ nodeRef + ", name=" + name + ", title=" + title
|
||||
+ ", description=" + description + ", createdAt=" + createdAt
|
||||
+ ", modifiedAt=" + modifiedAt + ", createdBy=" + createdBy
|
||||
+ ", modifiedBy=" + modifiedBy + "]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
public interface DocumentRatingSummary
|
||||
{
|
||||
}
|
40
source/java/org/alfresco/rest/api/model/DocumentTarget.java
Normal file
40
source/java/org/alfresco/rest/api/model/DocumentTarget.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
/**
|
||||
* A document target favourite.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class DocumentTarget extends Target
|
||||
{
|
||||
private Document file;
|
||||
|
||||
public DocumentTarget()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public DocumentTarget(Document file)
|
||||
{
|
||||
super();
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public void setDocument(Document file)
|
||||
{
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public Document getFile()
|
||||
{
|
||||
return file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "DocumentTarget [file=" + file + "]";
|
||||
}
|
||||
|
||||
}
|
56
source/java/org/alfresco/rest/api/model/Favourite.java
Normal file
56
source/java/org/alfresco/rest/api/model/Favourite.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
|
||||
/**
|
||||
* Representation of a favourite (document, folder, site, ...).
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Favourite
|
||||
{
|
||||
private String targetGuid;
|
||||
private Date createdAt;
|
||||
private Target target;
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt)
|
||||
{
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
@UniqueId(name="targetGuid")
|
||||
public String getTargetGuid()
|
||||
{
|
||||
return targetGuid;
|
||||
}
|
||||
|
||||
public void setTargetGuid(String targetGuid)
|
||||
{
|
||||
this.targetGuid = targetGuid;
|
||||
}
|
||||
|
||||
public Target getTarget()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(Target target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Favourite [targetGuid=" + targetGuid
|
||||
+ ", createdAt=" + createdAt + ", target=" + target + "]";
|
||||
}
|
||||
}
|
50
source/java/org/alfresco/rest/api/model/FavouriteSite.java
Normal file
50
source/java/org/alfresco/rest/api/model/FavouriteSite.java
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteRole;
|
||||
|
||||
/**
|
||||
* Represents a user's favourite site.
|
||||
*
|
||||
* Represented by a separate class in order to allow other attributes to be added.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class FavouriteSite extends SiteImpl
|
||||
{
|
||||
public FavouriteSite()
|
||||
{
|
||||
}
|
||||
|
||||
public FavouriteSite(SiteInfo siteInfo, SiteRole role)
|
||||
{
|
||||
super(siteInfo, role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "FavouriteSite [id=" + id + ", guid=" + guid + ", title="
|
||||
+ title + ", description=" + description + ", visibility="
|
||||
+ visibility + ", role=" + role + "]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
public class FiveStarRatingSummary implements DocumentRatingSummary
|
||||
{
|
||||
private Integer numberOfRatings;
|
||||
private Float average;
|
||||
|
||||
public FiveStarRatingSummary(Integer numberOfRatings, Float ratingTotal, Float average)
|
||||
{
|
||||
super();
|
||||
this.numberOfRatings = numberOfRatings;
|
||||
this.average = (average == -1 ? null : average);
|
||||
}
|
||||
|
||||
public Integer getNumberOfRatings()
|
||||
{
|
||||
return numberOfRatings;
|
||||
}
|
||||
|
||||
public Float getAverage()
|
||||
{
|
||||
return average;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "FiveStarRatingSummary [numberOfRatings=" + numberOfRatings
|
||||
+ ", average=" + average + "]";
|
||||
}
|
||||
|
||||
}
|
41
source/java/org/alfresco/rest/api/model/Folder.java
Normal file
41
source/java/org/alfresco/rest/api/model/Folder.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.chemistry.opencmis.commons.data.Properties;
|
||||
|
||||
/**
|
||||
* Representation of a folder node.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Folder extends Node
|
||||
{
|
||||
public Folder()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public Folder(NodeRef nodeRef, Properties properties)
|
||||
{
|
||||
super(nodeRef, properties);
|
||||
}
|
||||
|
||||
public Folder(NodeRef nodeRef, Map<QName, Serializable> nodeProps)
|
||||
{
|
||||
super(nodeRef, nodeProps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Folder [nodeRef=" + nodeRef + ", name=" + name + ", title="
|
||||
+ title + ", description=" + description + ", createdAt="
|
||||
+ createdAt + ", modifiedAt=" + modifiedAt + ", createdBy="
|
||||
+ createdBy + ", modifiedBy=" + modifiedBy + "]";
|
||||
}
|
||||
}
|
39
source/java/org/alfresco/rest/api/model/FolderTarget.java
Normal file
39
source/java/org/alfresco/rest/api/model/FolderTarget.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
/**
|
||||
* A folder target favourite.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class FolderTarget extends Target
|
||||
{
|
||||
private Folder folder;
|
||||
|
||||
public FolderTarget()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public FolderTarget(Folder folder)
|
||||
{
|
||||
super();
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
public void setFolder(Folder folder)
|
||||
{
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
public Folder getFolder()
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "FolderTarget [folder=" + folder + "]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
public class LikesRatingSummary implements DocumentRatingSummary
|
||||
{
|
||||
private Integer numberOfRatings;
|
||||
|
||||
public LikesRatingSummary(Integer numberOfRatings)
|
||||
{
|
||||
super();
|
||||
this.numberOfRatings = numberOfRatings;
|
||||
}
|
||||
|
||||
public Integer getNumberOfRatings()
|
||||
{
|
||||
return numberOfRatings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "LikesRatingSummary [numberOfRatings=" + numberOfRatings + "]";
|
||||
}
|
||||
|
||||
}
|
165
source/java/org/alfresco/rest/api/model/MemberOfSite.java
Normal file
165
source/java/org/alfresco/rest/api/model/MemberOfSite.java
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.rest.api.sites.SiteEntityResource;
|
||||
import org.alfresco.rest.framework.resource.EmbeddedEntityResource;
|
||||
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.SiteRole;
|
||||
|
||||
/**
|
||||
* Represents membership of a site.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class MemberOfSite implements Comparable<MemberOfSite>
|
||||
{
|
||||
private SiteRole role;
|
||||
private String siteShortName;
|
||||
private NodeRef guid;
|
||||
|
||||
public MemberOfSite()
|
||||
{
|
||||
}
|
||||
|
||||
public MemberOfSite(String siteShortName, NodeRef siteGuid, SiteRole role)
|
||||
{
|
||||
super();
|
||||
if(siteShortName == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if(role == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if(siteGuid == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.role = role;
|
||||
this.siteShortName = siteShortName;
|
||||
this.guid = siteGuid;
|
||||
}
|
||||
|
||||
public static MemberOfSite getMemberOfSite(SiteInfo siteInfo, SiteRole siteRole)
|
||||
{
|
||||
MemberOfSite memberOfSite = new MemberOfSite(siteInfo.getShortName(), siteInfo.getNodeRef(), siteRole);
|
||||
return memberOfSite;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
@EmbeddedEntityResource(propertyName = "site", entityResource = SiteEntityResource.class)
|
||||
public String getSiteShortName()
|
||||
{
|
||||
return siteShortName;
|
||||
}
|
||||
|
||||
public NodeRef getGuid()
|
||||
{
|
||||
return guid;
|
||||
}
|
||||
|
||||
public void setGuid(NodeRef guid)
|
||||
{
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public SiteRole getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(SiteRole role)
|
||||
{
|
||||
if(role == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public void setSiteShortName(String siteShortName)
|
||||
{
|
||||
if(siteShortName == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.siteShortName = siteShortName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((role == null) ? 0 : role.hashCode());
|
||||
result = prime * result
|
||||
+ ((siteShortName == null) ? 0 : siteShortName.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;
|
||||
}
|
||||
|
||||
MemberOfSite other = (MemberOfSite) obj;
|
||||
if (role != other.role)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return siteShortName.equals(other.siteShortName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(MemberOfSite o)
|
||||
{
|
||||
int i = siteShortName.compareTo(o.getSiteShortName());
|
||||
if(i == 0)
|
||||
{
|
||||
i = role.compareTo(o.getRole());
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "MemberOfSite [role=" + role + ", siteShortName="
|
||||
+ siteShortName + ", siteGuid=" + guid + "]";
|
||||
}
|
||||
}
|
56
source/java/org/alfresco/rest/api/model/Network.java
Normal file
56
source/java/org/alfresco/rest/api/model/Network.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a cloud network (account).
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public interface Network
|
||||
{
|
||||
public String getId();
|
||||
|
||||
/**
|
||||
* Gets the date the account was created
|
||||
*
|
||||
* @return The account creation date
|
||||
*/
|
||||
public Date getCreatedAt();
|
||||
public List<Quota> getQuotas();
|
||||
|
||||
/**
|
||||
* Gets whether an account is enabled or not.
|
||||
*
|
||||
* @return true = account is enabled, false = account is disabled
|
||||
*/
|
||||
public Boolean getIsEnabled();
|
||||
|
||||
/**
|
||||
* Gets the subscription level.
|
||||
* @return one of the values of {@link AccountType.SubscriptionLevel}.
|
||||
*/
|
||||
public String getSubscriptionLevel();
|
||||
|
||||
public Boolean getPaidNetwork();
|
||||
}
|
139
source/java/org/alfresco/rest/api/model/NetworkImpl.java
Normal file
139
source/java/org/alfresco/rest/api/model/NetworkImpl.java
Normal file
@@ -0,0 +1,139 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
|
||||
/**
|
||||
* Represents a cloud network (account).
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class NetworkImpl implements Comparable<NetworkImpl>, Network
|
||||
{
|
||||
private String id;
|
||||
private Date createdAt;
|
||||
private List<Quota> quotas = new LinkedList<Quota>();
|
||||
private Boolean isEnabled;
|
||||
private String subscriptionLevel;
|
||||
private Boolean paidNetwork;
|
||||
|
||||
public NetworkImpl(org.alfresco.repo.tenant.Network network)
|
||||
{
|
||||
this.id = network.getTenantDomain();
|
||||
this.createdAt = network.getCreatedAt();
|
||||
this.isEnabled = network.isEnabled();
|
||||
this.paidNetwork = network.getPaidNetwork();
|
||||
this.subscriptionLevel = network.getSubscriptionLevel();
|
||||
}
|
||||
|
||||
public NetworkImpl(String id, Date createdAt, Boolean isEnabled, String subscriptionLevel, Boolean paidNetwork)
|
||||
{
|
||||
this.id = id;
|
||||
this.createdAt = createdAt;
|
||||
this.isEnabled = isEnabled;
|
||||
this.subscriptionLevel = subscriptionLevel;
|
||||
this.paidNetwork = paidNetwork;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the account name
|
||||
*
|
||||
* @return The name of the account
|
||||
*/
|
||||
@UniqueId
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the date the account was created
|
||||
*
|
||||
* @return The account creation date
|
||||
*/
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public List<Quota> getQuotas()
|
||||
{
|
||||
return quotas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether an account is enabled or not.
|
||||
*
|
||||
* @return true = account is enabled, false = account is disabled
|
||||
*/
|
||||
public Boolean getIsEnabled()
|
||||
{
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the subscription level.
|
||||
*
|
||||
* @return ths subscription level
|
||||
*/
|
||||
public String getSubscriptionLevel()
|
||||
{
|
||||
return subscriptionLevel;
|
||||
}
|
||||
|
||||
public Boolean getPaidNetwork()
|
||||
{
|
||||
return paidNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(NetworkImpl network)
|
||||
{
|
||||
return id.compareTo(network.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.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;
|
||||
}
|
||||
|
||||
Network other = (Network) obj;
|
||||
return(id.equals(other.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Network [id=" + id
|
||||
+ ", createdAt=" + createdAt + ", quotas=" + quotas
|
||||
+ ", isEnabled=" + isEnabled + ", subscriptionLevel="
|
||||
+ subscriptionLevel + "]";
|
||||
}
|
||||
|
||||
}
|
208
source/java/org/alfresco/rest/api/model/Node.java
Normal file
208
source/java/org/alfresco/rest/api/model/Node.java
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.data.Properties;
|
||||
import org.apache.chemistry.opencmis.commons.data.PropertyData;
|
||||
|
||||
/**
|
||||
* Concrete class carrying general information for <b>alf_node</b> data
|
||||
*
|
||||
* @author steveglover
|
||||
* @author Gethin James
|
||||
*/
|
||||
public class Node implements Comparable<Node>
|
||||
{
|
||||
protected NodeRef nodeRef;
|
||||
protected String name;
|
||||
protected String title;
|
||||
protected NodeRef guid;
|
||||
protected String description;
|
||||
protected Date createdAt;
|
||||
protected Date modifiedAt;
|
||||
protected String createdBy;
|
||||
protected String modifiedBy;
|
||||
|
||||
public Node(NodeRef nodeRef, Map<QName, Serializable> nodeProps)
|
||||
{
|
||||
if(nodeRef == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.nodeRef = nodeRef;
|
||||
mapProperties(nodeProps);
|
||||
}
|
||||
|
||||
protected Object getValue(Map<String, PropertyData<?>> props, String name)
|
||||
{
|
||||
PropertyData<?> prop = props.get(name);
|
||||
Object value = (prop != null ? prop.getFirstValue() : null);
|
||||
return value;
|
||||
}
|
||||
|
||||
public Node(NodeRef nodeRef, Properties properties)
|
||||
{
|
||||
this.nodeRef = nodeRef;
|
||||
|
||||
Map<String, PropertyData<?>> props = properties.getProperties();
|
||||
this.name = (String)getValue(props, PropertyIds.NAME);
|
||||
this.title = (String)getValue(props, ContentModel.PROP_TITLE.toString());
|
||||
this.guid = nodeRef;
|
||||
GregorianCalendar cal = (GregorianCalendar)getValue(props, PropertyIds.CREATION_DATE);
|
||||
this.createdAt = cal.getTime();
|
||||
cal = (GregorianCalendar)getValue(props, PropertyIds.LAST_MODIFICATION_DATE);
|
||||
this.modifiedAt = cal.getTime();
|
||||
this.createdBy = (String)getValue(props, PropertyIds.CREATED_BY);
|
||||
this.modifiedBy = (String)getValue(props, PropertyIds.LAST_MODIFIED_BY);
|
||||
}
|
||||
|
||||
public Node()
|
||||
{
|
||||
}
|
||||
|
||||
protected void mapProperties(Map<QName, Serializable> nodeProps)
|
||||
{
|
||||
this.name = (String)nodeProps.get(ContentModel.PROP_NAME);
|
||||
this.guid = nodeRef;
|
||||
this.title = (String)nodeProps.get(ContentModel.PROP_TITLE);
|
||||
this.createdAt = (Date)nodeProps.get(ContentModel.PROP_CREATED);
|
||||
this.createdBy = (String)nodeProps.get(ContentModel.PROP_CREATOR);
|
||||
this.modifiedAt = (Date)nodeProps.get(ContentModel.PROP_MODIFIED);
|
||||
this.modifiedBy = (String)nodeProps.get(ContentModel.PROP_MODIFIER);
|
||||
this.description = (String)nodeProps.get(ContentModel.PROP_DESCRIPTION);
|
||||
}
|
||||
|
||||
public void setGuid(NodeRef guid)
|
||||
{
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public NodeRef getGuid()
|
||||
{
|
||||
return guid;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
public void setNodeRef(NodeRef nodeRef)
|
||||
{
|
||||
// if(nodeRef == null)
|
||||
// {
|
||||
// throw new IllegalArgumentException();
|
||||
// }
|
||||
this.nodeRef = nodeRef;
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return this.createdAt;
|
||||
}
|
||||
|
||||
public void setCreated(Date createdAt)
|
||||
{
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Date getModifiedAt()
|
||||
{
|
||||
return modifiedAt;
|
||||
}
|
||||
|
||||
public String getModifiedBy()
|
||||
{
|
||||
return modifiedBy;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCreatedBy()
|
||||
{
|
||||
return this.createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy)
|
||||
{
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public boolean equals(Object other)
|
||||
{
|
||||
if(this == other)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!(other instanceof Node))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Node node = (Node)other;
|
||||
return EqualsHelper.nullSafeEquals(getNodeRef(), node.getNodeRef());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Node node)
|
||||
{
|
||||
return getNodeRef().toString().compareTo(node.getNodeRef().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Node [nodeRef=" + nodeRef + ", name=" + name + ", title="
|
||||
+ title + ", description=" + description + ", createdAt="
|
||||
+ createdAt + ", modifiedAt=" + modifiedAt + ", createdBy=" + createdBy + ", modifiedBy="
|
||||
+ modifiedBy + "]";
|
||||
}
|
||||
}
|
138
source/java/org/alfresco/rest/api/model/NodeRating.java
Normal file
138
source/java/org/alfresco/rest/api/model/NodeRating.java
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
|
||||
/**
|
||||
* Represents a node rating.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class NodeRating implements Comparable<NodeRating>
|
||||
{
|
||||
private String ratingSchemeId;
|
||||
private Object myRating;
|
||||
private Date ratedAt;
|
||||
private DocumentRatingSummary documentRatingSummary;
|
||||
|
||||
public NodeRating()
|
||||
{
|
||||
}
|
||||
|
||||
public NodeRating(String ratingSchemeId, Object myRating, Date ratedAt, DocumentRatingSummary documentRatingSummary)
|
||||
{
|
||||
if(ratingSchemeId == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.ratingSchemeId = ratingSchemeId;
|
||||
this.documentRatingSummary = documentRatingSummary;
|
||||
this.myRating = myRating;
|
||||
this.ratedAt = ratedAt;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public String getScheme()
|
||||
{
|
||||
return ratingSchemeId;
|
||||
}
|
||||
|
||||
public void setScheme(String ratingSchemeId)
|
||||
{
|
||||
if(ratingSchemeId == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.ratingSchemeId = ratingSchemeId;
|
||||
}
|
||||
|
||||
public Date getRatedAt()
|
||||
{
|
||||
return ratedAt;
|
||||
}
|
||||
|
||||
public Object getMyRating()
|
||||
{
|
||||
return myRating;
|
||||
}
|
||||
|
||||
public void setMyRating(Object myRating)
|
||||
{
|
||||
this.myRating = myRating;
|
||||
}
|
||||
|
||||
public DocumentRatingSummary getAggregate()
|
||||
{
|
||||
return documentRatingSummary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((ratingSchemeId == null) ? 0 : ratingSchemeId.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;
|
||||
NodeRating other = (NodeRating) obj;
|
||||
if (ratingSchemeId == null) {
|
||||
if (other.getScheme() != null)
|
||||
return false;
|
||||
} else if (!ratingSchemeId.equals(other.getScheme()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(NodeRating other)
|
||||
{
|
||||
if(other != null)
|
||||
{
|
||||
int ret = (ratingSchemeId.compareTo(other.getScheme()));
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "NodeRating [scheme=" + ratingSchemeId + ", myRating=" + myRating
|
||||
+ ", ratedAt=" + ratedAt
|
||||
+ ", documentRatingSummary=" + documentRatingSummary + "]";
|
||||
}
|
||||
}
|
240
source/java/org/alfresco/rest/api/model/Person.java
Normal file
240
source/java/org/alfresco/rest/api/model/Person.java
Normal file
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Represents a user of the system.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Person
|
||||
{
|
||||
public static final QName PROP_PERSON_DESCRIPTION = QName.createQName("RestApi", "description");
|
||||
|
||||
protected String userName;
|
||||
protected Boolean enabled;
|
||||
protected NodeRef avatarId;
|
||||
protected String firstName;
|
||||
protected String lastName;
|
||||
protected String jobTitle;
|
||||
protected String location;
|
||||
protected String telephone;
|
||||
protected String mobile;
|
||||
protected String email;
|
||||
protected String skypeId;
|
||||
protected String instantMessageId;
|
||||
protected String userStatus;
|
||||
protected Date statusUpdatedAt;
|
||||
protected String googleId;
|
||||
protected Long quota;
|
||||
protected Long quotaUsed;
|
||||
protected Boolean emailNotificationsEnabled;
|
||||
protected String description;
|
||||
protected Company company;
|
||||
|
||||
public Person()
|
||||
{
|
||||
}
|
||||
|
||||
public Person(NodeRef nodeRef, Map<QName, Serializable> nodeProps, boolean enabled)
|
||||
{
|
||||
mapProperties(nodeProps);
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
protected void mapProperties(Map<QName, Serializable> nodeProps)
|
||||
{
|
||||
nodeProps.remove(ContentModel.PROP_CONTENT);
|
||||
|
||||
this.userName = (String) nodeProps.get(ContentModel.PROP_USERNAME);
|
||||
this.firstName = (String) nodeProps.get(ContentModel.PROP_FIRSTNAME);
|
||||
this.lastName = (String) nodeProps.get(ContentModel.PROP_LASTNAME);
|
||||
this.jobTitle = (String) nodeProps.get(ContentModel.PROP_JOBTITLE);
|
||||
|
||||
this.location = (String) nodeProps.get(ContentModel.PROP_LOCATION);
|
||||
this.telephone = (String) nodeProps.get(ContentModel.PROP_TELEPHONE);
|
||||
this.mobile = (String) nodeProps.get(ContentModel.PROP_MOBILE);
|
||||
this.email = (String) nodeProps.get(ContentModel.PROP_EMAIL);
|
||||
|
||||
String organization = (String) nodeProps.get(ContentModel.PROP_ORGANIZATION);
|
||||
String companyAddress1 = (String) nodeProps.get(ContentModel.PROP_COMPANYADDRESS1);
|
||||
String companyAddress2 = (String) nodeProps.get(ContentModel.PROP_COMPANYADDRESS2);
|
||||
String companyAddress3 = (String) nodeProps.get(ContentModel.PROP_COMPANYADDRESS3);
|
||||
String companyPostcode = (String) nodeProps.get(ContentModel.PROP_COMPANYPOSTCODE);
|
||||
String companyTelephone = (String) nodeProps.get(ContentModel.PROP_COMPANYTELEPHONE);
|
||||
String companyFax = (String) nodeProps.get(ContentModel.PROP_COMPANYFAX);
|
||||
String companyEmail = (String) nodeProps.get(ContentModel.PROP_COMPANYEMAIL);
|
||||
this.company = new Company(organization, companyAddress1, companyAddress2, companyAddress3, companyPostcode, companyTelephone, companyFax, companyEmail);
|
||||
|
||||
this.skypeId = (String) nodeProps.get(ContentModel.PROP_SKYPE);
|
||||
this.instantMessageId = (String) nodeProps.get(ContentModel.PROP_INSTANTMSG);
|
||||
this.userStatus = (String) nodeProps.get(ContentModel.PROP_USER_STATUS);
|
||||
this.statusUpdatedAt = (Date) nodeProps.get(ContentModel.PROP_USER_STATUS_TIME);
|
||||
this.googleId = (String) nodeProps.get(ContentModel.PROP_GOOGLEUSERNAME);
|
||||
this.quota = (Long) nodeProps.get(ContentModel.PROP_SIZE_QUOTA);
|
||||
this.quotaUsed = (Long) nodeProps.get(ContentModel.PROP_SIZE_CURRENT);
|
||||
Boolean bool = (Boolean)nodeProps.get(ContentModel.PROP_EMAIL_FEED_DISABLED);
|
||||
this.emailNotificationsEnabled = (bool == null ? Boolean.TRUE : !bool.booleanValue());
|
||||
this.description = (String)nodeProps.get(PROP_PERSON_DESCRIPTION);
|
||||
}
|
||||
|
||||
public Company getCompany()
|
||||
{
|
||||
return company;
|
||||
}
|
||||
|
||||
public String getInstantMessageId()
|
||||
{
|
||||
return instantMessageId;
|
||||
}
|
||||
|
||||
public String getGoogleId()
|
||||
{
|
||||
return googleId;
|
||||
}
|
||||
|
||||
public Long getQuota()
|
||||
{
|
||||
return quota;
|
||||
}
|
||||
|
||||
public Long getQuotaUsed()
|
||||
{
|
||||
return quotaUsed;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public Boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setAvatarId(NodeRef avatarId)
|
||||
{
|
||||
this.avatarId = avatarId;
|
||||
}
|
||||
|
||||
public NodeRef getAvatarId()
|
||||
{
|
||||
return avatarId;
|
||||
}
|
||||
|
||||
public String getFirstName()
|
||||
{
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName)
|
||||
{
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName)
|
||||
{
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getLastName()
|
||||
{
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public String getJobTitle()
|
||||
{
|
||||
return jobTitle;
|
||||
}
|
||||
|
||||
public String getLocation()
|
||||
{
|
||||
return location;
|
||||
}
|
||||
|
||||
public String getTelephone()
|
||||
{
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public String getMobile()
|
||||
{
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public String getEmail()
|
||||
{
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getSkypeId()
|
||||
{
|
||||
return skypeId;
|
||||
}
|
||||
|
||||
public String getUserStatus()
|
||||
{
|
||||
return userStatus;
|
||||
}
|
||||
|
||||
public Date getStatusUpdatedAt()
|
||||
{
|
||||
return statusUpdatedAt;
|
||||
}
|
||||
|
||||
public Boolean isEmailNotificationsEnabled()
|
||||
{
|
||||
return emailNotificationsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Person [userName=" + userName + ", enabled=" + enabled
|
||||
+ ", avatarId=" + avatarId + ", firstName=" + firstName
|
||||
+ ", lastName=" + lastName + ", jobTitle=" + jobTitle
|
||||
+ ", location=" + location
|
||||
+ ", telephone=" + telephone + ", mobile=" + mobile
|
||||
+ ", email=" + email + ", skypeId=" + skypeId
|
||||
+ ", instantMessageId=" + instantMessageId + ", userStatus="
|
||||
+ userStatus + ", statusUpdatedAt=" + statusUpdatedAt
|
||||
+ ", googleId=" + googleId + ", quota=" + quota
|
||||
+ ", quotaUsed=" + quotaUsed + ", emailNotificationsEnabled="
|
||||
+ emailNotificationsEnabled + ", description=" + description
|
||||
+ ", company=" + company + "]";
|
||||
}
|
||||
|
||||
}
|
125
source/java/org/alfresco/rest/api/model/PersonNetwork.java
Normal file
125
source/java/org/alfresco/rest/api/model/PersonNetwork.java
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
|
||||
/**
|
||||
* Represents network membership.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class PersonNetwork implements Network, Comparable<PersonNetwork>
|
||||
{
|
||||
private Boolean homeNetwork;
|
||||
private Network network;
|
||||
|
||||
public PersonNetwork()
|
||||
{
|
||||
}
|
||||
|
||||
public PersonNetwork(Boolean homeNetwork, Network network)
|
||||
{
|
||||
super();
|
||||
this.homeNetwork = homeNetwork;
|
||||
this.network = network;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public String getId()
|
||||
{
|
||||
return network.getId();
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return network.getCreatedAt();
|
||||
}
|
||||
|
||||
public List<Quota> getQuotas()
|
||||
{
|
||||
return network.getQuotas();
|
||||
}
|
||||
|
||||
public Boolean getIsEnabled()
|
||||
{
|
||||
return network.getIsEnabled();
|
||||
}
|
||||
|
||||
public String getSubscriptionLevel()
|
||||
{
|
||||
return network.getSubscriptionLevel();
|
||||
}
|
||||
|
||||
public Boolean getPaidNetwork()
|
||||
{
|
||||
return network.getPaidNetwork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PersonNetwork member)
|
||||
{
|
||||
int ret = getId().compareTo(member.getId());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Boolean getHomeNetwork()
|
||||
{
|
||||
return homeNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((network == null) ? 0 : network.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;
|
||||
PersonNetwork other = (PersonNetwork) obj;
|
||||
if (network == null)
|
||||
{
|
||||
if (other.network != null)
|
||||
return false;
|
||||
}
|
||||
else if (!network.equals(other.network))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "PersonNetwork [homeNetwork=" + homeNetwork + ", network="
|
||||
+ network + "]";
|
||||
}
|
||||
}
|
117
source/java/org/alfresco/rest/api/model/Preference.java
Normal file
117
source/java/org/alfresco/rest/api/model/Preference.java
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
|
||||
/**
|
||||
* Represents a user preference.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Preference implements Comparable<Preference>
|
||||
{
|
||||
private String name;
|
||||
private Serializable value;
|
||||
|
||||
public Preference()
|
||||
{
|
||||
}
|
||||
|
||||
public Preference(String name, Serializable value)
|
||||
{
|
||||
if(name == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
if(name == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Serializable getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Serializable value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.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;
|
||||
}
|
||||
|
||||
Preference other = (Preference) obj;
|
||||
return name.equals(other.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Preference preference)
|
||||
{
|
||||
return name.compareTo(preference.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Preference [name=" + name + ", value=" + value + "]";
|
||||
}
|
||||
}
|
84
source/java/org/alfresco/rest/api/model/Quota.java
Normal file
84
source/java/org/alfresco/rest/api/model/Quota.java
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
|
||||
/**
|
||||
* Represents a network quota.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Quota
|
||||
{
|
||||
private String name;
|
||||
private Long limit;
|
||||
private Long usage;
|
||||
|
||||
public Quota()
|
||||
{
|
||||
}
|
||||
|
||||
public Quota(String name, Long limit, Long usage)
|
||||
{
|
||||
this.name = name;
|
||||
this.limit = limit;
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getLimit()
|
||||
{
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(Long limit)
|
||||
{
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public Long getUsage()
|
||||
{
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(Long usage)
|
||||
{
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Quota [name=" + name + ", limit=" + limit + ", usage=" + usage
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
42
source/java/org/alfresco/rest/api/model/Site.java
Normal file
42
source/java/org/alfresco/rest/api/model/Site.java
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.site.SiteRole;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
|
||||
/**
|
||||
* Represents a site.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public interface Site
|
||||
{
|
||||
public static final String ROLE = "role";
|
||||
|
||||
String getId();
|
||||
void setId(String id);
|
||||
NodeRef getGuid();
|
||||
String getTitle();
|
||||
String getDescription();
|
||||
SiteVisibility getVisibility();
|
||||
SiteRole getRole();
|
||||
}
|
110
source/java/org/alfresco/rest/api/model/SiteContainer.java
Normal file
110
source/java/org/alfresco/rest/api/model/SiteContainer.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* Represents a site container.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class SiteContainer implements Comparable<SiteContainer>
|
||||
{
|
||||
private String folderId;
|
||||
private NodeRef nodeRef;
|
||||
|
||||
public SiteContainer()
|
||||
{
|
||||
}
|
||||
|
||||
public SiteContainer(String folderId, NodeRef nodeRef)
|
||||
{
|
||||
super();
|
||||
if(folderId == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if(nodeRef == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.folderId = folderId;
|
||||
this.nodeRef = nodeRef;
|
||||
}
|
||||
|
||||
public String getFolderId()
|
||||
{
|
||||
return folderId;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((folderId == null) ? 0 : folderId.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;
|
||||
}
|
||||
|
||||
SiteContainer other = (SiteContainer) obj;
|
||||
return nodeRef.equals(other.getNodeRef());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SiteContainer other)
|
||||
{
|
||||
return folderId.compareTo(other.getFolderId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SiteContainer [folderId=" + folderId + ", nodeRef="
|
||||
+ nodeRef + "]";
|
||||
}
|
||||
|
||||
}
|
147
source/java/org/alfresco/rest/api/model/SiteImpl.java
Normal file
147
source/java/org/alfresco/rest/api/model/SiteImpl.java
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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.SiteRole;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
|
||||
/**
|
||||
* Represents a site.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class SiteImpl implements Site, Comparable<SiteImpl>
|
||||
{
|
||||
protected String id;
|
||||
protected NodeRef guid;
|
||||
protected String title;
|
||||
protected String description;
|
||||
protected SiteVisibility visibility;
|
||||
protected SiteRole role;
|
||||
|
||||
public SiteImpl()
|
||||
{
|
||||
}
|
||||
|
||||
public SiteImpl(SiteInfo siteInfo, SiteRole role)
|
||||
{
|
||||
if(siteInfo == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Must provide siteInfo");
|
||||
}
|
||||
this.id = siteInfo.getShortName();
|
||||
this.guid = siteInfo.getNodeRef();
|
||||
this.title = siteInfo.getTitle();
|
||||
this.description = siteInfo.getDescription();
|
||||
this.visibility = siteInfo.getVisibility();
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public NodeRef getGuid()
|
||||
{
|
||||
return guid;
|
||||
}
|
||||
|
||||
public void setGuid(NodeRef guid)
|
||||
{
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public SiteVisibility getVisibility()
|
||||
{
|
||||
return visibility;
|
||||
}
|
||||
|
||||
@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;
|
||||
return id.equals(other.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SiteImpl site)
|
||||
{
|
||||
return id.compareTo(site.getId());
|
||||
}
|
||||
|
||||
@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
|
||||
+ "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public SiteRole getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
}
|
130
source/java/org/alfresco/rest/api/model/SiteMember.java
Normal file
130
source/java/org/alfresco/rest/api/model/SiteMember.java
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.rest.api.people.PeopleEntityResource;
|
||||
import org.alfresco.rest.framework.resource.EmbeddedEntityResource;
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
import org.alfresco.service.cmr.site.SiteRole;
|
||||
|
||||
/**
|
||||
* Represents site membership.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class SiteMember
|
||||
{
|
||||
private String personId;
|
||||
private SiteRole role;
|
||||
|
||||
public SiteMember()
|
||||
{
|
||||
}
|
||||
|
||||
public SiteMember(String personId, SiteRole role)
|
||||
{
|
||||
super();
|
||||
if(personId == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if(role == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.personId = personId;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
@EmbeddedEntityResource(propertyName = "person", entityResource = PeopleEntityResource.class)
|
||||
public String getPersonId()
|
||||
{
|
||||
return personId;
|
||||
}
|
||||
|
||||
public SiteRole getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(SiteRole role)
|
||||
{
|
||||
if(role == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public void setPersonId(String personId)
|
||||
{
|
||||
if(personId == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.personId = personId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((personId == null) ? 0 : personId.hashCode());
|
||||
result = prime * result + ((role == null) ? 0 : role.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;
|
||||
}
|
||||
|
||||
SiteMember other = (SiteMember) obj;
|
||||
if (!personId.equals(other.personId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return(role == other.role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SiteMember [personId=" + personId + ", role=" + role + "]";
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,159 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.rest.api.sites.SiteEntityResource;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.EmbeddedEntityResource;
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
|
||||
/**
|
||||
* Representation of a site membership request for a specific user.
|
||||
*
|
||||
* Ordering is by id (site id).
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class SiteMembershipRequest implements Comparable<SiteMembershipRequest>
|
||||
{
|
||||
private static Collator collator = Collator.getInstance();
|
||||
|
||||
private String id; // site id
|
||||
private String message;
|
||||
private Date createdAt;
|
||||
private Date modifiedAt;
|
||||
private String title; // for sorting only
|
||||
|
||||
public static Pair<String, String> splitId(String id)
|
||||
{
|
||||
int idx = id.indexOf(":");
|
||||
if(idx != -1)
|
||||
{
|
||||
String workflowId = id.substring(0, idx);
|
||||
String key = id.substring(idx + 1);
|
||||
Pair<String, String> ret = new Pair<String, String>(workflowId, key);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidArgumentException("Site invite id is invalid: " + id);
|
||||
}
|
||||
}
|
||||
|
||||
public SiteMembershipRequest()
|
||||
{
|
||||
}
|
||||
|
||||
@EmbeddedEntityResource(propertyName = "site", entityResource = SiteEntityResource.class)
|
||||
@UniqueId
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt)
|
||||
{
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Date getModifiedAt()
|
||||
{
|
||||
return modifiedAt;
|
||||
}
|
||||
|
||||
public void setModifiedAt(Date modifiedAt)
|
||||
{
|
||||
this.modifiedAt = modifiedAt;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SiteMembershipRequest [id=" + id + ", message=" + message + ", createdAt=" + createdAt
|
||||
+ ", modifiedAt=" + modifiedAt + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.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;
|
||||
SiteMembershipRequest other = (SiteMembershipRequest) obj;
|
||||
if (id == null)
|
||||
{
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SiteMembershipRequest o)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if(title == null && o.getTitle() != null)
|
||||
{
|
||||
ret = -1;
|
||||
}
|
||||
else if(title != null && o.getTitle() == null)
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = collator.compare(title, o.getTitle());
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
40
source/java/org/alfresco/rest/api/model/SiteTarget.java
Normal file
40
source/java/org/alfresco/rest/api/model/SiteTarget.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
|
||||
/**
|
||||
* A site target favourite.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class SiteTarget extends Target
|
||||
{
|
||||
private Site site;
|
||||
|
||||
public SiteTarget()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public SiteTarget(Site site)
|
||||
{
|
||||
super();
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
public void setSite(Site site)
|
||||
{
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
public Site getSite()
|
||||
{
|
||||
return site;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SiteTarget [site=" + site + "]";
|
||||
}
|
||||
}
|
119
source/java/org/alfresco/rest/api/model/Tag.java
Normal file
119
source/java/org/alfresco/rest/api/model/Tag.java
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* Represents a node tag.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class Tag implements Comparable<Tag>
|
||||
{
|
||||
private NodeRef nodeRef;
|
||||
private String tag;
|
||||
|
||||
public Tag()
|
||||
{
|
||||
}
|
||||
|
||||
public Tag(NodeRef nodeRef, String tag)
|
||||
{
|
||||
this.nodeRef = nodeRef;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
public void setNodeRef(NodeRef nodeRef)
|
||||
{
|
||||
this.nodeRef = nodeRef;
|
||||
}
|
||||
|
||||
public String getTag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag)
|
||||
{
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that comparison of tags is based on their string value. This should still
|
||||
* be consistent with equals since tags that are equal implies NodeRefs that are equal.
|
||||
*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(Tag o)
|
||||
{
|
||||
int ret = getTag().compareTo(o.getTag());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((nodeRef == null) ? 0 : nodeRef.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tags are equal if they have the same NodeRef
|
||||
*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Tag other = (Tag) obj;
|
||||
if (nodeRef == null) {
|
||||
if (other.nodeRef != null)
|
||||
return false;
|
||||
} else if (!nodeRef.equals(other.nodeRef))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Tag [nodeRef=" + nodeRef + ", tag=" + tag + "]";
|
||||
}
|
||||
|
||||
}
|
11
source/java/org/alfresco/rest/api/model/Target.java
Normal file
11
source/java/org/alfresco/rest/api/model/Target.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
/**
|
||||
* A favourite target entity.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public abstract class Target
|
||||
{
|
||||
}
|
60
source/java/org/alfresco/rest/api/model/UserRating.java
Normal file
60
source/java/org/alfresco/rest/api/model/UserRating.java
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import org.alfresco.rest.framework.resource.UniqueId;
|
||||
|
||||
/**
|
||||
* Represents a user rating for a node.
|
||||
*
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class UserRating
|
||||
{
|
||||
private Float userRating;
|
||||
private String personId;
|
||||
|
||||
public UserRating(String personId, Float userRating)
|
||||
{
|
||||
super();
|
||||
this.userRating = userRating;
|
||||
this.personId = personId;
|
||||
}
|
||||
|
||||
public Float getUserRating()
|
||||
{
|
||||
return userRating;
|
||||
}
|
||||
|
||||
@UniqueId
|
||||
public String getPersonId()
|
||||
{
|
||||
return personId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "UserRating [userRating=" + userRating + ", personId="
|
||||
+ personId + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user