public String toString() { StringBuffer sb = new StringBuffer(32); sb.append("ChildAssoc") .append("[ id=") .append(id) .append(", parent=") .append(parent.getId()) .append(", child=") .append(child.getId()) .append(", child name=") .append(childNodeName) .append(", child name crc=") .append(childNodeNameCrc) .append(", assoc type=") .append(typeQNameId) .append(", assoc qname ns=") .append(qnameNamespaceId) .append(", assoc qname localname=") .append(qnameLocalName) .append(", assoc qname crc=") .append(qnameCrc) .append(", isPrimary=") .append(isPrimary) .append("]"); return sb.toString(); }
/** * {@inheritDoc} * * <p>This method is thread-safe and lazily creates the required references, if required. */ public ChildAssociationRef getChildAssocRef(QNameDAO qnameDAO) { boolean trashReference = false; // first check if it is available refReadLock.lock(); try { if (childAssocRef != null) { // double check that the parent and child node references match those of our reference if (childAssocRef.getParentRef() != parent.getNodeRef() || childAssocRef.getChildRef() != child.getNodeRef()) { trashReference = true; } else { // we are sure that the reference is correct return childAssocRef; } } } finally { refReadLock.unlock(); } // get write lock refWriteLock.lock(); try { // double check if (childAssocRef == null || trashReference) { if (typeQName == null) { typeQName = qnameDAO.getQName(this.typeQNameId).getSecond(); } if (qname == null) { String qnameNamespace = qnameDAO.getNamespace(qnameNamespaceId).getSecond(); qname = QName.createQName(qnameNamespace, qnameLocalName); } childAssocRef = new ChildAssociationRef( typeQName, parent.getNodeRef(), qname, child.getNodeRef(), this.isPrimary, index); } return childAssocRef; } finally { refWriteLock.unlock(); } }
public int hashCode() { return (child == null ? 0 : child.hashCode()); }