コード例 #1
0
 // Override 'equals' to be DOM-based...
 public boolean equals(Object o) {
   if (o == null) {
     return false;
   }
   if (!(o instanceof DOMBased)) {
     return super.equals(o);
   }
   DOMBased db = (DOMBased) o;
   Node dbNode = db.getDOMNode();
   return dbNode.equals(getDOMNode());
 }
コード例 #2
0
  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)));
    }
  }
コード例 #3
0
  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)));
    }
  }
コード例 #4
0
  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)));
    }
  }