Package com.google.livingstories.server.dataservices.entities

Examples of com.google.livingstories.server.dataservices.entities.UserEntity


    return entity == null ? 0 : entity.getVisitCount();
  }

  @Override
  public synchronized FilterSpec getDefaultStoryView(String userId) {
    UserEntity userEntity = retrieveUserEntity(userId);
    if (userEntity == null) {
      return null;
    } else {
      String defaultStoryView = userEntity.getDefaultLspView();
      return defaultStoryView == null ? null : new FilterSpec(defaultStoryView);
    }
  }
View Full Code Here


  @Override
  public synchronized void setDefaultStoryView(String userId, FilterSpec defaultView) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
   
    try {
      UserEntity userInfo = pm.getObjectById(UserEntity.class, createKey(userId));
      userInfo.setDefaultLspView(defaultView.getFilterParams());
      pm.makePersistent(userInfo);
    } catch (JDOObjectNotFoundException e) {
      UserEntity userInfo = new UserEntity();
      userInfo.setEmailAddress(userId);
      userInfo.setDefaultLspView(defaultView.getFilterParams());
      pm.makePersistent(userInfo);
    } finally {
      pm.close();
    }
  }
View Full Code Here

   * the data for all its child objects so that it can be accessed.
   */
  private UserEntity retrieveUserEntity(String userEmail) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      UserEntity userInfo = pm.getObjectById(UserEntity.class, createKey(userEmail));
      // This step is needed to fetch the data for the child objects
      pm.retrieve(userInfo);
      return userInfo;
    } catch (JDOObjectNotFoundException e) {
      return null;
View Full Code Here

   * persist it to the database.
   */
  private UserEntity createNewUserEntity(String userEmail) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      UserEntity userInfo = new UserEntity();
      userInfo.setEmailAddress(userEmail);
      pm.makePersistent(userInfo);
      return userInfo;
    } finally {
      pm.close();
    }
View Full Code Here

TOP

Related Classes of com.google.livingstories.server.dataservices.entities.UserEntity

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.