Package org.dmd.dms

Examples of org.dmd.dms.ClassDefinition


    Iterator<ClassDefinition>  classes = sd.getClassDefList();
    if (classes != null){
      // We only generate the iterators for unnamed classes. Named classes will have their
      // Iterable generated along with the types because internal types are generated for them
      while(classes.hasNext()){
        ClassDefinition cd = classes.next();
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY)
          continue;
       
        if (cd.getIsNamedBy() == null){
          String dmwImport = cd.getDmwImport();
          if (cd.getUseWrapperType() == WrapperTypeEnum.EXTENDED)
            dmwImport = cd.getDmeImport();
         
          GenUtility.dumpObjectIterable(dmwdir, sd.getDmwPackage(), cd.getDmoImport(), cd.getName().getNameString(), dmwImport, "", fileHeader, progress);
        }
      }
     
    }
   
View Full Code Here


      createIfRequired(dmwdir);
     
      // We only generate the iterators for unnamed classes. Named classes will have their
      // Iterable generated along with the types because internal types are generated for them
      while(classes.hasNext()){
        ClassDefinition cd = classes.next();
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY)
          continue;
       
        if (cd.getIsNamedBy() == null){
          String dmwImport = cd.getDmwImport();
          if (cd.getUseWrapperType() == WrapperTypeEnum.EXTENDED)
            dmwImport = cd.getDmeImport();
         
          GenUtility.dumpObjectIterable(dmwdir, sd.getDmwPackage(), cd.getDmoImport(), cd.getName().getNameString(), dmwImport, "", fileHeader, progress);
        }
      }
     
    }
   
View Full Code Here

   
    // READ: the construction class ID
    int classID = dis.readInt();
   
    // Try to find the class in the schema
    ClassDefinition cd = schema.isClass(classID);
   
    if (cd == null)
      throw new IllegalStateException("Unknown class ID: " + classID + " ensure that you have loaded the required schemas.");
   
    // Tricky stuff: we always try to instantiate the wrapper for the object so that
    // we can support the DMW environment i.e. the DMO will have a handle to its
    // container. If something goes wrong, we fall back to directly instantiating
    // the DMO.
    DmwWrapper wrapper = null;
    try {
      wrapper = cd.newInstance();
    }
    catch(Exception ex){
      // Just fall back to instantiating the DMO
    }
   
    if (wrapper == null)
      rc = cd.newDMOInstance();
    else
      rc = wrapper.getDmcObject();
   
    // Add the auxiliary classes if they exist
    if (classCount > 1){
      for(int i=1; i<classCount; i++){
        classID = dis.readInt();
        cd = schema.isClass(classID);
        rc.addAux(new ClassDefinitionREF(cd.getDMO()));
      }
    }
   
    return(rc);
  }
