Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ProjectImpl.java

Go to the documentation of this file.
00001 
00066 package com.arcle.rmt.superwaba.model.imp.rqml;
00067 
00068 import superwaba.ext.xplat.io.Storable;
00069 import superwaba.ext.xplat.io.DataStream;
00070 
00071 import com.arcle.rmt.superwaba.model.imp.*;
00072 import com.arcle.rmt.rqml.*;
00073 
00079 public class ProjectImpl extends RQMLFirstClassImpl implements Project {
00080 
00081     //-----------------------------------------------------------------------
00082     // Project Implementations
00083 
00085     public Product getProduct() {
00086         if (product == null) {
00087             product = createProductImpl();
00088         }
00089         return product;
00090     }
00091 
00092 
00094     public Problem getProblem() {
00095         if (problem == null) {
00096             problem = createProblemImpl();
00097         }
00098         return problem;
00099     }
00100 
00101 
00103     public Scope getScope() {
00104         if (scope == null) {
00105             scope = createScopeImpl();
00106         }
00107         return scope;
00108     }
00109 
00110 
00112     public Vision getVision() {
00113         if (vision == null) {
00114             vision = createVisionImpl();
00115         }
00116         return vision;
00117     }
00118 
00119 
00120     //-----------------------------------------------------------------------
00121     // Factory Methods
00122 
00123     public GenericMemento createMemento() {
00124         return new Memento(this);
00125     }
00126 
00127     protected ScopeImpl createScopeImpl() {
00128         return new ScopeImpl();
00129     }
00130 
00131     protected VisionImpl createVisionImpl() {
00132         return new VisionImpl();
00133     }
00134 
00135     protected ProductImpl createProductImpl() {
00136         return new ProductImpl();
00137     }
00138 
00139     protected ProblemImpl createProblemImpl() {
00140         return new ProblemImpl();
00141     }
00142 
00143     //-----------------------------------------------------------------------
00144     // Member Variables
00145 
00146     private ProblemImpl problem = null;
00147 
00148     private VisionImpl vision = null;
00149 
00150     private ScopeImpl scope = null;
00151 
00152     private ProductImpl product = null;
00153 
00154 
00155     //-----------------------------------------------------------------------
00156     // Inner Classes
00157 
00158     protected static class Memento extends RQMLFirstClassImpl.Memento {
00159         public Memento(ProjectImpl originator) {
00160             super(originator);
00161         }
00162 
00163         public Storable getInstance() {
00164             // This memento is not directly stored in the Catalog as an
00165             // object, so this factory method is not required.
00166             return null;
00167         }
00168 
00169         public byte getID() {
00170             return DocumentImpl.PROJECT_ID;
00171         }
00172 
00173         public void saveState(DataStream data) {
00174             final ProjectImpl org = (ProjectImpl) getOriginator();
00175             super.saveState(data);
00176             saveMementoable(org.problem, data);
00177             saveMementoable(org.vision, data);
00178             saveMementoable(org.scope, data);
00179             saveMementoable(org.product, data);
00180         }
00181 
00182         public void loadState(DataStream data) {
00183             final ProjectImpl org = (ProjectImpl) getOriginator();
00184             super.loadState(data);
00185             org.problem = (ProblemImpl) loadMementoable(data, new MementoableFactory() {
00186                 public Mementoable createOriginator() {
00187                     return org.createProblemImpl();
00188                 }
00189             });
00190 
00191             org.vision = (VisionImpl) loadMementoable(data, new MementoableFactory() {
00192                 public Mementoable createOriginator() {
00193                     return org.createVisionImpl();
00194                 }
00195             });
00196 
00197             org.scope = (ScopeImpl) loadMementoable(data, new MementoableFactory() {
00198                 public Mementoable createOriginator() {
00199                     return org.createScopeImpl();
00200                 }
00201             });
00202 
00203             org.product = (ProductImpl) loadMementoable(data, new MementoableFactory() {
00204                 public Mementoable createOriginator() {
00205                     return org.createProductImpl();
00206                 }
00207             });
00208         }
00209     }
00210 }

Generated on Fri Jun 18 19:51:24 2004 for Arcle Rambutan by doxygen 1.3.5