001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.ResourceAction;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing ResourceAction in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see ResourceAction
035     * @generated
036     */
037    @ProviderType
038    public class ResourceActionCacheModel implements CacheModel<ResourceAction>,
039            Externalizable, MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(11);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", resourceActionId=");
057                    sb.append(resourceActionId);
058                    sb.append(", name=");
059                    sb.append(name);
060                    sb.append(", actionId=");
061                    sb.append(actionId);
062                    sb.append(", bitwiseValue=");
063                    sb.append(bitwiseValue);
064                    sb.append("}");
065    
066                    return sb.toString();
067            }
068    
069            @Override
070            public ResourceAction toEntityModel() {
071                    ResourceActionImpl resourceActionImpl = new ResourceActionImpl();
072    
073                    resourceActionImpl.setMvccVersion(mvccVersion);
074                    resourceActionImpl.setResourceActionId(resourceActionId);
075    
076                    if (name == null) {
077                            resourceActionImpl.setName(StringPool.BLANK);
078                    }
079                    else {
080                            resourceActionImpl.setName(name);
081                    }
082    
083                    if (actionId == null) {
084                            resourceActionImpl.setActionId(StringPool.BLANK);
085                    }
086                    else {
087                            resourceActionImpl.setActionId(actionId);
088                    }
089    
090                    resourceActionImpl.setBitwiseValue(bitwiseValue);
091    
092                    resourceActionImpl.resetOriginalValues();
093    
094                    return resourceActionImpl;
095            }
096    
097            @Override
098            public void readExternal(ObjectInput objectInput) throws IOException {
099                    mvccVersion = objectInput.readLong();
100                    resourceActionId = objectInput.readLong();
101                    name = objectInput.readUTF();
102                    actionId = objectInput.readUTF();
103                    bitwiseValue = objectInput.readLong();
104            }
105    
106            @Override
107            public void writeExternal(ObjectOutput objectOutput)
108                    throws IOException {
109                    objectOutput.writeLong(mvccVersion);
110                    objectOutput.writeLong(resourceActionId);
111    
112                    if (name == null) {
113                            objectOutput.writeUTF(StringPool.BLANK);
114                    }
115                    else {
116                            objectOutput.writeUTF(name);
117                    }
118    
119                    if (actionId == null) {
120                            objectOutput.writeUTF(StringPool.BLANK);
121                    }
122                    else {
123                            objectOutput.writeUTF(actionId);
124                    }
125    
126                    objectOutput.writeLong(bitwiseValue);
127            }
128    
129            public long mvccVersion;
130            public long resourceActionId;
131            public String name;
132            public String actionId;
133            public long bitwiseValue;
134    }