Package org.alfresco.rest.core
Class RestModels<Model,ModelCollection>
- java.lang.Object
-
- org.alfresco.rest.core.RestModels<Model,ModelCollection>
-
- All Implemented Interfaces:
IModelsCollectionAssertion<ModelCollection>,IRestModelsCollection<Model>
- Direct Known Subclasses:
RestActionDefinitionModelsCollection,RestActivityModelsCollection,RestAuditAppModelsCollection,RestAuditEntryModelsCollection,RestCandidateModelsCollection,RestCommentModelsCollection,RestDeploymentModelsCollection,RestFormModelsCollection,RestGroupMemberModelsCollection,RestGroupsModelsCollection,RestItemModelsCollection,RestNetworkModelsCollection,RestNodeAssociationModelCollection,RestNodeChildAssocModelCollection,RestNodeModelsCollection,RestPersonFavoritesModelsCollection,RestPersonModelsCollection,RestPreferenceModelsCollection,RestProcessDefinitionModelsCollection,RestProcessModelsCollection,RestProcessVariableCollection,RestRatingModelsCollection,RestRenditionInfoModelCollection,RestShardInfoModelCollection,RestSharedLinksModelCollection,RestSiteContainerModelsCollection,RestSiteMemberModelsCollection,RestSiteMembershipModelsCollection,RestSiteMembershipRequestModelsCollection,RestSiteModelsCollection,RestSitePersonMembershipRequestModelsCollection,RestSubscriberModelCollection,RestSyncNodeSubscriptionModelCollection,RestTagModelsCollection,RestTaskModelsCollection,RestVariableModelsCollection,RestVersionModelsCollection,SearchNodeModelsCollection,SearchResponse
public abstract class RestModels<Model,ModelCollection> extends java.lang.Object implements IRestModelsCollection<Model>, IModelsCollectionAssertion<ModelCollection>
Map multiple entries of JSON response to a classExample: "entries": [ { "entry": { "visibility": "PUBLIC", "guid": "79e140e1-5039-4efa-acaf-c22b5ba7c947", "description": "Description1470255221170", "id": "0-C2291-1470255221170", "title": "0-C2291-1470255221170" } }, Having this JSON Entry, we can auto-map this to RestSiteModelsCollectionclass having a List ofbased on this example - Author:
- Paul Brodner
-
-
Constructor Summary
Constructors Constructor Description RestModels()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModelsCollectionAssertion<RestModels<Model,ModelCollection>>and()ModelsCollectionAssertion<RestModels<Model,ModelCollection>>assertThat()java.util.List<Model>getEntries()ModelgetEntryByIndex(int index)ExamplesiteMembershipRequests.getEntryByIndex(0) .assertThat().field("site.visibility").is(moderatedSite.getVisibility()) .assertThat().field("site.description").is(moderatedSite.getDescription()) .assertThat().field("site.id").is(moderatedSite.getId()) .assertThat().field("site.title").is(moderatedSite.getTitle());ModelgetOneRandomEntry()RestPaginationModelgetPagination()booleanisEmpty()voidsetPagination(RestPaginationModel pagination)ModelCollectionwhen()
-
-
-
Method Detail
-
getEntries
public java.util.List<Model> getEntries()
- Specified by:
getEntriesin interfaceIRestModelsCollection<Model>
-
getOneRandomEntry
public Model getOneRandomEntry() throws EmptyRestModelCollectionException
- Specified by:
getOneRandomEntryin interfaceIRestModelsCollection<Model>- Returns:
- a random entry from entries list
- Throws:
EmptyRestModelCollectionException
-
getEntryByIndex
public Model getEntryByIndex(int index) throws EmptyRestModelCollectionException
ExamplesiteMembershipRequests.getEntryByIndex(0) .assertThat().field("site.visibility").is(moderatedSite.getVisibility()) .assertThat().field("site.description").is(moderatedSite.getDescription()) .assertThat().field("site.id").is(moderatedSite.getId()) .assertThat().field("site.title").is(moderatedSite.getTitle());- Parameters:
index-- Returns:
- Throws:
EmptyRestModelCollectionException
-
assertThat
public ModelsCollectionAssertion<RestModels<Model,ModelCollection>> assertThat()
- Specified by:
assertThatin interfaceIModelsCollectionAssertion<Model>
-
and
public ModelsCollectionAssertion<RestModels<Model,ModelCollection>> and()
- Specified by:
andin interfaceIModelsCollectionAssertion<Model>
-
when
public ModelCollection when()
- Specified by:
whenin interfaceIModelsCollectionAssertion<Model>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceIRestModelsCollection<Model>- Returns:
- boolean value if entry is empty
-
getPagination
public RestPaginationModel getPagination()
- Specified by:
getPaginationin interfaceIRestModelsCollection<Model>
-
setPagination
public void setPagination(RestPaginationModel pagination)
-
-