001    /**
002     * Copyright (c) 2000-2012 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 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.ResourceAction;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing ResourceAction in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see ResourceAction
032     * @generated
033     */
034    public class ResourceActionCacheModel implements CacheModel<ResourceAction>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(9);
039    
040                    sb.append("{resourceActionId=");
041                    sb.append(resourceActionId);
042                    sb.append(", name=");
043                    sb.append(name);
044                    sb.append(", actionId=");
045                    sb.append(actionId);
046                    sb.append(", bitwiseValue=");
047                    sb.append(bitwiseValue);
048                    sb.append("}");
049    
050                    return sb.toString();
051            }
052    
053            public ResourceAction toEntityModel() {
054                    ResourceActionImpl resourceActionImpl = new ResourceActionImpl();
055    
056                    resourceActionImpl.setResourceActionId(resourceActionId);
057    
058                    if (name == null) {
059                            resourceActionImpl.setName(StringPool.BLANK);
060                    }
061                    else {
062                            resourceActionImpl.setName(name);
063                    }
064    
065                    if (actionId == null) {
066                            resourceActionImpl.setActionId(StringPool.BLANK);
067                    }
068                    else {
069                            resourceActionImpl.setActionId(actionId);
070                    }
071    
072                    resourceActionImpl.setBitwiseValue(bitwiseValue);
073    
074                    resourceActionImpl.resetOriginalValues();
075    
076                    return resourceActionImpl;
077            }
078    
079            public void readExternal(ObjectInput objectInput) throws IOException {
080                    resourceActionId = objectInput.readLong();
081                    name = objectInput.readUTF();
082                    actionId = objectInput.readUTF();
083                    bitwiseValue = objectInput.readLong();
084            }
085    
086            public void writeExternal(ObjectOutput objectOutput)
087                    throws IOException {
088                    objectOutput.writeLong(resourceActionId);
089    
090                    if (name == null) {
091                            objectOutput.writeUTF(StringPool.BLANK);
092                    }
093                    else {
094                            objectOutput.writeUTF(name);
095                    }
096    
097                    if (actionId == null) {
098                            objectOutput.writeUTF(StringPool.BLANK);
099                    }
100                    else {
101                            objectOutput.writeUTF(actionId);
102                    }
103    
104                    objectOutput.writeLong(bitwiseValue);
105            }
106    
107            public long resourceActionId;
108            public String name;
109            public String actionId;
110            public long bitwiseValue;
111    }