Faster Development Through Modeling
by Jeff Cahoon

Example 1:

// connect to the repository
MDRepository rep = MDRManager.getDefault().getDefaultRepository();
if (rep == null) {
   throw new Exception("MDRManager returned a null repository");
}
 ...
public Collection getDimensions(DwDesignPackage extent) {
   RefPackage olap = extent.refPackage("Olap");
   DimensionClass dc = (DimensionClass)olap.refClass("Dimension");
   return dc.refAllOfClass();
}
 ...
DwDesignPackage extent = mdr.getExtent();
for (Iterator iter1 = (mdr.getDimensions(extent)).iterator(); 
   iter1.hasNext();) {
   Dimension dim = (Dimension) iter1.next();
 ...
   String dn = dim.getName();

Example 2:

private HashMap build<%TfmName%>Lookup() throws Exception {
    CustomTransform customTransform = new CustomTransform();
    <%DimName%>ManagerOlapFactory <%dimName%>MOFactory =
        new <%DimName%>ManagerOlapFactory();
    <%dimName%>MOFactory.setProperties(properties);
    <%DimName%>ManagerOlap <%dimName%>ManagerOlap = 
        <%dimName%>MOFactory.create<%DimName%>ManagerOlap();
    <%DimName%>Olap <%dimName%>Olap[] = 
        <%dimName%>ManagerOlap.loadAll();
    HashMap lookup = new HashMap();
    Class[] preformatArray = {Object.class};
    boolean preformatSet = false;
    Method preformat = null;
    try {
        preformat = customTransform.getClass().getDeclaredMethod(
            "pre<%TfmName%>", preformatArray); 
        preformatSet = true;
    } catch (NoSuchMethodException nsme) {
        preformatSet = false;
    }





1


