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

org.duracloud.snapshot.db.repo.RestoreRepo Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
/*
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 *     http://duracloud.org/license/
 */
package org.duracloud.snapshot.db.repo;

import java.util.List;

import org.duracloud.snapshot.db.model.Restoration;
import org.duracloud.snapshot.dto.RestoreStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author Daniel Bernstein
 *         Date: Jul 21, 2014
 */
@Repository(value="restoreRepo")
public interface RestoreRepo extends JpaRepository {

    /**
     * Returns a list of restorations for a given destinantion host.
     * @param host
     * @return
     */
    public List findByDestinationHost(String host);
    
    /**
     * Returns a list of restorations based on the restoration's snapshot name property.
     * @param name
     * @return
     */
    public List findBySnapshotNameOrderByModifiedDesc(String name);

    /**
     * @param restorationId
     * @return
     */
    public Restoration findByRestorationId(String restorationId);

    /**
     * Returns a list of restorations based on the restoration's status
     * @param status
     * @return
     */
    public List findByStatus(RestoreStatus status);
    
    @Query("select r from Restoration r where r.status not in ('WAITING_FOR_DPN','RESTORATION_COMPLETE','RESTORATION_EXPIRED','ERROR')")
    public List findRunning();
    
    /**
     * Deletes the restore entity
     * @param restoreId
     */
    public void deleteByRestorationId(String restoreId);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy