/**
  * 显示人员所在的部门
  *
  * @param user 人员对象
  */
 public void showUserDeps(User user) {
   for (DepUserModel du : depUserCol) {
     if (du.getUserId().equals(user.getUserId())) {
       System.out.println("人员编号=" + user.getUserId() + "属于部门编号是:" + du.getDepId());
     }
   }
 }
Exemplo n.º 2
0
  @Test
  public void testLoadTwoRootObjectsWithNoType() throws JsonProcessingException {
    JsonNode data =
        mapper
            .createArrayNode()
            .add(
                mapper.createObjectNode().put("userId", "1").put("name", "Paul").put("sex", "MALE"))
            .add(
                mapper
                    .createObjectNode()
                    .put("userId", "2")
                    .put("name", "Anna")
                    .put("sex", "FEMALE"));

    Resource result =
        mapper
            .reader()
            .withAttribute(RESOURCE_SET, resourceSet)
            .withAttribute(ROOT_ELEMENT, ModelPackage.Literals.USER)
            .treeToValue(data, Resource.class);

    assertNotNull(result);
    assertEquals(2, result.getContents().size());

    User first = (User) result.getContents().get(0);
    User second = (User) result.getContents().get(1);

    assertEquals("1", first.getUserId());
    assertEquals("Paul", first.getName());
    assertEquals("MALE", first.getSex().getLiteral());

    assertEquals("2", second.getUserId());
    assertEquals("Anna", second.getName());
    assertEquals("FEMALE", second.getSex().getLiteral());
  }
Exemplo n.º 3
0
 public void update(User user) {
   if (user == null || !USERS_TABLE.containsKey(user.getUserId())) {
     throw new RuntimeException(
         "Unable to update User. User object is null or User Id ["
             + user.getUserId()
             + "] is invalid.");
   }
   USERS_TABLE.put(user.getUserId(), user);
 }
  public User updateUser(User user) throws UserNotFoundException {
    User existingUser = this.getUser(user.getUserId());

    if (existingUser == null) {
      throw new UserNotFoundException(user.getUserId());
    }

    return user;
  }
Exemplo n.º 5
0
  public ArrayList<Receipt> getReceipts(User user) {
    ArrayList<Receipt> toReturn = new ArrayList<Receipt>();
    connect();
    try {
      // Create a stmt object
      stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

      // Query the database, storing the result
      // in an object of type ResultSet
      rs =
          stmt.executeQuery(
              "SELECT * from Receipt WHERE " + "Receipt.UserId='" + user.getUserId() + "'");

      // Check if User is already in the database
      while (rs.next()) {
        String receiptId = rs.getString("ReceiptId");
        String userId = rs.getString("UserId");
        String receiptNumber = rs.getString("ReceiptNumber");
        String date = rs.getString("Date");
        Receipt toAdd = new Receipt(receiptId, userId, receiptNumber, date);
        toReturn.add(toAdd);
      } // end while loop
    } catch (Exception e) {
      e.printStackTrace();
    } // end catch
    finally {
      disconnect();
    }
    return toReturn;
  }
  @Test
  public void testExecute_WithSecondState() throws Exception {
    User user = TestUtil.createUser();
    user.setActiveted(null);
    Site parentSite = TestUtil.createSite();
    DraftChildSiteRegistration registration = TestUtil.createChildSiteRegistration(parentSite);
    ChildSiteSettings settings = TestUtil.createChildSiteSettings(registration, parentSite);
    settings.setCreatedDate(new Date());
    settings.setUserId(user.getUserId());
    settings.setConfirmCode("confirm");
    action.setSettingsId(settings.getChildSiteSettingsId());
    action.setConfirmCode("confirm");

    DraftChildSiteRegistration childSiteRegistration =
        TestUtil.createChildSiteRegistration("name", "comment");
    childSiteRegistration.setBlueprintsId(Arrays.asList(1, 2));
    settings.setRequiredToUseSiteBlueprint(true);
    settings.setSitePaymentSettings(new SitePaymentSettings());
    settings.setChildSiteRegistration(childSiteRegistration);

    Assert.assertNull(user.getActiveted());
    Assert.assertNull(new UsersManager().getLoginedUser());

    ForwardResolution resolutionMock = (ForwardResolution) action.show();
    Assert.assertNotNull(new UsersManager().getLoginedUser());
    Assert.assertEquals(user, new UsersManager().getLoginedUser());
    Assert.assertEquals(
        "/account/registration/childSiteRigistrationConfirmationSecondState.jsp",
        resolutionMock.getPath());

    Assert.assertNotNull(user.getActiveted());
    Assert.assertNotNull(new UsersManager().getLoginedUser());
    Assert.assertEquals(user, new UsersManager().getLoginedUser());
    Assert.assertNull(action.getTellFriendHtml());
  }
