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.Dictionary; import at.graz.meduni.liferay.model.DictionaryModel; import at.graz.meduni.liferay.model.DictionarySoap; 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 Dictionary service. Represents a row in the "dictionary2" 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.DictionaryModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DictionaryImpl}. * </p> * * @author reihsr * @see DictionaryImpl * @see at.graz.meduni.liferay.model.Dictionary * @see at.graz.meduni.liferay.model.DictionaryModel * @generated */ @JSON(strict = true) public class DictionaryModelImpl extends BaseModelImpl<Dictionary> implements DictionaryModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a dictionary model instance should use the {@link at.graz.meduni.liferay.model.Dictionary} interface instead. */ public static final String TABLE_NAME = "dictionary2"; public static final Object[][] TABLE_COLUMNS = { { "dictionary_id", Types.BIGINT }, { "synonym", Types.VARCHAR }, { "before_synonym", Types.INTEGER }, { "after_synonym", Types.INTEGER }, { "foreword", Types.BOOLEAN }, { "ending", Types.BOOLEAN }, { "sentence", Types.BOOLEAN }, { "iscode", Types.BOOLEAN }, { "pattern", Types.VARCHAR }, { "code_typ", Types.VARCHAR }, { "code_value", Types.VARCHAR }, { "root", Types.BOOLEAN }, { "negation", Types.BOOLEAN }, { "occur", Types.BOOLEAN }, { "disease_ids", Types.VARCHAR }, { "dirty", Types.BOOLEAN }, { "priority", Types.INTEGER }, { "disease_ids_count", Types.INTEGER }, { "priority_mode", Types.BOOLEAN } }; public static final String TABLE_SQL_CREATE = "create table dictionary2 (dictionary_id LONG not null primary key,synonym TEXT null,before_synonym INTEGER,after_synonym INTEGER,foreword BOOLEAN,ending BOOLEAN,sentence BOOLEAN,iscode BOOLEAN,pattern TEXT null,code_typ TEXT null,code_value TEXT null,root BOOLEAN,negation BOOLEAN,occur BOOLEAN,disease_ids TEXT null,dirty BOOLEAN,priority INTEGER,disease_ids_count INTEGER,priority_mode BOOLEAN)"; public static final String TABLE_SQL_DROP = "drop table dictionary2"; public static final String ORDER_BY_JPQL = " ORDER BY dictionary.dictionary_id ASC"; public static final String ORDER_BY_SQL = " ORDER BY dictionary2.dictionary_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.Dictionary"), 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.Dictionary"), 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.Dictionary"), true); public static long ROOT_COLUMN_BITMASK = 1L; public static long SYNONYM_COLUMN_BITMASK = 2L; public static long DICTIONARY_ID_COLUMN_BITMASK = 4L; /** * 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 Dictionary toModel(DictionarySoap soapModel) { if (soapModel == null) { return null; } Dictionary model = new DictionaryImpl(); model.setDictionary_id(soapModel.getDictionary_id()); model.setSynonym(soapModel.getSynonym()); model.setBefore_synonym(soapModel.getBefore_synonym()); model.setAfter_synonym(soapModel.getAfter_synonym()); model.setForeword(soapModel.getForeword()); model.setEnding(soapModel.getEnding()); model.setSentence(soapModel.getSentence()); model.setIscode(soapModel.getIscode()); model.setPattern(soapModel.getPattern()); model.setCode_typ(soapModel.getCode_typ()); model.setCode_value(soapModel.getCode_value()); model.setRoot(soapModel.getRoot()); model.setNegation(soapModel.getNegation()); model.setOccur(soapModel.getOccur()); model.setDisease_ids(soapModel.getDisease_ids()); model.setDirty(soapModel.getDirty()); model.setPriority(soapModel.getPriority()); model.setDisease_ids_count(soapModel.getDisease_ids_count()); model.setPriority_mode(soapModel.getPriority_mode()); 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<Dictionary> toModels(DictionarySoap[] soapModels) { if (soapModels == null) { return null; } List<Dictionary> models = new ArrayList<Dictionary>(soapModels.length); for (DictionarySoap 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.Dictionary")); public DictionaryModelImpl() { } @Override public long getPrimaryKey() { return _dictionary_id; } @Override public void setPrimaryKey(long primaryKey) { setDictionary_id(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _dictionary_id; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long) primaryKeyObj).longValue()); } @Override public Class<?> getModelClass() { return Dictionary.class; } @Override public String getModelClassName() { return Dictionary.class.getName(); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("dictionary_id", getDictionary_id()); attributes.put("synonym", getSynonym()); attributes.put("before_synonym", getBefore_synonym()); attributes.put("after_synonym", getAfter_synonym()); attributes.put("foreword", getForeword()); attributes.put("ending", getEnding()); attributes.put("sentence", getSentence()); attributes.put("iscode", getIscode()); attributes.put("pattern", getPattern()); attributes.put("code_typ", getCode_typ()); attributes.put("code_value", getCode_value()); attributes.put("root", getRoot()); attributes.put("negation", getNegation()); attributes.put("occur", getOccur()); attributes.put("disease_ids", getDisease_ids()); attributes.put("dirty", getDirty()); attributes.put("priority", getPriority()); attributes.put("disease_ids_count", getDisease_ids_count()); attributes.put("priority_mode", getPriority_mode()); return attributes; } @Override public void setModelAttributes(Map<String, Object> attributes) { Long dictionary_id = (Long) attributes.get("dictionary_id"); if (dictionary_id != null) { setDictionary_id(dictionary_id); } String synonym = (String) attributes.get("synonym"); if (synonym != null) { setSynonym(synonym); } Integer before_synonym = (Integer) attributes.get("before_synonym"); if (before_synonym != null) { setBefore_synonym(before_synonym); } Integer after_synonym = (Integer) attributes.get("after_synonym"); if (after_synonym != null) { setAfter_synonym(after_synonym); } Boolean foreword = (Boolean) attributes.get("foreword"); if (foreword != null) { setForeword(foreword); } Boolean ending = (Boolean) attributes.get("ending"); if (ending != null) { setEnding(ending); } Boolean sentence = (Boolean) attributes.get("sentence"); if (sentence != null) { setSentence(sentence); } Boolean iscode = (Boolean) attributes.get("iscode"); if (iscode != null) { setIscode(iscode); } String pattern = (String) attributes.get("pattern"); if (pattern != null) { setPattern(pattern); } String code_typ = (String) attributes.get("code_typ"); if (code_typ != null) { setCode_typ(code_typ); } String code_value = (String) attributes.get("code_value"); if (code_value != null) { setCode_value(code_value); } Boolean root = (Boolean) attributes.get("root"); if (root != null) { setRoot(root); } Boolean negation = (Boolean) attributes.get("negation"); if (negation != null) { setNegation(negation); } Boolean occur = (Boolean) attributes.get("occur"); if (occur != null) { setOccur(occur); } String disease_ids = (String) attributes.get("disease_ids"); if (disease_ids != null) { setDisease_ids(disease_ids); } Boolean dirty = (Boolean) attributes.get("dirty"); if (dirty != null) { setDirty(dirty); } Integer priority = (Integer) attributes.get("priority"); if (priority != null) { setPriority(priority); } Integer disease_ids_count = (Integer) attributes.get("disease_ids_count"); if (disease_ids_count != null) { setDisease_ids_count(disease_ids_count); } Boolean priority_mode = (Boolean) attributes.get("priority_mode"); if (priority_mode != null) { setPriority_mode(priority_mode); } } @JSON @Override public long getDictionary_id() { return _dictionary_id; } @Override public void setDictionary_id(long dictionary_id) { _columnBitmask = -1L; _dictionary_id = dictionary_id; } @JSON @Override public String getSynonym() { if (_synonym == null) { return StringPool.BLANK; } else { return _synonym; } } @Override public void setSynonym(String synonym) { _columnBitmask |= SYNONYM_COLUMN_BITMASK; if (_originalSynonym == null) { _originalSynonym = _synonym; } _synonym = synonym; } public String getOriginalSynonym() { return GetterUtil.getString(_originalSynonym); } @JSON @Override public int getBefore_synonym() { return _before_synonym; } @Override public void setBefore_synonym(int before_synonym) { _before_synonym = before_synonym; } @JSON @Override public int getAfter_synonym() { return _after_synonym; } @Override public void setAfter_synonym(int after_synonym) { _after_synonym = after_synonym; } @JSON @Override public boolean getForeword() { return _foreword; } @Override public boolean isForeword() { return _foreword; } @Override public void setForeword(boolean foreword) { _foreword = foreword; } @JSON @Override public boolean getEnding() { return _ending; } @Override public boolean isEnding() { return _ending; } @Override public void setEnding(boolean ending) { _ending = ending; } @JSON @Override public boolean getSentence() { return _sentence; } @Override public boolean isSentence() { return _sentence; } @Override public void setSentence(boolean sentence) { _sentence = sentence; } @JSON @Override public boolean getIscode() { return _iscode; } @Override public boolean isIscode() { return _iscode; } @Override public void setIscode(boolean iscode) { _iscode = iscode; } @JSON @Override public String getPattern() { if (_pattern == null) { return StringPool.BLANK; } else { return _pattern; } } @Override public void setPattern(String pattern) { _pattern = pattern; } @JSON @Override public String getCode_typ() { if (_code_typ == null) { return StringPool.BLANK; } else { return _code_typ; } } @Override public void setCode_typ(String code_typ) { _code_typ = code_typ; } @JSON @Override public String getCode_value() { if (_code_value == null) { return StringPool.BLANK; } else { return _code_value; } } @Override public void setCode_value(String code_value) { _code_value = code_value; } @JSON @Override public boolean getRoot() { return _root; } @Override public boolean isRoot() { return _root; } @Override public void setRoot(boolean root) { _columnBitmask |= ROOT_COLUMN_BITMASK; if (!_setOriginalRoot) { _setOriginalRoot = true; _originalRoot = _root; } _root = root; } public boolean getOriginalRoot() { return _originalRoot; } @JSON @Override public boolean getNegation() { return _negation; } @Override public boolean isNegation() { return _negation; } @Override public void setNegation(boolean negation) { _negation = negation; } @JSON @Override public boolean getOccur() { return _occur; } @Override public boolean isOccur() { return _occur; } @Override public void setOccur(boolean occur) { _occur = occur; } @JSON @Override public String getDisease_ids() { if (_disease_ids == null) { return StringPool.BLANK; } else { return _disease_ids; } } @Override public void setDisease_ids(String disease_ids) { _disease_ids = disease_ids; } @JSON @Override public boolean getDirty() { return _dirty; } @Override public boolean isDirty() { return _dirty; } @Override public void setDirty(boolean dirty) { _dirty = dirty; } @JSON @Override public int getPriority() { return _priority; } @Override public void setPriority(int priority) { _priority = priority; } @JSON @Override public int getDisease_ids_count() { return _disease_ids_count; } @Override public void setDisease_ids_count(int disease_ids_count) { _disease_ids_count = disease_ids_count; } @JSON @Override public boolean getPriority_mode() { return _priority_mode; } @Override public boolean isPriority_mode() { return _priority_mode; } @Override public void setPriority_mode(boolean priority_mode) { _priority_mode = priority_mode; } public long getColumnBitmask() { return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge(0, Dictionary.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public Dictionary toEscapedModel() { if (_escapedModel == null) { _escapedModel = (Dictionary) ProxyUtil.newProxyInstance(_classLoader, _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { DictionaryImpl dictionaryImpl = new DictionaryImpl(); dictionaryImpl.setDictionary_id(getDictionary_id()); dictionaryImpl.setSynonym(getSynonym()); dictionaryImpl.setBefore_synonym(getBefore_synonym()); dictionaryImpl.setAfter_synonym(getAfter_synonym()); dictionaryImpl.setForeword(getForeword()); dictionaryImpl.setEnding(getEnding()); dictionaryImpl.setSentence(getSentence()); dictionaryImpl.setIscode(getIscode()); dictionaryImpl.setPattern(getPattern()); dictionaryImpl.setCode_typ(getCode_typ()); dictionaryImpl.setCode_value(getCode_value()); dictionaryImpl.setRoot(getRoot()); dictionaryImpl.setNegation(getNegation()); dictionaryImpl.setOccur(getOccur()); dictionaryImpl.setDisease_ids(getDisease_ids()); dictionaryImpl.setDirty(getDirty()); dictionaryImpl.setPriority(getPriority()); dictionaryImpl.setDisease_ids_count(getDisease_ids_count()); dictionaryImpl.setPriority_mode(getPriority_mode()); dictionaryImpl.resetOriginalValues(); return dictionaryImpl; } @Override public int compareTo(Dictionary dictionary) { int value = 0; if (getDictionary_id() < dictionary.getDictionary_id()) { value = -1; } else if (getDictionary_id() > dictionary.getDictionary_id()) { 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 Dictionary)) { return false; } Dictionary dictionary = (Dictionary) obj; long primaryKey = dictionary.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int) getPrimaryKey(); } @Override public void resetOriginalValues() { DictionaryModelImpl dictionaryModelImpl = this; dictionaryModelImpl._originalSynonym = dictionaryModelImpl._synonym; dictionaryModelImpl._originalRoot = dictionaryModelImpl._root; dictionaryModelImpl._setOriginalRoot = false; dictionaryModelImpl._columnBitmask = 0; } @Override public CacheModel<Dictionary> toCacheModel() { DictionaryCacheModel dictionaryCacheModel = new DictionaryCacheModel(); dictionaryCacheModel.dictionary_id = getDictionary_id(); dictionaryCacheModel.synonym = getSynonym(); String synonym = dictionaryCacheModel.synonym; if ((synonym != null) && (synonym.length() == 0)) { dictionaryCacheModel.synonym = null; } dictionaryCacheModel.before_synonym = getBefore_synonym(); dictionaryCacheModel.after_synonym = getAfter_synonym(); dictionaryCacheModel.foreword = getForeword(); dictionaryCacheModel.ending = getEnding(); dictionaryCacheModel.sentence = getSentence(); dictionaryCacheModel.iscode = getIscode(); dictionaryCacheModel.pattern = getPattern(); String pattern = dictionaryCacheModel.pattern; if ((pattern != null) && (pattern.length() == 0)) { dictionaryCacheModel.pattern = null; } dictionaryCacheModel.code_typ = getCode_typ(); String code_typ = dictionaryCacheModel.code_typ; if ((code_typ != null) && (code_typ.length() == 0)) { dictionaryCacheModel.code_typ = null; } dictionaryCacheModel.code_value = getCode_value(); String code_value = dictionaryCacheModel.code_value; if ((code_value != null) && (code_value.length() == 0)) { dictionaryCacheModel.code_value = null; } dictionaryCacheModel.root = getRoot(); dictionaryCacheModel.negation = getNegation(); dictionaryCacheModel.occur = getOccur(); dictionaryCacheModel.disease_ids = getDisease_ids(); String disease_ids = dictionaryCacheModel.disease_ids; if ((disease_ids != null) && (disease_ids.length() == 0)) { dictionaryCacheModel.disease_ids = null; } dictionaryCacheModel.dirty = getDirty(); dictionaryCacheModel.priority = getPriority(); dictionaryCacheModel.disease_ids_count = getDisease_ids_count(); dictionaryCacheModel.priority_mode = getPriority_mode(); return dictionaryCacheModel; } @Override public String toString() { StringBundler sb = new StringBundler(39); sb.append("{dictionary_id="); sb.append(getDictionary_id()); sb.append(", synonym="); sb.append(getSynonym()); sb.append(", before_synonym="); sb.append(getBefore_synonym()); sb.append(", after_synonym="); sb.append(getAfter_synonym()); sb.append(", foreword="); sb.append(getForeword()); sb.append(", ending="); sb.append(getEnding()); sb.append(", sentence="); sb.append(getSentence()); sb.append(", iscode="); sb.append(getIscode()); sb.append(", pattern="); sb.append(getPattern()); sb.append(", code_typ="); sb.append(getCode_typ()); sb.append(", code_value="); sb.append(getCode_value()); sb.append(", root="); sb.append(getRoot()); sb.append(", negation="); sb.append(getNegation()); sb.append(", occur="); sb.append(getOccur()); sb.append(", disease_ids="); sb.append(getDisease_ids()); sb.append(", dirty="); sb.append(getDirty()); sb.append(", priority="); sb.append(getPriority()); sb.append(", disease_ids_count="); sb.append(getDisease_ids_count()); sb.append(", priority_mode="); sb.append(getPriority_mode()); sb.append("}"); return sb.toString(); } @Override public String toXmlString() { StringBundler sb = new StringBundler(61); sb.append("<model><model-name>"); sb.append("at.graz.meduni.liferay.model.Dictionary"); sb.append("</model-name>"); sb.append("<column><column-name>dictionary_id</column-name><column-value><![CDATA["); sb.append(getDictionary_id()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>synonym</column-name><column-value><![CDATA["); sb.append(getSynonym()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>before_synonym</column-name><column-value><![CDATA["); sb.append(getBefore_synonym()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>after_synonym</column-name><column-value><![CDATA["); sb.append(getAfter_synonym()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>foreword</column-name><column-value><![CDATA["); sb.append(getForeword()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>ending</column-name><column-value><![CDATA["); sb.append(getEnding()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>sentence</column-name><column-value><![CDATA["); sb.append(getSentence()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>iscode</column-name><column-value><![CDATA["); sb.append(getIscode()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>pattern</column-name><column-value><![CDATA["); sb.append(getPattern()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>code_typ</column-name><column-value><![CDATA["); sb.append(getCode_typ()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>code_value</column-name><column-value><![CDATA["); sb.append(getCode_value()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>root</column-name><column-value><![CDATA["); sb.append(getRoot()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>negation</column-name><column-value><![CDATA["); sb.append(getNegation()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>occur</column-name><column-value><![CDATA["); sb.append(getOccur()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>disease_ids</column-name><column-value><![CDATA["); sb.append(getDisease_ids()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>dirty</column-name><column-value><![CDATA["); sb.append(getDirty()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>priority</column-name><column-value><![CDATA["); sb.append(getPriority()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>disease_ids_count</column-name><column-value><![CDATA["); sb.append(getDisease_ids_count()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>priority_mode</column-name><column-value><![CDATA["); sb.append(getPriority_mode()); sb.append("]]></column-value></column>"); sb.append("</model>"); return sb.toString(); } private static ClassLoader _classLoader = Dictionary.class.getClassLoader(); private static Class<?>[] _escapedModelInterfaces = new Class[] { Dictionary.class }; private long _dictionary_id; private String _synonym; private String _originalSynonym; private int _before_synonym; private int _after_synonym; private boolean _foreword; private boolean _ending; private boolean _sentence; private boolean _iscode; private String _pattern; private String _code_typ; private String _code_value; private boolean _root; private boolean _originalRoot; private boolean _setOriginalRoot; private boolean _negation; private boolean _occur; private String _disease_ids; private boolean _dirty; private int _priority; private int _disease_ids_count; private boolean _priority_mode; private long _columnBitmask; private Dictionary _escapedModel; }