Package br.com.thiagomoreira.liferay.plugins.notfound.services.model.impl

Source Code of br.com.thiagomoreira.liferay.plugins.notfound.services.model.impl.NotFoundModelImpl

/**
* Copyright (C) 2014 Thiago Moreira (tmoreira2020@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*         http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package br.com.thiagomoreira.liferay.plugins.notfound.services.model.impl;

import br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFound;
import br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFoundModel;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
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.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.util.PortalUtil;

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.Date;
import java.util.HashMap;
import java.util.Map;

/**
* The base model implementation for the NotFound service. Represents a row in the "TM_NF_NotFound" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFoundModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link NotFoundImpl}.
* </p>
*
* @author Thiago Moreira
* @see NotFoundImpl
* @see br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFound
* @see br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFoundModel
* @generated
*/
public class NotFoundModelImpl extends BaseModelImpl<NotFound>
    implements NotFoundModel {
    /*
     * NOTE FOR DEVELOPERS:
     *
     * Never modify or reference this class directly. All methods that expect a not found model instance should use the {@link br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFound} interface instead.
     */
    public static final String TABLE_NAME = "TM_NF_NotFound";
    public static final Object[][] TABLE_COLUMNS = {
            { "notFoundId", Types.BIGINT },
            { "companyId", Types.BIGINT },
            { "groupId", Types.BIGINT },
            { "userId", Types.BIGINT },
            { "createDate", Types.TIMESTAMP },
            { "classNameId", Types.BIGINT },
            { "keywords", Types.VARCHAR }
        };
    public static final String TABLE_SQL_CREATE = "create table TM_NF_NotFound (notFoundId LONG not null primary key,companyId LONG,groupId LONG,userId LONG,createDate DATE null,classNameId LONG,keywords VARCHAR(75) null)";
    public static final String TABLE_SQL_DROP = "drop table TM_NF_NotFound";
    public static final String ORDER_BY_JPQL = " ORDER BY notFound.notFoundId ASC";
    public static final String ORDER_BY_SQL = " ORDER BY TM_NF_NotFound.notFoundId ASC";
    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.br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFound"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFound"),
            true);
    public static final boolean COLUMN_BITMASK_ENABLED = false;
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFound"));
    private static ClassLoader _classLoader = NotFound.class.getClassLoader();
    private static Class<?>[] _escapedModelInterfaces = new Class[] {
            NotFound.class
        };
    private long _notFoundId;
    private long _companyId;
    private long _groupId;
    private long _userId;
    private String _userUuid;
    private Date _createDate;
    private long _classNameId;
    private String _keywords;
    private NotFound _escapedModel;

    public NotFoundModelImpl() {
    }

    @Override
    public long getPrimaryKey() {
        return _notFoundId;
    }

    @Override
    public void setPrimaryKey(long primaryKey) {
        setNotFoundId(primaryKey);
    }

    @Override
    public Serializable getPrimaryKeyObj() {
        return _notFoundId;
    }

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

    @Override
    public Class<?> getModelClass() {
        return NotFound.class;
    }

    @Override
    public String getModelClassName() {
        return NotFound.class.getName();
    }

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

        attributes.put("notFoundId", getNotFoundId());
        attributes.put("companyId", getCompanyId());
        attributes.put("groupId", getGroupId());
        attributes.put("userId", getUserId());
        attributes.put("createDate", getCreateDate());
        attributes.put("classNameId", getClassNameId());
        attributes.put("keywords", getKeywords());

        return attributes;
    }

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

        if (notFoundId != null) {
            setNotFoundId(notFoundId);
        }

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

        if (companyId != null) {
            setCompanyId(companyId);
        }

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

        if (groupId != null) {
            setGroupId(groupId);
        }

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

        if (userId != null) {
            setUserId(userId);
        }

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

        if (createDate != null) {
            setCreateDate(createDate);
        }

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

        if (classNameId != null) {
            setClassNameId(classNameId);
        }

        String keywords = (String) attributes.get("keywords");

        if (keywords != null) {
            setKeywords(keywords);
        }
    }

    @Override
    public long getNotFoundId() {
        return _notFoundId;
    }

    @Override
    public void setNotFoundId(long notFoundId) {
        _notFoundId = notFoundId;
    }

    @Override
    public long getCompanyId() {
        return _companyId;
    }

    @Override
    public void setCompanyId(long companyId) {
        _companyId = companyId;
    }

    @Override
    public long getGroupId() {
        return _groupId;
    }

    @Override
    public void setGroupId(long groupId) {
        _groupId = groupId;
    }

    @Override
    public long getUserId() {
        return _userId;
    }

    @Override
    public void setUserId(long userId) {
        _userId = userId;
    }

    @Override
    public String getUserUuid() throws SystemException {
        return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
    }

    @Override
    public void setUserUuid(String userUuid) {
        _userUuid = userUuid;
    }

    @Override
    public Date getCreateDate() {
        return _createDate;
    }

    @Override
    public void setCreateDate(Date createDate) {
        _createDate = createDate;
    }

    @Override
    public String getClassName() {
        if (getClassNameId() <= 0) {
            return StringPool.BLANK;
        }

        return PortalUtil.getClassName(getClassNameId());
    }

    @Override
    public void setClassName(String className) {
        long classNameId = 0;

        if (Validator.isNotNull(className)) {
            classNameId = PortalUtil.getClassNameId(className);
        }

        setClassNameId(classNameId);
    }

    @Override
    public long getClassNameId() {
        return _classNameId;
    }

    @Override
    public void setClassNameId(long classNameId) {
        _classNameId = classNameId;
    }

    @Override
    public String getKeywords() {
        if (_keywords == null) {
            return StringPool.BLANK;
        } else {
            return _keywords;
        }
    }

    @Override
    public void setKeywords(String keywords) {
        _keywords = keywords;
    }

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

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

        expandoBridge.setAttributes(serviceContext);
    }

    @Override
    public NotFound toEscapedModel() {
        if (_escapedModel == null) {
            _escapedModel = (NotFound) ProxyUtil.newProxyInstance(_classLoader,
                    _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
        }

        return _escapedModel;
    }

    @Override
    public Object clone() {
        NotFoundImpl notFoundImpl = new NotFoundImpl();

        notFoundImpl.setNotFoundId(getNotFoundId());
        notFoundImpl.setCompanyId(getCompanyId());
        notFoundImpl.setGroupId(getGroupId());
        notFoundImpl.setUserId(getUserId());
        notFoundImpl.setCreateDate(getCreateDate());
        notFoundImpl.setClassNameId(getClassNameId());
        notFoundImpl.setKeywords(getKeywords());

        notFoundImpl.resetOriginalValues();

        return notFoundImpl;
    }

    @Override
    public int compareTo(NotFound notFound) {
        long primaryKey = notFound.getPrimaryKey();

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

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (!(obj instanceof NotFound)) {
            return false;
        }

        NotFound notFound = (NotFound) obj;

        long primaryKey = notFound.getPrimaryKey();

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

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

    @Override
    public void resetOriginalValues() {
    }

    @Override
    public CacheModel<NotFound> toCacheModel() {
        NotFoundCacheModel notFoundCacheModel = new NotFoundCacheModel();

        notFoundCacheModel.notFoundId = getNotFoundId();

        notFoundCacheModel.companyId = getCompanyId();

        notFoundCacheModel.groupId = getGroupId();

        notFoundCacheModel.userId = getUserId();

        Date createDate = getCreateDate();

        if (createDate != null) {
            notFoundCacheModel.createDate = createDate.getTime();
        } else {
            notFoundCacheModel.createDate = Long.MIN_VALUE;
        }

        notFoundCacheModel.classNameId = getClassNameId();

        notFoundCacheModel.keywords = getKeywords();

        String keywords = notFoundCacheModel.keywords;

        if ((keywords != null) && (keywords.length() == 0)) {
            notFoundCacheModel.keywords = null;
        }

        return notFoundCacheModel;
    }

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

        sb.append("{notFoundId=");
        sb.append(getNotFoundId());
        sb.append(", companyId=");
        sb.append(getCompanyId());
        sb.append(", groupId=");
        sb.append(getGroupId());
        sb.append(", userId=");
        sb.append(getUserId());
        sb.append(", createDate=");
        sb.append(getCreateDate());
        sb.append(", classNameId=");
        sb.append(getClassNameId());
        sb.append(", keywords=");
        sb.append(getKeywords());
        sb.append("}");

        return sb.toString();
    }

    @Override
    public String toXmlString() {
        StringBundler sb = new StringBundler(25);

        sb.append("<model><model-name>");
        sb.append(
            "br.com.thiagomoreira.liferay.plugins.notfound.services.model.NotFound");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>notFoundId</column-name><column-value><![CDATA[");
        sb.append(getNotFoundId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>companyId</column-name><column-value><![CDATA[");
        sb.append(getCompanyId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>groupId</column-name><column-value><![CDATA[");
        sb.append(getGroupId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>userId</column-name><column-value><![CDATA[");
        sb.append(getUserId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>createDate</column-name><column-value><![CDATA[");
        sb.append(getCreateDate());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
        sb.append(getClassNameId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>keywords</column-name><column-value><![CDATA[");
        sb.append(getKeywords());
        sb.append("]]></column-value></column>");

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

        return sb.toString();
    }
}
TOP

Related Classes of br.com.thiagomoreira.liferay.plugins.notfound.services.model.impl.NotFoundModelImpl

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.