Class ModuleEntries


  • public class ModuleEntries
    extends java.lang.Object
    Entries Module.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  ModuleEntries.Async
      Async module.
    • Constructor Summary

      Constructors 
      Constructor Description
      ModuleEntries​(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)
      Create entries module.
    • Constructor Detail

      • ModuleEntries

        public ModuleEntries​(retrofit2.Retrofit retrofit,
                             java.util.concurrent.Executor callbackExecutor,
                             java.lang.String spaceId,
                             java.lang.String environmentId,
                             boolean environmentIdConfigured)
        Create entries module.
        Parameters:
        retrofit - the retrofit instance to be used to create the service.
        callbackExecutor - to tell on which thread it should run.
        spaceId - the space to be used when not given.
        environmentId - the environment to be used when not given.
        environmentIdConfigured - internal helper to see if environment was set.
    • Method Detail

      • createService

        protected com.contentful.java.cma.ServiceEntries createService​(retrofit2.Retrofit retrofit)
      • archive

        public CMAEntry archive​(CMAEntry entry)
        Archive an Entry.
        Parameters:
        entry - Entry
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if entry is null.
        java.lang.IllegalArgumentException - if entry's id is null.
      • create

        public CMAEntry create​(java.lang.String contentTypeId,
                               CMAEntry entry)
        Create a new Entry in the configured space and environment.

        In case the given entry has an ID associated with it, that ID will be used, otherwise the server will auto-generate an ID that will be contained in the response upon success.

        Parameters:
        contentTypeId - Content Type ID
        entry - Entry
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if configured space id is null.
        java.lang.IllegalArgumentException - if configured environment id is null.
        java.lang.IllegalArgumentException - if contentTypeId is null.
        java.lang.IllegalArgumentException - if entry is null.
        See Also:
        CMAClient.Builder.setSpaceId(String), CMAClient.Builder.setEnvironmentId(String)
      • create

        public CMAEntry create​(java.lang.String spaceId,
                               java.lang.String environmentId,
                               java.lang.String contentTypeId,
                               CMAEntry entry)
        Create a new Entry.

        In case the given entry has an ID associated with it, that ID will be used, otherwise the server will auto-generate an ID that will be contained in the response upon success.

        This method will override the configuration specified through CMAClient.Builder.setSpaceId(String) and CMAClient.Builder.setEnvironmentId(String).

        Parameters:
        spaceId - Space ID
        environmentId - Environment ID
        contentTypeId - Content Type ID
        entry - Entry
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if spaceId is null.
        java.lang.IllegalArgumentException - if environmentId is null.
        java.lang.IllegalArgumentException - if contentTypeId is null.
        java.lang.IllegalArgumentException - if entry is null.
      • delete

        public java.lang.Integer delete​(CMAEntry entry)
        Delete an Entry.
        Parameters:
        entry - Entry ID
        Returns:
        Integer representing the success (204) of the action
        Throws:
        java.lang.IllegalArgumentException - if spaceId is null.
        java.lang.IllegalArgumentException - if environmentId is null.
        java.lang.IllegalArgumentException - if entryId is null.
        java.lang.IllegalArgumentException - if entry is null.
      • fetchAll

        public CMAArray<CMAEntry> fetchAll​(java.util.Map<java.lang.String,​java.lang.String> query)
        Fetch all entries matching the query from the configured space and environment.

        This fetch uses the default parameter defined in DefaultQueryParameter.FETCH

        Parameters:
        query - the criteria to filter on.
        Returns:
        CMAArray result instance
        Throws:
        java.lang.IllegalArgumentException - if configured space id is null.
        java.lang.IllegalArgumentException - if configured environment id is null.
        See Also:
        CMAClient.Builder.setSpaceId(String), CMAClient.Builder.setEnvironmentId(String)
      • fetchAll

        public CMAArray<CMAEntry> fetchAll​(java.lang.String spaceId,
                                           java.lang.String environmentId)
        Fetch all entries from the given space and environment.

        This fetch uses the default parameter defined in DefaultQueryParameter.FETCH

        This method will override the configuration specified through CMAClient.Builder.setSpaceId(String) and CMAClient.Builder.setEnvironmentId(String).

        Parameters:
        spaceId - Space ID
        environmentId - Environment ID
        Returns:
        CMAArray result instance
        Throws:
        java.lang.IllegalArgumentException - if spaceId is null.
        java.lang.IllegalArgumentException - if environmentId is null.
      • fetchAll

        public CMAArray<CMAEntry> fetchAll​(java.lang.String spaceId,
                                           java.lang.String environmentId,
                                           java.util.Map<java.lang.String,​java.lang.String> query)
        Fetch all entries from the given space and environment matching the query.
        Parameters:
        spaceId - Space ID
        environmentId - Environment ID
        query - Query
        Returns:
        CMAArray of entries matching the query.
        Throws:
        java.lang.IllegalArgumentException - if spaceId is null.
        java.lang.IllegalArgumentException - if environmentId is null.
      • fetchOne

        public CMAEntry fetchOne​(java.lang.String entryId)
        Fetch an entry with the given entryId from the configured space and environment.
        Parameters:
        entryId - Entry ID
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if configured space id is null.
        java.lang.IllegalArgumentException - if configured environment id is null.
        java.lang.IllegalArgumentException - if entry id is null.
        See Also:
        CMAClient.Builder.setSpaceId(String), CMAClient.Builder.setEnvironmentId(String)
      • fetchOne

        public CMAEntry fetchOne​(java.lang.String spaceId,
                                 java.lang.String environmentId,
                                 java.lang.String entryId)
        Fetch an entry with the given entryId from the given environment and space.
        Parameters:
        spaceId - Space ID
        environmentId - Environment ID
        entryId - Entry ID
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if space id is null.
        java.lang.IllegalArgumentException - if environment id is null.
        java.lang.IllegalArgumentException - if entry id is null.
      • publish

        public CMAEntry publish​(CMAEntry entry)
        Publish an Entry.
        Parameters:
        entry - Entry
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if entry is null.
        java.lang.IllegalArgumentException - if entry's id is null.
        java.lang.IllegalArgumentException - if entry's space id is null.
      • unArchive

        public CMAEntry unArchive​(CMAEntry entry)
        Un-Archive an Entry.
        Parameters:
        entry - Entry
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if entry is null.
        java.lang.IllegalArgumentException - if entry's id is null.
        java.lang.IllegalArgumentException - if entry's space id is null.
      • unPublish

        public CMAEntry unPublish​(CMAEntry entry)
        Un-Publish an Entry.
        Parameters:
        entry - Entry
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if entry is null.
        java.lang.IllegalArgumentException - if entry's id is null.
        java.lang.IllegalArgumentException - if entry's space id is null.
      • update

        public CMAEntry update​(CMAEntry entry)
        Update an Entry.
        Parameters:
        entry - Entry
        Returns:
        CMAEntry result instance
        Throws:
        java.lang.IllegalArgumentException - if entry is null.
        java.lang.IllegalArgumentException - if entry's id is null.
        java.lang.IllegalArgumentException - if entry's space id is null.
        java.lang.IllegalArgumentException - if entry's version is null.
      • fetchAllSnapshots

        public CMAArray<CMASnapshot> fetchAllSnapshots​(CMAEntry entry)
        Fetch all snapshots of an entry.
        Parameters:
        entry - the entry whose snapshots to be returned.
        Returns:
        an array of snapshots.
        Throws:
        java.lang.IllegalArgumentException - if entry is null.
        java.lang.IllegalArgumentException - if entry's id is null.
        java.lang.IllegalArgumentException - if entry's space id is null.
      • fetchOneSnapshot

        public CMASnapshot fetchOneSnapshot​(CMAEntry entry,
                                            java.lang.String snapshotId)
        Fetch a specific snapshot of an entry.
        Parameters:
        entry - the entry whose snapshot to be returned.
        snapshotId - the snapshot to be returned.
        Returns:
        an array of snapshots.
        Throws:
        java.lang.IllegalArgumentException - if entry is null.
        java.lang.IllegalArgumentException - if entry's id is null.
        java.lang.IllegalArgumentException - if entry's space id is null.
        java.lang.IllegalArgumentException - if snapshotId is null.
      • async

        public ModuleEntries.Async async()
        Returns:
        a module with a set of asynchronous methods.