/**
  * Set the xArchPath attribute on this object.
  *
  * @param xArchPath attribute value.
  */
 public void setXArchPath(String xArchPath) {
   {
     String oldValue = getXArchPath();
     if (oldValue == null ? xArchPath == null : oldValue.equals(xArchPath)) return;
     DOMUtils.removeAttribute(elt, ChangesetsConstants.NS_URI, X_ARCH_PATH_ATTR_NAME);
     IXArch _x = getXArch();
     if (_x != null) {
       _x.fireXArchEvent(
           new XArchEvent(
               this,
               XArchEvent.CLEAR_EVENT,
               XArchEvent.ATTRIBUTE_CHANGED,
               "xArchPath",
               oldValue,
               XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this),
               true));
     }
   }
   DOMUtils.setAttribute(elt, ChangesetsConstants.NS_URI, X_ARCH_PATH_ATTR_NAME, xArchPath);
   IXArch _x = getXArch();
   if (_x != null) {
     _x.fireXArchEvent(
         new XArchEvent(
             this,
             XArchEvent.SET_EVENT,
             XArchEvent.ATTRIBUTE_CHANGED,
             "xArchPath",
             xArchPath,
             XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
   }
 }
Beispiel #2
0
 /**
  * Set the generated attribute on this object.
  *
  * @param generated attribute value.
  */
 public void setGenerated(String generated) {
   {
     String oldValue = getGenerated();
     if (oldValue == null ? generated == null : oldValue.equals(generated)) return;
     DOMUtils.removeAttribute(elt, ChangesetsConstants.NS_URI, GENERATED_ATTR_NAME);
     IXArch _x = getXArch();
     if (_x != null) {
       _x.fireXArchEvent(
           new XArchEvent(
               this,
               XArchEvent.CLEAR_EVENT,
               XArchEvent.ATTRIBUTE_CHANGED,
               "generated",
               oldValue,
               XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this),
               true));
     }
   }
   DOMUtils.setAttribute(elt, ChangesetsConstants.NS_URI, GENERATED_ATTR_NAME, generated);
   IXArch _x = getXArch();
   if (_x != null) {
     _x.fireXArchEvent(
         new XArchEvent(
             this,
             XArchEvent.SET_EVENT,
             XArchEvent.ATTRIBUTE_CHANGED,
             "generated",
             generated,
             XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
   }
 }
  public edu.uci.isr.xarch.instance.IXMLLink getChangeSet() {
    NodeList nl = DOMUtils.getChildren(elt, ChangesetsConstants.NS_URI, CHANGE_SET_ELT_NAME);
    if (nl.getLength() == 0) {
      return null;
    } else {
      Element el = (Element) nl.item(0);
      IXArch de = getXArch();
      if (de != null) {
        IXArchElement cachedXArchElt = de.getWrapper(el);
        if (cachedXArchElt != null) {
          return (edu.uci.isr.xarch.instance.IXMLLink) cachedXArchElt;
        }
      }

      Object o = makeDerivedWrapper(el, "XMLLink");
      if (o != null) {
        try {
          ((edu.uci.isr.xarch.IXArchElement) o).setXArch(getXArch());
          if (de != null) {
            de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) o));
          }
          return (edu.uci.isr.xarch.instance.IXMLLink) o;
        } catch (Exception e) {
        }
      }
      edu.uci.isr.xarch.instance.XMLLinkImpl eltImpl =
          new edu.uci.isr.xarch.instance.XMLLinkImpl(el);
      eltImpl.setXArch(getXArch());
      if (de != null) {
        de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) eltImpl));
      }
      return eltImpl;
    }
  }
  public void removeRepositoryLocation(IRepositoryLocation repositoryLocationToRemove) {
    if (!(repositoryLocationToRemove instanceof DOMBased)) {
      throw new IllegalArgumentException("Cannot handle non-DOM-based xArch entities.");
    }
    NodeList nl =
        DOMUtils.getChildren(elt, JavasourcecodeConstants.NS_URI, REPOSITORY_LOCATION_ELT_NAME);
    for (int i = 0; i < nl.getLength(); i++) {
      Node n = nl.item(i);
      if (n == ((DOMBased) repositoryLocationToRemove).getDOMNode()) {
        synchronized (DOMUtils.getDOMLock(elt)) {
          elt.removeChild(n);
        }

        IXArch context = getXArch();
        if (context != null) {
          context.fireXArchEvent(
              new XArchEvent(
                  this,
                  XArchEvent.REMOVE_EVENT,
                  XArchEvent.ELEMENT_CHANGED,
                  "repositoryLocation",
                  repositoryLocationToRemove,
                  XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
        }

        return;
      }
    }
  }
  public IJavaSourceCodeManager getSourceCodeManager() {
    NodeList nl =
        DOMUtils.getChildren(elt, JavasourcecodeConstants.NS_URI, SOURCE_CODE_MANAGER_ELT_NAME);
    if (nl.getLength() == 0) {
      return null;
    } else {
      Element el = (Element) nl.item(0);
      IXArch de = getXArch();
      if (de != null) {
        IXArchElement cachedXArchElt = de.getWrapper(el);
        if (cachedXArchElt != null) {
          return (IJavaSourceCodeManager) cachedXArchElt;
        }
      }

      Object o = makeDerivedWrapper(el, "JavaSourceCodeManager");
      if (o != null) {
        try {
          ((edu.uci.isr.xarch.IXArchElement) o).setXArch(getXArch());
          if (de != null) {
            de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) o));
          }
          return (IJavaSourceCodeManager) o;
        } catch (Exception e) {
        }
      }
      JavaSourceCodeManagerImpl eltImpl = new JavaSourceCodeManagerImpl(el);
      eltImpl.setXArch(getXArch());
      if (de != null) {
        de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) eltImpl));
      }
      return eltImpl;
    }
  }
  public void addRepositoryLocation(IRepositoryLocation newRepositoryLocation) {
    if (!(newRepositoryLocation instanceof DOMBased)) {
      throw new IllegalArgumentException("Cannot handle non-DOM-based xArch entities.");
    }
    Element newChildElt = (Element) (((DOMBased) newRepositoryLocation).getDOMNode());
    newChildElt =
        DOMUtils.cloneAndRename(
            newChildElt, JavasourcecodeConstants.NS_URI, REPOSITORY_LOCATION_ELT_NAME);
    ((DOMBased) newRepositoryLocation).setDOMNode(newChildElt);

    synchronized (DOMUtils.getDOMLock(elt)) {
      elt.appendChild(newChildElt);
      DOMUtils.order(elt, getSequenceOrder());
    }

    IXArch context = getXArch();
    if (context != null) {
      context.fireXArchEvent(
          new XArchEvent(
              this,
              XArchEvent.ADD_EVENT,
              XArchEvent.ELEMENT_CHANGED,
              "repositoryLocation",
              newRepositoryLocation,
              XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
    }
  }
  public void clearValue() {
    synchronized (DOMUtils.getDOMLock(elt)) {
      // Get rid of any text nodes that are children of the element.
      elt.normalize();
    }
    NodeList nl = elt.getChildNodes();
    for (int i = (nl.getLength() - 1); i >= 0; i--) {
      Node n = nl.item(i);
      if (n.getNodeType() == Node.TEXT_NODE) {
        synchronized (DOMUtils.getDOMLock(elt)) {
          elt.removeChild(n);
        }

        IXArch context = getXArch();
        if (context != null) {
          context.fireXArchEvent(
              new XArchEvent(
                  this,
                  XArchEvent.CLEAR_EVENT,
                  XArchEvent.SIMPLE_TYPE_VALUE_CHANGED,
                  "$SIMPLETYPEVALUE$",
                  null,
                  XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
        }
      }
    }
  }
  public void setValue(String value) {
    synchronized (DOMUtils.getDOMLock(elt)) {
      {
        String oldValue = getValue();
        if (oldValue == null ? value == null : oldValue.equals(value)) return;
        synchronized (DOMUtils.getDOMLock(elt)) {
          // Get rid of any text nodes that are children of the element.
          elt.normalize();
        }
        NodeList nl = elt.getChildNodes();
        for (int i = (nl.getLength() - 1); i >= 0; i--) {
          Node n = nl.item(i);
          if (n.getNodeType() == Node.TEXT_NODE) {
            synchronized (DOMUtils.getDOMLock(elt)) {
              elt.removeChild(n);
            }

            IXArch context = getXArch();
            if (context != null) {
              context.fireXArchEvent(
                  new XArchEvent(
                      this,
                      XArchEvent.CLEAR_EVENT,
                      XArchEvent.SIMPLE_TYPE_VALUE_CHANGED,
                      "$SIMPLETYPEVALUE$",
                      null,
                      XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this),
                      true));
            }
          }
        }
      }
      elt.normalize();
      Document doc = elt.getOwnerDocument();
      Text txt = doc.createTextNode(value);
      elt.appendChild(txt);
    }

    IXArch context = getXArch();
    if (context != null) {
      context.fireXArchEvent(
          new XArchEvent(
              this,
              XArchEvent.SET_EVENT,
              XArchEvent.SIMPLE_TYPE_VALUE_CHANGED,
              "$SIMPLETYPEVALUE$",
              value,
              XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
    }
  }
Beispiel #9
0
 /** Removes the id attribute from this object. */
 public void clearId() {
   String oldValue = getId();
   if (oldValue == null) return;
   DOMUtils.removeAttribute(elt, ChangesetsConstants.NS_URI, ID_ATTR_NAME);
   IXArch _x = getXArch();
   if (_x != null) {
     _x.fireXArchEvent(
         new XArchEvent(
             this,
             XArchEvent.CLEAR_EVENT,
             XArchEvent.ATTRIBUTE_CHANGED,
             "id",
             oldValue,
             XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
   }
 }
  public void clearChangeSet() {
    edu.uci.isr.xarch.instance.IXMLLink oldElt = getChangeSet();
    DOMUtils.removeChildren(elt, ChangesetsConstants.NS_URI, CHANGE_SET_ELT_NAME);

    IXArch context = getXArch();
    if (context != null) {
      context.fireXArchEvent(
          new XArchEvent(
              this,
              XArchEvent.CLEAR_EVENT,
              XArchEvent.ELEMENT_CHANGED,
              "changeSet",
              oldElt,
              XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
    }
  }
  public void clearSourceCodeManager() {
    IJavaSourceCodeManager oldElt = getSourceCodeManager();
    DOMUtils.removeChildren(elt, JavasourcecodeConstants.NS_URI, SOURCE_CODE_MANAGER_ELT_NAME);

    IXArch context = getXArch();
    if (context != null) {
      context.fireXArchEvent(
          new XArchEvent(
              this,
              XArchEvent.CLEAR_EVENT,
              XArchEvent.ELEMENT_CHANGED,
              "sourceCodeManager",
              oldElt,
              XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
    }
  }
 public Collection getAllRepositoryLocations() {
   NodeList nl =
       DOMUtils.getChildren(elt, JavasourcecodeConstants.NS_URI, REPOSITORY_LOCATION_ELT_NAME);
   int nlLength = nl.getLength();
   ArrayList v = new ArrayList(nlLength);
   IXArch de = getXArch();
   for (int i = 0; i < nlLength; i++) {
     Element el = (Element) nl.item(i);
     boolean found = false;
     if (de != null) {
       IXArchElement cachedXArchElt = de.getWrapper(el);
       if (cachedXArchElt != null) {
         v.add((IRepositoryLocation) cachedXArchElt);
         found = true;
       }
     }
     if (!found) {
       Object o = makeDerivedWrapper(el, "RepositoryLocation");
       if (o != null) {
         try {
           ((edu.uci.isr.xarch.IXArchElement) o).setXArch(getXArch());
           if (de != null) {
             de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) o));
           }
           v.add((IRepositoryLocation) o);
         } catch (Exception e) {
           RepositoryLocationImpl eltImpl = new RepositoryLocationImpl((Element) nl.item(i));
           eltImpl.setXArch(getXArch());
           if (de != null) {
             de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) eltImpl));
           }
           v.add(eltImpl);
         }
       } else {
         RepositoryLocationImpl eltImpl = new RepositoryLocationImpl((Element) nl.item(i));
         eltImpl.setXArch(getXArch());
         if (de != null) {
           de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) eltImpl));
         }
         v.add(eltImpl);
       }
     }
   }
   return v;
 }
  public void setSourceCodeManager(IJavaSourceCodeManager value) {
    if (!(value instanceof DOMBased)) {
      throw new IllegalArgumentException("Cannot handle non-DOM-based xArch entities.");
    }
    {
      IJavaSourceCodeManager oldElt = getSourceCodeManager();
      DOMUtils.removeChildren(elt, JavasourcecodeConstants.NS_URI, SOURCE_CODE_MANAGER_ELT_NAME);

      IXArch context = getXArch();
      if (context != null) {
        context.fireXArchEvent(
            new XArchEvent(
                this,
                XArchEvent.CLEAR_EVENT,
                XArchEvent.ELEMENT_CHANGED,
                "sourceCodeManager",
                oldElt,
                XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this),
                true));
      }
    }
    Element newChildElt = (Element) (((DOMBased) value).getDOMNode());
    newChildElt =
        DOMUtils.cloneAndRename(
            newChildElt, JavasourcecodeConstants.NS_URI, SOURCE_CODE_MANAGER_ELT_NAME);
    ((DOMBased) value).setDOMNode(newChildElt);

    synchronized (DOMUtils.getDOMLock(elt)) {
      elt.appendChild(newChildElt);
      DOMUtils.order(elt, getSequenceOrder());
    }

    IXArch context = getXArch();
    if (context != null) {
      context.fireXArchEvent(
          new XArchEvent(
              this,
              XArchEvent.SET_EVENT,
              XArchEvent.ELEMENT_CHANGED,
              "sourceCodeManager",
              value,
              XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
    }
  }
  public void setChangeSet(edu.uci.isr.xarch.instance.IXMLLink value) {
    if (!(value instanceof DOMBased)) {
      throw new IllegalArgumentException("Cannot handle non-DOM-based xArch entities.");
    }
    {
      edu.uci.isr.xarch.instance.IXMLLink oldElt = getChangeSet();
      DOMUtils.removeChildren(elt, ChangesetsConstants.NS_URI, CHANGE_SET_ELT_NAME);

      IXArch context = getXArch();
      if (context != null) {
        context.fireXArchEvent(
            new XArchEvent(
                this,
                XArchEvent.CLEAR_EVENT,
                XArchEvent.ELEMENT_CHANGED,
                "changeSet",
                oldElt,
                XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this),
                true));
      }
    }
    Element newChildElt = (Element) (((DOMBased) value).getDOMNode());
    newChildElt =
        DOMUtils.cloneAndRename(newChildElt, ChangesetsConstants.NS_URI, CHANGE_SET_ELT_NAME);
    ((DOMBased) value).setDOMNode(newChildElt);

    synchronized (DOMUtils.getDOMLock(elt)) {
      elt.appendChild(newChildElt);
      DOMUtils.order(elt, getSequenceOrder());
    }

    IXArch context = getXArch();
    if (context != null) {
      context.fireXArchEvent(
          new XArchEvent(
              this,
              XArchEvent.SET_EVENT,
              XArchEvent.ELEMENT_CHANGED,
              "changeSet",
              value,
              XArchUtils.getDefaultXArchImplementation().isContainedIn(xArch, this)));
    }
  }
  public IXArchElement cloneElement(int depth) {
    synchronized (DOMUtils.getDOMLock(elt)) {
      Document doc = elt.getOwnerDocument();
      if (depth == 0) {
        Element cloneElt = (Element) elt.cloneNode(false);
        cloneElt = (Element) doc.importNode(cloneElt, true);
        DirectionImpl cloneImpl = new DirectionImpl(cloneElt);
        cloneImpl.setXArch(getXArch());
        IXArch de = getXArch();
        if (de != null) {
          de.cacheWrapper(cloneElt, cloneImpl);
        }
        return cloneImpl;
      } else if (depth == 1) {
        Element cloneElt = (Element) elt.cloneNode(false);
        cloneElt = (Element) doc.importNode(cloneElt, true);
        DirectionImpl cloneImpl = new DirectionImpl(cloneElt);
        cloneImpl.setXArch(getXArch());

        NodeList nl = elt.getChildNodes();
        int size = nl.getLength();
        for (int i = 0; i < size; i++) {
          Node n = nl.item(i);
          Node cloneNode = (Node) n.cloneNode(false);
          cloneNode = doc.importNode(cloneNode, true);
          cloneElt.appendChild(cloneNode);
        }
        IXArch de = getXArch();
        if (de != null) {
          de.cacheWrapper(cloneElt, cloneImpl);
        }
        return cloneImpl;
      } else /* depth = infinity */ {
        Element cloneElt = (Element) elt.cloneNode(true);
        cloneElt = (Element) doc.importNode(cloneElt, true);
        DirectionImpl cloneImpl = new DirectionImpl(cloneElt);
        cloneImpl.setXArch(getXArch());
        IXArch de = getXArch();
        if (de != null) {
          de.cacheWrapper(cloneElt, cloneImpl);
        }
        return cloneImpl;
      }
    }
  }