Package org.dmd.dms

Examples of org.dmd.dms.ClassDefinition


   
    Iterator<ClassDefinition> cdefs = sd.getClassDefList();
   
    if (cdefs != null){
      while(cdefs.hasNext()){
        ClassDefinition cd = cdefs.next();
        cd.adjustJavaClass(genContext,genSuffix);
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
          createIfRequired(auxwdir);
          dumpAUX(cd, auxwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
          dumpWrapper(config, loc, f, sm, cd);
        }
View Full Code Here


   
    Iterator<ClassDefinition> cdefs = sd.getClassDefList();
   
    if (cdefs != null){
      while(cdefs.hasNext()){
        ClassDefinition cd = cdefs.next();
       
        if (cd.generateWrapper(genContext) == false){
//          DebugInfo.debug("Skipping " + cd.getName() + " for context " + genContext);
          continue;
        }
       
        cd.adjustJavaClass(genContext,genSuffix);
       
        if (cd.getClassType() == ClassTypeEnum.AUXILIARY){
//          createIfRequired(auxwdir);
          dumpAUX(cd, dmwdir);
        }
        else
         
          if (cd.getJavaClass() == null){
            ResultException ex = new ResultException();
            ex.addError("The " + cd.getName() + " class must define the javaClass attribute to facilitate wrapper creation.");
            ex.result.lastResult().fileName(cd.getFile());
            ex.result.lastResult().lineNumber(cd.getLineNumber());
            throw(ex);
          }
         
          dumpWrapper(config, loc, f, sm, cd);
        }
      }
    }
   
    if (useWrappedObjectRefs){
      Iterator<TypeDefinition>  tdefs = sd.getInternalTypeDefList();
      while(tdefs.hasNext()){
        TypeDefinition td = tdefs.next();
       
        ClassDefinition cd = td.getOriginalClass();
        if (cd != null){
          dumpIterable(config, loc, f, sm, cd, sd);
        }
      }
     
      Iterator<ExtendedReferenceTypeDefinition> extrefs = sd.getExtendedReferenceTypeDefList();
      while(extrefs.hasNext()){
        ExtendedReferenceTypeDefinition ertd = extrefs.next();
        ClassDefinition cd = ertd.getExtendedReferenceClass();
        dumpExtendedReferenceIterable(config, loc, f, sm, cd, sd, ertd);
      }
    }
   
View Full Code Here

            }
            else{
              field.setAttrDef(def);
             
              if (fbd.isStrictlyChecked()){
                ClassDefinition cd = (ClassDefinition) fbd.getEditObject();
                if (cd.hasAttribute(def.getName().getNameString()) == null){
                  if (errors == null)
                    errors = new ResultException();
                 
                  errors.addError("Attribute: " + field.getAttribute() + " is not an attribute of editObject: " + cd.getName());
                  errors.result.lastResult().fileName(fbd.getFile());
                  errors.result.lastResult().lineNumber(fbd.getLineNumber());
                }
              }
            }
           
          }
        }
      }
    }
   
    if (enumMappings.size() > 0){
      for(EnumMapping mapping: enumMappings.values()){
        if (mapping.getDefinedInModule() == codeGenModule){
          EnumDefinition ed = readSchemas.isEnum(mapping.getEnumName());
          if (ed == null){
            if (errors == null)
              errors = new ResultException();
           
            errors.addError(mapping.getEnumName() + " is not a known enum type.");
            errors.result.lastResult().fileName(mapping.getFile());
            errors.result.lastResult().lineNumber(mapping.getLineNumber());
          }
          else{
            mapping.setEnumDef(ed);
         
            EnumValue ev = ed.getEnumValue(mapping.getUnsetValue());
            if (ev == null){
              if (errors == null)
                errors = new ResultException();
             
              errors.addError(mapping.getUnsetValue() + " is not a valid member of enum: " + ed.getName());
              errors.result.lastResult().fileName(mapping.getFile());
              errors.result.lastResult().lineNumber(mapping.getLineNumber());
             
            }
          }
        }
      }
    }
   
    if (components.size() > 0){
      for(Component component: components.values()){
        if (component.getSendsRequestHasValue()){
          if (readSchemas.isSchema("dmp") == null){
            DmpSchemaAG dmp = new DmpSchemaAG();
            readSchemas.manageSchema(dmp);
          }
         
          component.getDMO().addUsesRunContextItem("commsController");
          needMvwComms = true;
          // Try to resolve reference to the request being sent and set the
          // import information
          for(RequestTypeWithOptions rq: component.getSendsRequestIterable()){
            String request = rq.getRequestType() + "Request";
            String response = rq.getRequestType() + "Response";
            ClassDefinition cd = readSchemas.cdef(request);
            if (cd == null){
              ResultException ex = new ResultException();
              ex.addError("Unknown request type: " + request);
              ex.result.lastResult().lineNumber(component.getLineNumber());
              ex.result.lastResult().fileName(component.getFile());
              throw(ex);
            }
            rq.setRequestImport(cd.getDmoImport());
           
            cd = readSchemas.cdef(response);
            if (cd == null){
              ResultException ex = new ResultException();
              ex.addError("Unknown response type: " + response);
              ex.result.lastResult().lineNumber(component.getLineNumber());
              ex.result.lastResult().fileName(component.getFile());
              throw(ex);
            }
            rq.setResponseImport(cd.getDmoImport());
           
            if (rq.isUsingClassInfo()){
              cd = readSchemas.cdef(rq.getClassName());
              if (cd == null){
                ResultException ex = new ResultException();
                ex.addError("Unknown class: " + rq.getClassName() + " in " + rq.getRequestType() + "Request spec");
                ex.result.lastResult().lineNumber(component.getLineNumber());
                ex.result.lastResult().fileName(component.getFile());
                throw(ex);
              }
              rq.setClassImport(cd.getDmoImport());
             
              if (rq.getRequestType().equals("Set") || rq.getRequestType().equals("Delete")){
                if (cd.getIsNamedBy() == null){
                  ResultException ex = new ResultException();
                  ex.addError(rq.getRequestType() + "Requests are only applicable to named objects.");
                  ex.result.lastResult().lineNumber(component.getLineNumber());
                  ex.result.lastResult().fileName(component.getFile());
                  throw(ex);
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
    dmo = cd.newDMOInstance();
   
    // 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

     * @throws DmcValueException
     * @throws DmcRuleExceptionSet
     * @throws DmcValueExceptionSet
     */
    public void handleObject(DmcUncheckedObject uco, String infile, int lineNumber) throws ResultException, DmcValueException, DmcRuleExceptionSet {
        ClassDefinition     cd                  = null;
        boolean             isSchema            = false;
        DmsDefinition      newDef              = null;
        Iterator<String>    dependsOnSchemas    = null;
        Iterator<String>    defFiles            = null;
        SchemaDefinition    currSchema          = null;
        String              depSchema           = null;
        SchemaDefinition    newSchema           = null;
        String              currFile            = null;
        String         srcFile       = "";
        // Determine if we have a valid class
        if ((cd = allSchema.isClass((String)uco.classes.get(0))) == null){
          ResultException ex = new ResultException();

            ex.result.addResult(Result.ERROR,"Unknown class: " + uco.classes.get(0));
            ex.result.lastResult().lineNumber(uco.lineNumber);
            ex.result.lastResult().fileName(infile);
            throw(ex);
        }
        else{
          try {
            if (uco.classes.get(0).equals(MetaSchema._SchemaDefinition.getName())){
              // Okay, a bit of cheating to handle schema extensions - since the
              // schema extensions are defined in schemas themselves, those schemas
              // have to be loaded before we attempt to resolve the schema extension
              // AUX class. So, we let the schema manager know that we're loading
              // a new schema with just the unchecked object.
              allSchema.schemaPreAdd(uco);
            }
           
            // If we're underneath a standard eclipse project, we ignore everything before
            // the /src folder name.
        int srcloc = infile.indexOf("/src");
        srcFile = "";
        if (srcloc != -1)
          srcFile = infile.substring(srcloc);
        else
          srcFile = infile;

        // More interesting hand waving to handle rule instances. For most of the
            // objects that are found in schema definitions everything can be handled
            // in the usual way i.e. for ClassDefinitions, AttributeDefinitions,
            // RuleDefinitions etc. all of those classes are defined as part of the
            // meta schema and we have loaded the MetaSchemaAG. This means that we
            // can use the dmwfactory to instantiate these objects. However, for
            // instances of RuleDefinition, we're dealing with objects that are read
            // from the schema definition files and not using the loaded schemas. In
            // that case, we don't have all the information required to instantiate
            // objects.
        //
        // Rule data objects are stored against the schema for processing once
        // all schemas have been read.
            ClassDefinition checkClass = allSchema.isClass(uco.classes.get(0));
            if (checkClass != null){
              if (checkClass.getRuleDefinition() != null){
                uco.addValue(MetaDMSAG.__lineNumber.name, lineNumber + "");
                uco.addValue(MetaDMSAG.__file.name, srcFile);
                uco.addValue(MetaDMSAG.__definedIn.name, schemaLoading.getName().getNameString());
               
                schemaLoading.addParsedRule(uco);
View Full Code Here

   * @throws ClassNotFoundException 
   */
  public DmcObject createObject(DmcUncheckedObject uco) throws ResultException, DmcValueException, ClassNotFoundException {
    DmcObject      dmo  = null;
    AttributeDefinition  ad  = null;
    ClassDefinition    cd  = schema.cdef(uco.getConstructionClass());
    Class<?>      dmoClass;
   
    if (cd == null){
          ResultException ex = new ResultException();
            ex.result.addResult(Result.ERROR,"Unknown class: " + uco.getConstructionClass());
            ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
            throw(ex);
    }

        if (cd.getClassType() == ClassTypeEnum.ABSTRACT){
          ResultException ex = new ResultException();
          ex.result.addResult(Result.ERROR,"Can't instantiate an ABSTRACT class: " + cd.getDmoImport());
            ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
            throw(ex);         
        }

        try{
          synchronized (this) {
              dmoClass = Class.forName(cd.getDmoImport());
      }
        }
        catch(Exception e){
          ResultException ex = new ResultException();
          ex.result.addResult(Result.FATAL,"Couldn't load Java class: " + cd.getDmoImport());
            ex.result.lastResult().moreMessages(e.getMessage());
            ex.result.lastResult().moreMessages(DebugInfo.extractTheStack(e));
            throw(ex);
        }
       
        try{
          dmo = (DmcObject) dmoClass.newInstance();
        }
        catch(Exception e){
          ResultException ex = new ResultException();
          ex.result.addResult(Result.FATAL,"Couldn't instantiate Java class: " + cd.getDmoImport());
          ex.result.lastResult().moreMessages("This may be because the class doesn't have a constructor that takes no arguments.");
          ex.result.lastResult().moreMessages(DebugInfo.getCurrentStack());
          throw(ex);
        }
       
   
    // Add the object class
    DmcTypeClassDefinitionREFMV cref = new DmcTypeClassDefinitionREFMV();
    cref.add(cd.getObjectName());
   
    // And add any auxiliary classes if we have them
    for(int i=1; i<uco.classes.size(); i++){
      if ((cd = schema.isClass((String)uco.classes.get(i))) == null){
            ResultException ex = new ResultException();
              ex.result.addResult(Result.ERROR,"Unknown class: " + uco.classes.get(i));
              throw(ex);
      }
      cref.add(cd.getObjectName());
//      dmo.add("objectClass", cref);
    }
   
    dmo.add(DmcObject.__objectClass, cref);
   
View Full Code Here

        dumpHeaderDMSAG(out, sm, sd.getSchemaPackage(), sd, nameBuilders, filterBuilders);
       
        Iterator<ClassDefinition> cds = sd.getClassDefList();
    if (cds != null){
      while(cds.hasNext()){
        ClassDefinition cd = cds.next();
        classes.put(cd.getName().getNameString(), cd);
      }
    }
     
        Iterator<AttributeDefinition> ads = sd.getAttributeDefList();
    if (ads != null){
      while(ads.hasNext()){
        AttributeDefinition ad = ads.next();
        attributes.put(ad.getName().getNameString(), ad);
      }
    }
     
        Iterator<TypeDefinition> tds = sd.getTypeDefList();
    if (tds != null){
      while(tds.hasNext()){
        TypeDefinition td = tds.next();
        types.put(td.getName().getNameString(), td);
      }
    }
   
    tds = sd.getInternalTypeDefList();
    if (tds != null){
      while(tds.hasNext()){
        TypeDefinition td = tds.next();
        types.put(td.getName().getNameString(), td);
      }
    }
   
     
        out.write("\n");

    out.write("// Generated from: " + DebugInfo.getWhereWeAreNow() + "\n");
        out.write("public class " + schemaName + " implements DmcCompactSchemaIF {\n\n");

        out.write("\n");
        out.write("    static String schemaName = \"" + sd.getName().getNameString() + "\";\n");
        out.write("\n");

        out.write("\n");
        out.write("    static int schemaBaseID = " + sd.getSchemaBaseID() + ";\n");
        out.write("\n");

        out.write("\n");
        out.write("    static int schemaIDRange = " + sd.getSchemaIDRange() + ";\n");
        out.write("\n");

        int max = sd.getSchemaBaseID() + sd.getSchemaIDRange();
       
        out.write("\n");
        out.write("    static int schemaMaxID = " + max + ";\n");
        out.write("\n");

        for(AttributeDefinition ad: attributes.values()){
      //     public final static DmcAttributeInfo __monitoredBy = new DmcAttributeInfo("monitoredBy",2202,"DashboardPrefs",ValueTypeEnum.MULTI,false);
      out.write("    public final static DmcAttributeInfo __" + ad.getName().getNameString() + " = new DmcAttributeInfo(");
      out.write("\"" + ad.getName().getNameString() + "\"");
      out.write(", " + ad.getDmdID());
      out.write(", \"" + ad.getType().getName().getNameString() + "\"");
      out.write(", ValueTypeEnum." + ad.getValueType());
      out.write(", DataTypeEnum." + ad.getDataType());
     
      if (ad.getIndexSize() == null)
        out.write(");\n");
      else
        out.write(", " + ad.getIndexSize() + ");\n");
    }
       
        if (types.size() > 0){
            out.write("\n");
        out.write("    // Generated from: " + DebugInfo.getWhereWeAreNow() + "\n");
        for(TypeDefinition td: types.values()){
           
            if (td.getInternallyGenerated() == false){
              // This is a straightforward type definition
             
              if (td.getIsNameType() == false)
                out.write("    public final static DmcTypeInfo __type_" + td.getName().getNameString() + " = new DmcTypeInfo(\"" + td.getName().getNameString() + "\", OriginalTypeEnum.TYPE);\n");
              else
                out.write("    public final static DmcTypeInfo __type_" + td.getName().getNameString() + " = new DmcTypeInfo(\"" + td.getName().getNameString() + "\", OriginalTypeEnum.NAMETYPE);\n");

            }
            else{
              // Have to check extended ref before ref type since both values are set of extended refs.
             
              if (td.getIsEnumType())
                out.write("    public final static DmcTypeInfo __type_" + td.getName().getNameString() + " = new DmcTypeInfo(\"" + td.getName().getNameString() + "\", OriginalTypeEnum.ENUM);\n");
              else if (td.getIsExtendedRefType())
                out.write("    public final static DmcTypeInfo __type_" + td.getName().getNameString() + " = new DmcTypeInfo(\"" + td.getName().getNameString() + "\", OriginalTypeEnum.EXTREF);\n");
              else if (td.getIsRefType()){
                // We actually want to distinguish between unnamed objects and named objects
                if (td.getOriginalClass().getIsNamedBy() == null)
                  out.write("    public final static DmcTypeInfo __type_" + td.getOriginalClass().getName().getNameString() + " = new DmcTypeInfo(\"" + td.getOriginalClass().getName().getNameString() + "\", OriginalTypeEnum.OBJECT);\n");
                else
                  out.write("    public final static DmcTypeInfo __type_" + td.getOriginalClass().getName().getNameString() + " = new DmcTypeInfo(\"" + td.getOriginalClass().getName().getNameString() + "\", OriginalTypeEnum.REFERENCE);\n");
              }
              else{
                // Fixed 20130121 for references to classes
                if (td.getOriginalClass() == null)
                  out.write("    public final static DmcTypeInfo __type_" + td.getName().getNameString() + " = new DmcTypeInfo(\"" + td.getName().getNameString() + "\", OriginalTypeEnum.COMPLEXTYPE);\n");
                else
                  out.write("    public final static DmcTypeInfo __type_" + td.getOriginalClass().getName().getNameString() + " = new DmcTypeInfo(\"" + td.getOriginalClass().getName().getNameString() + "\", OriginalTypeEnum.COMPLEXTYPE);\n");
              }
            }
           
//            System.out.println("HERE\n\n" + td.toOIF());
        }
        }
       
        if (classes.size() > 0){
            out.write("\n");
        out.write("    // Generated from: " + DebugInfo.getWhereWeAreNow() + "\n");
          TreeMap<String,ClassNode> hierarchy = getHierarchy(classes.values().iterator());
          for(ClassNode cn: hierarchy.values()){
            cn.writeClassInfo(out);
      }
        }
       
        ///////////////////////////////////////////////////////////////////////
       
        if (sd.getSliceDefListSize() > 0){
          out.write("\n");
      out.write("    // Generated from: " + DebugInfo.getWhereWeAreNow() + "\n");
          for(SliceDefinition slice: sd.getSliceDefList()){
        out.write("    public final static DmcSliceInfo __" + slice.getName() + " = new DmcSliceInfo(\"" + slice.getName() + "\");\n");
            for(AttributeDefinition ad: slice.getSelectAttribute()){
          out.write("    // " + ad.getName() + "\n");
            }
            out.write("\n");
       
          }
        }
       
//        DmoObjectFactoryNew  factory = new DmoObjectFactoryNew(sm);
       
        ///////////////////////////////////////////////////////////////////////
        Iterator<DmcUncheckedObject>  rules = sd.getParsedRules();
       
        if (rules != null){
          out.write("\n");
      out.write("    // Generated from: " + DebugInfo.getWhereWeAreNow() + "\n");
          while(rules.hasNext()){
        DmcUncheckedObject ruleData = rules.next();
       
//        try {
//          RuleDataDMO rdd = (RuleDataDMO) factory.createObject(ruleData);
//          DebugInfo.debugWithTrace(rdd.toOIF());
//        } catch (DmcValueException e) {
//          // TODO Auto-generated catch block
//          e.printStackTrace();
//        } catch (ClassNotFoundException e) {
//          // TODO Auto-generated catch block
//          e.printStackTrace();
//        }
       
        String dataName   = ruleData.getConstructionClass();
        int dataPos     = dataName.indexOf("Data");
        String ruleClass   = dataName.substring(0, dataPos);
        String ruleName    = ruleData.getSV("ruleName");
       
        out.write("    public final static " + ruleClass + " __" + ruleName + ";\n");
          }
        }
       
        ///////////////////////////////////////////////////////////////////////
        // Static initializer

        writeCommonPart1(out);
       
        // Inside the static initializer
       
        for(AttributeDefinition ad: attributes.values()){
            // _SmAp.put(__jobName.name,__jobName);
      out.write("        _SmAp.put(__" + ad.getName().getNameString() + ".id,__" + ad.getName().getNameString() + ");\n");
    }
       
        for(ClassDefinition cd: classes.values()){
            // _SmAp.put(__jobName.name,__jobName);
      out.write("        _CmAp.put(__" + cd.getName().getNameString() + ".id,__" + cd.getName().getNameString() + ");\n");
    }
       
        out.write(nameBuilders.toString());
       
        for(SliceDefinition slice: sd.getSliceDefList()){
          out.write("\n");
            // _SmAp.put(__jobName.name,__jobName);
          for(AttributeDefinition ad: slice.getSelectAttribute()){
        out.write("        __" + slice.getName().getNameString() + ".addAttributeID(" + ad.getDmdID() + ");\n");
          }
         
      out.write("        _SImAp.put(\"" + slice.getName() + "\",__" + slice.getName().getNameString() + ");\n");
    }
       
        cds = sd.getClassDefList();
    if (cds != null){
      while(cds.hasNext()){
        out.write("\n");
        ClassDefinition cd = cds.next();
       
        String attr = null;
        for (AttributeDefinition ad: cd.getMust()){
          if (ad.getDefinedIn() == cd.getDefinedIn())
            attr = "__" + ad.getName();
          else
            attr = ad.getDefinedIn().getDMSASGName() + ".__" + ad.getName();
          out.write("        __" + cd.getName() + ".addMust(" + attr + ");\n");
        }
       
        for (AttributeDefinition ad: cd.getMay()){
          if (ad.getDefinedIn() == cd.getDefinedIn())
            attr = "__" + ad.getName();
          else
            attr = ad.getDefinedIn().getDMSASGName() + ".__" + ad.getName();
          out.write("        __" + cd.getName() + ".addMay(" + attr + ");\n");
        }
       
      }
      out.write("\n");
     
View Full Code Here

    // Rule instances
    Iterator<DmcUncheckedObject> rules = sd.getParsedRules();
    if (rules != null){
      while(rules.hasNext()){
        DmcUncheckedObject rule = rules.next();
        ClassDefinition ruleDataCD = sm.isClass(rule.getConstructionClass());
       
        if (ruleDataCD == null){
          ResultException ex = new ResultException();
          ex.addError("Unknown rule data class. For Rule instance: \n" + rule.toOIF());
          throw(ex);
        }
        manager.addImport(ruleDataCD.getDmoImport(), "To instantiate " + rule.getConstructionClass() + " rule data");
        manager.addImport(ruleDataCD.getRuleDefinition().getRuleDefinitionImport(), "To instantiate rules of this type");
       
        ruleDataCD.addImportsForAdditionalAttributes(sm,manager, rule);
      }
    }
   
        out.write(manager.getFormattedImports());
      out.write("\n");
View Full Code Here

    TreeMap<String,ClassNode> getHierarchy(Iterator<ClassDefinition> classes){
      TreeMap<String,ClassNode> sorted = new TreeMap<String, ClassNode>();
      TreeMap<String,ClassNode> hierarchy = new TreeMap<String, ClassNode>();
     
      while(classes.hasNext()){
        ClassDefinition cd = classes.next();
        String name = cd.getName().getNameString();
        sorted.put(name, new ClassNode(name,cd));
      }
     
      for(ClassNode cn: sorted.values()){
        ClassDefinition cd = cn.cd;
        ClassDefinition derivedFrom = cd.getDerivedFrom();
       
        if (derivedFrom == null)
          hierarchy.put(cn.name, cn);
        else{
          ClassNode parent = sorted.get(derivedFrom.getName().getNameString());
          if (parent == null){
            // The parent is defined in another schema
            String temp = cd.getDerivedFrom().getDefinedIn().getName().getNameString();
            String name = GeneratorUtils.dotNameToCamelCase(temp) + "DMSAG";
            cn.parentRef = name + ".__" + cd.getDerivedFrom().getName();
View Full Code Here

 
   
  private void setAttributeValues(BufferedWriter out, SchemaManager sm, DmcUncheckedObject obj, PrintfFormat pf) throws IOException, ResultException {
    String        attrName  = null;
    String            objName    = null;
    ClassDefinition    cd      = null;
    AttributeDefinition  attrDef    = null;
//    TypeDefinition    typeDef    = null;
//    String            typeName    = null;
//    boolean        multiValued  = false;
//    boolean           isReference = false;
//    boolean           isEnumType  = false;
   
    objName = obj.getSV("ruleName") + "Data";
   
    cd = sm.isClass(obj.getConstructionClass());
    if (cd == null){
      ResultException ex = new ResultException();
      ex.addError("Unknown rule data class: \n" + obj.toOIF());
      throw(ex);
    }
   
//    if (cd.getClassType() == ClassTypeEnum.EXTENSIBLE){
//      DebugInfo.debug("DmoCompactSchemaFormatter.setAttributeValues() " + cd.getName() + " is extensible");
//    }
   
    Iterator<String> attributeNames = obj.getAttributeNames();
    while(attributeNames.hasNext()){
      NamedStringArray attr = obj.get(attributeNames.next());
      attrName = attr.getName();
      if (attrName == null){
        DebugInfo.debugWithTrace("Attr name null");
        continue;
      }
      attrDef  = sm.isAttribute(attrName);
     
      if (attrDef == null){
        ResultException ex = new ResultException();
        ex.addError("Unknown attribute: " + attrName);
        ex.result.lastResult().fileName(obj.getSV(MetaDMSAG.__file.name));
        ex.result.lastResult().lineNumber(obj.lineNumber);
        throw(ex);
      }
     
        StringBuffer   attrNameCapped   = new StringBuffer();
        attrNameCapped.append(attrName);
        attrNameCapped.setCharAt(0,Character.toUpperCase(attrNameCapped.charAt(0)));

        if (cd.isAllowedAttribute(new StringName(attrName))){
        if (attrDef.getValueType() == ValueTypeEnum.SINGLE){
          String value = obj.getSV(attrName);
                out.write("            _" + pf.sprintf(objName));
          out.write(".set" + attrNameCapped + "(");
          out.write("\"" + value + "\");\n");
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.