All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jnosql.artemis.document.DocumentEventPersistManager Maven / Gradle / Ivy

The newest version!
/*
 *  Copyright (c) 2017 Otávio Santana and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   Otavio Santana
 */
package org.jnosql.artemis.document;


import org.jnosql.diana.api.document.DocumentDeleteQuery;
import org.jnosql.diana.api.document.DocumentEntity;
import org.jnosql.diana.api.document.DocumentQuery;

/**
 * This interface represent the manager of events. When an entity be either saved or updated an event will be fired. This order gonna be:
 * 1) firePreEntity
 * 2) firePreDocumentEntity
 * 3) firePreDocument
 * 4) firePostDocument
 * 5) firePostEntity
 * 6) firePostDocumentEntity
 *
 * @see DocumentWorkflow
 */
public interface DocumentEventPersistManager {

    /**
     * Fire an event after the conversion of the entity to communication API model.
     *
     * @param entity the entity
     */
    void firePreDocument(DocumentEntity entity);

    /**
     * Fire an event after the response from communication layer
     *
     * @param entity the entity
     */
    void firePostDocument(DocumentEntity entity);

    /**
     * Fire an event once the method is called
     *
     * @param entity the entity
     * @param     the entity type
     */
     void firePreEntity(T entity);

    /**
     * Fire an event after convert the {@link DocumentEntity},
     * from database response, to Entity.
     *
     * @param entity the entity
     * @param     the entity kind
     */
     void firePostEntity(T entity);

    /**
     * Fire an event after firePreEntity
     *
     * @param entity the entity
     * @param     the entity type
     */
     void firePreDocumentEntity(T entity);

    /**
     * Fire an event after firePostEntity
     *
     * @param entity the entity
     * @param     the entity kind
     */
     void firePostDocumentEntity(T entity);


    /**
     * Fire an event before the query is executed
     *
     * @param query the query
     */
    void firePreQuery(DocumentQuery query);

    /**
     * Fire an event before the delete query is executed
     *
     * @param query the query
     */
    void firePreDeleteQuery(DocumentDeleteQuery query);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy