at.graz.meduni.liferay.portlet.saat.model.impl.SCGCacheModel.java Source code

Java tutorial

Introduction

Here is the source code for at.graz.meduni.liferay.portlet.saat.model.impl.SCGCacheModel.java

Source

/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package at.graz.meduni.liferay.portlet.saat.model.impl;

import at.graz.meduni.liferay.portlet.saat.model.SCG;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

/**
 * The cache model class for representing SCG in entity cache.
 *
 * @author reihsr
 * @see SCG
 * @generated
 */
public class SCGCacheModel implements CacheModel<SCG>, Externalizable {
    @Override
    public String toString() {
        StringBundler sb = new StringBundler(7);

        sb.append("{scgId=");
        sb.append(scgId);
        sb.append(", code=");
        sb.append(code);
        sb.append(", description=");
        sb.append(description);
        sb.append("}");

        return sb.toString();
    }

    @Override
    public SCG toEntityModel() {
        SCGImpl scgImpl = new SCGImpl();

        scgImpl.setScgId(scgId);

        if (code == null) {
            scgImpl.setCode(StringPool.BLANK);
        } else {
            scgImpl.setCode(code);
        }

        if (description == null) {
            scgImpl.setDescription(StringPool.BLANK);
        } else {
            scgImpl.setDescription(description);
        }

        scgImpl.resetOriginalValues();

        return scgImpl;
    }

    @Override
    public void readExternal(ObjectInput objectInput) throws IOException {
        scgId = objectInput.readLong();
        code = objectInput.readUTF();
        description = objectInput.readUTF();
    }

    @Override
    public void writeExternal(ObjectOutput objectOutput) throws IOException {
        objectOutput.writeLong(scgId);

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

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

    public long scgId;
    public String code;
    public String description;
}