Exemplo n.º 7
0
  public Float getMovesDone() {
    if (currentPlayer == null) {
      return null;
    }

    Integer total = 0;
    Integer voted = 0;

    try {
      if (getRequirementsMatrixData() != null) {
        for (RequirementsMatrixData data : getRequirementsMatrixData()) {
          for (PlayerMove pm : data.getPlayerMoves()) {
            if (pm.getPlayer().getUserId().equals(currentPlayer.getUserId())) {
              total++;
              if (pm.getPlayed() == true && pm.getValue() != null && !pm.getValue().equals(-1l)) {
                voted++;
              }
            }
          }
        }
      }
      return total.equals(0) ? 0f : new Float(voted);
    } catch (Exception ex) {
      return -1f;
    }
  }
  @Test
  public void getForumsByUserId() {
    User user = new User();
    user.setPassword("1");
    user.setEmail("a");
    user.setRegistrationDate(new Date());
    persistance.putUser(user);

    Site site = new Site();
    site.getSitePaymentSettings().setUserId(-1);
    site.setSubDomain("$");
    site.getThemeId().setTemplateDirectory("f");
    site.getThemeId().setThemeCss("G");
    site.setTitle("F");
    persistance.putSite(site);

    UserOnSiteRight userOnUserRight = new UserOnSiteRight();
    userOnUserRight.setActive(true);
    userOnUserRight.setSiteAccessType(SiteAccessLevel.ADMINISTRATOR);
    user.addUserOnSiteRight(userOnUserRight);
    site.addUserOnSiteRight(userOnUserRight);
    persistance.putUserOnSiteRight(userOnUserRight);

    DraftForum forum = new DraftForum();
    forum.setSiteId(site.getSiteId());
    forum.setName("name");
    persistance.putItem(forum);

    List<DraftItem> userForums =
        persistance.getDraftItemsByUserId(user.getUserId(), ItemType.FORUM);
    Assert.assertEquals(forum, userForums.get(0));
  }
  @Test
  public void getForumPostsByUserIdWithOther() {
    final User user = new User();
    user.setEmail("a");
    user.setRegistrationDate(new Date());
    persistance.putUser(user);

    DraftForum forum = new DraftForum();
    forum.setName("name");
    persistance.putItem(forum);

    SubForum subForum = new SubForum();
    subForum.setSubForumName("ffff");
    subForum.setSubForumDescription("ffff1");
    forum.addSubForum(subForum);
    persistance.putSubForum(subForum);

    ForumThread forumThread = new ForumThread();
    forumThread.setThreadName("f");
    forumThread.setThreadDescription("f2");
    forumThread.setUpdateDate(new Date());
    subForum.addForumThread(forumThread);
    persistance.putForumThread(forumThread);

    ForumPost forumPost = new ForumPost();
    forumPost.setText("bbb");
    forumPost.setAuthor(user);
    forumPost.setDateCreated(new Date(System.currentTimeMillis() * 2));
    forumThread.addForumPost(forumPost);
    persistance.putForumPost(forumPost);

    List<ForumPost> forumPosts = persistance.getForumPostsByUserId(user.getUserId() + 9);
    Assert.assertEquals(0, forumPosts.size());
  }
