001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.util.StringBundler;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.model.CacheModel;
020 import com.liferay.portal.model.WebDAVProps;
021
022 import java.io.Externalizable;
023 import java.io.IOException;
024 import java.io.ObjectInput;
025 import java.io.ObjectOutput;
026
027 import java.util.Date;
028
029
036 public class WebDAVPropsCacheModel implements CacheModel<WebDAVProps>,
037 Externalizable {
038 @Override
039 public String toString() {
040 StringBundler sb = new StringBundler(15);
041
042 sb.append("{webDavPropsId=");
043 sb.append(webDavPropsId);
044 sb.append(", companyId=");
045 sb.append(companyId);
046 sb.append(", createDate=");
047 sb.append(createDate);
048 sb.append(", modifiedDate=");
049 sb.append(modifiedDate);
050 sb.append(", classNameId=");
051 sb.append(classNameId);
052 sb.append(", classPK=");
053 sb.append(classPK);
054 sb.append(", props=");
055 sb.append(props);
056 sb.append("}");
057
058 return sb.toString();
059 }
060
061 @Override
062 public WebDAVProps toEntityModel() {
063 WebDAVPropsImpl webDAVPropsImpl = new WebDAVPropsImpl();
064
065 webDAVPropsImpl.setWebDavPropsId(webDavPropsId);
066 webDAVPropsImpl.setCompanyId(companyId);
067
068 if (createDate == Long.MIN_VALUE) {
069 webDAVPropsImpl.setCreateDate(null);
070 }
071 else {
072 webDAVPropsImpl.setCreateDate(new Date(createDate));
073 }
074
075 if (modifiedDate == Long.MIN_VALUE) {
076 webDAVPropsImpl.setModifiedDate(null);
077 }
078 else {
079 webDAVPropsImpl.setModifiedDate(new Date(modifiedDate));
080 }
081
082 webDAVPropsImpl.setClassNameId(classNameId);
083 webDAVPropsImpl.setClassPK(classPK);
084
085 if (props == null) {
086 webDAVPropsImpl.setProps(StringPool.BLANK);
087 }
088 else {
089 webDAVPropsImpl.setProps(props);
090 }
091
092 webDAVPropsImpl.resetOriginalValues();
093
094 return webDAVPropsImpl;
095 }
096
097 @Override
098 public void readExternal(ObjectInput objectInput) throws IOException {
099 webDavPropsId = objectInput.readLong();
100 companyId = objectInput.readLong();
101 createDate = objectInput.readLong();
102 modifiedDate = objectInput.readLong();
103 classNameId = objectInput.readLong();
104 classPK = objectInput.readLong();
105 props = objectInput.readUTF();
106 }
107
108 @Override
109 public void writeExternal(ObjectOutput objectOutput)
110 throws IOException {
111 objectOutput.writeLong(webDavPropsId);
112 objectOutput.writeLong(companyId);
113 objectOutput.writeLong(createDate);
114 objectOutput.writeLong(modifiedDate);
115 objectOutput.writeLong(classNameId);
116 objectOutput.writeLong(classPK);
117
118 if (props == null) {
119 objectOutput.writeUTF(StringPool.BLANK);
120 }
121 else {
122 objectOutput.writeUTF(props);
123 }
124 }
125
126 public long webDavPropsId;
127 public long companyId;
128 public long createDate;
129 public long modifiedDate;
130 public long classNameId;
131 public long classPK;
132 public String props;
133 }