View Javadoc
1   package ordertracker;
2   
3   import com.google.common.base.MoreObjects;
4   import com.google.common.base.Optional;
5   import java.io.Serializable;
6   import java.lang.Class;
7   import java.lang.IllegalAccessException;
8   import java.lang.IllegalArgumentException;
9   import java.lang.InstantiationException;
10  import java.lang.Integer;
11  import java.lang.NullPointerException;
12  import java.lang.Override;
13  import java.lang.SecurityException;
14  import java.lang.String;
15  import java.lang.SuppressWarnings;
16  import java.lang.System;
17  import java.lang.reflect.InvocationTargetException;
18  import java.math.BigDecimal;
19  import java.util.concurrent.TimeUnit;
20  import java.util.regex.Pattern;
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.EntityManager;
24  import javax.persistence.FetchType;
25  import javax.persistence.Id;
26  import javax.persistence.JoinColumn;
27  import javax.persistence.JoinColumns;
28  import javax.persistence.ManyToOne;
29  import javax.persistence.PrePersist;
30  import javax.persistence.PreUpdate;
31  import javax.persistence.Table;
32  import javax.persistence.Transient;
33  import ordertracker.Depot;
34  import scala.concurrent.duration.Duration;
35  import xuml.tools.model.compiler.runtime.BehaviourFactoryNotSetException;
36  import xuml.tools.model.compiler.runtime.CreationEvent;
37  import xuml.tools.model.compiler.runtime.EntityHelper;
38  import xuml.tools.model.compiler.runtime.Event;
39  import xuml.tools.model.compiler.runtime.Signaller;
40  import xuml.tools.model.compiler.runtime.ValidationException;
41  import xuml.tools.model.compiler.runtime.query.BooleanExpression;
42  import xuml.tools.model.compiler.runtime.query.NumericExpressionField;
43  import xuml.tools.model.compiler.runtime.query.SelectBuilder;
44  import xuml.tools.model.compiler.runtime.query.StringExpressionField;
45  
46  /**
47   * 
48   */
49  @Entity
50  @Table(schema="ordertracker", name="order_1")
51  public class Order implements xuml.tools.model.compiler.runtime.Entity<Order> {
52  
53      /**
54       * No argument constructor required by JPA.
55       */
56      public Order(){
57          //JPA requires no-arg constructor
58          if (_behaviourFactory == null) {
59              throw new BehaviourFactoryNotSetException("Order does not have a BehaviourFactory set. Use Order.setBehaviourFactory in your App class (one-time setup).");
60          }
61          _behaviour = _behaviourFactory.create(this);
62      }
63  
64      /**
65       * If behaviour is not explicitly specified then the
66       * behaviour factory is used to create behaviour.
67       */
68      private static volatile BehaviourFactory _behaviourFactory;
69  
70      /**
71       * All actions like onEntry actions and defined
72       * operations are performed by this Behaviour class.
73       */
74      @Transient
75      private Behaviour _behaviour;
76  
77      /**
78       * Sets the BehaviourFactory for all instances of
79       * this class. It will only be used when Behaviour
80       * is not explicitly provided in the constructor.
81       */
82      public static void setBehaviourFactory(BehaviourFactory factory){
83          _behaviourFactory = factory;
84      }
85  
86      /**
87       * Sets the BehaviourFactory for all instances of
88       * this class using the given Behaviour class as the base. It will only be used when Behaviour
89       * is not explicitly provided in the constructor.
90       */
91      public static void setBehaviourFactory(Class<? extends Behaviour> cls){
92          _behaviourFactory = createBehaviourFactory(cls);
93      }
94  
95      /**
96       * Returns the singleton BehaviourFactory for this.
97       */
98      public static BehaviourFactory getBehaviourFactory(){
99          return _behaviourFactory;
100     }
101 
102     /**
103      * Constructor using id.
104      */
105     public Order(String id) {
106         this.id = id;
107     }
108 
109     /**
110      * Static creator method using id.
111      */
112     public static Order create(String id) {
113         return new Order(id);
114     }
115 
116     /**
117      * Static creator method using CreationEvent.
118      */
119     public static Order create(CreationEvent<Order> creationEvent) {
120         return Context.create(Order.class, creationEvent);
121     }
122 
123     /**
124      * The signaller used by the current Context. It will
125      * get injected into the EntityHelper.
126      */
127     private static Signaller signaller;
128 
129     /**
130      * Sets the Signaller to be used by the EntityHelper.
131      */
132     static void setSignaller_(Signaller sig) {
133         signaller = sig;
134     }
135 
136     /**
137      * Helper for this class.
138      */
139     @Transient
140     private EntityHelper _helper;
141 
142     /**
143      * Returns the Helper for this instance.
144      */
145     public synchronized EntityHelper helper() {
146         if (_helper==null)
147             _helper = new EntityHelper(signaller,this);
148         return _helper;
149     }
150 
151     /**
152      * Primary identifier
153      */
154     @Id
155     @Column(name="order_id", nullable=false,length=2048)
156     private String id = new String("");
157 
158     /**
159      * Returns a unique id for this instance as a String. 
160      * Used for synchronizing access to entities.
161      */
162     @Override
163     public String uniqueId(){
164         return Order.class.getName() + ":" + getId();
165     }
166 
167     @Column(name="description", nullable=false,length=4096)
168     private String description = new String("");
169 
170     /**
171      * Validates description against type constraints.
172      */
173     private void validateDescription() {
174         if (description == null || description.length() < 1)
175             throw new ValidationException("min length constraint not met");
176          if (description == null || !description.startsWith(""))
177             throw new ValidationException("prefix constraint not met");
178         if (description == null || !description.endsWith(""))
179             throw new ValidationException("suffix constraint not met");
180         if (description == null || !Pattern.matches(".*", description))
181             throw new ValidationException("validation pattern constraint not met");
182     }
183 
184     @Column(name="from_address", nullable=false,length=4096)
185     private String fromAddress = new String("");
186 
187     /**
188      * Validates fromAddress against type constraints.
189      */
190     private void validateFromAddress() {
191         if (fromAddress == null || fromAddress.length() < 1)
192             throw new ValidationException("min length constraint not met");
193          if (fromAddress == null || !fromAddress.startsWith(""))
194             throw new ValidationException("prefix constraint not met");
195         if (fromAddress == null || !fromAddress.endsWith(""))
196             throw new ValidationException("suffix constraint not met");
197         if (fromAddress == null || !Pattern.matches(".*", fromAddress))
198             throw new ValidationException("validation pattern constraint not met");
199     }
200 
201     @Column(name="to_address", nullable=false,length=4096)
202     private String toAddress = new String("");
203 
204     /**
205      * Validates toAddress against type constraints.
206      */
207     private void validateToAddress() {
208         if (toAddress == null || toAddress.length() < 1)
209             throw new ValidationException("min length constraint not met");
210          if (toAddress == null || !toAddress.startsWith(""))
211             throw new ValidationException("prefix constraint not met");
212         if (toAddress == null || !toAddress.endsWith(""))
213             throw new ValidationException("suffix constraint not met");
214         if (toAddress == null || !Pattern.matches(".*", toAddress))
215             throw new ValidationException("validation pattern constraint not met");
216     }
217 
218     @Column(name="destination_email", nullable=false,length=512)
219     private String destinationEmail = new String("");
220 
221     /**
222      * Validates destinationEmail against type constraints.
223      */
224     private void validateDestinationEmail() {
225         if (destinationEmail == null || destinationEmail.length() < 1)
226             throw new ValidationException("min length constraint not met");
227          if (destinationEmail == null || !destinationEmail.startsWith(""))
228             throw new ValidationException("prefix constraint not met");
229         if (destinationEmail == null || !destinationEmail.endsWith(""))
230             throw new ValidationException("suffix constraint not met");
231         if (destinationEmail == null || !Pattern.matches(".*", destinationEmail))
232             throw new ValidationException("validation pattern constraint not met");
233     }
234 
235     @Column(name="sender_email", nullable=false,length=512)
236     private String senderEmail = new String("");
237 
238     /**
239      * Validates senderEmail against type constraints.
240      */
241     private void validateSenderEmail() {
242         if (senderEmail == null || senderEmail.length() < 1)
243             throw new ValidationException("min length constraint not met");
244          if (senderEmail == null || !senderEmail.startsWith(""))
245             throw new ValidationException("prefix constraint not met");
246         if (senderEmail == null || !senderEmail.endsWith(""))
247             throw new ValidationException("suffix constraint not met");
248         if (senderEmail == null || !Pattern.matches(".*", senderEmail))
249             throw new ValidationException("validation pattern constraint not met");
250     }
251 
252     @Column(name="max_attempts", nullable=false)
253     private Integer maxAttempts = new Integer("0");
254 
255     private static final BigDecimal MAXATTEMPTS_UPPER_LIMIT=new BigDecimal("1000");
256     private static final BigDecimal MAXATTEMPTS_LOWER_LIMIT=new BigDecimal("0");
257 
258     /**
259      * Validates maxAttempts against type constraints.
260      */
261     private void validateMaxAttempts() {
262         if (MAXATTEMPTS_UPPER_LIMIT.doubleValue() < maxAttempts) 
263             throw new ValidationException("upper limit of 1000 failed");
264         if (MAXATTEMPTS_LOWER_LIMIT.doubleValue() > maxAttempts)
265              throw new ValidationException("lower limit of 0 failed");
266     }
267 
268     @Column(name="attempts", nullable=false)
269     private Integer attempts = new Integer("0");
270 
271     private static final BigDecimal ATTEMPTS_UPPER_LIMIT=new BigDecimal("1000");
272     private static final BigDecimal ATTEMPTS_LOWER_LIMIT=new BigDecimal("0");
273 
274     /**
275      * Validates attempts against type constraints.
276      */
277     private void validateAttempts() {
278         if (ATTEMPTS_UPPER_LIMIT.doubleValue() < attempts) 
279             throw new ValidationException("upper limit of 1000 failed");
280         if (ATTEMPTS_LOWER_LIMIT.doubleValue() > attempts)
281              throw new ValidationException("lower limit of 0 failed");
282     }
283 
284     @Column(name="comment_1", nullable=false,length=4096)
285     private String comment = new String("");
286 
287     /**
288      * Validates comment against type constraints.
289      */
290     private void validateComment() {
291         if (comment == null || comment.length() < 1)
292             throw new ValidationException("min length constraint not met");
293          if (comment == null || !comment.startsWith(""))
294             throw new ValidationException("prefix constraint not met");
295         if (comment == null || !comment.endsWith(""))
296             throw new ValidationException("suffix constraint not met");
297         if (comment == null || !Pattern.matches(".*", comment))
298             throw new ValidationException("validation pattern constraint not met");
299     }
300 
301     @Column(name="status_1", nullable=false,length=4096)
302     private String status = new String("Preparing");
303 
304     /**
305      * Validates status against type constraints.
306      */
307     private void validateStatus() {
308         if (status == null || status.length() < 1)
309             throw new ValidationException("min length constraint not met");
310          if (status == null || !status.startsWith(""))
311             throw new ValidationException("prefix constraint not met");
312         if (status == null || !status.endsWith(""))
313             throw new ValidationException("suffix constraint not met");
314         if (status == null || !Pattern.matches(".*", status))
315             throw new ValidationException("validation pattern constraint not met");
316     }
317 
318     /**
319      * For internal use only by the state machine but is persisted by the jpa provider.
320      */
321     @Column(name="state",nullable=false)
322     private String state;
323 
324     /**
325      * MANY Order was last at ZERO_ONE Depot
326      */
327     @ManyToOne(targetEntity=Depot.class, fetch=FetchType.LAZY)
328     @JoinColumns(value={
329         @JoinColumn(name="last_depot", referencedColumnName="depot_id", nullable=true, insertable=true, updatable=true)})
330     private Depot depot_R1;
331 
332     /**
333      * Getter. MANY Order was last at ZERO_ONE Depot
334      */
335     public Depot getDepot_R1(){
336         return depot_R1;
337     }
338 
339     /**
340      * Setter. MANY Order was last at ZERO_ONE Depot
341      */
342     public void setDepot_R1(Depot depot_R1){
343         this.depot_R1=depot_R1;
344     }
345 
346     /**
347      * MANY Order was last at ZERO_ONE Depot
348      */
349     public Order relateAcrossR1(Depot depot_R1) {
350         setDepot_R1(depot_R1);
351         return this;
352     }
353 
354     /**
355      * MANY Order was last at ZERO_ONE Depot
356      */
357     public Order unrelateAcrossR1(Depot depot_R1) {
358         setDepot_R1(null);
359         depot_R1.getOrder_R1().remove(this);
360         return this;
361     }
362 
363     /**
364      * Calls all validation methods just before updating database.
365      */
366     @PreUpdate
367     void validateBeforeUpdate(){
368         validateAttempts();
369         validateComment();
370         validateDescription();
371         validateDestinationEmail();
372         validateFromAddress();
373         validateMaxAttempts();
374         validateSenderEmail();
375         validateStatus();
376         validateToAddress();
377     }
378 
379     /**
380      * Calls all validation methods just before first persist of this entity.
381      */
382     @PrePersist
383     void validateBeforePersist(){
384         validateAttempts();
385         validateComment();
386         validateDescription();
387         validateDestinationEmail();
388         validateFromAddress();
389         validateMaxAttempts();
390         validateSenderEmail();
391         validateStatus();
392         validateToAddress();
393     }
394 
395     /**
396      * Returns the identifier for this entity.
397      */
398     public String getId() {
399         return id;
400     }
401 
402     public void setId(String id) {
403         this.id = id;
404     }
405 
406     public Order setId_(String id) {
407         this.id = id;
408         return this;
409     }
410 
411     /**
412      * Returns description. 
413      */
414     public String getDescription(){
415         return description;
416     }
417 
418     /**
419      * Sets description to the given value. 
420      */
421     public void setDescription(String description){
422         this.description = description;
423     }
424 
425     /**
426      * Sets the attribute to the given value and returns this
427      * (enables method chaining).
428      */
429     public Order setDescription_(String description){
430         setDescription(description);
431         return this;
432     }
433 
434     /**
435      * Returns fromAddress. 
436      */
437     public String getFromAddress(){
438         return fromAddress;
439     }
440 
441     /**
442      * Sets fromAddress to the given value. 
443      */
444     public void setFromAddress(String fromAddress){
445         this.fromAddress = fromAddress;
446     }
447 
448     /**
449      * Sets the attribute to the given value and returns this
450      * (enables method chaining).
451      */
452     public Order setFromAddress_(String fromAddress){
453         setFromAddress(fromAddress);
454         return this;
455     }
456 
457     /**
458      * Returns toAddress. 
459      */
460     public String getToAddress(){
461         return toAddress;
462     }
463 
464     /**
465      * Sets toAddress to the given value. 
466      */
467     public void setToAddress(String toAddress){
468         this.toAddress = toAddress;
469     }
470 
471     /**
472      * Sets the attribute to the given value and returns this
473      * (enables method chaining).
474      */
475     public Order setToAddress_(String toAddress){
476         setToAddress(toAddress);
477         return this;
478     }
479 
480     /**
481      * Returns destinationEmail. 
482      */
483     public String getDestinationEmail(){
484         return destinationEmail;
485     }
486 
487     /**
488      * Sets destinationEmail to the given value. 
489      */
490     public void setDestinationEmail(String destinationEmail){
491         this.destinationEmail = destinationEmail;
492     }
493 
494     /**
495      * Sets the attribute to the given value and returns this
496      * (enables method chaining).
497      */
498     public Order setDestinationEmail_(String destinationEmail){
499         setDestinationEmail(destinationEmail);
500         return this;
501     }
502 
503     /**
504      * Returns senderEmail. 
505      */
506     public String getSenderEmail(){
507         return senderEmail;
508     }
509 
510     /**
511      * Sets senderEmail to the given value. 
512      */
513     public void setSenderEmail(String senderEmail){
514         this.senderEmail = senderEmail;
515     }
516 
517     /**
518      * Sets the attribute to the given value and returns this
519      * (enables method chaining).
520      */
521     public Order setSenderEmail_(String senderEmail){
522         setSenderEmail(senderEmail);
523         return this;
524     }
525 
526     /**
527      * Returns maxAttempts. 
528      */
529     public Integer getMaxAttempts(){
530         return maxAttempts;
531     }
532 
533     /**
534      * Sets maxAttempts to the given value. 
535      */
536     public void setMaxAttempts(Integer maxAttempts){
537         this.maxAttempts = maxAttempts;
538     }
539 
540     /**
541      * Sets the attribute to the given value and returns this
542      * (enables method chaining).
543      */
544     public Order setMaxAttempts_(Integer maxAttempts){
545         setMaxAttempts(maxAttempts);
546         return this;
547     }
548 
549     /**
550      * Returns attempts. 
551      */
552     public Integer getAttempts(){
553         return attempts;
554     }
555 
556     /**
557      * Sets attempts to the given value. 
558      */
559     public void setAttempts(Integer attempts){
560         this.attempts = attempts;
561     }
562 
563     /**
564      * Sets the attribute to the given value and returns this
565      * (enables method chaining).
566      */
567     public Order setAttempts_(Integer attempts){
568         setAttempts(attempts);
569         return this;
570     }
571 
572     /**
573      * Returns comment. 
574      */
575     public String getComment(){
576         return comment;
577     }
578 
579     /**
580      * Sets comment to the given value. 
581      */
582     public void setComment(String comment){
583         this.comment = comment;
584     }
585 
586     /**
587      * Sets the attribute to the given value and returns this
588      * (enables method chaining).
589      */
590     public Order setComment_(String comment){
591         setComment(comment);
592         return this;
593     }
594 
595     /**
596      * Returns status. 
597      */
598     public String getStatus(){
599         return status;
600     }
601 
602     /**
603      * Sets status to the given value. 
604      */
605     public void setStatus(String status){
606         this.status = status;
607     }
608 
609     /**
610      * Sets the attribute to the given value and returns this
611      * (enables method chaining).
612      */
613     public Order setStatus_(String status){
614         setStatus(status);
615         return this;
616     }
617 
618     /**
619      * For internal use only by the state machine but is persisted by the jpa provider.
620      */
621     public String getState(){
622         return state;
623     }
624 
625     /**
626      * For internal use only by the state machine but is persisted by the jpa provider.
627      */
628     public void setState(String state){
629         this.state = state;
630     }
631 
632     /**
633      * Sets the current state. This should only be used when creating an instance without using the state machine.
634      */
635     public void setState(State state){
636         this.state = state.toString();
637     }
638 
639     /**
640      * The list of all states from the state machine for this entity.
641      */
642     public static enum State {
643         AWAITING_NEXT_DELIVERY_ATTEMPT,COULD_NOT_DELIVER,COURIER_ASSIGNED,DELIVERED,DELIVERING,DELIVERY_FAILED,HELD_FOR_PICKUP,IN_TRANSIT,PREPARING,READY_FOR_DELIVERY,READY_FOR_DISPATCH,RETURN_TO_SENDER;
644     }
645 
646     /**
647      * Event declarations.
648      */
649     public static class Events {
650 
651         /**
652          * Event implementation for event 'Create'
653          */
654         @SuppressWarnings("serial")
655         public static class Create implements Event<Order>, Serializable, CreationEvent<Order> {
656 
657             public static final String signatureKey = "java.lang.String;java.lang.String;java.lang.String;java.lang.String;java.lang.String;java.lang.String;java.lang.Integer;java.lang.String;";
658 
659             public String signatureKey() {
660                 return signatureKey;
661             }
662             private final String orderID;
663             private final String description;
664             private final String fromAddress;
665             private final String toAddress;
666             private final String destinationEmail;
667             private final String senderEmail;
668             private final Integer maxAttempts;
669             private final String comment;
670 
671             /**
672              * Constructor.
673              */
674             public Create(String orderID, String description, String fromAddress, String toAddress, String destinationEmail, String senderEmail, Integer maxAttempts, String comment){
675                 if (orderID == null) throw new NullPointerException("orderID cannot be null");
676                 this.orderID = orderID;
677                 if (description == null) throw new NullPointerException("description cannot be null");
678                 this.description = description;
679                 if (fromAddress == null) throw new NullPointerException("fromAddress cannot be null");
680                 this.fromAddress = fromAddress;
681                 if (toAddress == null) throw new NullPointerException("toAddress cannot be null");
682                 this.toAddress = toAddress;
683                 if (destinationEmail == null) throw new NullPointerException("destinationEmail cannot be null");
684                 this.destinationEmail = destinationEmail;
685                 if (senderEmail == null) throw new NullPointerException("senderEmail cannot be null");
686                 this.senderEmail = senderEmail;
687                 if (maxAttempts == null) throw new NullPointerException("maxAttempts cannot be null");
688                 this.maxAttempts = maxAttempts;
689                 if (comment == null) throw new NullPointerException("comment cannot be null");
690                 this.comment = comment;
691             }
692 
693             public String getOrderID(){
694                 return orderID;
695             }
696 
697             public String getDescription(){
698                 return description;
699             }
700 
701             public String getFromAddress(){
702                 return fromAddress;
703             }
704 
705             public String getToAddress(){
706                 return toAddress;
707             }
708 
709             public String getDestinationEmail(){
710                 return destinationEmail;
711             }
712 
713             public String getSenderEmail(){
714                 return senderEmail;
715             }
716 
717             public Integer getMaxAttempts(){
718                 return maxAttempts;
719             }
720 
721             public String getComment(){
722                 return comment;
723             }
724 
725             private Create(Builder builder) {
726                 if (builder.orderID == null) throw new NullPointerException("orderID cannot be null");
727                 this.orderID = builder.orderID;
728                 if (builder.description == null) throw new NullPointerException("description cannot be null");
729                 this.description = builder.description;
730                 if (builder.fromAddress == null) throw new NullPointerException("fromAddress cannot be null");
731                 this.fromAddress = builder.fromAddress;
732                 if (builder.toAddress == null) throw new NullPointerException("toAddress cannot be null");
733                 this.toAddress = builder.toAddress;
734                 if (builder.destinationEmail == null) throw new NullPointerException("destinationEmail cannot be null");
735                 this.destinationEmail = builder.destinationEmail;
736                 if (builder.senderEmail == null) throw new NullPointerException("senderEmail cannot be null");
737                 this.senderEmail = builder.senderEmail;
738                 if (builder.maxAttempts == null) throw new NullPointerException("maxAttempts cannot be null");
739                 this.maxAttempts = builder.maxAttempts;
740                 if (builder.comment == null) throw new NullPointerException("comment cannot be null");
741                 this.comment = builder.comment;
742             }
743 
744             public static Builder builder() {
745                 return new Builder();
746             }
747 
748             public static class Builder {
749 
750                 private String orderID;
751                 private String description;
752                 private String fromAddress;
753                 private String toAddress;
754                 private String destinationEmail;
755                 private String senderEmail;
756                 private Integer maxAttempts;
757                 private String comment;
758 
759                 public Builder orderID(String orderID) {
760                     this.orderID = orderID;
761                     return this;
762                 }
763 
764                 public Builder description(String description) {
765                     this.description = description;
766                     return this;
767                 }
768 
769                 public Builder fromAddress(String fromAddress) {
770                     this.fromAddress = fromAddress;
771                     return this;
772                 }
773 
774                 public Builder toAddress(String toAddress) {
775                     this.toAddress = toAddress;
776                     return this;
777                 }
778 
779                 public Builder destinationEmail(String destinationEmail) {
780                     this.destinationEmail = destinationEmail;
781                     return this;
782                 }
783 
784                 public Builder senderEmail(String senderEmail) {
785                     this.senderEmail = senderEmail;
786                     return this;
787                 }
788 
789                 public Builder maxAttempts(Integer maxAttempts) {
790                     this.maxAttempts = maxAttempts;
791                     return this;
792                 }
793 
794                 public Builder comment(String comment) {
795                     this.comment = comment;
796                     return this;
797                 }
798 
799                 public Create build() {
800                     return new Create(this);
801                 }
802             }
803 
804             @Override
805             public String toString() {
806                 return MoreObjects.toStringHelper(this.getClass())
807                     .add("orderID", orderID)
808                     .add("description", description)
809                     .add("fromAddress", fromAddress)
810                     .add("toAddress", toAddress)
811                     .add("destinationEmail", destinationEmail)
812                     .add("senderEmail", senderEmail)
813                     .add("maxAttempts", maxAttempts)
814                     .add("comment", comment)
815                     .toString();
816             }
817         }
818 
819 
820         /**
821          * Event implementation for event 'Send'
822          */
823         @SuppressWarnings("serial")
824         public static class Send implements Event<Order>, Serializable {
825 
826             public static final String signatureKey = "";
827 
828             public String signatureKey() {
829                 return signatureKey;
830             }
831 
832             /**
833              * Constructor.
834              */
835             public Send(){
836             }
837 
838             private Send(Builder builder) {
839             }
840 
841             public static Builder builder() {
842                 return new Builder();
843             }
844 
845             public static class Builder {
846 
847 
848                 public Send build() {
849                     return new Send(this);
850                 }
851             }
852         }
853 
854 
855         /**
856          * Event implementation for event 'Assign'
857          */
858         @SuppressWarnings("serial")
859         public static class Assign implements Event<Order>, Serializable {
860 
861             public static final String signatureKey = "";
862 
863             public String signatureKey() {
864                 return signatureKey;
865             }
866 
867             /**
868              * Constructor.
869              */
870             public Assign(){
871             }
872 
873             private Assign(Builder builder) {
874             }
875 
876             public static Builder builder() {
877                 return new Builder();
878             }
879 
880             public static class Builder {
881 
882 
883                 public Assign build() {
884                     return new Assign(this);
885                 }
886             }
887         }
888 
889 
890         /**
891          * Event implementation for event 'Picked up'
892          */
893         @SuppressWarnings("serial")
894         public static class PickedUp implements Event<Order>, Serializable {
895 
896             public static final String signatureKey = "";
897 
898             public String signatureKey() {
899                 return signatureKey;
900             }
901 
902             /**
903              * Constructor.
904              */
905             public PickedUp(){
906             }
907 
908             private PickedUp(Builder builder) {
909             }
910 
911             public static Builder builder() {
912                 return new Builder();
913             }
914 
915             public static class Builder {
916 
917 
918                 public PickedUp build() {
919                     return new PickedUp(this);
920                 }
921             }
922         }
923 
924 
925         /**
926          * Event implementation for event 'Arrived depot'
927          */
928         @SuppressWarnings("serial")
929         public static class ArrivedDepot implements Event<Order>, Serializable {
930 
931             public static final String signatureKey = "java.lang.String;";
932 
933             public String signatureKey() {
934                 return signatureKey;
935             }
936             private final String depotID;
937 
938             /**
939              * Constructor.
940              */
941             public ArrivedDepot(String depotID){
942                 if (depotID == null) throw new NullPointerException("depotID cannot be null");
943                 this.depotID = depotID;
944             }
945 
946             public String getDepotID(){
947                 return depotID;
948             }
949 
950             private ArrivedDepot(Builder builder) {
951                 if (builder.depotID == null) throw new NullPointerException("depotID cannot be null");
952                 this.depotID = builder.depotID;
953             }
954 
955             public static Builder builder() {
956                 return new Builder();
957             }
958 
959             public static class Builder {
960 
961                 private String depotID;
962 
963                 public Builder depotID(String depotID) {
964                     this.depotID = depotID;
965                     return this;
966                 }
967 
968                 public ArrivedDepot build() {
969                     return new ArrivedDepot(this);
970                 }
971             }
972 
973             @Override
974             public String toString() {
975                 return MoreObjects.toStringHelper(this.getClass())
976                     .add("depotID", depotID)
977                     .toString();
978             }
979         }
980 
981 
982         /**
983          * Event implementation for event 'Arrived final depot'
984          */
985         @SuppressWarnings("serial")
986         public static class ArrivedFinalDepot implements Event<Order>, Serializable {
987 
988             public static final String signatureKey = "java.lang.String;";
989 
990             public String signatureKey() {
991                 return signatureKey;
992             }
993             private final String depotID;
994 
995             /**
996              * Constructor.
997              */
998             public ArrivedFinalDepot(String depotID){
999                 if (depotID == null) throw new NullPointerException("depotID cannot be null");
1000                 this.depotID = depotID;
1001             }
1002 
1003             public String getDepotID(){
1004                 return depotID;
1005             }
1006 
1007             private ArrivedFinalDepot(Builder builder) {
1008                 if (builder.depotID == null) throw new NullPointerException("depotID cannot be null");
1009                 this.depotID = builder.depotID;
1010             }
1011 
1012             public static Builder builder() {
1013                 return new Builder();
1014             }
1015 
1016             public static class Builder {
1017 
1018                 private String depotID;
1019 
1020                 public Builder depotID(String depotID) {
1021                     this.depotID = depotID;
1022                     return this;
1023                 }
1024 
1025                 public ArrivedFinalDepot build() {
1026                     return new ArrivedFinalDepot(this);
1027                 }
1028             }
1029 
1030             @Override
1031             public String toString() {
1032                 return MoreObjects.toStringHelper(this.getClass())
1033                     .add("depotID", depotID)
1034                     .toString();
1035             }
1036         }
1037 
1038 
1039         /**
1040          * Event implementation for event 'Delivering'
1041          */
1042         @SuppressWarnings("serial")
1043         public static class Delivering implements Event<Order>, Serializable {
1044 
1045             public static final String signatureKey = "";
1046 
1047             public String signatureKey() {
1048                 return signatureKey;
1049             }
1050 
1051             /**
1052              * Constructor.
1053              */
1054             public Delivering(){
1055             }
1056 
1057             private Delivering(Builder builder) {
1058             }
1059 
1060             public static Builder builder() {
1061                 return new Builder();
1062             }
1063 
1064             public static class Builder {
1065 
1066 
1067                 public Delivering build() {
1068                     return new Delivering(this);
1069                 }
1070             }
1071         }
1072 
1073 
1074         /**
1075          * Event implementation for event 'Delivered'
1076          */
1077         @SuppressWarnings("serial")
1078         public static class Delivered implements Event<Order>, Serializable {
1079 
1080             public static final String signatureKey = "";
1081 
1082             public String signatureKey() {
1083                 return signatureKey;
1084             }
1085 
1086             /**
1087              * Constructor.
1088              */
1089             public Delivered(){
1090             }
1091 
1092             private Delivered(Builder builder) {
1093             }
1094 
1095             public static Builder builder() {
1096                 return new Builder();
1097             }
1098 
1099             public static class Builder {
1100 
1101 
1102                 public Delivered build() {
1103                     return new Delivered(this);
1104                 }
1105             }
1106         }
1107 
1108 
1109         /**
1110          * Event implementation for event 'Delivery failed'
1111          */
1112         @SuppressWarnings("serial")
1113         public static class DeliveryFailed implements Event<Order>, Serializable {
1114 
1115             public static final String signatureKey = "";
1116 
1117             public String signatureKey() {
1118                 return signatureKey;
1119             }
1120 
1121             /**
1122              * Constructor.
1123              */
1124             public DeliveryFailed(){
1125             }
1126 
1127             private DeliveryFailed(Builder builder) {
1128             }
1129 
1130             public static Builder builder() {
1131                 return new Builder();
1132             }
1133 
1134             public static class Builder {
1135 
1136 
1137                 public DeliveryFailed build() {
1138                     return new DeliveryFailed(this);
1139                 }
1140             }
1141         }
1142 
1143 
1144         /**
1145          * Event implementation for event 'Deliver again'
1146          */
1147         @SuppressWarnings("serial")
1148         public static class DeliverAgain implements Event<Order>, Serializable {
1149 
1150             public static final String signatureKey = "";
1151 
1152             public String signatureKey() {
1153                 return signatureKey;
1154             }
1155 
1156             /**
1157              * Constructor.
1158              */
1159             public DeliverAgain(){
1160             }
1161 
1162             private DeliverAgain(Builder builder) {
1163             }
1164 
1165             public static Builder builder() {
1166                 return new Builder();
1167             }
1168 
1169             public static class Builder {
1170 
1171 
1172                 public DeliverAgain build() {
1173                     return new DeliverAgain(this);
1174                 }
1175             }
1176         }
1177 
1178 
1179         /**
1180          * Event implementation for event 'No more attempts'
1181          */
1182         @SuppressWarnings("serial")
1183         public static class NoMoreAttempts implements Event<Order>, Serializable {
1184 
1185             public static final String signatureKey = "";
1186 
1187             public String signatureKey() {
1188                 return signatureKey;
1189             }
1190 
1191             /**
1192              * Constructor.
1193              */
1194             public NoMoreAttempts(){
1195             }
1196 
1197             private NoMoreAttempts(Builder builder) {
1198             }
1199 
1200             public static Builder builder() {
1201                 return new Builder();
1202             }
1203 
1204             public static class Builder {
1205 
1206 
1207                 public NoMoreAttempts build() {
1208                     return new NoMoreAttempts(this);
1209                 }
1210             }
1211         }
1212 
1213 
1214         /**
1215          * Event implementation for event 'Could not deliver'
1216          */
1217         @SuppressWarnings("serial")
1218         public static class CouldNotDeliver implements Event<Order>, Serializable {
1219 
1220             public static final String signatureKey = "";
1221 
1222             public String signatureKey() {
1223                 return signatureKey;
1224             }
1225 
1226             /**
1227              * Constructor.
1228              */
1229             public CouldNotDeliver(){
1230             }
1231 
1232             private CouldNotDeliver(Builder builder) {
1233             }
1234 
1235             public static Builder builder() {
1236                 return new Builder();
1237             }
1238 
1239             public static class Builder {
1240 
1241 
1242                 public CouldNotDeliver build() {
1243                     return new CouldNotDeliver(this);
1244                 }
1245             }
1246         }
1247 
1248 
1249         /**
1250          * Event implementation for event 'Return to sender'
1251          */
1252         @SuppressWarnings("serial")
1253         public static class ReturnToSender implements Event<Order>, Serializable {
1254 
1255             public static final String signatureKey = "";
1256 
1257             public String signatureKey() {
1258                 return signatureKey;
1259             }
1260 
1261             /**
1262              * Constructor.
1263              */
1264             public ReturnToSender(){
1265             }
1266 
1267             private ReturnToSender(Builder builder) {
1268             }
1269 
1270             public static Builder builder() {
1271                 return new Builder();
1272             }
1273 
1274             public static class Builder {
1275 
1276 
1277                 public ReturnToSender build() {
1278                     return new ReturnToSender(this);
1279                 }
1280             }
1281         }
1282 
1283 
1284         /**
1285          * Event implementation for event 'Delivered by pickup'
1286          */
1287         @SuppressWarnings("serial")
1288         public static class DeliveredByPickup implements Event<Order>, Serializable {
1289 
1290             public static final String signatureKey = "";
1291 
1292             public String signatureKey() {
1293                 return signatureKey;
1294             }
1295 
1296             /**
1297              * Constructor.
1298              */
1299             public DeliveredByPickup(){
1300             }
1301 
1302             private DeliveredByPickup(Builder builder) {
1303             }
1304 
1305             public static Builder builder() {
1306                 return new Builder();
1307             }
1308 
1309             public static class Builder {
1310 
1311 
1312                 public DeliveredByPickup build() {
1313                     return new DeliveredByPickup(this);
1314                 }
1315             }
1316         }
1317 
1318     }
1319 
1320     /**
1321      * Asychronously queues the given signal against this entity for processing.
1322      */
1323     @Override
1324     public Order signal(Event<Order> event) {
1325         helper().signal(event);
1326         return this;
1327     }
1328 
1329     /**
1330      * Asychronously queues the given signal against this entity for processing
1331      * after the delay specified. Delay cannot be null.
1332      */
1333     @Override
1334     public Order signal(Event<Order> event, Duration delay) {
1335         helper().signal(event, Optional.of(delay));
1336         return this;
1337     }
1338 
1339     /**
1340      * Asychronously queues the given signal against this entity for processing
1341      * at the epoch time in ms specified. Delay cannot be null.
1342      */
1343     @Override
1344     public Order signal(Event<Order> event, long time) {
1345         return signal(event, Duration.create(time-System.currentTimeMillis(),TimeUnit.MILLISECONDS));
1346     }
1347 
1348     public Order cancelSignal(String eventSignatureKey) {
1349          return this;
1350     }
1351 
1352     public Order cancelSignal(Event<Order> event) {
1353          return cancelSignal(event.signatureKey());
1354     }
1355 
1356     /**
1357      * Synchronously runs the on entry procedure associated
1358      * with this event and also any signals to self that are
1359      * made during the procedure. This method should not
1360      * be called directly except in a unit testing scenario
1361      * perhaps. Call signal method instead.
1362      */
1363     @Override
1364     public Order event(Event<Order> event){
1365 
1366         helper().beforeEvent();
1367 
1368         // process the event
1369         if (event instanceof Events.Create){
1370             processEvent((Events.Create) event);
1371         }
1372         else if (event instanceof Events.Send){
1373             processEvent((Events.Send) event);
1374         }
1375         else if (event instanceof Events.Assign){
1376             processEvent((Events.Assign) event);
1377         }
1378         else if (event instanceof Events.PickedUp){
1379             processEvent((Events.PickedUp) event);
1380         }
1381         else if (event instanceof Events.ArrivedDepot){
1382             processEvent((Events.ArrivedDepot) event);
1383         }
1384         else if (event instanceof Events.ArrivedFinalDepot){
1385             processEvent((Events.ArrivedFinalDepot) event);
1386         }
1387         else if (event instanceof Events.Delivering){
1388             processEvent((Events.Delivering) event);
1389         }
1390         else if (event instanceof Events.Delivered){
1391             processEvent((Events.Delivered) event);
1392         }
1393         else if (event instanceof Events.DeliveryFailed){
1394             processEvent((Events.DeliveryFailed) event);
1395         }
1396         else if (event instanceof Events.DeliverAgain){
1397             processEvent((Events.DeliverAgain) event);
1398         }
1399         else if (event instanceof Events.NoMoreAttempts){
1400             processEvent((Events.NoMoreAttempts) event);
1401         }
1402         else if (event instanceof Events.CouldNotDeliver){
1403             processEvent((Events.CouldNotDeliver) event);
1404         }
1405         else if (event instanceof Events.ReturnToSender){
1406             processEvent((Events.ReturnToSender) event);
1407         }
1408         else if (event instanceof Events.DeliveredByPickup){
1409             processEvent((Events.DeliveredByPickup) event);
1410         }
1411 
1412         helper().afterEvent();
1413         return this;
1414     }
1415 
1416     /**
1417      * Synchronously perform the change.
1418      */
1419     private void processEvent(Events.Create event){
1420         if (state==null){
1421             state=State.PREPARING.toString();
1422             synchronized(this) {
1423                 _behaviour.onEntryPreparing(event);
1424             }
1425         }
1426     }
1427 
1428     /**
1429      * Synchronously perform the change.
1430      */
1431     private void processEvent(Events.Send event){
1432         if (state.equals(State.PREPARING.toString())){
1433             state=State.READY_FOR_DISPATCH.toString();
1434             synchronized(this) {
1435                 _behaviour.onEntryReadyForDispatch(event);
1436             }
1437         }
1438     }
1439 
1440     /**
1441      * Synchronously perform the change.
1442      */
1443     private void processEvent(Events.Assign event){
1444         if (state.equals(State.READY_FOR_DISPATCH.toString())){
1445             state=State.COURIER_ASSIGNED.toString();
1446             synchronized(this) {
1447                 _behaviour.onEntryCourierAssigned(event);
1448             }
1449         }
1450     }
1451 
1452     /**
1453      * Synchronously perform the change.
1454      */
1455     private void processEvent(Events.PickedUp event){
1456         if (state.equals(State.COURIER_ASSIGNED.toString())){
1457             state=State.IN_TRANSIT.toString();
1458             synchronized(this) {
1459                 _behaviour.onEntryInTransit(event);
1460             }
1461         }
1462     }
1463 
1464     /**
1465      * Synchronously perform the change.
1466      */
1467     private void processEvent(Events.ArrivedDepot event){
1468         if (state.equals(State.IN_TRANSIT.toString())){
1469             state=State.IN_TRANSIT.toString();
1470             synchronized(this) {
1471                 _behaviour.onEntryInTransit(event);
1472             }
1473         }
1474     }
1475 
1476     /**
1477      * Synchronously perform the change.
1478      */
1479     private void processEvent(Events.ArrivedFinalDepot event){
1480         if (state.equals(State.IN_TRANSIT.toString())){
1481             state=State.READY_FOR_DELIVERY.toString();
1482             synchronized(this) {
1483                 _behaviour.onEntryReadyForDelivery(event);
1484             }
1485         }
1486     }
1487 
1488     /**
1489      * Synchronously perform the change.
1490      */
1491     private void processEvent(Events.Delivering event){
1492         if (state.equals(State.READY_FOR_DELIVERY.toString())){
1493             state=State.DELIVERING.toString();
1494             synchronized(this) {
1495                 _behaviour.onEntryDelivering(event);
1496             }
1497         }
1498     }
1499 
1500     /**
1501      * Synchronously perform the change.
1502      */
1503     private void processEvent(Events.Delivered event){
1504         if (state.equals(State.DELIVERING.toString())){
1505             state=State.DELIVERED.toString();
1506             synchronized(this) {
1507                 _behaviour.onEntryDelivered(event);
1508             }
1509         }
1510     }
1511 
1512     /**
1513      * Synchronously perform the change.
1514      */
1515     private void processEvent(Events.DeliveryFailed event){
1516         if (state.equals(State.DELIVERING.toString())){
1517             state=State.DELIVERY_FAILED.toString();
1518             synchronized(this) {
1519                 _behaviour.onEntryDeliveryFailed(event);
1520             }
1521         }
1522     }
1523 
1524     /**
1525      * Synchronously perform the change.
1526      */
1527     private void processEvent(Events.DeliverAgain event){
1528         if (state.equals(State.DELIVERY_FAILED.toString())){
1529             state=State.AWAITING_NEXT_DELIVERY_ATTEMPT.toString();
1530             synchronized(this) {
1531                 _behaviour.onEntryAwaitingNextDeliveryAttempt(event);
1532             }
1533         }
1534         else if (state.equals(State.AWAITING_NEXT_DELIVERY_ATTEMPT.toString())){
1535             state=State.READY_FOR_DELIVERY.toString();
1536             synchronized(this) {
1537                 _behaviour.onEntryReadyForDelivery(event);
1538             }
1539         }
1540     }
1541 
1542     /**
1543      * Synchronously perform the change.
1544      */
1545     private void processEvent(Events.NoMoreAttempts event){
1546         if (state.equals(State.DELIVERY_FAILED.toString())){
1547             state=State.HELD_FOR_PICKUP.toString();
1548             synchronized(this) {
1549                 _behaviour.onEntryHeldForPickup(event);
1550             }
1551         }
1552     }
1553 
1554     /**
1555      * Synchronously perform the change.
1556      */
1557     private void processEvent(Events.CouldNotDeliver event){
1558         if (state.equals(State.DELIVERING.toString())){
1559             state=State.HELD_FOR_PICKUP.toString();
1560             synchronized(this) {
1561                 _behaviour.onEntryHeldForPickup(event);
1562             }
1563         }
1564     }
1565 
1566     /**
1567      * Synchronously perform the change.
1568      */
1569     private void processEvent(Events.ReturnToSender event){
1570         if (state.equals(State.HELD_FOR_PICKUP.toString())){
1571             state=State.RETURN_TO_SENDER.toString();
1572             synchronized(this) {
1573                 _behaviour.onEntryReturnToSender(event);
1574             }
1575         }
1576     }
1577 
1578     /**
1579      * Synchronously perform the change.
1580      */
1581     private void processEvent(Events.DeliveredByPickup event){
1582         if (state.equals(State.HELD_FOR_PICKUP.toString())){
1583             state=State.DELIVERED.toString();
1584             synchronized(this) {
1585                 _behaviour.onEntryDelivered(event);
1586             }
1587         }
1588     }
1589 
1590     /**
1591      * Static creator method associated with the creation transition to 'Preparing' via event 'Create'.
1592      */
1593     public static Order create(EntityManager em, CreationEvent<Order> event) {
1594         Order entity = new Order();
1595         entity.event(event);
1596         em.persist(entity);
1597         return entity;
1598     }
1599 
1600     /**
1601      * Same as EntityManager.merge() except allows method chaining.
1602      * Returns a new merged instance.
1603      */
1604     public Order merge(EntityManager em) {
1605         return em.merge(this);
1606     }
1607 
1608     /**
1609      * Same as EntityManager.persist() except allows method chaining. Returns this.
1610      */
1611     public Order persist(EntityManager em) {
1612         em.persist(this);
1613         return this;
1614     }
1615 
1616 
1617     /**
1618      * Same as {@code persist(Context.em())}. Returns this.
1619      */
1620     public Order persist() {
1621         Context.em().persist(this);
1622         return this;
1623     }
1624 
1625     /**
1626      * Same as EntityManager.remove() except inverted to facilitate method chaining. Returns this.
1627      */
1628     public Order remove(EntityManager em) {
1629         em.remove(this);
1630         return this;
1631     }
1632 
1633     /**
1634      * Same as EntityManager.remove() except inverted to facilitate method chaining. Returns this.
1635      */
1636     public Order remove() {
1637         Context.remove(this);
1638         return this;
1639     }
1640 
1641     /**
1642      * Same as this.remove()
1643      */
1644     public Order delete() {
1645         return remove();
1646     }
1647 
1648     /**
1649      * Same as EntityManager.refresh() except inverted to facilitate method chaining. Returns this.
1650      */
1651     public Order refresh(EntityManager em) {
1652         em.refresh(this);
1653         return this;
1654     }
1655 
1656     /**
1657      * Does a merge then a refresh and returns a new updated merged instance.
1658      */
1659     public Order load(EntityManager em) {
1660         return merge(em).refresh(em);
1661     }
1662 
1663     public Order load() {
1664         return Context.load(this);
1665     }
1666 
1667     /**
1668      * On entry procedures for this entity.
1669      */
1670     public static interface Behaviour {
1671 
1672         void onEntryReadyForDelivery(Events.ArrivedFinalDepot event);
1673 
1674         void onEntryDelivered(Events.Delivered event);
1675 
1676         void onEntryReadyForDelivery(Events.DeliverAgain event);
1677 
1678         void onEntryReadyForDispatch(Events.Send event);
1679 
1680         void onEntryHeldForPickup(Events.NoMoreAttempts event);
1681 
1682         void onEntryReturnToSender(Events.ReturnToSender event);
1683 
1684         void onEntryAwaitingNextDeliveryAttempt(Events.DeliverAgain event);
1685 
1686         void onEntryHeldForPickup(Events.CouldNotDeliver event);
1687 
1688         void onEntryPreparing(Events.Create event);
1689 
1690         void onEntryCourierAssigned(Events.Assign event);
1691 
1692         void onEntryDelivering(Events.Delivering event);
1693 
1694         void onEntryDeliveryFailed(Events.DeliveryFailed event);
1695 
1696         void onEntryInTransit(Events.ArrivedDepot event);
1697 
1698         void onEntryDelivered(Events.DeliveredByPickup event);
1699 
1700         void onEntryInTransit(Events.PickedUp event);
1701 
1702     }
1703 
1704     /**
1705      * A factory that creates behaviour for a given entity.
1706      */
1707     public static interface BehaviourFactory {
1708 
1709         Behaviour create(Order entity);
1710 
1711     }
1712 
1713     /**
1714      * Returns a BehaviourFactory on the assumption that the given class
1715      * has a single constructor with one parameter of type Order.
1716      */
1717     public static BehaviourFactory createBehaviourFactory(final Class<? extends Behaviour> cls) {
1718         return new BehaviourFactory() {
1719             @Override
1720             public Behaviour create(Order entity) {
1721                 if (cls.getConstructors().length != 1)
1722                      throw new RuntimeException(
1723                               "expected only one constructor in the Behaviour implementation");
1724                 try {
1725                     return (Behaviour) cls.getConstructors()[0].newInstance(entity);
1726                 } catch (InstantiationException e) {
1727                     throw new RuntimeException(e);
1728                 } catch (IllegalAccessException e) {
1729                     throw new RuntimeException(e);
1730                 } catch (IllegalArgumentException e) {
1731                     throw new RuntimeException(e);
1732                 } catch (InvocationTargetException e) {
1733                     throw new RuntimeException(e);
1734                 } catch (SecurityException e) {
1735                     throw new RuntimeException(e);
1736                 }
1737             }
1738         };
1739     }
1740 
1741     public static Optional<Order> find(String id) {
1742         if (Context.em()!=null) {
1743             return Optional.fromNullable(Context.em().find(Order.class,id));
1744         } else {
1745             EntityManager em = Context.createEntityManager();
1746             try {
1747                 Order result = em.find(Order.class,id);
1748                 return Optional.fromNullable(result);
1749             } finally {
1750                 em.close();
1751             }
1752         }
1753     }
1754 
1755     public static class Attribute {
1756         public static final StringExpressionField<Order> description = new StringExpressionField<Order>(
1757             new xuml.tools.model.compiler.runtime.query.Field("description"));
1758         public static final StringExpressionField<Order> fromAddress = new StringExpressionField<Order>(
1759             new xuml.tools.model.compiler.runtime.query.Field("fromAddress"));
1760         public static final StringExpressionField<Order> toAddress = new StringExpressionField<Order>(
1761             new xuml.tools.model.compiler.runtime.query.Field("toAddress"));
1762         public static final StringExpressionField<Order> destinationEmail = new StringExpressionField<Order>(
1763             new xuml.tools.model.compiler.runtime.query.Field("destinationEmail"));
1764         public static final StringExpressionField<Order> senderEmail = new StringExpressionField<Order>(
1765             new xuml.tools.model.compiler.runtime.query.Field("senderEmail"));
1766         public static final NumericExpressionField<Order> maxAttempts = new NumericExpressionField<Order>(
1767             new xuml.tools.model.compiler.runtime.query.Field("maxAttempts"));
1768         public static final NumericExpressionField<Order> attempts = new NumericExpressionField<Order>(
1769             new xuml.tools.model.compiler.runtime.query.Field("attempts"));
1770         public static final StringExpressionField<Order> comment = new StringExpressionField<Order>(
1771             new xuml.tools.model.compiler.runtime.query.Field("comment"));
1772         public static final StringExpressionField<Order> status = new StringExpressionField<Order>(
1773             new xuml.tools.model.compiler.runtime.query.Field("status"));
1774         public static final StringExpressionField<Order> id = new StringExpressionField<Order>(
1775             new xuml.tools.model.compiler.runtime.query.Field("id"));
1776         public static final StringExpressionField<Order> depot_R1_id = new StringExpressionField<Order>(
1777             new xuml.tools.model.compiler.runtime.query.Field("depot_R1.id"));
1778     }
1779 
1780     public static SelectBuilder<Order> select(BooleanExpression<Order> where) {
1781         return new SelectBuilder<Order>(where).entityClass(Order.class).info(signaller.getInfo());
1782     }
1783 
1784     public static SelectBuilder<Order> select() {
1785         return select(null);
1786     }
1787 
1788 }