Example #1
0
  public Folder getFileFolder(File file, String hostId) throws DotDataException {
    HibernateUtil hu = new HibernateUtil(Folder.class);
    hu.setSQLQuery(
        "select {folder.*} from folder,identifier,inode folder_1_ where folder.identifier = identifier.id and "
            + "folder_1_.inode = folder.inode and host_inode = ? and path =(select parent_path from identifier where id=?)");

    hu.setParam(hostId);
    hu.setParam(file.getIdentifier());
    return (Folder) hu.load();
  }
Example #2
0
  public File getLiveFileByFileName(String fileName, Folder folder) throws DotDataException {

    Identifier id = APILocator.getIdentifierAPI().find(folder);

    HibernateUtil hu = new HibernateUtil(File.class);
    hu.setSQLQuery(liveFileByName);
    hu.setParam(id.getPath());
    hu.setParam(fileName);

    return (File) hu.load();
  }
Example #3
0
 @SuppressWarnings("unchecked")
 public File getWorkingFileById(String identifier) throws DotDataException {
   HibernateUtil hu = new HibernateUtil(File.class);
   hu.setSQLQuery(
       "select {file_asset.*} from file_asset, inode file_asset_1_, fileasset_version_info vi "
           + " where file_asset.identifier = ? and vi.identifier=file_asset.identifier and vi.working_inode=file_asset.inode "
           + "and file_asset_1_.inode = file_asset.inode");
   hu.setParam(identifier);
   List<File> files = hu.list();
   if (files.size() == 0) return null;
   return files.get(0);
 }
 @SuppressWarnings("unchecked")
 public static java.util.List<ClickstreamRequest> getClickstreamRequestsByClickStream(
     Clickstream cs) {
   HibernateUtil dh = new HibernateUtil(ClickstreamRequest.class);
   try {
     dh.setSQLQuery(
         "SELECT    {clickstream_request.*}  FROM clickstream_request WHERE  clickstream_id = ? ORDER BY timestampper");
     dh.setParam(cs.getClickstreamId());
     return (List<ClickstreamRequest>) dh.list();
   } catch (DotHibernateException e) {
     Logger.error(
         ClickstreamRequestFactory.class, "getClickstreamRequestsByClickStream: failed", e);
     throw new DotRuntimeException(e.getMessage(), e);
   }
 }
Example #5
0
  @SuppressWarnings("unchecked")
  public List<File> getAllHostFiles(Host host, boolean live) throws DotDataException {
    HibernateUtil hu = new HibernateUtil(File.class);
    StringBuilder queryBuilder =
        new StringBuilder(
            "select {file_asset.*} from file_asset, inode file_asset_1_,identifier ident, fileasset_version_info vi "
                + "where file_asset.inode = file_asset_1_.inode and "
                + "file_asset.identifier = ident.id and asset_type='file_asset' and ident.id=vi.identifier "
                + " and ident.host_inode = ? ");
    if (live) queryBuilder.append(" and vi.live_inode=file_asset.inode ");
    else queryBuilder.append(" and vi.working_inode=file_asset.inode ");

    hu.setSQLQuery(queryBuilder.toString());
    hu.setParam(host.getIdentifier());

    return hu.list();
  }