Exemplo n.º 10
0
  public User putUser(User user) throws RESTLightClientException {
    Document docReq = buildUser(user);

    Document docResp = putWithResponse(USER_PATH + "/" + user.getUserId(), null, docReq);

    return parseUser(docResp);
  }
  @Test
  public void getForumThreadsByUserIdWithNotFound() {
    final User user = new User();
    user.setEmail("a");
    user.setRegistrationDate(new Date());
    persistance.putUser(user);

    DraftForum forum = new DraftForum();
    forum.setName("name");
    persistance.putItem(forum);

    SubForum subForum = new SubForum();
    subForum.setSubForumName("ffff");
    subForum.setSubForumDescription("ffff1");
    forum.addSubForum(subForum);
    persistance.putSubForum(subForum);

    ForumThread forumThread1 = new ForumThread();
    forumThread1.setThreadName("f");
    forumThread1.setThreadDescription("f2");
    forumThread1.setUpdateDate(new Date());
    forumThread1.setAuthor(user);
    subForum.addForumThread(forumThread1);
    persistance.putForumThread(forumThread1);

    List<ForumThread> forumThreads = persistance.getForumThreadsByUserId(user.getUserId() + 90);
    Assert.assertEquals(0, forumThreads.size());
  }
  @Test
  public void getForumsByUserIdWithoutActive() {
    User user = new User();
    user.setPassword("1");
    user.setEmail("a");
    user.setRegistrationDate(new Date());
    persistance.putUser(user);

    Site site = new Site();
    site.getSitePaymentSettings().setUserId(-1);
    site.setSubDomain("$");
    site.getThemeId().setTemplateDirectory("f");
    site.getThemeId().setThemeCss("G");
    site.setTitle("F");
    persistance.putSite(site);

    DraftForum forum = new DraftForum();
    forum.setSiteId(site.getSiteId());
    forum.setName("name");
    persistance.putItem(forum);

    List<DraftItem> userForums =
        persistance.getDraftItemsByUserId(user.getUserId(), ItemType.FORUM);
    Assert.assertEquals(0, userForums.size());
  }
Exemplo n.º 13
0
  private Document buildUser(User user) {
    Element root = new Element(USER_REQUEST_ELEMENT);

    Document doc = new Document().setRootElement(root);

    Element data = new Element("data");

    root.addContent(data);

    data.addContent(new Element(USER_ID_ELEMENT).setText(user.getUserId()));
    data.addContent(new Element(USER_NAME_ELEMENT).setText(user.getName()));
    data.addContent(new Element(USER_STATUS_ELEMENT).setText(user.getStatus()));
    data.addContent(new Element(USER_EMAIL_ELEMENT).setText(user.getEmail()));

    Element roles = new Element(USER_ROLES_ELEMENT);

    for (String role : user.getRoles()) {
      roles.addContent(new Element(USER_ROLE_ELEMENT).setText(role));
    }

    data.addContent(roles);

    data.addContent(
        new Element(USER_USER_MANAGED_ELEMENT).setText(user.isUserManaged() ? "true" : "false"));

    return doc;
  }
 public User getUser(String userId) {
   for (User user : this.getUsers()) {
     if (user.getUserId().equals(userId)) {
       return user;
     }
   }
   return null;
 }
Exemplo n.º 15
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#updateUser(org.openiam
   * .idm.srvc.user.dto.User)
   */
  @Transactional
  public void updateUser(User user) {
    if (user == null) throw new NullPointerException("user object is null");
    if (user.getUserId() == null) throw new NullPointerException("user id is null");

    user.setLastUpdate(new Date(System.currentTimeMillis()));

    userDao.update(userDozerConverter.convertToEntity(user, true));
  }
  public Set<String> listUserIds() {
    Set<String> userIds = new HashSet<String>();

    for (User user : this.getUsers()) {
      userIds.add(user.getUserId());
    }

    return userIds;
  }
  private void _buildParentGroupsBreadcrumb(
      LayoutSet layoutSet, PortletURL portletURL, ThemeDisplay themeDisplay, StringBundler sb)
      throws Exception {
    Group group = layoutSet.getGroup();

    if (group.isOrganization()) {
      Organization organization =
          OrganizationLocalServiceUtil.getOrganization(group.getOrganizationId());

      Organization parentOrganization = organization.getParentOrganization();

      if (parentOrganization != null) {
        Group parentGroup = parentOrganization.getGroup();

        LayoutSet parentLayoutSet =
            LayoutSetLocalServiceUtil.getLayoutSet(
                parentGroup.getGroupId(), layoutSet.isPrivateLayout());

        _buildParentGroupsBreadcrumb(parentLayoutSet, portletURL, themeDisplay, sb);
      }
    } else if (group.isUser()) {
      User groupUser = UserLocalServiceUtil.getUser(group.getClassPK());

      List<Organization> organizations =
          OrganizationLocalServiceUtil.getUserOrganizations(groupUser.getUserId(), true);

      if (!organizations.isEmpty()) {
        Organization organization = organizations.get(0);

        Group parentGroup = organization.getGroup();

        LayoutSet parentLayoutSet =
            LayoutSetLocalServiceUtil.getLayoutSet(
                parentGroup.getGroupId(), layoutSet.isPrivateLayout());

        _buildParentGroupsBreadcrumb(parentLayoutSet, portletURL, themeDisplay, sb);
      }
    }

    int layoutsPageCount = 0;

    if (layoutSet.isPrivateLayout()) {
      layoutsPageCount = group.getPrivateLayoutsPageCount();
    } else {
      layoutsPageCount = group.getPublicLayoutsPageCount();
    }

    if ((layoutsPageCount > 0) && !group.getName().equals(GroupConstants.GUEST)) {
      String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay);

      sb.append("<li><span><a href=\"");
      sb.append(layoutSetFriendlyURL);
      sb.append("\">");
      sb.append(HtmlUtil.escape(group.getDescriptiveName()));
      sb.append("</a></span></li>");
    }
  }
