diff options
Diffstat (limited to 'src/main/java/com/android/vts/entity/TestPlanEntity.java')
-rw-r--r-- | src/main/java/com/android/vts/entity/TestPlanEntity.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/main/java/com/android/vts/entity/TestPlanEntity.java b/src/main/java/com/android/vts/entity/TestPlanEntity.java index 82d7e5e..805c3cd 100644 --- a/src/main/java/com/android/vts/entity/TestPlanEntity.java +++ b/src/main/java/com/android/vts/entity/TestPlanEntity.java @@ -16,12 +16,24 @@ package com.android.vts.entity; +import static com.googlecode.objectify.ObjectifyService.ofy; + import com.google.appengine.api.datastore.Entity; +import com.googlecode.objectify.annotation.Cache; +import com.googlecode.objectify.annotation.Id; +import java.io.Serializable; +import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; +import lombok.Data; +import lombok.NoArgsConstructor; +@com.googlecode.objectify.annotation.Entity(name="TestPlan") +@Cache +@Data +@NoArgsConstructor /** Entity describing test plan metadata. */ -public class TestPlanEntity implements DashboardEntity { +public class TestPlanEntity implements Serializable { protected static final Logger logger = Logger.getLogger(TestPlanEntity.class.getName()); public static final String KIND = "TestPlan"; @@ -29,7 +41,8 @@ public class TestPlanEntity implements DashboardEntity { // Property keys public static final String TEST_PLAN_NAME = "testPlanName"; - public final String testPlanName; + @Id + public String testPlanName; /** * Create a TestPlanEntity object. @@ -40,7 +53,6 @@ public class TestPlanEntity implements DashboardEntity { this.testPlanName = testPlanName; } - @Override public Entity toEntity() { Entity planEntity = new Entity(KIND, this.testPlanName); return planEntity; @@ -62,4 +74,9 @@ public class TestPlanEntity implements DashboardEntity { String testPlanName = e.getKey().getName(); return new TestPlanEntity(testPlanName); } + + /** Saving function for the instance of this class */ + public void save() { + ofy().save().entity(this).now(); + } } |