mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged WEBAPP-API (5.2.1) to 5.2.N (5.2.1)
136749 jkaabimofrad: Minor re-formatting (replace tabs with spaces) noted via APPSREPO-147. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@136756 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,13 +39,13 @@ public interface Favourites
|
|||||||
{
|
{
|
||||||
String PARAM_INCLUDE_PATH = Nodes.PARAM_INCLUDE_PATH;
|
String PARAM_INCLUDE_PATH = Nodes.PARAM_INCLUDE_PATH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a favourite for user personId
|
* Add a favourite for user personId
|
||||||
*
|
*
|
||||||
* @param personId the personId for which the favourite is to be added
|
* @param personId the personId for which the favourite is to be added
|
||||||
* @param favourite the favourite to add
|
* @param favourite the favourite to add
|
||||||
*/
|
*/
|
||||||
Favourite addFavourite(String personId, Favourite favourite);
|
Favourite addFavourite(String personId, Favourite favourite);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a favourite for user personId taking parameters into account
|
* Add a favourite for user personId taking parameters into account
|
||||||
@@ -56,30 +56,30 @@ public interface Favourites
|
|||||||
*/
|
*/
|
||||||
Favourite addFavourite(String personId, Favourite favourite, Parameters parameters);
|
Favourite addFavourite(String personId, Favourite favourite, Parameters parameters);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a favourite for user personId
|
* Add a favourite for user personId
|
||||||
*
|
*
|
||||||
* @param personId the personId for which the favourite is to be removed
|
* @param personId the personId for which the favourite is to be removed
|
||||||
* @param id the id of the favourite to remove (id is a uuid)
|
* @param id the id of the favourite to remove (id is a uuid)
|
||||||
*/
|
*/
|
||||||
void removeFavourite(String personId, String id);
|
void removeFavourite(String personId, String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a paged list of favourites for user personId
|
* Get a paged list of favourites for user personId
|
||||||
*
|
*
|
||||||
* @param personId the personId for which the favourite is to be removed
|
* @param personId the personId for which the favourite is to be removed
|
||||||
* @param parameters Parameters
|
* @param parameters Parameters
|
||||||
* @return paged favourites
|
* @return paged favourites
|
||||||
*/
|
*/
|
||||||
CollectionWithPagingInfo<Favourite> getFavourites(String personId, final Parameters parameters);
|
CollectionWithPagingInfo<Favourite> getFavourites(String personId, final Parameters parameters);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a specific favourite for user personId
|
* Get a specific favourite for user personId
|
||||||
*
|
*
|
||||||
* @param personId the personId for which the favourite is to be removed
|
* @param personId the personId for which the favourite is to be removed
|
||||||
* @param favouriteId the favourite id
|
* @param favouriteId the favourite id
|
||||||
* @return the favourite
|
* @return the favourite
|
||||||
*/
|
*/
|
||||||
Favourite getFavourite(String personId, String favouriteId);
|
Favourite getFavourite(String personId, String favouriteId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -49,12 +49,12 @@ RelationshipResourceAction.Create<Favourite>, RelationshipResourceAction.Delete
|
|||||||
|
|
||||||
private Favourites favourites;
|
private Favourites favourites;
|
||||||
|
|
||||||
public void setFavourites(Favourites favourites)
|
public void setFavourites(Favourites favourites)
|
||||||
{
|
{
|
||||||
this.favourites = favourites;
|
this.favourites = favourites;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet()
|
public void afterPropertiesSet()
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("favourites", this.favourites);
|
ParameterCheck.mandatory("favourites", this.favourites);
|
||||||
@@ -72,34 +72,34 @@ RelationshipResourceAction.Create<Favourite>, RelationshipResourceAction.Delete
|
|||||||
return favourites.getFavourites(personId, parameters);
|
return favourites.getFavourites(personId, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the given site as a favourite site for the user.
|
* Adds the given site as a favourite site for the user.
|
||||||
*
|
*
|
||||||
* @see org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction.Create#create(String, java.util.List, org.alfresco.rest.framework.resource.parameters.Parameters)
|
* @see org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction.Create#create(String, java.util.List, org.alfresco.rest.framework.resource.parameters.Parameters)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@WebApiDescription(title = "Add Person Favorite", description = "Favorite something")
|
@WebApiDescription(title = "Add Person Favorite", description = "Favorite something")
|
||||||
public List<Favourite> create(String personId, List<Favourite> entity, Parameters parameters)
|
public List<Favourite> create(String personId, List<Favourite> entity, Parameters parameters)
|
||||||
{
|
{
|
||||||
List<Favourite> ret = new ArrayList<Favourite>(entity.size());
|
List<Favourite> ret = new ArrayList<Favourite>(entity.size());
|
||||||
for(Favourite favourite : entity)
|
for(Favourite favourite : entity)
|
||||||
{
|
{
|
||||||
ret.add(favourites.addFavourite(personId, favourite, parameters));
|
ret.add(favourites.addFavourite(personId, favourite, parameters));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@WebApiDescription(title = "Remove Person Favorite", description = "Un-favorite something")
|
@WebApiDescription(title = "Remove Person Favorite", description = "Un-favorite something")
|
||||||
public void delete(String personId, String id, Parameters parameters)
|
public void delete(String personId, String id, Parameters parameters)
|
||||||
{
|
{
|
||||||
favourites.removeFavourite(personId, id);
|
favourites.removeFavourite(personId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Favourite readById(String personId, String favouriteId, Parameters parameters)
|
public Favourite readById(String personId, String favouriteId, Parameters parameters)
|
||||||
throws RelationshipResourceNotFoundException
|
throws RelationshipResourceNotFoundException
|
||||||
{
|
{
|
||||||
return favourites.getFavourite(personId, favouriteId, parameters);
|
return favourites.getFavourite(personId, favouriteId, parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -49,127 +49,127 @@ import org.json.simple.JSONObject;
|
|||||||
*/
|
*/
|
||||||
public class FavouriteDocument extends FavouriteNode implements ExpectedComparison, JSONAble
|
public class FavouriteDocument extends FavouriteNode implements ExpectedComparison, JSONAble
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -5890002728061039516L;
|
private static final long serialVersionUID = -5890002728061039516L;
|
||||||
|
|
||||||
private String mimeType;
|
private String mimeType;
|
||||||
private BigInteger sizeInBytes;
|
private BigInteger sizeInBytes;
|
||||||
private String versionLabel;
|
private String versionLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For POSTs
|
* For POSTs
|
||||||
* @param guid String
|
* @param guid String
|
||||||
*/
|
*/
|
||||||
public FavouriteDocument(String guid)
|
public FavouriteDocument(String guid)
|
||||||
{
|
{
|
||||||
super(guid);
|
super(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FavouriteDocument(String id, String guid)
|
public FavouriteDocument(String id, String guid)
|
||||||
{
|
{
|
||||||
super(id, guid);
|
super(id, guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Document(String id, String guid, Map<String, Serializable> properties)
|
// public Document(String id, String guid, Map<String, Serializable> properties)
|
||||||
// {
|
// {
|
||||||
// super(id, guid, properties);
|
// super(id, guid, properties);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public static FavouriteDocument getDocument(String id, String guid, Properties props)
|
public static FavouriteDocument getDocument(String id, String guid, Properties props)
|
||||||
{
|
{
|
||||||
FavouriteDocument document = new FavouriteDocument(id, guid);
|
FavouriteDocument document = new FavouriteDocument(id, guid);
|
||||||
|
|
||||||
Map<String, PropertyData<?>> properties = props.getProperties();
|
Map<String, PropertyData<?>> properties = props.getProperties();
|
||||||
document.setName((String)properties.get(PropertyIds.NAME).getFirstValue());
|
document.setName((String)properties.get(PropertyIds.NAME).getFirstValue());
|
||||||
document.setTitle((String)properties.get(ContentModel.PROP_TITLE.toString()).getFirstValue());
|
document.setTitle((String)properties.get(ContentModel.PROP_TITLE.toString()).getFirstValue());
|
||||||
document.setCreatedBy((String)properties.get(PropertyIds.CREATED_BY).getFirstValue());
|
document.setCreatedBy((String)properties.get(PropertyIds.CREATED_BY).getFirstValue());
|
||||||
document.setModifiedBy((String)properties.get(PropertyIds.LAST_MODIFIED_BY).getFirstValue());
|
document.setModifiedBy((String)properties.get(PropertyIds.LAST_MODIFIED_BY).getFirstValue());
|
||||||
GregorianCalendar modifiedAt = (GregorianCalendar)properties.get(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
|
GregorianCalendar modifiedAt = (GregorianCalendar)properties.get(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
|
||||||
document.setModifiedAt(modifiedAt.getTime());
|
document.setModifiedAt(modifiedAt.getTime());
|
||||||
GregorianCalendar createdAt = (GregorianCalendar)properties.get(PropertyIds.CREATION_DATE).getFirstValue();
|
GregorianCalendar createdAt = (GregorianCalendar)properties.get(PropertyIds.CREATION_DATE).getFirstValue();
|
||||||
document.setCreatedAt(createdAt.getTime());
|
document.setCreatedAt(createdAt.getTime());
|
||||||
//document.setDescription((String)props.get(PropertyIds.DE).getFirstValue());
|
//document.setDescription((String)props.get(PropertyIds.DE).getFirstValue());
|
||||||
document.setMimeType((String)properties.get(PropertyIds.CONTENT_STREAM_MIME_TYPE).getFirstValue());
|
document.setMimeType((String)properties.get(PropertyIds.CONTENT_STREAM_MIME_TYPE).getFirstValue());
|
||||||
document.setSizeInBytes((BigInteger)properties.get(PropertyIds.CONTENT_STREAM_LENGTH).getFirstValue());
|
document.setSizeInBytes((BigInteger)properties.get(PropertyIds.CONTENT_STREAM_LENGTH).getFirstValue());
|
||||||
document.setVersionLabel((String)properties.get(PropertyIds.VERSION_LABEL).getFirstValue());
|
document.setVersionLabel((String)properties.get(PropertyIds.VERSION_LABEL).getFirstValue());
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMimeType()
|
public String getMimeType()
|
||||||
{
|
{
|
||||||
return mimeType;
|
return mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigInteger getSizeInBytes()
|
public BigInteger getSizeInBytes()
|
||||||
{
|
{
|
||||||
return sizeInBytes;
|
return sizeInBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersionLabel()
|
public String getVersionLabel()
|
||||||
{
|
{
|
||||||
return versionLabel;
|
return versionLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMimeType(String mimeType)
|
|
||||||
{
|
|
||||||
this.mimeType = mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSizeInBytes(BigInteger sizeInBytes)
|
public void setMimeType(String mimeType)
|
||||||
{
|
{
|
||||||
this.sizeInBytes = sizeInBytes;
|
this.mimeType = mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVersionLabel(String versionLabel)
|
public void setSizeInBytes(BigInteger sizeInBytes)
|
||||||
{
|
{
|
||||||
this.versionLabel = versionLabel;
|
this.sizeInBytes = sizeInBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject toJSON()
|
public void setVersionLabel(String versionLabel)
|
||||||
{
|
{
|
||||||
JSONObject json = super.toJSON();
|
this.versionLabel = versionLabel;
|
||||||
return json;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void expected(Object o)
|
|
||||||
{
|
|
||||||
super.expected(o);
|
|
||||||
|
|
||||||
assertTrue(o instanceof FavouriteDocument);
|
public JSONObject toJSON()
|
||||||
|
{
|
||||||
|
JSONObject json = super.toJSON();
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
FavouriteDocument other = (FavouriteDocument)o;
|
@Override
|
||||||
|
public void expected(Object o)
|
||||||
AssertUtil.assertEquals("mimeType", mimeType, other.getMimeType());
|
{
|
||||||
AssertUtil.assertEquals("sizeInBytes", sizeInBytes, other.getSizeInBytes());
|
super.expected(o);
|
||||||
AssertUtil.assertEquals("versionLabel", versionLabel, other.getVersionLabel());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FavouriteDocument parseDocument(JSONObject jsonObject) throws ParseException
|
assertTrue(o instanceof FavouriteDocument);
|
||||||
{
|
|
||||||
String id = (String)jsonObject.get("id");
|
|
||||||
String guid = (String)jsonObject.get("guid");
|
|
||||||
String name = (String)jsonObject.get("name");
|
|
||||||
String title = (String)jsonObject.get("title");
|
|
||||||
String description = (String)jsonObject.get("description");
|
|
||||||
Date createdAt = PublicApiDateFormat.getDateFormat().parse((String)jsonObject.get("createdAt"));
|
|
||||||
Date modifiedAt = PublicApiDateFormat.getDateFormat().parse((String)jsonObject.get("modifiedAt"));
|
|
||||||
String createdBy = (String)jsonObject.get("createdBy");
|
|
||||||
String modifiedBy = (String)jsonObject.get("modifiedBy");
|
|
||||||
String mimeType = (String)jsonObject.get("mimeType");
|
|
||||||
Long sizeInBytes = (Long)jsonObject.get("sizeInBytes");
|
|
||||||
String versionLabel = (String)jsonObject.get("versionLabel");
|
|
||||||
|
|
||||||
FavouriteDocument document = new FavouriteDocument(id, guid);
|
FavouriteDocument other = (FavouriteDocument)o;
|
||||||
document.setName(name);
|
|
||||||
document.setTitle(title);
|
AssertUtil.assertEquals("mimeType", mimeType, other.getMimeType());
|
||||||
document.setCreatedBy(createdBy);
|
AssertUtil.assertEquals("sizeInBytes", sizeInBytes, other.getSizeInBytes());
|
||||||
document.setModifiedBy(modifiedBy);
|
AssertUtil.assertEquals("versionLabel", versionLabel, other.getVersionLabel());
|
||||||
document.setModifiedAt(modifiedAt);
|
}
|
||||||
document.setCreatedAt(createdAt);
|
|
||||||
document.setDescription(description);
|
public static FavouriteDocument parseDocument(JSONObject jsonObject) throws ParseException
|
||||||
document.setMimeType(mimeType);
|
{
|
||||||
document.setSizeInBytes(BigInteger.valueOf(sizeInBytes));
|
String id = (String)jsonObject.get("id");
|
||||||
document.setVersionLabel(versionLabel);
|
String guid = (String)jsonObject.get("guid");
|
||||||
|
String name = (String)jsonObject.get("name");
|
||||||
|
String title = (String)jsonObject.get("title");
|
||||||
|
String description = (String)jsonObject.get("description");
|
||||||
|
Date createdAt = PublicApiDateFormat.getDateFormat().parse((String)jsonObject.get("createdAt"));
|
||||||
|
Date modifiedAt = PublicApiDateFormat.getDateFormat().parse((String)jsonObject.get("modifiedAt"));
|
||||||
|
String createdBy = (String)jsonObject.get("createdBy");
|
||||||
|
String modifiedBy = (String)jsonObject.get("modifiedBy");
|
||||||
|
String mimeType = (String)jsonObject.get("mimeType");
|
||||||
|
Long sizeInBytes = (Long)jsonObject.get("sizeInBytes");
|
||||||
|
String versionLabel = (String)jsonObject.get("versionLabel");
|
||||||
|
|
||||||
|
FavouriteDocument document = new FavouriteDocument(id, guid);
|
||||||
|
document.setName(name);
|
||||||
|
document.setTitle(title);
|
||||||
|
document.setCreatedBy(createdBy);
|
||||||
|
document.setModifiedBy(modifiedBy);
|
||||||
|
document.setModifiedAt(modifiedAt);
|
||||||
|
document.setCreatedAt(createdAt);
|
||||||
|
document.setDescription(description);
|
||||||
|
document.setMimeType(mimeType);
|
||||||
|
document.setSizeInBytes(BigInteger.valueOf(sizeInBytes));
|
||||||
|
document.setVersionLabel(versionLabel);
|
||||||
// set path if available
|
// set path if available
|
||||||
document.parseAndSetPath(jsonObject);
|
document.parseAndSetPath(jsonObject);
|
||||||
return document;
|
return document;
|
||||||
|
@@ -46,80 +46,80 @@ import org.json.simple.JSONObject;
|
|||||||
*/
|
*/
|
||||||
public class FavouriteFolder extends FavouriteNode implements ExpectedComparison, JSONAble
|
public class FavouriteFolder extends FavouriteNode implements ExpectedComparison, JSONAble
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 5020819866533183524L;
|
private static final long serialVersionUID = 5020819866533183524L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For POSTs
|
* For POSTs
|
||||||
* @param guid String
|
* @param guid String
|
||||||
*/
|
*/
|
||||||
public FavouriteFolder(String guid)
|
public FavouriteFolder(String guid)
|
||||||
{
|
{
|
||||||
super(guid);
|
super(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FavouriteFolder(String id, String guid)
|
|
||||||
{
|
|
||||||
super(id, guid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public Folder(String id, String guid, Map<String, Serializable> properties)
|
public FavouriteFolder(String id, String guid)
|
||||||
// {
|
{
|
||||||
// super(id, guid, properties);
|
super(id, guid);
|
||||||
// }
|
}
|
||||||
|
|
||||||
public static FavouriteFolder getFolder(String id, String guid, Properties props)
|
// public Folder(String id, String guid, Map<String, Serializable> properties)
|
||||||
{
|
// {
|
||||||
FavouriteFolder folder = new FavouriteFolder(id, guid);
|
// super(id, guid, properties);
|
||||||
|
// }
|
||||||
|
|
||||||
Map<String, PropertyData<?>> properties = props.getProperties();
|
public static FavouriteFolder getFolder(String id, String guid, Properties props)
|
||||||
folder.setName((String)properties.get(PropertyIds.NAME).getFirstValue());
|
{
|
||||||
folder.setTitle((String)properties.get(ContentModel.PROP_TITLE.toString()).getFirstValue());
|
FavouriteFolder folder = new FavouriteFolder(id, guid);
|
||||||
folder.setCreatedBy((String)properties.get(PropertyIds.CREATED_BY).getFirstValue());
|
|
||||||
folder.setModifiedBy((String)properties.get(PropertyIds.LAST_MODIFIED_BY).getFirstValue());
|
|
||||||
GregorianCalendar modifiedAt = (GregorianCalendar)properties.get(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
|
|
||||||
folder.setModifiedAt(modifiedAt.getTime());
|
|
||||||
GregorianCalendar createdAt = (GregorianCalendar)properties.get(PropertyIds.CREATION_DATE).getFirstValue();
|
|
||||||
folder.setCreatedAt(createdAt.getTime());
|
|
||||||
//document.setDescription((String)props.get(PropertyIds.DE).getFirstValue());
|
|
||||||
return folder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSONObject toJSON()
|
|
||||||
{
|
|
||||||
JSONObject json = super.toJSON();
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FavouriteFolder parseFolder(JSONObject jsonObject) throws ParseException
|
Map<String, PropertyData<?>> properties = props.getProperties();
|
||||||
{
|
folder.setName((String)properties.get(PropertyIds.NAME).getFirstValue());
|
||||||
String id = (String)jsonObject.get("id");
|
folder.setTitle((String)properties.get(ContentModel.PROP_TITLE.toString()).getFirstValue());
|
||||||
String guid = (String)jsonObject.get("guid");
|
folder.setCreatedBy((String)properties.get(PropertyIds.CREATED_BY).getFirstValue());
|
||||||
String name = (String)jsonObject.get("name");
|
folder.setModifiedBy((String)properties.get(PropertyIds.LAST_MODIFIED_BY).getFirstValue());
|
||||||
String title = (String)jsonObject.get("title");
|
GregorianCalendar modifiedAt = (GregorianCalendar)properties.get(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
|
||||||
String description = (String)jsonObject.get("description");
|
folder.setModifiedAt(modifiedAt.getTime());
|
||||||
Date createdAt = PublicApiDateFormat.getDateFormat().parse((String)jsonObject.get("createdAt"));
|
GregorianCalendar createdAt = (GregorianCalendar)properties.get(PropertyIds.CREATION_DATE).getFirstValue();
|
||||||
Date modifiedAt = PublicApiDateFormat.getDateFormat().parse((String)jsonObject.get("modifiedAt"));
|
folder.setCreatedAt(createdAt.getTime());
|
||||||
String createdBy = (String)jsonObject.get("createdBy");
|
//document.setDescription((String)props.get(PropertyIds.DE).getFirstValue());
|
||||||
String modifiedBy = (String)jsonObject.get("modifiedBy");
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
FavouriteFolder folder = new FavouriteFolder(id, guid);
|
public JSONObject toJSON()
|
||||||
folder.setName(name);
|
{
|
||||||
folder.setTitle(title);
|
JSONObject json = super.toJSON();
|
||||||
folder.setCreatedBy(createdBy);
|
return json;
|
||||||
folder.setModifiedBy(modifiedBy);
|
}
|
||||||
folder.setModifiedAt(modifiedAt);
|
|
||||||
folder.setCreatedAt(createdAt);
|
public static FavouriteFolder parseFolder(JSONObject jsonObject) throws ParseException
|
||||||
folder.setDescription(description);
|
{
|
||||||
|
String id = (String)jsonObject.get("id");
|
||||||
|
String guid = (String)jsonObject.get("guid");
|
||||||
|
String name = (String)jsonObject.get("name");
|
||||||
|
String title = (String)jsonObject.get("title");
|
||||||
|
String description = (String)jsonObject.get("description");
|
||||||
|
Date createdAt = PublicApiDateFormat.getDateFormat().parse((String)jsonObject.get("createdAt"));
|
||||||
|
Date modifiedAt = PublicApiDateFormat.getDateFormat().parse((String)jsonObject.get("modifiedAt"));
|
||||||
|
String createdBy = (String)jsonObject.get("createdBy");
|
||||||
|
String modifiedBy = (String)jsonObject.get("modifiedBy");
|
||||||
|
|
||||||
|
FavouriteFolder folder = new FavouriteFolder(id, guid);
|
||||||
|
folder.setName(name);
|
||||||
|
folder.setTitle(title);
|
||||||
|
folder.setCreatedBy(createdBy);
|
||||||
|
folder.setModifiedBy(modifiedBy);
|
||||||
|
folder.setModifiedAt(modifiedAt);
|
||||||
|
folder.setCreatedAt(createdAt);
|
||||||
|
folder.setDescription(description);
|
||||||
// set path if available
|
// set path if available
|
||||||
folder.parseAndSetPath(jsonObject);
|
folder.parseAndSetPath(jsonObject);
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void expected(Object o)
|
public void expected(Object o)
|
||||||
{
|
{
|
||||||
super.expected(o);
|
super.expected(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
|
@@ -43,138 +43,138 @@ import org.json.simple.JSONObject;
|
|||||||
*/
|
*/
|
||||||
public class FavouriteNode implements Serializable, ExpectedComparison
|
public class FavouriteNode implements Serializable, ExpectedComparison
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -6881545732441221372L;
|
private static final long serialVersionUID = -6881545732441221372L;
|
||||||
|
|
||||||
protected String nodeId;
|
protected String nodeId;
|
||||||
protected String guid;
|
protected String guid;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String title;
|
protected String title;
|
||||||
protected String description;
|
protected String description;
|
||||||
protected Date createdAt;
|
protected Date createdAt;
|
||||||
protected Date modifiedAt;
|
protected Date modifiedAt;
|
||||||
protected String createdBy;
|
protected String createdBy;
|
||||||
protected String modifiedBy;
|
protected String modifiedBy;
|
||||||
protected PathInfo path;
|
protected PathInfo path;
|
||||||
|
|
||||||
public FavouriteNode()
|
public FavouriteNode()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For POSTs
|
* For POSTs
|
||||||
*
|
*
|
||||||
* @param guid String
|
* @param guid String
|
||||||
*/
|
*/
|
||||||
public FavouriteNode(String guid)
|
public FavouriteNode(String guid)
|
||||||
{
|
{
|
||||||
this.guid = guid;
|
this.guid = guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FavouriteNode(String id, String guid)
|
public FavouriteNode(String id, String guid)
|
||||||
{
|
{
|
||||||
this.nodeId = id;
|
this.nodeId = id;
|
||||||
this.guid = guid;
|
this.guid = guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGuid(String guid)
|
public void setGuid(String guid)
|
||||||
{
|
{
|
||||||
this.guid = guid;
|
this.guid = guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGuid()
|
public String getGuid()
|
||||||
{
|
{
|
||||||
return guid;
|
return guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRawNodeId()
|
public String getRawNodeId()
|
||||||
{
|
{
|
||||||
return nodeId;
|
return nodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNodeId()
|
public String getNodeId()
|
||||||
{
|
{
|
||||||
return nodeId;
|
return nodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFolder()
|
public boolean isFolder()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name)
|
public String getName()
|
||||||
{
|
{
|
||||||
this.name = name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle()
|
public void setName(String name)
|
||||||
{
|
{
|
||||||
return title;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title)
|
public String getTitle()
|
||||||
{
|
{
|
||||||
this.title = title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public void setTitle(String title)
|
||||||
{
|
{
|
||||||
return description;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description)
|
public String getDescription()
|
||||||
{
|
{
|
||||||
this.description = description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreatedAt()
|
public void setDescription(String description)
|
||||||
{
|
{
|
||||||
return createdAt;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedAt(Date createdAt)
|
public Date getCreatedAt()
|
||||||
{
|
{
|
||||||
this.createdAt = createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getModifiedAt()
|
public void setCreatedAt(Date createdAt)
|
||||||
{
|
{
|
||||||
return modifiedAt;
|
this.createdAt = createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModifiedAt(Date modifiedAt)
|
public Date getModifiedAt()
|
||||||
{
|
{
|
||||||
this.modifiedAt = modifiedAt;
|
return modifiedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreatedBy()
|
public void setModifiedAt(Date modifiedAt)
|
||||||
{
|
{
|
||||||
return createdBy;
|
this.modifiedAt = modifiedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy)
|
public String getCreatedBy()
|
||||||
{
|
{
|
||||||
this.createdBy = createdBy;
|
return createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModifiedBy()
|
public void setCreatedBy(String createdBy)
|
||||||
{
|
{
|
||||||
return modifiedBy;
|
this.createdBy = createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModifiedBy(String modifiedBy)
|
public String getModifiedBy()
|
||||||
{
|
{
|
||||||
this.modifiedBy = modifiedBy;
|
return modifiedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNodeId(String nodeId)
|
public void setModifiedBy(String modifiedBy)
|
||||||
{
|
{
|
||||||
this.nodeId = nodeId;
|
this.modifiedBy = modifiedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNodeId(String nodeId)
|
||||||
|
{
|
||||||
|
this.nodeId = nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
public PathInfo getPath()
|
public PathInfo getPath()
|
||||||
{
|
{
|
||||||
@@ -203,66 +203,66 @@ public class FavouriteNode implements Serializable, ExpectedComparison
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = prime * result + ((nodeId == null) ? 0 : nodeId.hashCode());
|
result = prime * result + ((nodeId == null) ? 0 : nodeId.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (this == obj)
|
if (this == obj)
|
||||||
return true;
|
return true;
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
return false;
|
return false;
|
||||||
if (getClass() != obj.getClass())
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
FavouriteNode other = (FavouriteNode) obj;
|
FavouriteNode other = (FavouriteNode) obj;
|
||||||
if (nodeId == null)
|
if (nodeId == null)
|
||||||
{
|
{
|
||||||
if (other.nodeId != null)
|
if (other.nodeId != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!nodeId.equals(other.nodeId))
|
} else if (!nodeId.equals(other.nodeId))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public JSONObject toJSON()
|
public JSONObject toJSON()
|
||||||
{
|
{
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("guid", getGuid());
|
json.put("guid", getGuid());
|
||||||
json.put("id", getNodeId());
|
json.put("id", getNodeId());
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void expected(Object o)
|
public void expected(Object o)
|
||||||
{
|
{
|
||||||
assertTrue(o instanceof FavouriteNode);
|
assertTrue(o instanceof FavouriteNode);
|
||||||
|
|
||||||
FavouriteNode other = (FavouriteNode) o;
|
FavouriteNode other = (FavouriteNode) o;
|
||||||
|
|
||||||
AssertUtil.assertEquals("id", nodeId, other.getNodeId());
|
AssertUtil.assertEquals("id", nodeId, other.getNodeId());
|
||||||
AssertUtil.assertEquals("guid", guid, other.getGuid());
|
AssertUtil.assertEquals("guid", guid, other.getGuid());
|
||||||
AssertUtil.assertEquals("name", name, other.getName());
|
AssertUtil.assertEquals("name", name, other.getName());
|
||||||
AssertUtil.assertEquals("title", title, other.getTitle());
|
AssertUtil.assertEquals("title", title, other.getTitle());
|
||||||
AssertUtil.assertEquals("description", description, other.getDescription());
|
AssertUtil.assertEquals("description", description, other.getDescription());
|
||||||
AssertUtil.assertEquals("createdAt", createdAt, other.getCreatedAt());
|
AssertUtil.assertEquals("createdAt", createdAt, other.getCreatedAt());
|
||||||
if(modifiedAt != null)
|
if(modifiedAt != null)
|
||||||
{
|
{
|
||||||
assertTrue(modifiedAt.before(other.getModifiedAt()) || modifiedAt.equals(other.getModifiedAt()));
|
assertTrue(modifiedAt.before(other.getModifiedAt()) || modifiedAt.equals(other.getModifiedAt()));
|
||||||
}
|
}
|
||||||
AssertUtil.assertEquals("createdBy", createdBy, other.getCreatedBy());
|
AssertUtil.assertEquals("createdBy", createdBy, other.getCreatedBy());
|
||||||
AssertUtil.assertEquals("modifiedBy", modifiedBy, other.getModifiedBy());
|
AssertUtil.assertEquals("modifiedBy", modifiedBy, other.getModifiedBy());
|
||||||
if(path != null)
|
if(path != null)
|
||||||
{
|
{
|
||||||
path.expected(other.path);
|
path.expected(other.path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
|
Reference in New Issue
Block a user