// 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()); }
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 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))); } }