use of org.alfresco.rest.api.tests.client.data.SiteFavouriteTarget in project alfresco-remote-api by Alfresco.
the class TestFavourites method makeSiteFavourite.
private Favourite makeSiteFavourite(Site site) throws ParseException {
SiteFavouriteTarget target = new SiteFavouriteTarget(site);
Date creationDate = new Date();
Favourite favourite = new Favourite(creationDate, null, target, null);
return favourite;
}
use of org.alfresco.rest.api.tests.client.data.SiteFavouriteTarget in project alfresco-remote-api by Alfresco.
the class TestFavourites method filter.
/**
* Returns a new list.
*
* @param favourites List<Favourite>
* @param types Set<Type>
* @return ArrayList<Favourite>
*/
private ArrayList<Favourite> filter(List<Favourite> favourites, final Set<Type> types) {
Predicate<Favourite> predicate = new Predicate<Favourite>() {
@Override
public boolean apply(Favourite other) {
Type type = null;
if (other.getTarget() instanceof FileFavouriteTarget) {
type = Type.FILE;
} else if (other.getTarget() instanceof FolderFavouriteTarget) {
type = Type.FOLDER;
} else if (other.getTarget() instanceof SiteFavouriteTarget) {
type = Type.SITE;
}
boolean ret = (type != null && types.contains(type));
return ret;
}
};
ArrayList<Favourite> ret = Lists.newArrayList(Collections2.filter(favourites, predicate));
return ret;
}
Aggregations