public User getByName(String username) { CriteriaBuilder criteriaBuilder = ... try { return em.createQuery(query).getSingleResult(); } catch (NoSuchResultException e){ // Note: this is a System Exception throw new NoSuchUserException(username); } }
@Override public Recommender buildRecommender(DataModel model) throws TasteException { try { return new LibimsetiRecommender(model); } catch (IOException ioe) { throw new TasteException(ioe); } } };
@Override public PreferenceArray getPreferencesForItem(long itemID) throws NoSuchItemException { PreferenceArray prefs = preferenceForItems.get(itemID); if (prefs == null) { throw new NoSuchItemException(itemID); } return prefs; }
try { currentUser=(String) userList.nextElement(); currentPass=(String) credentials.get(currentUser); } catch(NoSuchElementException nsee) { ^^^^^^^ System.err.println("Is properties file blank?"); throw new NoSuchUserException("Is properties file blank?"); ^^^^ }
@Override public PreferenceArray getPreferencesForItem(long itemID) throws NoSuchItemException { PreferenceArray prefs = preferenceForItems.get(itemID); if (prefs == null) { throw new NoSuchItemException(itemID); } return prefs; }
@Override public PreferenceArray getPreferencesFromUser(long userID) throws TasteException { if (userID == TEMP_USER_ID) { if (tempPrefs == null) { throw new NoSuchUserException(TEMP_USER_ID); } return tempPrefs; } return delegate.getPreferencesFromUser(userID); }
public double[] getItemFeatures(long itemID) throws NoSuchItemException { Integer index = itemIDMapping.get(itemID); if (index == null) { throw new NoSuchItemException(itemID); } return itemFeatures[index]; }
@Override public FastIDSet getItemIDsFromUser(long userID) throws TasteException { if (userID == TEMP_USER_ID) { if (tempPrefs == null) { throw new NoSuchUserException(TEMP_USER_ID); } return prefItemIDs; } return delegate.getItemIDsFromUser(userID); }
public int itemIndex(long itemID) throws NoSuchItemException { Integer index = itemIDMapping.get(itemID); if (index == null) { throw new NoSuchItemException(itemID); } return index; }
/** * @throws NoSuchUserException * if there is no such user */ @Override public PreferenceArray getPreferencesFromUser(long userID) throws NoSuchUserException { PreferenceArray prefs = preferenceFromUsers.get(userID); if (prefs == null) { throw new NoSuchUserException(userID); } return prefs; }
/** * @throws NoSuchUserException * if there is no such user */ @Override public PreferenceArray getPreferencesFromUser(long userID) throws NoSuchUserException { PreferenceArray prefs = preferenceFromUsers.get(userID); if (prefs == null) { throw new NoSuchUserException(userID); } return prefs; }
@Override public FastIDSet getItemIDsFromUser(long userID) throws TasteException { FastIDSet itemIDs = preferenceFromUsers.get(userID); if (itemIDs == null) { throw new NoSuchUserException(userID); } return itemIDs; }
@Override public Long getPreferenceTime(long userID, long itemID) throws TasteException { if (userID == TEMP_USER_ID) { if (tempPrefs == null) { throw new NoSuchUserException(TEMP_USER_ID); } return null; } return delegate.getPreferenceTime(userID, itemID); }
public int userIndex(long userID) throws NoSuchUserException { Integer index = userIDMapping.get(userID); if (index == null) { throw new NoSuchUserException(userID); } return index; }
@Override public FastIDSet getItemIDsFromUser(long userID) throws TasteException { if (userID == TEMP_USER_ID) { if (tempPrefs == null) { throw new NoSuchUserException(TEMP_USER_ID); } return prefItemIDs; } return delegate.getItemIDsFromUser(userID); }
public int userIndex(long userID) throws NoSuchUserException { Integer index = userIDMapping.get(userID); if (index == null) { throw new NoSuchUserException(userID); } return index; }
@Override public Long getPreferenceTime(long userID, long itemID) throws TasteException { if (timestamps == null) { return null; } FastByIDMap<Long> itemTimestamps = timestamps.get(userID); if (itemTimestamps == null) { throw new NoSuchUserException(userID); } return itemTimestamps.get(itemID); }
@Override public Long getPreferenceTime(long userID, long itemID) throws TasteException { if (timestamps == null) { return null; } FastByIDMap<Long> itemTimestamps = timestamps.get(userID); if (itemTimestamps == null) { throw new NoSuchUserException(userID); } return itemTimestamps.get(itemID); }
@Override public Long getPreferenceTime(long userID, long itemID) throws TasteException { if (timestamps == null) { return null; } FastByIDMap<Long> itemTimestamps = timestamps.get(userID); if (itemTimestamps == null) { throw new NoSuchUserException(userID); } return itemTimestamps.get(itemID); }
@Override public Long getPreferenceTime(long userID, long itemID) throws TasteException { if (timestamps == null) { return null; } FastByIDMap<Long> itemTimestamps = timestamps.get(userID); if (itemTimestamps == null) { throw new NoSuchUserException(userID); } return itemTimestamps.get(itemID); }