Java tutorial
/** * 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.model.impl; import at.graz.meduni.liferay.model.ICDO3; import at.graz.meduni.liferay.model.ICDO3Model; import at.graz.meduni.liferay.model.ICDO3Soap; 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.kernel.util.StringPool; 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.HashMap; import java.util.List; import java.util.Map; /** * The base model implementation for the ICDO3 service. Represents a row in the "code_icdo3" database table, with each column mapped to a property of this class. * * <p> * This implementation and its corresponding interface {@link at.graz.meduni.liferay.model.ICDO3Model} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ICDO3Impl}. * </p> * * @author reihsr * @see ICDO3Impl * @see at.graz.meduni.liferay.model.ICDO3 * @see at.graz.meduni.liferay.model.ICDO3Model * @generated */ @JSON(strict = true) public class ICDO3ModelImpl extends BaseModelImpl<ICDO3> implements ICDO3Model { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a i c d o3 model instance should use the {@link at.graz.meduni.liferay.model.ICDO3} interface instead. */ public static final String TABLE_NAME = "code_icdo3"; public static final Object[][] TABLE_COLUMNS = { { "id_", Types.BIGINT }, { "code_", Types.VARCHAR }, { "term", Types.INTEGER }, { "sui", Types.INTEGER }, { "typ", Types.VARCHAR }, { "use_", Types.VARCHAR }, { "description", Types.VARCHAR }, { "localisation", Types.VARCHAR }, { "link", Types.VARCHAR }, { "exklusiva", Types.VARCHAR }, { "hint", Types.VARCHAR } }; public static final String TABLE_SQL_CREATE = "create table code_icdo3 (id_ LONG not null primary key,code_ TEXT null,term INTEGER,sui INTEGER,typ VARCHAR(75) null,use_ VARCHAR(75) null,description TEXT null,localisation VARCHAR(75) null,link VARCHAR(75) null,exklusiva VARCHAR(75) null,hint VARCHAR(75) null)"; public static final String TABLE_SQL_DROP = "drop table code_icdo3"; public static final String ORDER_BY_JPQL = " ORDER BY icdo3.id ASC"; public static final String ORDER_BY_SQL = " ORDER BY code_icdo3.id_ 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.at.graz.meduni.liferay.model.ICDO3"), true); public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps .get("value.object.finder.cache.enabled.at.graz.meduni.liferay.model.ICDO3"), true); public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps .get("value.object.column.bitmask.enabled.at.graz.meduni.liferay.model.ICDO3"), true); public static long CODE_COLUMN_BITMASK = 1L; public static long ID_COLUMN_BITMASK = 2L; /** * 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 ICDO3 toModel(ICDO3Soap soapModel) { if (soapModel == null) { return null; } ICDO3 model = new ICDO3Impl(); model.setId(soapModel.getId()); model.setCode(soapModel.getCode()); model.setTerm(soapModel.getTerm()); model.setSui(soapModel.getSui()); model.setTyp(soapModel.getTyp()); model.setUse(soapModel.getUse()); model.setDescription(soapModel.getDescription()); model.setLocalisation(soapModel.getLocalisation()); model.setLink(soapModel.getLink()); model.setExklusiva(soapModel.getExklusiva()); model.setHint(soapModel.getHint()); 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<ICDO3> toModels(ICDO3Soap[] soapModels) { if (soapModels == null) { return null; } List<ICDO3> models = new ArrayList<ICDO3>(soapModels.length); for (ICDO3Soap 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.at.graz.meduni.liferay.model.ICDO3")); public ICDO3ModelImpl() { } @Override public long getPrimaryKey() { return _id; } @Override public void setPrimaryKey(long primaryKey) { setId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _id; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long) primaryKeyObj).longValue()); } @Override public Class<?> getModelClass() { return ICDO3.class; } @Override public String getModelClassName() { return ICDO3.class.getName(); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("id", getId()); attributes.put("code", getCode()); attributes.put("term", getTerm()); attributes.put("sui", getSui()); attributes.put("typ", getTyp()); attributes.put("use", getUse()); attributes.put("description", getDescription()); attributes.put("localisation", getLocalisation()); attributes.put("link", getLink()); attributes.put("exklusiva", getExklusiva()); attributes.put("hint", getHint()); return attributes; } @Override public void setModelAttributes(Map<String, Object> attributes) { Long id = (Long) attributes.get("id"); if (id != null) { setId(id); } String code = (String) attributes.get("code"); if (code != null) { setCode(code); } Integer term = (Integer) attributes.get("term"); if (term != null) { setTerm(term); } Integer sui = (Integer) attributes.get("sui"); if (sui != null) { setSui(sui); } String typ = (String) attributes.get("typ"); if (typ != null) { setTyp(typ); } String use = (String) attributes.get("use"); if (use != null) { setUse(use); } String description = (String) attributes.get("description"); if (description != null) { setDescription(description); } String localisation = (String) attributes.get("localisation"); if (localisation != null) { setLocalisation(localisation); } String link = (String) attributes.get("link"); if (link != null) { setLink(link); } String exklusiva = (String) attributes.get("exklusiva"); if (exklusiva != null) { setExklusiva(exklusiva); } String hint = (String) attributes.get("hint"); if (hint != null) { setHint(hint); } } @JSON @Override public long getId() { return _id; } @Override public void setId(long id) { _columnBitmask = -1L; _id = id; } @JSON @Override public String getCode() { if (_code == null) { return StringPool.BLANK; } else { return _code; } } @Override public void setCode(String code) { _columnBitmask |= CODE_COLUMN_BITMASK; if (_originalCode == null) { _originalCode = _code; } _code = code; } public String getOriginalCode() { return GetterUtil.getString(_originalCode); } @JSON @Override public int getTerm() { return _term; } @Override public void setTerm(int term) { _term = term; } @JSON @Override public int getSui() { return _sui; } @Override public void setSui(int sui) { _sui = sui; } @JSON @Override public String getTyp() { if (_typ == null) { return StringPool.BLANK; } else { return _typ; } } @Override public void setTyp(String typ) { _typ = typ; } @JSON @Override public String getUse() { if (_use == null) { return StringPool.BLANK; } else { return _use; } } @Override public void setUse(String use) { _use = use; } @JSON @Override public String getDescription() { if (_description == null) { return StringPool.BLANK; } else { return _description; } } @Override public void setDescription(String description) { _description = description; } @JSON @Override public String getLocalisation() { if (_localisation == null) { return StringPool.BLANK; } else { return _localisation; } } @Override public void setLocalisation(String localisation) { _localisation = localisation; } @JSON @Override public String getLink() { if (_link == null) { return StringPool.BLANK; } else { return _link; } } @Override public void setLink(String link) { _link = link; } @JSON @Override public String getExklusiva() { if (_exklusiva == null) { return StringPool.BLANK; } else { return _exklusiva; } } @Override public void setExklusiva(String exklusiva) { _exklusiva = exklusiva; } @JSON @Override public String getHint() { if (_hint == null) { return StringPool.BLANK; } else { return _hint; } } @Override public void setHint(String hint) { _hint = hint; } public long getColumnBitmask() { return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge(0, ICDO3.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public ICDO3 toEscapedModel() { if (_escapedModel == null) { _escapedModel = (ICDO3) ProxyUtil.newProxyInstance(_classLoader, _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { ICDO3Impl icdo3Impl = new ICDO3Impl(); icdo3Impl.setId(getId()); icdo3Impl.setCode(getCode()); icdo3Impl.setTerm(getTerm()); icdo3Impl.setSui(getSui()); icdo3Impl.setTyp(getTyp()); icdo3Impl.setUse(getUse()); icdo3Impl.setDescription(getDescription()); icdo3Impl.setLocalisation(getLocalisation()); icdo3Impl.setLink(getLink()); icdo3Impl.setExklusiva(getExklusiva()); icdo3Impl.setHint(getHint()); icdo3Impl.resetOriginalValues(); return icdo3Impl; } @Override public int compareTo(ICDO3 icdo3) { int value = 0; if (getId() < icdo3.getId()) { value = -1; } else if (getId() > icdo3.getId()) { value = 1; } else { value = 0; } if (value != 0) { return value; } return 0; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ICDO3)) { return false; } ICDO3 icdo3 = (ICDO3) obj; long primaryKey = icdo3.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int) getPrimaryKey(); } @Override public void resetOriginalValues() { ICDO3ModelImpl icdo3ModelImpl = this; icdo3ModelImpl._originalCode = icdo3ModelImpl._code; icdo3ModelImpl._columnBitmask = 0; } @Override public CacheModel<ICDO3> toCacheModel() { ICDO3CacheModel icdo3CacheModel = new ICDO3CacheModel(); icdo3CacheModel.id = getId(); icdo3CacheModel.code = getCode(); String code = icdo3CacheModel.code; if ((code != null) && (code.length() == 0)) { icdo3CacheModel.code = null; } icdo3CacheModel.term = getTerm(); icdo3CacheModel.sui = getSui(); icdo3CacheModel.typ = getTyp(); String typ = icdo3CacheModel.typ; if ((typ != null) && (typ.length() == 0)) { icdo3CacheModel.typ = null; } icdo3CacheModel.use = getUse(); String use = icdo3CacheModel.use; if ((use != null) && (use.length() == 0)) { icdo3CacheModel.use = null; } icdo3CacheModel.description = getDescription(); String description = icdo3CacheModel.description; if ((description != null) && (description.length() == 0)) { icdo3CacheModel.description = null; } icdo3CacheModel.localisation = getLocalisation(); String localisation = icdo3CacheModel.localisation; if ((localisation != null) && (localisation.length() == 0)) { icdo3CacheModel.localisation = null; } icdo3CacheModel.link = getLink(); String link = icdo3CacheModel.link; if ((link != null) && (link.length() == 0)) { icdo3CacheModel.link = null; } icdo3CacheModel.exklusiva = getExklusiva(); String exklusiva = icdo3CacheModel.exklusiva; if ((exklusiva != null) && (exklusiva.length() == 0)) { icdo3CacheModel.exklusiva = null; } icdo3CacheModel.hint = getHint(); String hint = icdo3CacheModel.hint; if ((hint != null) && (hint.length() == 0)) { icdo3CacheModel.hint = null; } return icdo3CacheModel; } @Override public String toString() { StringBundler sb = new StringBundler(23); sb.append("{id="); sb.append(getId()); sb.append(", code="); sb.append(getCode()); sb.append(", term="); sb.append(getTerm()); sb.append(", sui="); sb.append(getSui()); sb.append(", typ="); sb.append(getTyp()); sb.append(", use="); sb.append(getUse()); sb.append(", description="); sb.append(getDescription()); sb.append(", localisation="); sb.append(getLocalisation()); sb.append(", link="); sb.append(getLink()); sb.append(", exklusiva="); sb.append(getExklusiva()); sb.append(", hint="); sb.append(getHint()); sb.append("}"); return sb.toString(); } @Override public String toXmlString() { StringBundler sb = new StringBundler(37); sb.append("<model><model-name>"); sb.append("at.graz.meduni.liferay.model.ICDO3"); sb.append("</model-name>"); sb.append("<column><column-name>id</column-name><column-value><![CDATA["); sb.append(getId()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>code</column-name><column-value><![CDATA["); sb.append(getCode()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>term</column-name><column-value><![CDATA["); sb.append(getTerm()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>sui</column-name><column-value><![CDATA["); sb.append(getSui()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>typ</column-name><column-value><![CDATA["); sb.append(getTyp()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>use</column-name><column-value><![CDATA["); sb.append(getUse()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>description</column-name><column-value><![CDATA["); sb.append(getDescription()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>localisation</column-name><column-value><![CDATA["); sb.append(getLocalisation()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>link</column-name><column-value><![CDATA["); sb.append(getLink()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>exklusiva</column-name><column-value><![CDATA["); sb.append(getExklusiva()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>hint</column-name><column-value><![CDATA["); sb.append(getHint()); sb.append("]]></column-value></column>"); sb.append("</model>"); return sb.toString(); } private static ClassLoader _classLoader = ICDO3.class.getClassLoader(); private static Class<?>[] _escapedModelInterfaces = new Class[] { ICDO3.class }; private long _id; private String _code; private String _originalCode; private int _term; private int _sui; private String _typ; private String _use; private String _description; private String _localisation; private String _link; private String _exklusiva; private String _hint; private long _columnBitmask; private ICDO3 _escapedModel; }