summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIang <iang@cacert.org>2010-09-09 11:23:18 +1000
committerIang <iang@cacert.org>2010-09-09 11:23:18 +1000
commitcc1962e710edddd6e1ebf5538c7cc82e91691afc (patch)
treef1666296947c3cfa1b657ab3392bf7cde48ad40a
parentc9fc3daf9a7a8fc38dfb2f70d0202bb788e7d989 (diff)
downloadcacert-birdshack-cc1962e710edddd6e1ebf5538c7cc82e91691afc.tar.gz
cacert-birdshack-cc1962e710edddd6e1ebf5538c7cc82e91691afc.tar.xz
cacert-birdshack-cc1962e710edddd6e1ebf5538c7cc82e91691afc.zip
modified
-rw-r--r--Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntity.java13
-rw-r--r--Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntityVerifiable.java16
-rw-r--r--Business Logic/trunk/src/org/cacert/birdshack/bl/model/BirdShackObject.java46
-rw-r--r--Business Logic/trunk/src/org/cacert/birdshack/bl/model/Email.java24
-rw-r--r--Business Logic/trunk/src/org/cacert/birdshack/bl/model/Member.java28
5 files changed, 117 insertions, 10 deletions
diff --git a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntity.java b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntity.java
index f4434a7..49d37e7 100644
--- a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntity.java
+++ b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntity.java
@@ -5,6 +5,8 @@ package org.cacert.birdshack.bl.model;
import java.util.List;
+import org.cacert.birdshack.util.Junk;
+
/**
* @author law
*
@@ -33,5 +35,16 @@ public abstract class AssurableEntity extends BirdShackObject {
return this;
}
+
+
+ protected void setExample() {
+ super.setExample();
+ this.setName(Junk.string());
+ }
+ public String toString() {
+ String s = getName() + super.toString();
+ return s;
+ }
+
}
diff --git a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntityVerifiable.java b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntityVerifiable.java
index 03834c0..f4bdb16 100644
--- a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntityVerifiable.java
+++ b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/AssurableEntityVerifiable.java
@@ -3,6 +3,9 @@
*/
package org.cacert.birdshack.bl.model;
+import org.cacert.birdshack.util.Junk;
+
+
/**
* @author law
*
@@ -24,4 +27,17 @@ public abstract class AssurableEntityVerifiable extends AssurableEntity {
this.status = status;
return this;
}
+
+
+
+ protected void setExample() {
+ super.setExample();
+ this.setStatus(Junk.string());
+ }
+
+ public String toString() {
+ String s = super.toString();
+ s += " (" + getStatus() + ")";
+ return s;
+ }
}
diff --git a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/BirdShackObject.java b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/BirdShackObject.java
index 5a79c43..0fd6c54 100644
--- a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/BirdShackObject.java
+++ b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/BirdShackObject.java
@@ -5,26 +5,36 @@ package org.cacert.birdshack.bl.model;
import java.util.List;
+import org.cacert.birdshack.util.Junk;
+
/**
* @author law
- * Generic Object where all other are derived from
+ * Generic biz-logic Object.
+ * The object is expected to be a primary data element for
+ * storage within the server, and shipping in/out to the client.
*/
-public abstract class BirdShackObject {
- private String id;
+public abstract class BirdShackObject
+ implements Flight
+{
+ private Rid rid;
/**
- * @return the id
+ * Unique storage identity for this object.
+ * Might be a counter, or a hash of some form, is DB dependent.
+ * Guaranteed to not change, so can be used as link within other objects.
+ *
+ * @return the unique resource id of this resource
*/
- public String getId() {
- return id;
+ public Rid getRid() {
+ return rid;
}
/**
- * @param id the id to set
+ * @param rid the rid to set
*/
- public void setId(String id) {
- this.id = id;
+ public void setRid(Rid rid) {
+ this.rid = rid;
}
public List<Event> getEvents() {
@@ -34,4 +44,22 @@ public abstract class BirdShackObject {
protected BirdShackObject addEvent(Event event) {
return this;
}
+
+
+ public String prepareForFlight() {
+ throw new Error("write me dude");
+ }
+
+
+
+ protected void setExample() {
+ this.setRid( Rid.example() );
+ }
+
+ public String toString() {
+ String s = "";
+ if (null != rid)
+ s += " [" + rid + "]";
+ return s;
+ }
}
diff --git a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/Email.java b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/Email.java
index 6d93669..05bbcfe 100644
--- a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/Email.java
+++ b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/Email.java
@@ -3,10 +3,34 @@
*/
package org.cacert.birdshack.bl.model;
+
+import org.cacert.birdshack.util.Junk;
+
+
/**
* @author law
*
*/
public class Email extends AssurableEntityVerifiable {
+
+
+ public static Email example() {
+ String name = Junk.string();
+ String domain = Junk.string();
+ for (int i = Junk.exampleInt(1,3); i > 0; i--) {
+ domain = domain + '.' + Junk.string();
+ }
+ Email email = new Email();
+ email.setName(name + '@' + domain);
+
+ email.setExample();
+ return email;
+ }
+
+
+ public String toString() {
+ String s = "Em: " + super.toString();
+ return s;
+ }
}
diff --git a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/Member.java b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/Member.java
index 4c8a49b..5c1ef2f 100644
--- a/Business Logic/trunk/src/org/cacert/birdshack/bl/model/Member.java
+++ b/Business Logic/trunk/src/org/cacert/birdshack/bl/model/Member.java
@@ -4,6 +4,7 @@
package org.cacert.birdshack.bl.model;
import java.util.List;
+import org.cacert.birdshack.util.Junk;
/**
@@ -54,7 +55,8 @@ public class Member extends BirdShackObject {
return email;
}
- protected Member setEmail() {
+ protected Member setEmail(Email email) {
+ this.email = email;
return this;
}
@@ -125,4 +127,28 @@ public class Member extends BirdShackObject {
protected Member delete() {
return null;
}
+
+
+ public String prepareForFlight() {
+ return this.getEmail().getName();
+ }
+
+
+
+ public static Member example() {
+ Member obj = new Member();
+ obj.setExample();
+ obj.setPrivacy(Junk.exampleBool());
+ obj.setTerminated(Junk.exampleBool());
+ obj.setEmail(Email.example());
+ return obj;
+ }
+
+ public String toString() {
+ String s = "";
+ s += isPrivacy() ? "P" : "";
+ s += isTerminated() ? "T" : "";
+ s += " " + getEmail();
+ return s;
+ }
}