view storage/core/src/main/java/com/redhat/thermostat/storage/core/DataModifyingStatement.java @ 1239:cd020319d8ed

PR1524: DB write operations should return int on apply(). Reviewed-by: omajid Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-August/008021.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Fri, 23 Aug 2013 17:08:35 +0200
parents b015c7f31a11
children
line wrap: on
line source

package com.redhat.thermostat.storage.core;

import com.redhat.thermostat.storage.model.Pojo;

/**
 * Marker interface for {@link Statement}s which perform write operations on
 * storage. These statements usually only return success/failure responses or
 * more specific error codes.
 *
 */
public interface DataModifyingStatement<T extends Pojo> extends Statement<T> {

    /**
     * Default success status. The status code itself has no meaning other than
     * indicating success. Suitable to be returned on {@link #apply()}.
     */
    public static final int DEFAULT_STATUS_SUCCESS = 0;
    /**
     * Default failure status. The status code itself has no meaning other than
     * indicating failure. Suitable to be returned on {@link #apply()}.
     */
    public static final int DEFAULT_STATUS_FAILURE = -1;
    
    /**
     * Executes this statement.
     * 
     * @return a number greater than or equal to zero on success. A negative
     *         failure code otherwise.
     */
    int apply();
}