View Full Code Here

       
            Iterator<DmcUncheckedObject> ucoIT = curr.getParsedRules();
            if (ucoIT != null){
          while(ucoIT.hasNext()){
            DmcUncheckedObject   uco = ucoIT.next();
            ClassDefinition   ruleDataCD   = sm.cdef(uco.getConstructionClass());
            RuleDefinition    ruleDEF    = ruleDataCD.getRuleDefinition();
            RuleDataDMO     ruledata  = null;
            SourceInfo      source    = getSource(uco);
           
            try{
              ruledata = (RuleDataDMO) dmofactory.createObject(uco);
View Full Code Here

   * required for the DMO.
   * @param cd
   * @return
   */
  static void getImports(StringBuffer sb, DmsDefinition def, Iterator<AttributeDefinition> must, Iterator<AttributeDefinition> may, ArrayList<AttributeDefinition> allAttr, BooleanVar anySVAttributes, BooleanVar anyMVAttributes){
    ClassDefinition  cd         = null;
    boolean      needJavaUtil  = false;
    boolean      anyAttributes  = false;
    TreeMap<StringName,TypeDefinition>  types = new TreeMap<StringName,TypeDefinition>();
    TreeSet<String>  genericImports  = new TreeSet<String>();
   
    anyMVAttributes.set(false);
    anySVAttributes.set(false);
    attributeInfo   = new StringBuffer();
    allAttr     = new ArrayList<AttributeDefinition>();
   
    if (def instanceof ClassDefinition){
      cd = (ClassDefinition) def;
    }
   
    if (may != null){
      anyAttributes = true;
      while(may.hasNext()){
        AttributeDefinition ad = may.next();
        TypeDefinition td = ad.getType();
        types.put(td.getName(), td);
       
        switch(ad.getValueType()){
        case SINGLE:
          anySVAttributes.set(true);
          break;
        case MULTI:
        case HASHMAPPED:
        case TREEMAPPED:
        case HASHSET:
        case TREESET:
          anyMVAttributes.set(true);
          needJavaUtil = true;
          break;
        }

        appendAttributeInfo(attributeInfo, ad.getName().getNameString(), ad.getDmdID(), ad.getType().getName().getNameString(), ad.getValueType(), "true");
       
        if (ad.getGenericArgsImport() != null)
          genericImports.add(ad.getGenericArgsImport());
       
        allAttr.add(ad);
      }
    }
   
    if (must != null){
      anyAttributes = true;
      while(must.hasNext()){
        AttributeDefinition ad = must.next();
        TypeDefinition td = ad.getType();
        types.put(td.getName(), td);
       
        switch(ad.getValueType()){
        case SINGLE:
          anySVAttributes.set(true);
          break;
        case MULTI:
        case HASHMAPPED:
        case TREEMAPPED:
        case HASHSET:
        case TREESET:
          anyMVAttributes.set(true);
          needJavaUtil = true;
          break;
        }

        appendAttributeInfo(attributeInfo, ad.getName().getNameString(), ad.getDmdID(), ad.getType().getName().getNameString(), ad.getValueType(), "false");

        if (ad.getGenericArgsImport() != null)
          genericImports.add(ad.getGenericArgsImport());
       
        allAttr.add(ad);
      }
    }
   
    if (needJavaUtil)
      sb.append("import java.util.*;\n\n");
   
    if (anyAttributes){
      sb.append("import org.dmd.dmc.DmcAttribute;\n");
      sb.append("import org.dmd.dmc.DmcValueException;\n");
      sb.append("import org.dmd.dmc.DmcAttributeInfo;\n");
      sb.append("import org.dmd.dms.generated.enums.ValueTypeEnum;\n");
    }
   
    for(String s: genericImports){
      sb.append("import " + s + ";\n");
    }

    // If the class is auxiliary, we need the DmcTypeString to manipulate the ocl attribute
    if (cd != null){
      if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
        types.put(new StringName("String"), MetaSchema._String);
      }
    }

    Iterator<TypeDefinition> t = types.values().iterator();
    while(t.hasNext()){
      TypeDefinition td = t.next();

      if (cd != null){
        if ( (td.getPrimitiveType() != null) && (cd.getClassType() != ClassTypeEnum.AUXILIARY) ){
         
          if (td.getInternallyGenerated() && td.getIsRefType()){
            // We have an internally generated reference type, only import if
            // the definition is from a different schema, otherwise, we're
            // already in the same package and don't need to import it
            if (cd.getDefinedIn() != td.getDefinedIn()){
              sb.append("// import 1\n");
              sb.append("import " + td.getPrimitiveType() + ";\n");
            }
          }
          else{
View Full Code Here

      out.write("      <td class=\"spacer\"> </td>\n");
      out.write("      <td>Derived from</td>\n");
     
      out.write("      <td colspan=\"2\">\n");
      for(int i=0; i<classes.size(); i++){
        ClassDefinition bcd = classes.get(i);
        String schema = bcd.getDefinedIn().getName().getNameString();
        out.write("      <a href=\"" + schema + ".html#" + bcd.getName() + "\">" + bcd.getName() + "</a>");
        if (i+1 < classes.size())
          out.write(" <br />");
        out.write("\n");
      }
      out.write("      </td>\n");
View Full Code Here

     
      rules = ad.getClassRules();
      while(rules.hasNext()){
        RuleDataDMO rd = rules.next();
       
        ClassDefinition atc = schema.cdef(rd.getApplyToClass().getObjectName().getNameString());
       
        if (cd.isInstanceOfThis(atc)){
          // We only display the rule if it's applicable to this class or
          // if we're derived from the applyToClass
          sb.append("<tr> <td class=\"attributeRule\">\n");
View Full Code Here

      out.write("      <td class=\"label\">Used in:</td>\n");
      out.write("      <td>\n");
     
      for(DmwWrapper wrapper: referring){
        if (wrapper instanceof ClassDefinition){
          ClassDefinition cd = (ClassDefinition) wrapper;
          classes.put(cd.getName(), cd);
        }
//        else if (wrapper instanceof RuleDefinition){
//          RuleDefinition rd = (RuleDefinition) wrapper;
//          rules.put(rd.getName(), rd);
//        }
View Full Code Here

   
    // READ: the construction class ID
    int classID = dis.readInt();
   
    // Try to find the class in the schema
    ClassDefinition cd = schema.isClass(classID);
   
    if (cd == null)
      throw new IllegalStateException("Unknown class ID: " + classID + " ensure that you have loaded the required schemas.");
   
    // Instantiate the object
    rc = cd.newInstance();
    dmo = rc.getDmcObject();
   
//DebugInfo.debug("*** INSTANTIATED: " + cd.getConstructionClassName());
       
    // Add the auxiliary classes if they exist
    if (classCount > 1){
      for(int i=1; i<classCount; i++){
        classID = dis.readInt();
        cd = schema.isClass(classID);
        dmo.addAux(new ClassDefinitionREF(cd.getDMO()));
      }
    }
   
    // READ: the number of attributes
    int     attrCount = dis.readAttributeCount();
View Full Code Here

//      progress.println("\n");
   
    Iterator<ClassDefinition> cdl = sd.getClassDefList();
    if (cdl != null){
      while(cdl.hasNext()){
        ClassDefinition cd = cdl.next();
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
          dumpAUX(cd, auxdir);
        }
        else{
          dumpDMO(cd,dmodir);
        }
View Full Code Here

TOP

Related Classes of org.dmd.dms.ClassDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.