/**
  * Find the correct OSD version for a given relation side.
  *
  * @param relation The relation for which the correct osd version is needed.
  * @param osd the OSD whose version needs to be determined.
  * @param relationSide the side of the relation for which you need the OSD version to be resolved.
  * @return the version as found by the Resolver class.
  */
 ObjectSystemData findOsdVersion(
     Relation relation, ObjectSystemData osd, RelationSide relationSide) {
   switch (relationSide) {
     case LEFT:
       return leftResolver.resolveOsdVersion(relation, osd, relationSide);
     case RIGHT:
       return rightResolver.resolveOsdVersion(relation, osd, relationSide);
   }
   return null; // is never reached unless RelationSide is null. And then you are up a certain
                // creek without a paddle anyway.
 }
 public void toXmlElement(Element root) {
   Element rt = root.addElement("relationType");
   rt.addElement("id").addText(String.valueOf(getId()));
   rt.addElement("name").addText(LocalMessage.loc(getName()));
   rt.addElement("sysName").addText(getName());
   rt.addElement("description").addText(LocalMessage.loc(getDescription()));
   rt.addElement("rightobjectprotected").addText(rightobjectprotected.toString());
   rt.addElement("leftobjectprotected").addText(leftobjectprotected.toString());
   rt.addElement("cloneOnLeftCopy").addText(cloneOnLeftCopy.toString());
   rt.addElement("cloneOnLeftVersion").addText(cloneOnLeftVersion.toString());
   rt.addElement("cloneOnRightCopy").addText(cloneOnRightCopy.toString());
   rt.addElement("cloneOnRightVersion").addText(cloneOnRightVersion.toString());
   rt.addElement("leftResolver").addText(leftResolver.getName());
   rt.addElement("rightResolver").addText(rightResolver.getName());
 }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof RelationType)) return false;

    RelationType that = (RelationType) o;

    if (!cloneOnLeftCopy.equals(that.cloneOnLeftCopy)) return false;
    if (!cloneOnLeftVersion.equals(that.cloneOnLeftVersion)) return false;
    if (!cloneOnRightCopy.equals(that.cloneOnRightCopy)) return false;
    if (!cloneOnRightVersion.equals(that.cloneOnRightVersion)) return false;
    if (!description.equals(that.description)) return false;
    if (!leftResolver.equals(that.leftResolver)) return false;
    if (!leftobjectprotected.equals(that.leftobjectprotected)) return false;
    if (!name.equals(that.name)) return false;
    if (!rightResolver.equals(that.rightResolver)) return false;
    if (!rightobjectprotected.equals(that.rightobjectprotected)) return false;

    return true;
  }