Package com.jenginetest.builder.model.impl

Source Code of com.jenginetest.builder.model.impl.STransactionModelImpl

/**
* Copyright (c) 2000-2012 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 com.jenginetest.builder.model.impl;

import com.jenginetest.builder.model.STransaction;
import com.jenginetest.builder.model.STransactionModel;
import com.jenginetest.builder.model.STransactionSoap;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import java.io.Serializable;

import java.sql.Types;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* The base model implementation for the STransaction service. Represents a row in the "SB_STransaction" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link com.jenginetest.builder.model.STransactionModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link STransactionImpl}.
* </p>
*
* @author Brian Wing Shun Chan
* @see STransactionImpl
* @see com.jenginetest.builder.model.STransaction
* @see com.jenginetest.builder.model.STransactionModel
* @generated
*/
@JSON(strict = true)
public class STransactionModelImpl extends BaseModelImpl<STransaction>
  implements STransactionModel {
  /*
   * NOTE FOR DEVELOPERS:
   *
   * Never modify or reference this class directly. All methods that expect a s transaction model instance should use the {@link com.jenginetest.builder.model.STransaction} interface instead.
   */
  public static final String TABLE_NAME = "SB_STransaction";
  public static final Object[][] TABLE_COLUMNS = {
      { "transactionId", Types.BIGINT },
      { "bookId", Types.BIGINT },
      { "memberId", Types.BIGINT },
      { "tdate", Types.TIMESTAMP }
    };
  public static final String TABLE_SQL_CREATE = "create table SB_STransaction (transactionId LONG not null primary key,bookId LONG,memberId LONG,tdate DATE null)";
  public static final String TABLE_SQL_DROP = "drop table SB_STransaction";
  public static final String DATA_SOURCE = "liferayDataSource";
  public static final String SESSION_FACTORY = "liferaySessionFactory";
  public static final String TX_MANAGER = "liferayTransactionManager";
  public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
        "value.object.entity.cache.enabled.com.jenginetest.builder.model.STransaction"),
      true);
  public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
        "value.object.finder.cache.enabled.com.jenginetest.builder.model.STransaction"),
      true);
  public static final boolean COLUMN_BITMASK_ENABLED = false;

  /**
   * Converts the soap model instance into a normal model instance.
   *
   * @param soapModel the soap model instance to convert
   * @return the normal model instance
   */
  public static STransaction toModel(STransactionSoap soapModel) {
    if (soapModel == null) {
      return null;
    }

    STransaction model = new STransactionImpl();

    model.setTransactionId(soapModel.getTransactionId());
    model.setBookId(soapModel.getBookId());
    model.setMemberId(soapModel.getMemberId());
    model.setTdate(soapModel.getTdate());

    return model;
  }

  /**
   * Converts the soap model instances into normal model instances.
   *
   * @param soapModels the soap model instances to convert
   * @return the normal model instances
   */
  public static List<STransaction> toModels(STransactionSoap[] soapModels) {
    if (soapModels == null) {
      return null;
    }

    List<STransaction> models = new ArrayList<STransaction>(soapModels.length);

    for (STransactionSoap soapModel : soapModels) {
      models.add(toModel(soapModel));
    }

    return models;
  }

  public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
        "lock.expiration.time.com.jenginetest.builder.model.STransaction"));

  public STransactionModelImpl() {
  }

  public long getPrimaryKey() {
    return _transactionId;
  }

  public void setPrimaryKey(long primaryKey) {
    setTransactionId(primaryKey);
  }

  public Serializable getPrimaryKeyObj() {
    return new Long(_transactionId);
  }

  public void setPrimaryKeyObj(Serializable primaryKeyObj) {
    setPrimaryKey(((Long)primaryKeyObj).longValue());
  }

  public Class<?> getModelClass() {
    return STransaction.class;
  }

  public String getModelClassName() {
    return STransaction.class.getName();
  }

  @Override
  public Map<String, Object> getModelAttributes() {
    Map<String, Object> attributes = new HashMap<String, Object>();

    attributes.put("transactionId", getTransactionId());
    attributes.put("bookId", getBookId());
    attributes.put("memberId", getMemberId());
    attributes.put("tdate", getTdate());

    return attributes;
  }

  @Override
  public void setModelAttributes(Map<String, Object> attributes) {
    Long transactionId = (Long)attributes.get("transactionId");

    if (transactionId != null) {
      setTransactionId(transactionId);
    }

    Long bookId = (Long)attributes.get("bookId");

    if (bookId != null) {
      setBookId(bookId);
    }

    Long memberId = (Long)attributes.get("memberId");

    if (memberId != null) {
      setMemberId(memberId);
    }

    Date tdate = (Date)attributes.get("tdate");

    if (tdate != null) {
      setTdate(tdate);
    }
  }

  @JSON
  public long getTransactionId() {
    return _transactionId;
  }

  public void setTransactionId(long transactionId) {
    _transactionId = transactionId;
  }

  @JSON
  public long getBookId() {
    return _bookId;
  }

  public void setBookId(long bookId) {
    _bookId = bookId;
  }

  @JSON
  public long getMemberId() {
    return _memberId;
  }

  public void setMemberId(long memberId) {
    _memberId = memberId;
  }

  @JSON
  public Date getTdate() {
    return _tdate;
  }

  public void setTdate(Date tdate) {
    _tdate = tdate;
  }

  @Override
  public ExpandoBridge getExpandoBridge() {
    return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
      STransaction.class.getName(), getPrimaryKey());
  }

  @Override
  public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
    ExpandoBridge expandoBridge = getExpandoBridge();

    expandoBridge.setAttributes(serviceContext);
  }

  @Override
  public STransaction toEscapedModel() {
    if (_escapedModelProxy == null) {
      _escapedModelProxy = (STransaction)ProxyUtil.newProxyInstance(_classLoader,
          _escapedModelProxyInterfaces,
          new AutoEscapeBeanHandler(this));
    }

    return _escapedModelProxy;
  }

  @Override
  public Object clone() {
    STransactionImpl sTransactionImpl = new STransactionImpl();

    sTransactionImpl.setTransactionId(getTransactionId());
    sTransactionImpl.setBookId(getBookId());
    sTransactionImpl.setMemberId(getMemberId());
    sTransactionImpl.setTdate(getTdate());

    sTransactionImpl.resetOriginalValues();

    return sTransactionImpl;
  }

  public int compareTo(STransaction sTransaction) {
    long primaryKey = sTransaction.getPrimaryKey();

    if (getPrimaryKey() < primaryKey) {
      return -1;
    }
    else if (getPrimaryKey() > primaryKey) {
      return 1;
    }
    else {
      return 0;
    }
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }

    STransaction sTransaction = null;

    try {
      sTransaction = (STransaction)obj;
    }
    catch (ClassCastException cce) {
      return false;
    }

    long primaryKey = sTransaction.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    }
    else {
      return false;
    }
  }

  @Override
  public int hashCode() {
    return (int)getPrimaryKey();
  }

  @Override
  public void resetOriginalValues() {
  }

  @Override
  public CacheModel<STransaction> toCacheModel() {
    STransactionCacheModel sTransactionCacheModel = new STransactionCacheModel();

    sTransactionCacheModel.transactionId = getTransactionId();

    sTransactionCacheModel.bookId = getBookId();

    sTransactionCacheModel.memberId = getMemberId();

    Date tdate = getTdate();

    if (tdate != null) {
      sTransactionCacheModel.tdate = tdate.getTime();
    }
    else {
      sTransactionCacheModel.tdate = Long.MIN_VALUE;
    }

    return sTransactionCacheModel;
  }

  @Override
  public String toString() {
    StringBundler sb = new StringBundler(9);

    sb.append("{transactionId=");
    sb.append(getTransactionId());
    sb.append(", bookId=");
    sb.append(getBookId());
    sb.append(", memberId=");
    sb.append(getMemberId());
    sb.append(", tdate=");
    sb.append(getTdate());
    sb.append("}");

    return sb.toString();
  }

  public String toXmlString() {
    StringBundler sb = new StringBundler(16);

    sb.append("<model><model-name>");
    sb.append("com.jenginetest.builder.model.STransaction");
    sb.append("</model-name>");

    sb.append(
      "<column><column-name>transactionId</column-name><column-value><![CDATA[");
    sb.append(getTransactionId());
    sb.append("]]></column-value></column>");
    sb.append(
      "<column><column-name>bookId</column-name><column-value><![CDATA[");
    sb.append(getBookId());
    sb.append("]]></column-value></column>");
    sb.append(
      "<column><column-name>memberId</column-name><column-value><![CDATA[");
    sb.append(getMemberId());
    sb.append("]]></column-value></column>");
    sb.append(
      "<column><column-name>tdate</column-name><column-value><![CDATA[");
    sb.append(getTdate());
    sb.append("]]></column-value></column>");

    sb.append("</model>");

    return sb.toString();
  }

  private static ClassLoader _classLoader = STransaction.class.getClassLoader();
  private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
      STransaction.class
    };
  private long _transactionId;
  private long _bookId;
  private long _memberId;
  private Date _tdate;
  private STransaction _escapedModelProxy;
}
TOP

Related Classes of com.jenginetest.builder.model.impl.STransactionModelImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.