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); } }
output(request, response, similar); } catch (NoSuchUserException nsue) { response.sendError(HttpServletResponse.SC_NOT_FOUND, nsue.toString()); } catch (NoSuchItemException nsie) { response.sendError(HttpServletResponse.SC_NOT_FOUND, nsie.toString());
log.debug("No such user exception. Skipping recommendations for user {}", e.getMessage()); } finally { counter++;
output(request, response, recommended); } catch (NoSuchUserException nsue) { response.sendError(HttpServletResponse.SC_NOT_FOUND, nsue.toString()); } catch (NotReadyException nre) { response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, nre.toString());
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?"); ^^^^ }
output(request, response, recommended); } catch (NoSuchUserException nsue) { response.sendError(HttpServletResponse.SC_NOT_FOUND, nsue.toString()); } catch (NotReadyException nre) { response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, nre.toString());
@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); }
@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); }
@Override public void removePreference(long userID, long itemID) throws TasteException { if (userID == TEMP_USER_ID) { if (tempPrefs == null) { throw new NoSuchUserException(TEMP_USER_ID); } throw new UnsupportedOperationException(); } delegate.removePreference(userID, itemID); }
/** * @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 void setPreference(long userID, long itemID, float value) throws TasteException { if (userID == TEMP_USER_ID) { if (tempPrefs == null) { throw new NoSuchUserException(TEMP_USER_ID); } throw new UnsupportedOperationException(); } delegate.setPreference(userID, itemID, value); }
public double[] getUserFeatures(long userID) throws NoSuchUserException { Integer index = userIDMapping.get(userID); if (index == null) { throw new NoSuchUserException(userID); } return userFeatures[index]; }
public int userIndex(long userID) throws NoSuchUserException { Integer index = userIDMapping.get(userID); if (index == null) { throw new NoSuchUserException(userID); } return index; }
@Override public void removePreference(long userID, long itemID) throws TasteException { if (userID == TEMP_USER_ID) { if (tempPrefs == null) { throw new NoSuchUserException(TEMP_USER_ID); } throw new UnsupportedOperationException(); } delegate.removePreference(userID, itemID); }
@Override public FastIDSet getItemIDsFromUser(long userID) throws TasteException { FastIDSet itemIDs = preferenceFromUsers.get(userID); if (itemIDs == null) { throw new NoSuchUserException(userID); } return itemIDs; }
public double[] getUserFeatures(long userID) throws NoSuchUserException { Integer index = userIDMapping.get(userID); if (index == null) { throw new NoSuchUserException(userID); } return userFeatures[index]; }
@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); }
@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 double[] getUserFeatures(long userID) throws NoSuchUserException { Integer index = userIDMapping.get(userID); if (index == null) { throw new NoSuchUserException(userID); } return userFeatures[index]; }