001    /**
002     * Copyright (c) 2000-2013 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            @Override
054            public ResourceAction toEntityModel() {
055                    ResourceActionImpl resourceActionImpl = new ResourceActionImpl();
056    
057                    resourceActionImpl.setResourceActionId(resourceActionId);
058    
059                    if (name == null) {
060                            resourceActionImpl.setName(StringPool.BLANK);
061                    }
062                    else {
063                            resourceActionImpl.setName(name);
064                    }
065    
066                    if (actionId == null) {
067                            resourceActionImpl.setActionId(StringPool.BLANK);
068                    }
069                    else {
070                            resourceActionImpl.setActionId(actionId);
071                    }
072    
073                    resourceActionImpl.setBitwiseValue(bitwiseValue);
074    
075                    resourceActionImpl.resetOriginalValues();
076    
077                    return resourceActionImpl;
078            }
079    
080            @Override
081            public void readExternal(ObjectInput objectInput) throws IOException {
082                    resourceActionId = objectInput.readLong();
083                    name = objectInput.readUTF();
084                    actionId = objectInput.readUTF();
085                    bitwiseValue = objectInput.readLong();
086            }
087    
088            @Override
089            public void writeExternal(ObjectOutput objectOutput)
090                    throws IOException {
091                    objectOutput.writeLong(resourceActionId);
092    
093                    if (name == null) {
094                            objectOutput.writeUTF(StringPool.BLANK);
095                    }
096                    else {
097                            objectOutput.writeUTF(name);
098                    }
099    
100                    if (actionId == null) {
101                            objectOutput.writeUTF(StringPool.BLANK);
102                    }
103                    else {
104                            objectOutput.writeUTF(actionId);
105                    }
106    
107                    objectOutput.writeLong(bitwiseValue);
108            }
109    
110            public long resourceActionId;
111            public String name;
112            public String actionId;
113            public long bitwiseValue;
114    }