/** @deprecated As of 6.2.0, replaced by {@link DLFileVersion#getUserId()} */ @Deprecated @Override public long getVersionUserId() { long versionUserId = 0; try { DLFileVersion dlFileVersion = getFileVersion(); versionUserId = dlFileVersion.getUserId(); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn(e, e); } } return versionUserId; }
public DLFileVersion updateDLFileVersion(DLFileVersion model) throws SystemException { DLFileVersion dlFileVersion = new DLFileVersionImpl(); dlFileVersion.setNew(false); dlFileVersion.setFileVersionId(model.getFileVersionId()); dlFileVersion.setCompanyId(model.getCompanyId()); dlFileVersion.setUserId(model.getUserId()); dlFileVersion.setUserName(model.getUserName()); dlFileVersion.setCreateDate(model.getCreateDate()); dlFileVersion.setFolderId(model.getFolderId()); dlFileVersion.setName(model.getName()); dlFileVersion.setVersion(model.getVersion()); dlFileVersion.setSize(model.getSize()); return dlFileVersionPersistence.update(dlFileVersion); }
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); DLFileVersion newDLFileVersion = _persistence.create(pk); newDLFileVersion.setUuid(RandomTestUtil.randomString()); newDLFileVersion.setGroupId(RandomTestUtil.nextLong()); newDLFileVersion.setCompanyId(RandomTestUtil.nextLong()); newDLFileVersion.setUserId(RandomTestUtil.nextLong()); newDLFileVersion.setUserName(RandomTestUtil.randomString()); newDLFileVersion.setCreateDate(RandomTestUtil.nextDate()); newDLFileVersion.setModifiedDate(RandomTestUtil.nextDate()); newDLFileVersion.setRepositoryId(RandomTestUtil.nextLong()); newDLFileVersion.setFolderId(RandomTestUtil.nextLong()); newDLFileVersion.setFileEntryId(RandomTestUtil.nextLong()); newDLFileVersion.setTreePath(RandomTestUtil.randomString()); newDLFileVersion.setExtension(RandomTestUtil.randomString()); newDLFileVersion.setMimeType(RandomTestUtil.randomString()); newDLFileVersion.setTitle(RandomTestUtil.randomString()); newDLFileVersion.setDescription(RandomTestUtil.randomString()); newDLFileVersion.setChangeLog(RandomTestUtil.randomString()); newDLFileVersion.setExtraSettings(RandomTestUtil.randomString()); newDLFileVersion.setFileEntryTypeId(RandomTestUtil.nextLong()); newDLFileVersion.setVersion(RandomTestUtil.randomString()); newDLFileVersion.setSize(RandomTestUtil.nextLong()); newDLFileVersion.setChecksum(RandomTestUtil.randomString()); newDLFileVersion.setStatus(RandomTestUtil.nextInt()); newDLFileVersion.setStatusByUserId(RandomTestUtil.nextLong()); newDLFileVersion.setStatusByUserName(RandomTestUtil.randomString()); newDLFileVersion.setStatusDate(RandomTestUtil.nextDate()); _persistence.update(newDLFileVersion); DLFileVersion existingDLFileVersion = _persistence.findByPrimaryKey(newDLFileVersion.getPrimaryKey()); Assert.assertEquals(existingDLFileVersion.getUuid(), newDLFileVersion.getUuid()); Assert.assertEquals( existingDLFileVersion.getFileVersionId(), newDLFileVersion.getFileVersionId()); Assert.assertEquals(existingDLFileVersion.getGroupId(), newDLFileVersion.getGroupId()); Assert.assertEquals(existingDLFileVersion.getCompanyId(), newDLFileVersion.getCompanyId()); Assert.assertEquals(existingDLFileVersion.getUserId(), newDLFileVersion.getUserId()); Assert.assertEquals(existingDLFileVersion.getUserName(), newDLFileVersion.getUserName()); Assert.assertEquals( Time.getShortTimestamp(existingDLFileVersion.getCreateDate()), Time.getShortTimestamp(newDLFileVersion.getCreateDate())); Assert.assertEquals( Time.getShortTimestamp(existingDLFileVersion.getModifiedDate()), Time.getShortTimestamp(newDLFileVersion.getModifiedDate())); Assert.assertEquals( existingDLFileVersion.getRepositoryId(), newDLFileVersion.getRepositoryId()); Assert.assertEquals(existingDLFileVersion.getFolderId(), newDLFileVersion.getFolderId()); Assert.assertEquals(existingDLFileVersion.getFileEntryId(), newDLFileVersion.getFileEntryId()); Assert.assertEquals(existingDLFileVersion.getTreePath(), newDLFileVersion.getTreePath()); Assert.assertEquals(existingDLFileVersion.getExtension(), newDLFileVersion.getExtension()); Assert.assertEquals(existingDLFileVersion.getMimeType(), newDLFileVersion.getMimeType()); Assert.assertEquals(existingDLFileVersion.getTitle(), newDLFileVersion.getTitle()); Assert.assertEquals(existingDLFileVersion.getDescription(), newDLFileVersion.getDescription()); Assert.assertEquals(existingDLFileVersion.getChangeLog(), newDLFileVersion.getChangeLog()); Assert.assertEquals( existingDLFileVersion.getExtraSettings(), newDLFileVersion.getExtraSettings()); Assert.assertEquals( existingDLFileVersion.getFileEntryTypeId(), newDLFileVersion.getFileEntryTypeId()); Assert.assertEquals(existingDLFileVersion.getVersion(), newDLFileVersion.getVersion()); Assert.assertEquals(existingDLFileVersion.getSize(), newDLFileVersion.getSize()); Assert.assertEquals(existingDLFileVersion.getChecksum(), newDLFileVersion.getChecksum()); Assert.assertEquals(existingDLFileVersion.getStatus(), newDLFileVersion.getStatus()); Assert.assertEquals( existingDLFileVersion.getStatusByUserId(), newDLFileVersion.getStatusByUserId()); Assert.assertEquals( existingDLFileVersion.getStatusByUserName(), newDLFileVersion.getStatusByUserName()); Assert.assertEquals( Time.getShortTimestamp(existingDLFileVersion.getStatusDate()), Time.getShortTimestamp(newDLFileVersion.getStatusDate())); }