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,RestAspectsCollection,RestAuditAppModelsCollection,RestAuditEntryModelsCollection,RestCandidateModelsCollection,RestCategoryModelsCollection,RestCommentModelsCollection,RestDeploymentModelsCollection,RestFormModelsCollection,RestGroupMemberModelsCollection,RestGroupsModelsCollection,RestItemModelsCollection,RestNetworkModelsCollection,RestNodeAssociationModelCollection,RestNodeChildAssocModelCollection,RestNodeModelsCollection,RestPersonFavoritesModelsCollection,RestPersonModelsCollection,RestPreferenceModelsCollection,RestProcessDefinitionModelsCollection,RestProcessModelsCollection,RestProcessVariableCollection,RestRatingModelsCollection,RestRenditionInfoModelCollection,RestRuleModelsCollection,RestRuleSetModelsCollection,RestShardInfoModelCollection,RestSharedLinksModelCollection,RestSiteContainerModelsCollection,RestSiteGroupModelsCollection,RestSiteMemberModelsCollection,RestSiteMembershipModelsCollection,RestSiteMembershipRequestModelsCollection,RestSiteModelsCollection,RestSitePersonMembershipRequestModelsCollection,RestSubscriberModelCollection,RestSyncNodeSubscriptionModelCollection,RestTagModelsCollection,RestTaskModelsCollection,RestTypesCollection,RestVariableModelsCollection,RestVersionModelsCollection,SearchNodeModelsCollection,SearchResponse
public abstract class RestModels<Model,ModelCollection>
extends Object
implements IRestModelsCollection<Model>, IModelsCollectionAssertion<ModelCollection>
Map multiple entries of JSON response to a class
Example:
"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 based on this example
RestSiteModelsCollection class having a List of - Author:
- Paul Brodner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionand()getEntryByIndex(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());booleanisEmpty()voidsetPagination(RestPaginationModel pagination) when()
-
Constructor Details
-
RestModels
public RestModels()
-
-
Method Details
-
getEntries
- Specified by:
getEntriesin interfaceIRestModelsCollection<Model>
-
getOneRandomEntry
- Specified by:
getOneRandomEntryin interfaceIRestModelsCollection<Model>- Returns:
- a random entry from entries list
- Throws:
EmptyRestModelCollectionException
-
getEntryByIndex
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
- Specified by:
assertThatin interfaceIModelsCollectionAssertion<Model>
-
and
- Specified by:
andin interfaceIModelsCollectionAssertion<Model>
-
when
- Specified by:
whenin interfaceIModelsCollectionAssertion<Model>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceIRestModelsCollection<Model>- Returns:
- boolean value if entry is empty
-
getPagination
- Specified by:
getPaginationin interfaceIRestModelsCollection<Model>
-
setPagination
-