Package org.apache.mahout.cf.taste.common

Examples of org.apache.mahout.cf.taste.common.NoSuchUserException


      while (rs.next()) {
        prefs.add(buildPreference(rs));
      }

      if (prefs.isEmpty()) {
        throw new NoSuchUserException(userID);
      }

      return new GenericUserPreferenceArray(prefs);

    } catch (SQLException sqle) {
View Full Code Here


      while (rs.next()) {
        result.add(getLongColumn(rs, 2));
      }

      if (result.isEmpty()) {
        throw new NoSuchUserException(userID);
      }

      return result;

    } catch (SQLException sqle) {
View Full Code Here

   */
  @Override
  public PreferenceArray getPreferencesFromUser(long userID) throws NoSuchUserException {
    PreferenceArray prefs = preferenceFromUsers.get(userID);
    if (prefs == null) {
      throw new NoSuchUserException(userID);
    }
    return prefs;
  }
View Full Code Here

    if (timestamps == null) {
      return null;
    }
    FastByIDMap<Long> itemTimestamps = timestamps.get(userID);
    if (itemTimestamps == null) {
      throw new NoSuchUserException(userID);
    }
    return itemTimestamps.get(itemID);
  }
View Full Code Here

      SliceQuery<Long,Long,Float> query = buildValueSliceQuery(USERS_CF);
      query.setKey(userID);

      ColumnSlice<Long,Float> result = query.execute().get();
      if (result == null) {
        throw new NoSuchUserException(userID);
      }
      List<HColumn<Long,Float>> itemIDColumns = result.getColumns();
      if (itemIDColumns.isEmpty()) {
        throw new NoSuchUserException(userID);
      }
      int size = itemIDColumns.size();
      PreferenceArray prefs = new GenericUserPreferenceArray(size);
      prefs.setUserID(0, userID);
      for (int i = 0; i < size; i++) {
View Full Code Here

      SliceQuery<Long,Long,byte[]> query = buildNoValueSliceQuery(USERS_CF);
      query.setKey(userID);
      FastIDSet itemIDs = new FastIDSet();
      ColumnSlice<Long,byte[]> result = query.execute().get();
      if (result == null) {
        throw new NoSuchUserException(userID);
      }
      List<HColumn<Long,byte[]>> columns = result.getColumns();
      if (columns.isEmpty()) {
        throw new NoSuchUserException(userID);
      }
      for (HColumn<Long,?> itemIDColumn : columns) {
        itemIDs.add(itemIDColumn.getName());
      }
      return itemIDs;
View Full Code Here

      if (itemIsObject && !ID_PATTERN.matcher(item.get(0)).matches()) {
        throw new IllegalArgumentException();
      }
    }
    if (!add && !isIDInModel(userID)) {
      throw new NoSuchUserException();
    }
    for (List<String> item : items) {
      if (!add && !isIDInModel(item.get(0))) {
        throw new NoSuchItemException();
      }
View Full Code Here

    } catch (IOException e) {
      throw new TasteException("Failed to retrieve user preferences from HBase", e);
    }

    if (result.isEmpty()) {
      throw new NoSuchUserException(userID);
    }

    SortedMap<byte[], byte[]> families = result.getFamilyMap(ITEMS_CF);
    PreferenceArray prefs = new GenericUserPreferenceArray(families.size());
    prefs.setUserID(0, userID);
View Full Code Here

    } catch (IOException e) {
      throw new TasteException("Failed to retrieve item IDs from HBase", e);
    }

    if (result.isEmpty()) {
      throw new NoSuchUserException(userID);
    }

    SortedMap<byte[],byte[]> families = result.getFamilyMap(ITEMS_CF);
    FastIDSet ids = new FastIDSet(families.size());
    for (byte[] family : families.keySet()) {
View Full Code Here

    } catch (IOException e) {
      throw new TasteException("Failed to retrieve user preferences from HBase", e);
    }

    if (result.isEmpty()) {
      throw new NoSuchUserException(userID);
    }

    if (result.containsColumn(ITEMS_CF, Bytes.toBytes(itemID))) {
      return Bytes.toFloat(result.getValue(ITEMS_CF, Bytes.toBytes(itemID)));
    } else {
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.common.NoSuchUserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.