Package org.dmd.dmc.types

Examples of org.dmd.dmc.types.DmcTypeNamedObjectREF


        attr.getAttributeInfo();
         
        if (attr instanceof DmcTypeNamedObjectREF){
//System.out.println("DmcObject.resolveReferences() resolving: " + attr.getName());

          DmcTypeNamedObjectREF reference = (DmcTypeNamedObjectREF) attr;
         
          if (attr.getMVSize() == 0){
            DmcNamedObjectREF ref = (DmcNamedObjectREF) attr.getSV();
            if (ref.isResolved())
              continue;
           
            DmcNamedObjectIF    obj       = rx.findNamedObject(ref.getObjectName(),attr.ID);
            DmcObject       resolvedObject   = null;
           
            if (obj == null){
              DmcValueException ex = new DmcValueException("Could not resolve reference to: " + ref.getObjectName() + " via attribute: " + attr.getName());
              if (errors == null)
                errors = new DmcValueExceptionSet();
              errors.add(ex);
              continue;
            }
            else{
              try{
                if (obj instanceof DmcContainerIF){
                  resolvedObject = ((DmcContainerIF)obj).getDmcObject();
                  ref.setObject((DmcNamedObjectIF) ((DmcContainerIF)obj).getDmcObject());
                }
                else{
                  resolvedObject = (DmcObject)obj;
                  ref.setObject(obj);
                }
              }
              catch(ClassCastException e){
                DmcValueException ex = new DmcValueException("Attribute " + attr.getName() + " is of type: " + attr.getAttributeInfo().type + " and you've tried to set it to " + obj.getObjectName() + " which is of type " + resolvedObject.getConstructionClassName());
                if (errors == null)
                  errors = new DmcValueExceptionSet();
                errors.add(ex);
                continue;
              }
            }
           
            // NOTE: we wouldn't do the backref tracking in the case of DMP
            // messages (which are marked as supportsBackrefTracking false).
            if (supportsBackrefTracking()){
//              if (DmcOmni.instance().backRefTracking() && (attr.ID > 200)){
              if (DmcOmni.instance().backRefTracking() && DmcOmni.instance().trackThisAttribute(attr.ID)){
                Modifier backrefMod = new Modifier(ModifyTypeEnum.SET,attr,this);
                resolvedObject.addBackref(backrefMod);
               
                // Let the reference know the backref modifier - this allows us to
                // easily remove the backref if the reference is deleted
                ref.setBackrefModifier(backrefMod);
              }
            }

          }
          else{
            Iterator<DmcNamedObjectREF> refs = reference.getMV();
            if (refs != null){
              int currIndex = -1;
              while(refs.hasNext()){
                currIndex++;
                DmcNamedObjectREF ref = refs.next();
View Full Code Here


     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
  public void clearReferenceInfo(){
    for(DmcAttribute<?> attr : attributes.values()){
      if (attr instanceof DmcTypeNamedObjectREF){
        DmcTypeNamedObjectREF reference = (DmcTypeNamedObjectREF) attr;
        if (attr.getMVSize() == 0){
          DmcNamedObjectREF<?> ref = (DmcNamedObjectREF<?>) attr.getSV();
          ref.setObject(null);
        }
        else{
          Iterator<DmcNamedObjectREF<?>> refs = reference.getMV();
          if (refs != null){
            int currIndex = -1;
            while(refs.hasNext()){
              currIndex++;
              DmcNamedObjectREF<?> ref = refs.next();
View Full Code Here

TOP

Related Classes of org.dmd.dmc.types.DmcTypeNamedObjectREF

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.