Exemplo n.º 18
0
 public PageList findProfiles(User user, int startingRow, int listSize) throws Exception {
   Session session = HibernateSessionFactory.getSession();
   try {
     UserDAO dao = new UserDAO();
     return dao.findProfiles(user.getUserId(), startingRow, listSize);
   } finally {
     HibernateSessionFactory.closeSession();
   }
 }
 @Test
 public void getUserInfo() throws Exception {
   User userInfo = module.getUserInfo();
   assertNotNull(userInfo);
   assertFalse(userInfo.getUserId().isEmpty());
   assertFalse(userInfo.getUserEmail().isEmpty());
   assertEquals(System.getenv("zuoraUsername"), userInfo.getUsername());
   assertFalse(userInfo.getTenantId().isEmpty());
   assertFalse(userInfo.getTenantName().isEmpty());
 }
 public User updateUser(User user) {
   int count =
       entityManager
           .createQuery("UPDATE User SET userName=:userName , password=:passwd WHERE userId=:uid")
           .setParameter("userName", user.getUserName())
           .setParameter("passwd", user.getPassword())
           .executeUpdate();
   System.out.println("Records Updated:" + count);
   return entityManager.find(User.class, user.getUserId());
 }
  @Test
  public void getFormFiltersByUserId_and_getFormFilterByNameAndUserId() {
    User user = new User();
    user.setPassword("1");
    user.setEmail("a");
    user.setRegistrationDate(new Date());
    persistance.putUser(user);

    Site site = new Site();
    site.getSitePaymentSettings().setUserId(-1);
    site.setSubDomain("$");
    site.getThemeId().setTemplateDirectory("f");
    site.getThemeId().setThemeCss("G");
    site.setTitle("F");
    persistance.putSite(site);

    UserOnSiteRight userOnUserRight = new UserOnSiteRight();
    userOnUserRight.setActive(true);
    userOnUserRight.setSiteAccessType(SiteAccessLevel.ADMINISTRATOR);
    user.addUserOnSiteRight(userOnUserRight);
    site.addUserOnSiteRight(userOnUserRight);
    persistance.putUserOnSiteRight(userOnUserRight);

    DraftForm form = new DraftCustomForm();
    form.setSiteId(site.getSiteId());
    form.setName("name");
    persistance.putItem(form);

    DraftFormFilter filter = new DraftFormFilter();
    filter.setForm(form);
    String filterName = "filter name " + System.currentTimeMillis();
    filter.setName(filterName);
    persistance.putFormFilter(filter);

    List<DraftFormFilter> userFitlers = persistance.getFormFiltersByUserId(user.getUserId());
    Assert.assertEquals(filter, userFitlers.get(0));

    DraftFormFilter namedUserFilter =
        persistance.getFormFilterByNameAndUserId(filterName, user.getUserId());
    Assert.assertEquals(filter, namedUserFilter);
  }
  @Test
  public void getForumsByUserIdForEmpty() {
    User user = new User();
    user.setPassword("1");
    user.setEmail("a");
    user.setRegistrationDate(new Date());
    persistance.putUser(user);

    List<DraftItem> userForums =
        persistance.getDraftItemsByUserId(user.getUserId(), ItemType.FORUM);
    Assert.assertEquals(0, userForums.size());
  }
Exemplo n.º 23
0
  @Override
  public String Login(User user) {

    int searchListLength = users.size();
    for (int i = 0; i < searchListLength; i++) {
      if (users.get(i).getUserId().contains(user.getUserId())) {
        if (users.get(i).getPassword().equals(user.getPassword())) {
          return "Login Success";
        } else return "Wrong Password";
      }
    }

    return "No User found";
  }
