Interface ObjectFacade

    • Field Detail

      • CTX_PARAM_SUPPRESS_EVENT

        static final java.lang.String CTX_PARAM_SUPPRESS_EVENT
        See Also:
        Constant Field Values
      • CTX_DISABLE_CRUD_COCKPIT_EVENT_NOTIFICATION

        @Deprecated(since="6.7",
                    forRemoval=true)
        static final java.lang.String CTX_DISABLE_CRUD_COCKPIT_EVENT_NOTIFICATION
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 6.7 use CTX_PARAM_SUPPRESS_EVENT. Since 6.7 it is not used and will be removed.
        See Also:
        Constant Field Values
    • Method Detail

      • load

        <T> T load​(java.lang.String id)
            throws ObjectNotFoundException
        Gets an object instance by it's id.
        Parameters:
        id - The unique qualifier of the object.
        Returns:
        loaded object instance for given id
        Throws:
        ObjectNotFoundException - if no object with the given id could be found.
      • delete

        <T> void delete​(T object)
                 throws ObjectDeletionException
        Deletes an object from system.
        Parameters:
        object - The object which should be deleted.
        Throws:
        ObjectDeletionException - if the given object could not be deleted.
      • delete

        default <T> ObjectFacadeOperationResult<T> delete​(java.util.Collection<T> objects)
        Deletes many objects from the system.
        Parameters:
        objects - Objects which should be deleted.
        Returns:
        Result of the operation. Should never be null.
      • create

        <T> T create​(java.lang.String typeId)
              throws ObjectCreationException
        Creates a new object in the system using given object data.
        Parameters:
        typeId - The type qualifier specifying the type of which the new object is an instance.
        Returns:
        The newly created object.
        Throws:
        ObjectCreationException - if the object couldn't be created, like an object with the specified id already exists.
      • save

        <T> T save​(T objectToSave)
            throws ObjectSavingException
        Persist an object by given object data.
        Parameters:
        objectToSave - An object, on which the save action should be applied (usually persisting in a DBS)
        Returns:
        The updated object, if saving it was successful.
        Throws:
        ObjectSavingException - if the object couldn't be persisted, like a unique attribute was updated to be non-unique.
      • save

        default <T> ObjectFacadeOperationResult<T> save​(java.util.Collection<T> objects)
        Persist objects by given collection data.
        Parameters:
        objects - the data for updating objects in system.
        Returns:
        ObjectFacadeOperationResult object.
      • reload

        <T> T reload​(T object)
              throws ObjectNotFoundException
        Gets a fresh instance of the given object. Usually it re-fetches a domain object from the persistence layer, but could also just return the same instance, if the object is not managed.
        Parameters:
        object - The object that should be refreshed.
        Returns:
        A new instance of the given object, or the object itself, if it's not managed.
        Throws:
        ObjectNotFoundException - If the current object couldn't be found (could be deleted in the mean time).
      • reload

        default <T> ObjectFacadeOperationResult<T> reload​(java.util.Collection<T> objects)
        Gets a fresh instance of the given collection of objects. Usually it re-fetches a domain object from the persistence layer, but could also just return the same instance, if the object is not managed. If an item in collection couldn't be found (could be deleted in the mean time) then item won't be added to collection
        Parameters:
        objects - The collection of object that should be refreshed.
        Returns:
        Two collections: one with objects that succeeded reloading (new instances of the given objects, or the object itself, if it's not managed) and second collection with objects that failed to be reloaded.
      • clone

        default <T> T clone​(T objectToClone)
                     throws ObjectCloningException
        Clone an object by given object data.
        Parameters:
        objectToClone - - source object to be cloned.
        Returns:
        cloned object.
        Throws:
        ObjectCloningException - if cannot perform the clone.
      • isPersisted

        default boolean isPersisted​(java.lang.Object object)
        Checks if object is persisted
        Parameters:
        object - object to check
        Returns:
        true if object was persisted, false if not