blob: e3559fbd9c76e9078773c2190f89933e9b2e01b9 [file] [log] [blame]
package org.eclipse.epf.library.edit.meta.internal;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.epf.common.utils.XMLUtil;
import org.eclipse.epf.library.edit.meta.IMetaDef;
import org.eclipse.epf.library.edit.meta.TypeDefException;
import org.eclipse.epf.library.edit.meta.TypeDefUtil;
import org.eclipse.epf.uma.util.ExtendedReference;
import org.eclipse.epf.uma.util.QualifiedReference;
import org.eclipse.epf.uma.util.UmaUtil;
import org.w3c.dom.Element;
public class ExtendedReferenceImpl extends MetaElementImpl implements ExtendedReference {
private EReference ref;
private List<QualifiedReference> qualifiedReferences;
public ExtendedReferenceImpl() {
}
public EReference getReference() {
return ref;
}
protected void setReference(EReference ref) {
this.ref = ref;
}
public List<QualifiedReference> getQualifiedReferences() {
return qualifiedReferences;
}
public void parseElement(Element element) throws TypeDefException {
super.parseElement(element);
if (element == null) {
return;
}
ref = UmaUtil.createReference(getId());
TypeDefUtil.getInstance().associate(this, ref);
qualifiedReferences = new ArrayList<QualifiedReference>();
List<Element> rqElements = XMLUtil.getChildElementsByTagName(element, IMetaDef.REFERENCE_QUALIFIERS);
if (rqElements == null || rqElements.isEmpty()) {
return;
}
for (Element rqElement : rqElements) {
List<Element> qElements = XMLUtil.getChildElementsByTagName(rqElement, IMetaDef.QUALIFIER);
for (Element qElement : qElements) {
QualifiedReferenceImpl q = new QualifiedReferenceImpl();
q.setParent(this);
q.parseElement(qElement);
qualifiedReferences.add(q);
}
}
}
}