1 package com.android.vts.entity; 2 3 import static com.googlecode.objectify.ObjectifyService.ofy; 4 5 import com.googlecode.objectify.Key; 6 import com.googlecode.objectify.annotation.Cache; 7 import com.googlecode.objectify.annotation.Entity; 8 import com.googlecode.objectify.annotation.Id; 9 import java.util.Date; 10 import lombok.EqualsAndHashCode; 11 import lombok.Getter; 12 import lombok.NoArgsConstructor; 13 14 @Cache 15 @Entity 16 @EqualsAndHashCode(of = "role") 17 @NoArgsConstructor 18 public class RoleEntity implements DashboardEntity { 19 20 private static final long serialVersionUID = 1L; 21 22 @Id private String role; 23 24 /** When this record was created or updated */ 25 @Getter Date updated; 26 27 /** Construction function for UserEntity Class */ RoleEntity(String roleName)28 public RoleEntity(String roleName) { 29 this.role = roleName; 30 } 31 32 /** Get role by email */ getRole(String role)33 public static RoleEntity getRole(String role) { 34 return ofy().load().type(RoleEntity.class).id(role).now(); 35 } 36 37 /** Saving function for the instance of this class */ 38 @Override save()39 public Key<RoleEntity> save() { 40 this.updated = new Date(); 41 return ofy().save().entity(this).now(); 42 } 43 } 44