// Gets public CalendarReminder getCalendarReminder(long userId, String eventId, Date sendDate) { /** * Find an CalenderReminder, based on the user, event and date of the reminder * * @param userId userId of the CalendarReminder to retrieve * @param eventId eventId of the CalendarReminder to retrieve * @param sendDate Date of the CalendarReminder to retrieve * @return */ CalendarReminder returnValue = new CalendarReminder(); try { String query = "from calendar_reminder in class com.dotmarketing.portlets.calendar.model.CalendarReminder where user_id = ? and event_id = ? and send_date = ?"; HibernateUtil dh = new HibernateUtil(CalendarReminder.class); dh.setQuery(query); dh.setParam(userId); dh.setParam(eventId); dh.setParam(eventId); dh.setParam(sendDate); returnValue = (CalendarReminder) dh.load(); } catch (Exception e) { Logger.warn( CalendarReminderFactoryImpl.class, "getCalendarReminder failed:" + e.getMessage(), e); } finally { return returnValue; } }
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(); }
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(); }
public File get(String inode) throws DotStateException, DotDataException, DotSecurityException { File file = fileCache.get(inode); if ((file == null) || !InodeUtils.isSet(file.getInode())) { file = (File) HibernateUtil.load(File.class, inode); fileCache.add(file); WorkingCache.removeAssetFromCache(file); WorkingCache.addToWorkingAssetToCache(file); LiveCache.removeAssetFromCache(file); if (file.isLive()) { LiveCache.addToLiveAssetToCache(file); } } return file; }