Beispiel #1
0
 public static Profile create(String email, Date now) {
   Profile p = new Profile();
   p.setEmail(email.toLowerCase());
   p.setCreatedDate(now);
   p.setModifiedDate(now);
   return p;
 }
  public static void update(Long idGroup, List<SqlRow> gpms) {
    Group group = Group.findById(idGroup);
    if (group == null) return;

    Ebean.beginTransaction();
    try {
      deleteForGroup(idGroup);

      Integer i = 1;
      for (SqlRow man : gpms) {
        Profile prof = Profile.lastProfileByGpmId(man.getLong("gpm"));
        if (prof == null) continue;

        CacheClassifier cc =
            new CacheClassifier(
                group,
                i++,
                prof.gpm.idGpm,
                prof.name,
                prof.image,
                (prof.gender == null) ? null : prof.gender.value,
                (prof.relationshipStatus == null) ? null : prof.relationshipStatus.status,
                prof.nFollowers);
        if (cc.name == null || cc.name.isEmpty())
          cc.name = Profile.getLastNotEmptyField(prof.gpm.id, "name");
        cc.save();
      }

      Ebean.commitTransaction();
    } finally {
      Ebean.endTransaction();
    }
  }
Beispiel #3
0
 public Profile getProfile() {
   if (profile == null) {
     profile = new Profile(this);
     profile.save();
   }
   return profile;
 }
Beispiel #4
0
 @Override
 public int hashCode() {
   int result = id != null ? id.hashCode() : 0;
   result = 31 * result + (name != null ? name.hashCode() : 0);
   result = 31 * result + (creationTime != null ? creationTime.hashCode() : 0);
   result = 31 * result + (profile != null ? profile.hashCode() : 0);
   result = 31 * result + (booksCount != null ? booksCount.hashCode() : 0);
   return result;
 }
Beispiel #5
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Library library = (Library) o;

    if (id != null ? !id.equals(library.id) : library.id != null) return false;
    if (name != null ? !name.equals(library.name) : library.name != null) return false;
    if (creationTime != null
        ? !creationTime.equals(library.creationTime)
        : library.creationTime != null) return false;
    if (profile != null ? !profile.equals(library.profile) : library.profile != null) return false;
    return booksCount != null ? booksCount.equals(library.booksCount) : library.booksCount == null;
  }