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

RealPaper.java

Go to the documentation of this file.
00001 package cedar.jetweb.model.paper;
00002 
00003 import cedar.jetweb.Storeable;
00004 import cedar.jetweb.JetWebException;
00005 import cedar.jetweb.model.plots.RealPlot;
00006 import cedar.jetweb.model.MCProcessType;
00007 import cedar.jetweb.model.Collision;
00008 import cedar.jetweb.db.DBPlotManager;
00009 
00010 import java.util.Collection;
00011 import java.util.HashMap;
00012 
00016 
00017 public class RealPaper implements Storeable{
00018 
00019     private Integer id_ = -1;
00020     private String directory_ =null;
00021     private String title_;
00022     private String reference_;
00023     private String codeAuthor_;
00024     private String contact_;
00025     private Integer nplots_ = 0;
00026     private String collaboration_;
00027     private String accelerator_;
00028     private Integer irn_;
00029 
00030     private HashMap<Integer, RealPlot> plots_ = 
00031     new HashMap<Integer, RealPlot>();
00032 
00034     public RealPaper(){
00035     
00036     }
00037 
00038     public RealPaper(Integer id) throws JetWebException{
00039     id_ = id;
00040     retrieve();
00041     }
00043     public RealPaper setIRN(Integer irn){
00044     irn_ = irn;
00045     return this;
00046     }
00047 
00048     public Integer getIRN(){
00049     return irn_;
00050     }
00051 
00053     public RealPaper setDirName(String directory){
00054     directory_ = directory;
00055     return this;
00056     }
00057 
00058     public String getDirName(){
00059     return directory_;
00060     }
00062     public RealPaper setCollaboration(String collaboration){
00063     collaboration_ = collaboration;
00064     return this;
00065     }
00066 
00067     public String getCollaboration(){
00068     return collaboration_;
00069     }
00071     public RealPaper setReference(String reference){
00072     reference_ = reference;
00073     return this;
00074     }
00075 
00076     public String getReference(){
00077     return reference_;
00078     }
00080     public RealPaper setCodeAuthor(String codeAuthor){
00081     codeAuthor_ = codeAuthor;
00082     return this;
00083     }
00084     
00085     public String getCodeAuthor(){
00086     return codeAuthor_;
00087     }
00089     public RealPaper setCodeContact(String contact){
00090     contact_ = contact;
00091     return this;
00092     }
00093 
00094     public String getCodeContact(){
00095     return contact_;
00096     }
00098     public RealPaper setNPlots(Integer nplots){
00099     nplots_ = nplots;
00100     return this;
00101     }
00102 
00103     public Integer getNPlots(){
00104     return nplots_;
00105     }
00107     public RealPaper setAccelerator(String accelerator){
00108     accelerator_ = accelerator;
00109     return this;
00110     }
00111 
00112     public String getAccelerator(){
00113     return accelerator_;
00114     }
00116     public Collection<RealPlot> getPlots(){
00117     return plots_.values();
00118     }
00119 
00120     public HashMap<Integer, RealPlot> getIndexedPlots(){
00121     return plots_;
00122     }
00124     public RealPaper addPlot(RealPlot plot){
00125 
00126     plots_.put(plot.getId(), plot);
00127     nplots_ = plots_.size();
00128     return this;
00129     }
00130 
00131     public RealPlot getPlot(Integer csnId){
00132 
00133     return plots_.get(csnId);
00134     }
00135 
00137     public RealPaper setTitle(String title){
00138     title_ = title;
00139     return this;
00140     }
00141 
00142     public String getTitle(){
00143     return title_;
00144     }
00146     public RealPaper setId(Integer id){
00147     id_ = id;
00148     return this;
00149     }
00150 
00151     public int getId(){
00152     return id_;
00153     }
00155     public boolean containsDataFor(MCProcessType proc)
00156     throws JetWebException{
00157     for(RealPlot plot: getPlots()){
00158         if(plot.getMCProcessType().equals(proc)){
00159         return true;
00160         }
00161     }
00162     return false;
00163     }
00164 
00165     public boolean containsDataFor(Collision collision)
00166     throws JetWebException{
00167     for(RealPlot plot: getPlots()){
00168         if(plot.getMCProcessType().getCollision().equals(collision)){
00169         return true;
00170         }
00171     }
00172     return false;
00173     }
00174 
00176     public boolean store() throws JetWebException{
00177     boolean paperExisted = DBPlotManager.addRealPaper(this);
00178     return !paperExisted;
00179     }
00180 
00181     public boolean retrieve() throws JetWebException{
00182     DBPlotManager.fillRealPaper(this);
00183     return true;
00184     }
00185 
00186     public void delete(){
00187 
00188     return;
00189     }
00190 }

Generated Wed Jan 17 09:14:27 GMT 2007