Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
SIX OVAL - http://code.google.com/p/six-oval/ Copyright (C) 2010 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number: H22PRO-1124 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package jp.go.aist.six.oval.repository;
 
 import java.util.List;
A prescription for the low-level persistent storage operations for the OVAL Domain Model objects. Example storage systems are relational databases, NoSQL databases, and file systems.

The classes of the objects that can be persisted MUST implement the Persistable interface, in addition to the OvalObject. That is, every object in the storage has a persistent identifier. If a relational database is used as the storage, the identifier corresponds to the primary key.

Author(s):
Akihito Nakamura, AIST
Version:
$Id: OvalDatabase.java 3082 2013-03-07 10:49:25Z nakamura5akihito@gmail.com $
 
 public interface OvalDatabase
 {

    
Loads the object of the specified identifier. If no such object exists in the storage, this method returns null.

Parameters:
type the type of the object.
id the identifier of the object.
Returns:
the object if exists, or null otherwise.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
 
     public <K, T extends Persistable<K> & OvalObject>
     T findByIdClass<T> type, K id );



    
Loads all the objects of the specified type.

Parameters:
type the type of the object.
Returns:
all the objects of the specified type.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
 
     public <K, T extends Persistable<K> & OvalObject>
     List<T> findClass<T> type );



    
Searches for the objects that match the specified query parameters.

Parameters:
type the type of the object.
params the parameters to select the objects.
Returns:
all the objects of the specified type.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
 
     public <K, T extends Persistable<K> & OvalObject>
     List<T> findClass<T> typeQueryParams params );



    
Returns identifiers of all the objects of the specified type.

Parameters:
type the type of the object.
Returns:
the identifiers of all the objects.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
    public <K, T extends Persistable<K> & OvalObject>
    List<K> findIdClass<T> type );



    
Searches for the identifiers of the objects that match the specified query parameters.

Parameters:
type the type of the object.
params the parameters to select the objects.
Returns:
the identifiers of all the objects.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
    public <K, T extends Persistable<K> & OvalObject>
    List<K> findIdClass<T> typeQueryParams params );



    
Counts the number of all the objects of the specified type.

Parameters:
type the type of the object.
Returns:
the number of the objects.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
    public <K, T extends Persistable<K> & OvalObject>
    long countClass<T> type );



    
Counts the number of the objects that match the specified query parameters.

Parameters:
type the type of the object.
params the parameters to select the objects.
Returns:
the number of the objects.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
    public <K, T extends Persistable<K> & OvalObject>
    long countClass<T> typeQueryParams params );



    
Saves the object, either inserting or updating the existing one.

Parameters:
type the type of the object.
object the object.
Returns:
the identifier of the object.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
    public <K, T extends Persistable<K> & OvalObject>
    K saveClass<T> type, T object );



    
Removes the object of the specified identifier. If no such object exists, this method returns immediately without any exception.

Parameters:
type the type of the object.
id the identifier of the object.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
    public <K, T extends Persistable<K> & OvalObject>
    void deleteByIdClass<T> type, K id );



    
Removes all the object of the specified type.

Parameters:
type the type of the object.
Throws:
OvalRepositoryException when an exceptional condition occurred during the OVAL repository processing.
    public <K, T extends Persistable<K> & OvalObject>
    void deleteClass<T> type );
//
New to GrepCode? Check out our FAQ X