示例#1
0
 public List<User> getUsers() {
   List<User> userList = null;
   try {
     userList =
         em.createNamedQuery(User.FIND_ALL, User.class)
             .setParameter("recordStatus", ConstantEzRent.RecordStatus.ACTIVE.getValue())
             .getResultList();
   } catch (Exception ex) {
     Logger.getLogger(this.getClass().getName())
         .log(
             Level.SEVERE,
             "Exception occurred in " + this.getClass().getName() + ", stacktrace:",
             ex);
   }
   return userList;
 }
示例#2
0
 public Long countUsers() {
   Long count = 0L;
   try {
     count =
         em.createNamedQuery(User.COUNT_ALL, Long.class)
             .setParameter("recordStatus", ConstantEzRent.RecordStatus.ACTIVE.getValue())
             .getSingleResult();
   } catch (Exception ex) {
     Logger.getLogger(this.getClass().getName())
         .log(
             Level.SEVERE,
             "Exception occurred in " + this.getClass().getName() + ", stacktrace:",
             ex);
   }
   return count;
 }
示例#3
0
 public List<User> getTenantUsersByOwnerUserId(Long ownerUserId) {
   List<User> tenantUserList = null;
   try {
     tenantUserList =
         em.createNamedQuery(User.FIND_ALL_TENANT_USERS_BY_OWNER_USER_ID, User.class)
             .setParameter("ownerUserId", ownerUserId)
             .setParameter("recordStatus", ConstantEzRent.RecordStatus.ACTIVE.getValue())
             .getResultList();
   } catch (Exception ex) {
     Logger.getLogger(this.getClass().getName())
         .log(
             Level.SEVERE,
             "Exception occurred in " + this.getClass().getName() + ", stacktrace:",
             ex);
   }
   return tenantUserList;
 }
示例#4
0
 public User getUser(String email) {
   User user = null;
   if (Utils.isNotNullNotEmptyNotWhiteSpaceOnly(email)) {
     try {
       user =
           (User)
               em.createNamedQuery(User.FIND_BY_EMAIL, User.class)
                   .setParameter("email", email)
                   .setParameter("recordStatus", ConstantEzRent.RecordStatus.ACTIVE.getValue())
                   .getSingleResult();
     } catch (Exception ex) {
       Logger.getLogger(this.getClass().getName())
           .log(
               Level.SEVERE,
               "Exception occurred in " + this.getClass().getName() + ", stacktrace:",
               ex);
     }
   }
   return user;
 }
示例#5
0
/**
 * The PropertyType class/entity that models the types of properties in the system.
 *
 * @author Magishan <*****@*****.**>
 * @author Gaurav Jain <gaurav.jain at student.csulb.edu>
 */
@Entity(name = "Property_Type")
@NamedQueries({
  @NamedQuery(
      name = PropertyType.FIND_ALL,
      query = "SELECT pt FROM Property_Type pt ORDER BY pt.propertyTypeName"),
  @NamedQuery(
      name = PropertyType.FIND_ALL_BY_PROPERTY_NAME,
      query = "SELECT pt FROM Property_Type pt WHERE pt.propertyTypeName = :propertyTypeName")
})
public class PropertyType implements Serializable {
  private static final long serialVersionUID = 1L;

  // Query constants
  public static final String FIND_ALL = "PropertyType.findAll";
  public static final String FIND_ALL_BY_PROPERTY_NAME = "PropertyType.findAllByPropertyName";

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "property_type_id")
  private Integer propertyTypeId;

  @Column(name = "property_type_name", nullable = false, length = 100)
  private String propertyTypeName;

  @Column(name = "description", nullable = true, length = 100)
  private String description;

  @Column(name = "record_status", nullable = false)
  private Integer recordStatus = ConstantEzRent.RecordStatus.ACTIVE.getValue();;

  public PropertyType() {
    // default constructor
  }

  public PropertyType(String propertyTypeName, String description) {
    this.propertyTypeName = propertyTypeName;
    this.description = description;
  }

  public Integer getPropertyTypeId() {
    return propertyTypeId;
  }

  public void setPropertyTypeId(Integer propertyTypeId) {
    this.propertyTypeId = propertyTypeId;
  }

  public Integer getRecordStatus() {
    return recordStatus;
  }

  public void setRecordStatus(Integer recordStatus) {
    this.recordStatus = recordStatus;
  }

  public String getPropertyTypeName() {
    return propertyTypeName;
  }

  public void setPropertyTypeName(String propertyTypeName) {
    this.propertyTypeName = propertyTypeName;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (getPropertyTypeId() != null ? getPropertyTypeId().hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    if (!(object instanceof PropertyType)) {
      return false;
    }
    PropertyType other = (PropertyType) object;
    if ((this.getPropertyTypeId() == null && other.getPropertyTypeId() != null)
        || (this.getPropertyTypeId() != null
            && !this.propertyTypeId.equals(other.propertyTypeId))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "edu.csulb.cecs423.ezrent.model.PropertyType[id=" + getPropertyTypeId() + "]";
  }
}