Row_Helper.java

00001 package ;
00002 
00003 
00011   // import configuration classes
00012 
00013 import config.*;
00014 
00015 
00029 public class Row_Helper {
00030 
00038   static public Row get(config.Configuration db, config.ConfigObject obj) {
00039     if(obj == null) { return null; }
00040     Row_Impl o = (Row_Impl)db.get("Row", obj);
00041     if(o == null) {
00042       o = new Row_Impl(db, obj);
00043       db.add("Row", obj.UID(), o);
00044     }
00045     return o;
00046   }
00047 
00048 
00056   static public Row get(config.Configuration db, String id) {
00057       // check the object is already in cache
00058     Row o = (Row)db.get("Row", id);
00059     if(o != null) return o;
00060 
00061       // check the object exists and get it from database
00062     config.ConfigObject obj = db.get_object("Row", id);
00063     return get(db, obj);
00064   }
00065 
00066 
00075   static public Row[] get(config.Configuration db, config.Query query) {
00076     ConfigObject[] objs = db.get_objects("Row", query);
00077     Row[] result = new Row[objs.length];
00078     for (int i = 0; i < objs.length; i++) {
00079       result[i] = get(db, objs[i]);
00080     }
00081     return result;
00082   }
00083 
00091   static public Row create(config.Configuration db, String file, String id) {
00092     return get(db, db.create(file, "Row", id));
00093   }
00094 
00102   static public Row create(config.Configuration db, config.DalObject at, String id) {
00103     return get(db, db.create(at.config_object(), "Row", id));
00104   }
00105 
00106 }

Generated on Mon Feb 6 14:12:17 2006 for SCT DAQ/DCS Software - Java by  doxygen 1.4.6