public void testFetchByPrimaryKeyExisting() throws Exception {
    SCFrameworkVersion newSCFrameworkVersion = addSCFrameworkVersion();

    SCFrameworkVersion existingSCFrameworkVersion =
        _persistence.fetchByPrimaryKey(newSCFrameworkVersion.getPrimaryKey());

    assertEquals(existingSCFrameworkVersion, newSCFrameworkVersion);
  }
  public void testCreate() throws Exception {
    long pk = nextLong();

    SCFrameworkVersion scFrameworkVersion = _persistence.create(pk);

    assertNotNull(scFrameworkVersion);

    assertEquals(scFrameworkVersion.getPrimaryKey(), pk);
  }
  public void testRemove() throws Exception {
    SCFrameworkVersion newSCFrameworkVersion = addSCFrameworkVersion();

    _persistence.remove(newSCFrameworkVersion);

    SCFrameworkVersion existingSCFrameworkVersion =
        _persistence.fetchByPrimaryKey(newSCFrameworkVersion.getPrimaryKey());

    assertNull(existingSCFrameworkVersion);
  }
  /**
   * Adds the s c framework version to the database. Also notifies the appropriate model listeners.
   *
   * @param scFrameworkVersion the s c framework version
   * @return the s c framework version that was added
   */
  @Indexable(type = IndexableType.REINDEX)
  @Override
  public SCFrameworkVersion addSCFrameworkVersion(SCFrameworkVersion scFrameworkVersion) {
    scFrameworkVersion.setNew(true);

    return scFrameworkVersionPersistence.update(scFrameworkVersion);
  }
  public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    SCFrameworkVersion newSCFrameworkVersion = addSCFrameworkVersion();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(
            SCFrameworkVersion.class, SCFrameworkVersion.class.getClassLoader());

    dynamicQuery.add(
        RestrictionsFactoryUtil.eq(
            "frameworkVersionId", newSCFrameworkVersion.getFrameworkVersionId()));

    List<SCFrameworkVersion> result = _persistence.findWithDynamicQuery(dynamicQuery);

    assertEquals(1, result.size());

    SCFrameworkVersion existingSCFrameworkVersion = result.get(0);

    assertEquals(existingSCFrameworkVersion, newSCFrameworkVersion);
  }
  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }

    SCFrameworkVersion scFrameworkVersion = null;

    try {
      scFrameworkVersion = (SCFrameworkVersion) obj;
    } catch (ClassCastException cce) {
      return false;
    }

    long primaryKey = scFrameworkVersion.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    } else {
      return false;
    }
  }
  public int compareTo(SCFrameworkVersion scFrameworkVersion) {
    int value = 0;

    value = getName().compareTo(scFrameworkVersion.getName());

    value = value * -1;

    if (value != 0) {
      return value;
    }

    return 0;
  }
  /**
   * 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 SCFrameworkVersion toModel(SCFrameworkVersionSoap soapModel) {
    if (soapModel == null) {
      return null;
    }

    SCFrameworkVersion model = new SCFrameworkVersionImpl();

    model.setFrameworkVersionId(soapModel.getFrameworkVersionId());
    model.setGroupId(soapModel.getGroupId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setUserId(soapModel.getUserId());
    model.setUserName(soapModel.getUserName());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setName(soapModel.getName());
    model.setUrl(soapModel.getUrl());
    model.setActive(soapModel.getActive());
    model.setPriority(soapModel.getPriority());

    return model;
  }
  public void testUpdateExisting() throws Exception {
    long pk = nextLong();

    SCFrameworkVersion newSCFrameworkVersion = _persistence.create(pk);

    newSCFrameworkVersion.setGroupId(nextLong());
    newSCFrameworkVersion.setCompanyId(nextLong());
    newSCFrameworkVersion.setUserId(nextLong());
    newSCFrameworkVersion.setUserName(randomString());
    newSCFrameworkVersion.setCreateDate(nextDate());
    newSCFrameworkVersion.setModifiedDate(nextDate());
    newSCFrameworkVersion.setName(randomString());
    newSCFrameworkVersion.setUrl(randomString());
    newSCFrameworkVersion.setActive(randomBoolean());
    newSCFrameworkVersion.setPriority(nextInt());

    _persistence.update(newSCFrameworkVersion, false);

    SCFrameworkVersion existingSCFrameworkVersion =
        _persistence.findByPrimaryKey(newSCFrameworkVersion.getPrimaryKey());

    assertEquals(
        existingSCFrameworkVersion.getFrameworkVersionId(),
        newSCFrameworkVersion.getFrameworkVersionId());
    assertEquals(existingSCFrameworkVersion.getGroupId(), newSCFrameworkVersion.getGroupId());
    assertEquals(existingSCFrameworkVersion.getCompanyId(), newSCFrameworkVersion.getCompanyId());
    assertEquals(existingSCFrameworkVersion.getUserId(), newSCFrameworkVersion.getUserId());
    assertEquals(existingSCFrameworkVersion.getUserName(), newSCFrameworkVersion.getUserName());
    assertEquals(
        Time.getShortTimestamp(existingSCFrameworkVersion.getCreateDate()),
        Time.getShortTimestamp(newSCFrameworkVersion.getCreateDate()));
    assertEquals(
        Time.getShortTimestamp(existingSCFrameworkVersion.getModifiedDate()),
        Time.getShortTimestamp(newSCFrameworkVersion.getModifiedDate()));
    assertEquals(existingSCFrameworkVersion.getName(), newSCFrameworkVersion.getName());
    assertEquals(existingSCFrameworkVersion.getUrl(), newSCFrameworkVersion.getUrl());
    assertEquals(existingSCFrameworkVersion.getActive(), newSCFrameworkVersion.getActive());
    assertEquals(existingSCFrameworkVersion.getPriority(), newSCFrameworkVersion.getPriority());
  }
  protected SCFrameworkVersion addSCFrameworkVersion() throws Exception {
    long pk = nextLong();

    SCFrameworkVersion scFrameworkVersion = _persistence.create(pk);

    scFrameworkVersion.setGroupId(nextLong());
    scFrameworkVersion.setCompanyId(nextLong());
    scFrameworkVersion.setUserId(nextLong());
    scFrameworkVersion.setUserName(randomString());
    scFrameworkVersion.setCreateDate(nextDate());
    scFrameworkVersion.setModifiedDate(nextDate());
    scFrameworkVersion.setName(randomString());
    scFrameworkVersion.setUrl(randomString());
    scFrameworkVersion.setActive(randomBoolean());
    scFrameworkVersion.setPriority(nextInt());

    _persistence.update(scFrameworkVersion, false);

    return scFrameworkVersion;
  }