Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-32946 Making RepositoryEntry a proper stagedmodel #9147

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions portal-impl/src/META-INF/portal-hbm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,11 @@
</id>
<property name="uuid" type="com.liferay.portal.dao.orm.hibernate.StringType" column="uuid_" />
<property name="groupId" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="companyId" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="userId" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="userName" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="createDate" type="org.hibernate.type.TimestampType" />
<property name="modifiedDate" type="org.hibernate.type.TimestampType" />
<property name="repositoryId" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="mappedId" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="manualCheckInRequired" type="com.liferay.portal.dao.orm.hibernate.BooleanType" />
Expand Down
5 changes: 5 additions & 0 deletions portal-impl/src/META-INF/portal-model-hints.xml
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,11 @@
<field name="uuid" type="String" />
<field name="repositoryEntryId" type="long" />
<field name="groupId" type="long" />
<field name="companyId" type="long" />
<field name="userId" type="long" />
<field name="userName" type="String" />
<field name="createDate" type="Date" />
<field name="modifiedDate" type="Date" />
<field name="repositoryId" type="long" />
<field name="mappedId" type="String" />
<field name="manualCheckInRequired" type="boolean" />
Expand Down
10 changes: 10 additions & 0 deletions portal-impl/src/META-INF/portal-orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -893,12 +893,22 @@
<column name="UUID_" />
</basic>
<basic name="groupId" />
<basic name="companyId" />
<basic name="userId" />
<basic name="userName" />
<basic name="createDate">
<temporal>TIMESTAMP</temporal>
</basic>
<basic name="modifiedDate">
<temporal>TIMESTAMP</temporal>
</basic>
<basic name="repositoryId" />
<basic name="mappedId" />
<basic name="manualCheckInRequired" />
<transient name="modelAttributes" />
<transient name="primaryKey" />
<transient name="primaryKeyObj" />
<transient name="userUuid" />
</attributes>
</mapped-superclass>
<mapped-superclass class="com.liferay.portal.model.impl.ResourceActionModelImpl">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;

import java.util.Date;

/**
* The cache model class for representing RepositoryEntry in entity cache.
*
Expand All @@ -35,14 +37,24 @@ public class RepositoryEntryCacheModel implements CacheModel<RepositoryEntry>,
Externalizable {
@Override
public String toString() {
StringBundler sb = new StringBundler(13);
StringBundler sb = new StringBundler(23);

sb.append("{uuid=");
sb.append(uuid);
sb.append(", repositoryEntryId=");
sb.append(repositoryEntryId);
sb.append(", groupId=");
sb.append(groupId);
sb.append(", companyId=");
sb.append(companyId);
sb.append(", userId=");
sb.append(userId);
sb.append(", userName=");
sb.append(userName);
sb.append(", createDate=");
sb.append(createDate);
sb.append(", modifiedDate=");
sb.append(modifiedDate);
sb.append(", repositoryId=");
sb.append(repositoryId);
sb.append(", mappedId=");
Expand All @@ -66,6 +78,30 @@ public RepositoryEntry toEntityModel() {

repositoryEntryImpl.setRepositoryEntryId(repositoryEntryId);
repositoryEntryImpl.setGroupId(groupId);
repositoryEntryImpl.setCompanyId(companyId);
repositoryEntryImpl.setUserId(userId);

if (userName == null) {
repositoryEntryImpl.setUserName(StringPool.BLANK);
}
else {
repositoryEntryImpl.setUserName(userName);
}

if (createDate == Long.MIN_VALUE) {
repositoryEntryImpl.setCreateDate(null);
}
else {
repositoryEntryImpl.setCreateDate(new Date(createDate));
}

if (modifiedDate == Long.MIN_VALUE) {
repositoryEntryImpl.setModifiedDate(null);
}
else {
repositoryEntryImpl.setModifiedDate(new Date(modifiedDate));
}

repositoryEntryImpl.setRepositoryId(repositoryId);

if (mappedId == null) {
Expand All @@ -86,6 +122,11 @@ public void readExternal(ObjectInput objectInput) throws IOException {
uuid = objectInput.readUTF();
repositoryEntryId = objectInput.readLong();
groupId = objectInput.readLong();
companyId = objectInput.readLong();
userId = objectInput.readLong();
userName = objectInput.readUTF();
createDate = objectInput.readLong();
modifiedDate = objectInput.readLong();
repositoryId = objectInput.readLong();
mappedId = objectInput.readUTF();
manualCheckInRequired = objectInput.readBoolean();
Expand All @@ -102,6 +143,18 @@ public void writeExternal(ObjectOutput objectOutput)

objectOutput.writeLong(repositoryEntryId);
objectOutput.writeLong(groupId);
objectOutput.writeLong(companyId);
objectOutput.writeLong(userId);

if (userName == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(userName);
}

objectOutput.writeLong(createDate);
objectOutput.writeLong(modifiedDate);
objectOutput.writeLong(repositoryId);

if (mappedId == null) {
Expand All @@ -117,6 +170,11 @@ public void writeExternal(ObjectOutput objectOutput)
public String uuid;
public long repositoryEntryId;
public long groupId;
public long companyId;
public long userId;
public String userName;
public long createDate;
public long modifiedDate;
public long repositoryId;
public String mappedId;
public boolean manualCheckInRequired;
Expand Down