/**
   * Converts the soap model instance into a normal model instance.
   *
   * @param soapModel the soap model instance to convert
   * @return the normal model instance
   */
  public static DDLRecordVersion toModel(DDLRecordVersionSoap soapModel) {
    if (soapModel == null) {
      return null;
    }

    DDLRecordVersion model = new DDLRecordVersionImpl();

    model.setRecordVersionId(soapModel.getRecordVersionId());
    model.setGroupId(soapModel.getGroupId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setUserId(soapModel.getUserId());
    model.setUserName(soapModel.getUserName());
    model.setCreateDate(soapModel.getCreateDate());
    model.setDDMStorageId(soapModel.getDDMStorageId());
    model.setRecordSetId(soapModel.getRecordSetId());
    model.setRecordId(soapModel.getRecordId());
    model.setVersion(soapModel.getVersion());
    model.setDisplayIndex(soapModel.getDisplayIndex());
    model.setStatus(soapModel.getStatus());
    model.setStatusByUserId(soapModel.getStatusByUserId());
    model.setStatusByUserName(soapModel.getStatusByUserName());
    model.setStatusDate(soapModel.getStatusDate());

    return model;
  }
  protected DDLRecordVersion addDDLRecordVersion() throws Exception {
    long pk = RandomTestUtil.nextLong();

    DDLRecordVersion ddlRecordVersion = _persistence.create(pk);

    ddlRecordVersion.setGroupId(RandomTestUtil.nextLong());

    ddlRecordVersion.setCompanyId(RandomTestUtil.nextLong());

    ddlRecordVersion.setUserId(RandomTestUtil.nextLong());

    ddlRecordVersion.setUserName(RandomTestUtil.randomString());

    ddlRecordVersion.setCreateDate(RandomTestUtil.nextDate());

    ddlRecordVersion.setDDMStorageId(RandomTestUtil.nextLong());

    ddlRecordVersion.setRecordSetId(RandomTestUtil.nextLong());

    ddlRecordVersion.setRecordId(RandomTestUtil.nextLong());

    ddlRecordVersion.setVersion(RandomTestUtil.randomString());

    ddlRecordVersion.setDisplayIndex(RandomTestUtil.nextInt());

    ddlRecordVersion.setStatus(RandomTestUtil.nextInt());

    ddlRecordVersion.setStatusByUserId(RandomTestUtil.nextLong());

    ddlRecordVersion.setStatusByUserName(RandomTestUtil.randomString());

    ddlRecordVersion.setStatusDate(RandomTestUtil.nextDate());

    _ddlRecordVersions.add(_persistence.update(ddlRecordVersion));

    return ddlRecordVersion;
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    DDLRecordVersion newDDLRecordVersion = _persistence.create(pk);

    newDDLRecordVersion.setGroupId(RandomTestUtil.nextLong());

    newDDLRecordVersion.setCompanyId(RandomTestUtil.nextLong());

    newDDLRecordVersion.setUserId(RandomTestUtil.nextLong());

    newDDLRecordVersion.setUserName(RandomTestUtil.randomString());

    newDDLRecordVersion.setCreateDate(RandomTestUtil.nextDate());

    newDDLRecordVersion.setDDMStorageId(RandomTestUtil.nextLong());

    newDDLRecordVersion.setRecordSetId(RandomTestUtil.nextLong());

    newDDLRecordVersion.setRecordId(RandomTestUtil.nextLong());

    newDDLRecordVersion.setVersion(RandomTestUtil.randomString());

    newDDLRecordVersion.setDisplayIndex(RandomTestUtil.nextInt());

    newDDLRecordVersion.setStatus(RandomTestUtil.nextInt());

    newDDLRecordVersion.setStatusByUserId(RandomTestUtil.nextLong());

    newDDLRecordVersion.setStatusByUserName(RandomTestUtil.randomString());

    newDDLRecordVersion.setStatusDate(RandomTestUtil.nextDate());

    _ddlRecordVersions.add(_persistence.update(newDDLRecordVersion));

    DDLRecordVersion existingDDLRecordVersion =
        _persistence.findByPrimaryKey(newDDLRecordVersion.getPrimaryKey());

    Assert.assertEquals(
        existingDDLRecordVersion.getRecordVersionId(), newDDLRecordVersion.getRecordVersionId());
    Assert.assertEquals(existingDDLRecordVersion.getGroupId(), newDDLRecordVersion.getGroupId());
    Assert.assertEquals(
        existingDDLRecordVersion.getCompanyId(), newDDLRecordVersion.getCompanyId());
    Assert.assertEquals(existingDDLRecordVersion.getUserId(), newDDLRecordVersion.getUserId());
    Assert.assertEquals(existingDDLRecordVersion.getUserName(), newDDLRecordVersion.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingDDLRecordVersion.getCreateDate()),
        Time.getShortTimestamp(newDDLRecordVersion.getCreateDate()));
    Assert.assertEquals(
        existingDDLRecordVersion.getDDMStorageId(), newDDLRecordVersion.getDDMStorageId());
    Assert.assertEquals(
        existingDDLRecordVersion.getRecordSetId(), newDDLRecordVersion.getRecordSetId());
    Assert.assertEquals(existingDDLRecordVersion.getRecordId(), newDDLRecordVersion.getRecordId());
    Assert.assertEquals(existingDDLRecordVersion.getVersion(), newDDLRecordVersion.getVersion());
    Assert.assertEquals(
        existingDDLRecordVersion.getDisplayIndex(), newDDLRecordVersion.getDisplayIndex());
    Assert.assertEquals(existingDDLRecordVersion.getStatus(), newDDLRecordVersion.getStatus());
    Assert.assertEquals(
        existingDDLRecordVersion.getStatusByUserId(), newDDLRecordVersion.getStatusByUserId());
    Assert.assertEquals(
        existingDDLRecordVersion.getStatusByUserName(), newDDLRecordVersion.getStatusByUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingDDLRecordVersion.getStatusDate()),
        Time.getShortTimestamp(newDDLRecordVersion.getStatusDate()));
  }