Package com.casamind.adware.server.domain

Source Code of com.casamind.adware.server.domain.UserAccount

/**
* Copyright 2010 Daniel Guermeur and Amy Unruh
*
*   Licensed under the Apache License, Version 2.0 (the "License");
*   you may not use this file except in compliance with the License.
*   You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*
*   See http://connectrapp.appspot.com/ for a demo, and links to more information
*   about this app and the book that it accompanies.
*/
package com.casamind.adware.server.domain;

import java.util.Date;

import com.casamind.adware.shared.model.UserAccountDTO;

public class UserAccount extends DatastoreObject {

  private int accessLevel;
  private int budget;
  private String login;
  private String service;
  private String uniqueId;
  private String firstname;
  private String lastname;
  private String phone;
  private String email;
  private String gdataLogin;
  private String gdataPassword;
  private Date lastLoginOn;
  private boolean isReceiveNewsLetter;
  private boolean isReceiveNotifications;

  public UserAccount() {
  }

  public UserAccount(String login, String service) {
    this.uniqueId = login + "-" + service;
  }

  public UserAccount(int accessLevel, String login, String service, String firstname, String lastname, String phone, String email, Date lastLoginOn, boolean isReceiveNewsLetter, boolean isReceiveNotifications, String gdataLogin, String gdataPassword) {
    this.accessLevel = accessLevel;
    this.login = login;
    this.service = service;
    this.uniqueId = login + "-" + service;
    this.firstname = firstname;
    this.lastname = lastname;
    this.phone = phone;
    this.email = email;
    this.gdataLogin = gdataLogin;
    this.gdataPassword = gdataPassword;
    this.lastLoginOn = lastLoginOn;
    this.isReceiveNewsLetter = isReceiveNewsLetter;
    this.isReceiveNotifications = isReceiveNotifications;
  }

  public String getDisplayName() {
    return this.getFirstname() == null || "".equals(this.getFirstname()) ? this.getLastname() : this.getFirstname() + " " + this.getLastname();
  }
  public String getLogin() {
    return login;
  }

  public void setLogin(String login) {
    this.login = login;
  }

  public String getService() {
    return service;
  }

  public void setService(String service) {
    this.service = service;
  }

  public int getAccessLevel() {
    return accessLevel;
  }

  public void setAccessLevel(int accessLevel) {
    this.accessLevel = accessLevel;
  }

  public String getUniqueId() {
    return uniqueId;
  }

  public void setBudget(int budget) {
    this.budget = budget;
  }

  public int getBudget() {
    return budget;
  }

  public void setUniqueId(String uniqueId) {
    this.uniqueId = uniqueId;
  }

  public String getFirstname() {
    return firstname;
  }

  public void setFirstname(String firstname) {
    this.firstname = firstname;
  }

  public String getLastname() {
    return lastname;
  }

  public void setLastname(String lastname) {
    this.lastname = lastname;
  }

  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public String getGdataLogin() {
    return gdataLogin;
  }

  public void setGdataLogin(String gdataLogin) {
    this.gdataLogin = gdataLogin;
  }

  public String getGdataPassword() {
    return gdataPassword;
  }

  public void setGdataPassword(String gdataPassword) {
    this.gdataPassword = gdataPassword;
  }

  public Date getLastLoginOn() {
    return lastLoginOn;
  }

  public void setLastLoginOn(Date lastLoginOn) {
    this.lastLoginOn = lastLoginOn;
  }

  public boolean isReceiveNewsLetter() {
    return isReceiveNewsLetter;
  }

  public void setReceiveNewsLetter(boolean isReceiveNewsLetter) {
    this.isReceiveNewsLetter = isReceiveNewsLetter;
  }

  public boolean isReceiveNotifications() {
    return isReceiveNotifications;
  }

  public void setReceiveNotifications(boolean isReceiveNotifications) {
    this.isReceiveNotifications = isReceiveNotifications;
  }

  @Override
  public String toString() {
    return "UserAccount [accessLevel=" + accessLevel + ", uniqueId=" + uniqueId + ", firstname=" + firstname + ", lastname=" + lastname + ", phone=" + phone + ", email=" + email + ", lastLoginOn=" + lastLoginOn + ", isReceiveNewsLetter=" + isReceiveNewsLetter + ", isReceiveNotifications=" + isReceiveNotifications + "]";
  }

  public static UserAccountDTO toDTO(UserAccount entity) {
    return entity == null ? null : new UserAccountDTO(entity.getId(), entity.getUUID(), entity.getAccessLevel(), entity.getLogin(), entity.getService(), entity.getFirstname(), entity.getLastname(), entity.getPhone(), entity.getEmail(), entity.getLastLoginOn(), entity.isReceiveNewsLetter(), entity.isReceiveNotifications());
  }
}
TOP

Related Classes of com.casamind.adware.server.domain.UserAccount

TOP
Copyright © 2018 www.massapi.com. 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.