Exemplo n.º 24
0
  private void validateEmailAddress(User user, Set<EmailAddress> emailSet) {

    if (emailSet == null || emailSet.isEmpty()) return;

    Iterator<EmailAddress> it = emailSet.iterator();

    while (it.hasNext()) {
      EmailAddress emailAdr = it.next();
      if (StringUtils.isEmpty(emailAdr.getParentId())) {
        emailAdr.setParentId(user.getUserId());
        emailAdr.setParentType(ContactConstants.PARENT_TYPE_USER);
      }
    }
  }
Exemplo n.º 25
0
    private Offer setNewOffer(JSONObject jsonObject) throws JSONException {

      Offer newOffer = new Offer();
      int id = jsonObject.getInt("id");

      JSONObject object = jsonObject.getJSONObject("object");
      String originalImageUrl =
          object.getString("remotePhotoPath") + object.getString("remotePhotoName");
      String actor = jsonObject.getJSONObject("actor").getString("id");
      String content = object.getString("content");
      JSONArray jTags = object.getJSONArray("tags");
      String[] tags = new String[jTags.length()];
      for (int j = 0; j < jTags.length(); j++) {
        tags[j] = jTags.get(j).toString();
      }
      String published = jsonObject.getString("published");

      newOffer.setContent(content);
      newOffer.setId(id);
      newOffer.setOriginalImageUrl(originalImageUrl);
      newOffer.setPublished(published);
      newOffer.setTags(tags);

      // String filename = getCurrentUser().getFullName() + "_offer_" + id
      // + ".jpg";
      ArrayList<User> contacts = getContacts();
      contacts.add(getCurrentUser());
      String actor_name = Utilities.getContactById(Integer.parseInt(actor), contacts).getFullName();
      String filename = actor_name + "_offer_" + id + ".jpg";
      Drawable imageFile = ImageOperations(originalImageUrl, filename);
      newOffer.setImageFile(imageFile);

      // set the actor who created the offer by checking that with the
      // contacts that I already have.
      int actor_id = Integer.parseInt(actor);
      if (getCurrentUser().getUserId() == actor_id) {
        newOffer.setSharedByUser(getCurrentUser());
      } else {

        for (User contact : getContacts()) {
          if (contact.getUserId() == actor_id) {
            newOffer.setSharedByUser(contact);
            break; // found it, go out
          }
        }
      }

      return newOffer;
    }
  public static User existingUser() {

    long userid = swipeCard();

    if (!User.userCardHash.containsKey(userid)) {
      System.out.println("User not found.");
      System.exit(0);
    }
    System.out.println(userid);
    User u = User.userCardHash.get(userid);
    System.out.println(u);
    System.out.println(u.getName() + " ------ " + u.getUserId() + " ------ " + u.getUsercard());

    return u;
  }
  public void getTestCaseExecutionDetails() throws Exception {
    //                testCaseObj.setTestCaseId("001");
    TestCase testCaseObj = tmsManager.getTestCaseExecutionDetails("001");

    Activity activityObj = testCaseObj.getActivityObj();
    System.out.println(activityObj.getActivityId());
    System.out.println(testCaseObj.getTestCaseId());
    User userObj = testCaseObj.getUserObj();
    System.out.println(userObj.getUserId());
    System.out.println(testCaseObj.getActualDate());

    System.out.println(testCaseObj.getTestCaseStatus());
    System.out.println(testCaseObj.getComments());
    System.out.println(testCaseObj.getActualBehaviour());
  }
  public void getTestCase() throws Exception {

    TestCase testCaseObj = tmsManager.getTestCase("15");

    System.out.println(testCaseObj.getTestCaseId());
    System.out.println(testCaseObj.getTestCaseDescription());
    System.out.println(testCaseObj.getTestCasePhase());
    Project projectObj = testCaseObj.getProjectObj();
    System.out.println(projectObj.getProjectId());
    User userObj = testCaseObj.getUserObj();
    System.out.println(userObj.getUserId());
    Activity activityObj = testCaseObj.getActivityObj();
    System.out.println(activityObj.getActivityId());
    System.out.println(testCaseObj.getExpectedBehaviour());
  }
