Example #1
0
  /**
   * Creates an instance of TPRole with the contents of a TPRoleBean. This behaviour could have also
   * been achieved using a constructor, however as this class is abstract no constructors are
   * allowed.
   *
   * <p>This method is intended for internal use only.
   *
   * @param bean the TPRoleBean which contents are used to create the resulting class
   * @param createdObjects a IdentityMap which maps beans to already created objects
   * @return an instance of TPRole with the contents of bean
   */
  public static TPRole createTPRole(TPRoleBean bean, IdentityMap createdObjects)
      throws TorqueException {
    TPRole result = (TPRole) createdObjects.get(bean);
    if (result != null) {
      // we already have an object for the bean, return it
      return result;
    }
    result = new TPRole();
    createdObjects.put(bean, result);

    result.setObjectID(bean.getObjectID());
    result.setProjectType(bean.getProjectType());
    result.setRole(bean.getRole());
    result.setUuid(bean.getUuid());

    {
      TProjectTypeBean relatedBean = bean.getTProjectTypeBean();
      if (relatedBean != null) {
        TProjectType relatedObject = TProjectType.createTProjectType(relatedBean, createdObjects);
        result.setTProjectType(relatedObject);
      }
    }

    {
      TRoleBean relatedBean = bean.getTRoleBean();
      if (relatedBean != null) {
        TRole relatedObject = TRole.createTRole(relatedBean, createdObjects);
        result.setTRole(relatedObject);
      }
    }
    result.setModified(bean.isModified());
    result.setNew(bean.isNew());
    return result;
  }
Example #2
0
  /**
   * Creates a TPRoleBean with the contents of this object intended for internal use only
   *
   * @param createdBeans a IdentityMap which maps objects to already created beans
   * @return a TPRoleBean with the contents of this object
   */
  public TPRoleBean getBean(IdentityMap createdBeans) {
    TPRoleBean result = (TPRoleBean) createdBeans.get(this);
    if (result != null) {
      // we have already created a bean for this object, return it
      return result;
    }
    // no bean exists for this object; create a new one
    result = new TPRoleBean();
    createdBeans.put(this, result);

    result.setObjectID(getObjectID());
    result.setProjectType(getProjectType());
    result.setRole(getRole());
    result.setUuid(getUuid());

    if (aTProjectType != null) {
      TProjectTypeBean relatedBean = aTProjectType.getBean(createdBeans);
      result.setTProjectTypeBean(relatedBean);
    }

    if (aTRole != null) {
      TRoleBean relatedBean = aTRole.getBean(createdBeans);
      result.setTRoleBean(relatedBean);
    }
    result.setModified(isModified());
    result.setNew(isNew());
    return result;
  }