content: /*
   *  Copyright (C) 2010-2017 Stichting Akvo (Akvo Foundation)
   *
   *  This file is part of Akvo FLOW.
   *
   *  Akvo FLOW is free software: you can redistribute it and modify it under the terms of
   *  the GNU Affero General Public License (AGPL) as published by the Free Software Foundation,
   *  either version 3 of the License or any later version.
   *
   *  Akvo FLOW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
   *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   *  See the GNU Affero General Public License included below for more details.
   *
   *  The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>.
   */
  
  package com.gallatinsystems.user.domain;
  
  import javax.jdo.annotations.PersistenceCapable;
  
  import com.gallatinsystems.framework.domain.BaseDomain;
  
  /**
   * User of the web application.
   *
   * @author Christopher Fagiani
   */
  @PersistenceCapable
  public class User extends BaseDomain {
  
      private static final long serialVersionUID = -1416095159769575254L;
  
      private String userName;
  
      private String emailAddress;
      private String permissionList;
      private Boolean superAdmin;
      private String accessKey;
      private String secret;
      private String language;
  
      public String getPermissionList() {
          return permissionList;
      }
  
      public void setPermissionList(String permissionList) {
          this.permissionList = permissionList;
      }
  
      public String getUserName() {
          return userName;
      }
  
      public void setUserName(String userName) {
          this.userName = userName;
      }
  
      public String getEmailAddress() {
          return emailAddress;
      }
  
      public void setEmailAddress(String emailAddress) {
          this.emailAddress = emailAddress;
      }
  
      public Boolean isSuperAdmin() {
          return Boolean.TRUE.equals(superAdmin);
      }
  
      public void setSuperAdmin(Boolean superAdmin) {
          this.superAdmin = superAdmin;
      }
  
      public String getLanguage() {
          return language;
      }
  
      public void setLanguage(String lang) {
          this.language = lang;
      }
  
      public String getEmailUserName() {
          if (emailAddress == null || emailAddress.trim().equals("")) {
              return null;
          }
  
          return emailAddress.substring(0, emailAddress.indexOf('@'));
      }
  }
  