Exemplo n.º 29
0
  public static UserSoap toSoapModel(User model) {
    UserSoap soapModel = new UserSoap();

    soapModel.setMvccVersion(model.getMvccVersion());
    soapModel.setUuid(model.getUuid());
    soapModel.setUserId(model.getUserId());
    soapModel.setCompanyId(model.getCompanyId());
    soapModel.setCreateDate(model.getCreateDate());
    soapModel.setModifiedDate(model.getModifiedDate());
    soapModel.setDefaultUser(model.getDefaultUser());
    soapModel.setContactId(model.getContactId());
    soapModel.setPassword(model.getPassword());
    soapModel.setPasswordEncrypted(model.getPasswordEncrypted());
    soapModel.setPasswordReset(model.getPasswordReset());
    soapModel.setPasswordModifiedDate(model.getPasswordModifiedDate());
    soapModel.setDigest(model.getDigest());
    soapModel.setReminderQueryQuestion(model.getReminderQueryQuestion());
    soapModel.setReminderQueryAnswer(model.getReminderQueryAnswer());
    soapModel.setGraceLoginCount(model.getGraceLoginCount());
    soapModel.setScreenName(model.getScreenName());
    soapModel.setEmailAddress(model.getEmailAddress());
    soapModel.setFacebookId(model.getFacebookId());
    soapModel.setLdapServerId(model.getLdapServerId());
    soapModel.setOpenId(model.getOpenId());
    soapModel.setPortraitId(model.getPortraitId());
    soapModel.setLanguageId(model.getLanguageId());
    soapModel.setTimeZoneId(model.getTimeZoneId());
    soapModel.setGreeting(model.getGreeting());
    soapModel.setComments(model.getComments());
    soapModel.setFirstName(model.getFirstName());
    soapModel.setMiddleName(model.getMiddleName());
    soapModel.setLastName(model.getLastName());
    soapModel.setJobTitle(model.getJobTitle());
    soapModel.setLoginDate(model.getLoginDate());
    soapModel.setLoginIP(model.getLoginIP());
    soapModel.setLastLoginDate(model.getLastLoginDate());
    soapModel.setLastLoginIP(model.getLastLoginIP());
    soapModel.setLastFailedLoginDate(model.getLastFailedLoginDate());
    soapModel.setFailedLoginAttempts(model.getFailedLoginAttempts());
    soapModel.setLockout(model.getLockout());
    soapModel.setLockoutDate(model.getLockoutDate());
    soapModel.setAgreedToTermsOfUse(model.getAgreedToTermsOfUse());
    soapModel.setEmailAddressVerified(model.getEmailAddressVerified());
    soapModel.setLastPublishDate(model.getLastPublishDate());
    soapModel.setStatus(model.getStatus());

    return soapModel;
  }
Exemplo n.º 30
0
  public static void main(String[] args) {
    MySQLHandler handler = new MySQLHandler();

    // Create data structures to be added to DB
    User user = new User("Wil", "Burns", "*****@*****.**", "password");
    City city = new City("Charlottesville", "VA", "22903");
    Store store = new Store("Harris Teeter", "975 Emmet Street North");
    Location location = new Location("1", "1");
    Item item1 = new Item("Milk", "1");
    Item item2 = new Item("Eggs", "1");
    Item item3 = new Item("Bacon", "1");
    Line line1 = new Line("1", "1", "3.39", "2");
    Line line2 = new Line("1", "2", "1.89", "1");
    Line line3 = new Line("1", "3", "2.99", "3");

    // Perform inserts
    handler.addUser(user);
    handler.addCity(city);
    handler.addStore(store);
    handler.addLocation(location);
    handler.addItem(item1);
    handler.addItem(item2);
    handler.addItem(item3);
    handler.addLine(line1);
    handler.addLine(line2);
    handler.addLine(line3);
    handler.addReceipt(new Receipt("1", "1", "2009-12-07"));

    user = handler.getUser("*****@*****.**");
    System.out.println("User Id: " + user.getUserId());

    // Print user's receipt list
    ArrayList<Receipt> receipts = handler.getReceipts(user);
    for (Receipt toPrint : receipts) {
      System.out.println("Receipt id:" + toPrint.getReceiptId());
      ArrayList<Line> lines = handler.getLines(toPrint);
      for (Line line : lines) {
        Item item = handler.getItem(line);
        System.out.println(
            "Item: "
                + item.getName()
                + " Price: "
                + line.getPrice()
                + " Quantity: "
                + line.getQuantity());
      }
    }
  }