com.trendmicro.grid.acl.ds.jpa
Class JpaPackageRepository

java.lang.Object
  extended by com.trendmicro.grid.acl.ds.jpa.JpaPackageRepository
All Implemented Interfaces:
com.trendmicro.grid.acl.ds.PackageProvider, com.trendmicro.grid.acl.ds.Repository

@Repository
@Transactional(readOnly=true)
public class JpaPackageRepository
extends Object
implements com.trendmicro.grid.acl.ds.PackageProvider

Implements FileProvider using JPA.

Version:
1.0
Author:
juergen_kellerer, 2010-06-11

Constructor Summary
JpaPackageRepository()
           
 
Method Summary
 Map<com.trendmicro.grid.acl.l0.datatypes.NamedFileIdentifier,JpaNamedFileIdentifier> getFilesContainedInPackage(JpaPackageDetails packageDetails)
          Returns a map of contained files for the given package details.
 com.trendmicro.grid.acl.ds.datatypes.SharedNamedFileIdentifierListPage getFilesContainedInPackageById(com.trendmicro.grid.acl.l0.datatypes.FileIdentifier packageFile, int pageNumber)
           
 com.trendmicro.grid.acl.ds.datatypes.SharedNamedFileIdentifierListPage getFilesContainedInPackageByName(String packageName, int pageNumber)
           
 Collection<JpaPackageDetails> getJpaPackageDetailsListById(Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> files)
          Returns the package details on the given package file ids.
 Collection<JpaPackageDetails> getJpaPackageDetailsListByName(Collection<String> packageNames)
          Returns the package details on the given package names.
 com.trendmicro.grid.acl.l0.datatypes.NameListPage getMatchingPackageNames(com.trendmicro.grid.acl.ds.TagQueryExpression expression, com.trendmicro.grid.acl.l0.datatypes.Range range, int pageNumber)
           
 Collection<com.trendmicro.grid.acl.ds.datatypes.SharedPackageDetails> getPackageDetailsListById(Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> files)
           
 Collection<com.trendmicro.grid.acl.ds.datatypes.SharedPackageDetails> getPackageDetailsListByName(Collection<String> packageNames)
           
 Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> getPackageFileIdentifiersByName(Collection<String> packageNames)
           
 Collection<com.trendmicro.grid.acl.ds.datatypes.SharedPackageInformation> getPackageInformationListById(Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> files)
           
 Collection<com.trendmicro.grid.acl.ds.datatypes.SharedPackageInformation> getPackageInformationListByName(Collection<String> packageNames)
           
 com.trendmicro.grid.acl.l0.datatypes.NameListPage getPackageNamesInFamily(String packageFamilyName, int pageNumber)
           
 Integer getPackagePrimaryKeyByName(String packageName)
          Returns the primary key of the specified package or 'null' if it does not exist.
 com.trendmicro.grid.acl.l0.datatypes.NameListPage getPackagesContainedInPackageById(com.trendmicro.grid.acl.l0.datatypes.FileIdentifier packageFile, int pageNumber)
           
 com.trendmicro.grid.acl.l0.datatypes.NameListPage getPackagesContainedInPackageByName(String packageName, int pageNumber)
           
static int getPageSize()
           
 com.trendmicro.grid.acl.l0.datatypes.NameListPage getReferencingPackageNames(String packageName, int pageNumber)
           
 com.trendmicro.grid.acl.l0.datatypes.NameListPage getReferencingPackageNamesById(com.trendmicro.grid.acl.l0.datatypes.FileIdentifier file, int pageNumber)
           
 Collection<Boolean> isPackagesTaggedWithById(Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> files, String[] tags)
           
 Collection<Boolean> isPackagesTaggedWithByName(Collection<String> packageNames, String[] tags)
           
static void setPageSize(int pageSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JpaPackageRepository

public JpaPackageRepository()
Method Detail

getPageSize

public static int getPageSize()

setPageSize

public static void setPageSize(int pageSize)

getPackageNamesInFamily

public com.trendmicro.grid.acl.l0.datatypes.NameListPage getPackageNamesInFamily(String packageFamilyName,
                                                                                 int pageNumber)
Specified by:
getPackageNamesInFamily in interface com.trendmicro.grid.acl.ds.PackageProvider

isPackagesTaggedWithById

public Collection<Boolean> isPackagesTaggedWithById(Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> files,
                                                    String[] tags)
Specified by:
isPackagesTaggedWithById in interface com.trendmicro.grid.acl.ds.PackageProvider

isPackagesTaggedWithByName

public Collection<Boolean> isPackagesTaggedWithByName(Collection<String> packageNames,
                                                      String[] tags)
Specified by:
isPackagesTaggedWithByName in interface com.trendmicro.grid.acl.ds.PackageProvider

getMatchingPackageNames

public com.trendmicro.grid.acl.l0.datatypes.NameListPage getMatchingPackageNames(com.trendmicro.grid.acl.ds.TagQueryExpression expression,
                                                                                 com.trendmicro.grid.acl.l0.datatypes.Range range,
                                                                                 int pageNumber)
Specified by:
getMatchingPackageNames in interface com.trendmicro.grid.acl.ds.PackageProvider

getFilesContainedInPackageById

public com.trendmicro.grid.acl.ds.datatypes.SharedNamedFileIdentifierListPage getFilesContainedInPackageById(com.trendmicro.grid.acl.l0.datatypes.FileIdentifier packageFile,
                                                                                                             int pageNumber)
Specified by:
getFilesContainedInPackageById in interface com.trendmicro.grid.acl.ds.PackageProvider

getFilesContainedInPackageByName

public com.trendmicro.grid.acl.ds.datatypes.SharedNamedFileIdentifierListPage getFilesContainedInPackageByName(String packageName,
                                                                                                               int pageNumber)
Specified by:
getFilesContainedInPackageByName in interface com.trendmicro.grid.acl.ds.PackageProvider

getFilesContainedInPackage

public Map<com.trendmicro.grid.acl.l0.datatypes.NamedFileIdentifier,JpaNamedFileIdentifier> getFilesContainedInPackage(JpaPackageDetails packageDetails)
Returns a map of contained files for the given package details.

Note: It is adviceable to use the values of the map only to satisfy foreign key dependencies as all operations cause lazy loading of file or package detail resources.

Parameters:
packageDetails - the package details to lookup all contained files for.
Returns:
a map of contained files for the given package details.

getReferencingPackageNamesById

public com.trendmicro.grid.acl.l0.datatypes.NameListPage getReferencingPackageNamesById(com.trendmicro.grid.acl.l0.datatypes.FileIdentifier file,
                                                                                        int pageNumber)
Specified by:
getReferencingPackageNamesById in interface com.trendmicro.grid.acl.ds.PackageProvider

getReferencingPackageNames

public com.trendmicro.grid.acl.l0.datatypes.NameListPage getReferencingPackageNames(String packageName,
                                                                                    int pageNumber)
Specified by:
getReferencingPackageNames in interface com.trendmicro.grid.acl.ds.PackageProvider

getPackagesContainedInPackageById

public com.trendmicro.grid.acl.l0.datatypes.NameListPage getPackagesContainedInPackageById(com.trendmicro.grid.acl.l0.datatypes.FileIdentifier packageFile,
                                                                                           int pageNumber)
Specified by:
getPackagesContainedInPackageById in interface com.trendmicro.grid.acl.ds.PackageProvider

getPackagesContainedInPackageByName

public com.trendmicro.grid.acl.l0.datatypes.NameListPage getPackagesContainedInPackageByName(String packageName,
                                                                                             int pageNumber)
Specified by:
getPackagesContainedInPackageByName in interface com.trendmicro.grid.acl.ds.PackageProvider

getPackageInformationListById

public Collection<com.trendmicro.grid.acl.ds.datatypes.SharedPackageInformation> getPackageInformationListById(Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> files)
Specified by:
getPackageInformationListById in interface com.trendmicro.grid.acl.ds.PackageProvider

getPackageInformationListByName

public Collection<com.trendmicro.grid.acl.ds.datatypes.SharedPackageInformation> getPackageInformationListByName(Collection<String> packageNames)
Specified by:
getPackageInformationListByName in interface com.trendmicro.grid.acl.ds.PackageProvider

getPackageDetailsListById

public Collection<com.trendmicro.grid.acl.ds.datatypes.SharedPackageDetails> getPackageDetailsListById(Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> files)
Specified by:
getPackageDetailsListById in interface com.trendmicro.grid.acl.ds.PackageProvider

getJpaPackageDetailsListById

public Collection<JpaPackageDetails> getJpaPackageDetailsListById(Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> files)
Returns the package details on the given package file ids.

Parameters:
files - The SHA1 hashes of the package files.
Returns:
the package details on the given package file ids.

getPackageDetailsListByName

public Collection<com.trendmicro.grid.acl.ds.datatypes.SharedPackageDetails> getPackageDetailsListByName(Collection<String> packageNames)
Specified by:
getPackageDetailsListByName in interface com.trendmicro.grid.acl.ds.PackageProvider

getJpaPackageDetailsListByName

public Collection<JpaPackageDetails> getJpaPackageDetailsListByName(Collection<String> packageNames)
Returns the package details on the given package names.

Parameters:
packageNames - The names the packages to lookup.
Returns:
the package details on the given package names.

getPackageFileIdentifiersByName

public Collection<com.trendmicro.grid.acl.l0.datatypes.FileIdentifier> getPackageFileIdentifiersByName(Collection<String> packageNames)
Specified by:
getPackageFileIdentifiersByName in interface com.trendmicro.grid.acl.ds.PackageProvider

getPackagePrimaryKeyByName

public Integer getPackagePrimaryKeyByName(String packageName)
Returns the primary key of the specified package or 'null' if it does not exist.

Parameters:
packageName - the name of the package to lookup.
Returns:
the primary key of the package or 'null' if it does not exist.