com.liferay.notification.model.impl.NotificationTemplateModelImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.notification.service
Show all versions of com.liferay.notification.service
Liferay Notification Service
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.notification.model.impl;
import com.liferay.expando.kernel.model.ExpandoBridge;
import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil;
import com.liferay.exportimport.kernel.lar.StagedModelType;
import com.liferay.notification.model.NotificationTemplate;
import com.liferay.notification.model.NotificationTemplateModel;
import com.liferay.petra.string.StringBundler;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.LocaleException;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.model.CacheModel;
import com.liferay.portal.kernel.model.ModelWrapper;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.model.impl.BaseModelImpl;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.LocaleUtil;
import com.liferay.portal.kernel.util.LocalizationUtil;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.sql.Blob;
import java.sql.Types;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.BiConsumer;
import java.util.function.Function;
/**
* The base model implementation for the NotificationTemplate service. Represents a row in the "NotificationTemplate" database table, with each column mapped to a property of this class.
*
*
* This implementation and its corresponding interface NotificationTemplateModel
exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link NotificationTemplateImpl}.
*
*
* @author Gabriel Albuquerque
* @see NotificationTemplateImpl
* @generated
*/
@JSON(strict = true)
public class NotificationTemplateModelImpl
extends BaseModelImpl
implements NotificationTemplateModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a notification template model instance should use the NotificationTemplate
interface instead.
*/
public static final String TABLE_NAME = "NotificationTemplate";
public static final Object[][] TABLE_COLUMNS = {
{"mvccVersion", Types.BIGINT}, {"uuid_", Types.VARCHAR},
{"externalReferenceCode", Types.VARCHAR},
{"notificationTemplateId", Types.BIGINT}, {"companyId", Types.BIGINT},
{"userId", Types.BIGINT}, {"userName", Types.VARCHAR},
{"createDate", Types.TIMESTAMP}, {"modifiedDate", Types.TIMESTAMP},
{"objectDefinitionId", Types.BIGINT}, {"body", Types.CLOB},
{"description", Types.VARCHAR}, {"editorType", Types.VARCHAR},
{"name", Types.VARCHAR}, {"recipientType", Types.VARCHAR},
{"subject", Types.VARCHAR}, {"system_", Types.BOOLEAN},
{"type_", Types.VARCHAR}
};
public static final Map TABLE_COLUMNS_MAP =
new HashMap();
static {
TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT);
TABLE_COLUMNS_MAP.put("uuid_", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("externalReferenceCode", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("notificationTemplateId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("userId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("userName", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("objectDefinitionId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("body", Types.CLOB);
TABLE_COLUMNS_MAP.put("description", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("editorType", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("name", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("recipientType", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("subject", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("system_", Types.BOOLEAN);
TABLE_COLUMNS_MAP.put("type_", Types.VARCHAR);
}
public static final String TABLE_SQL_CREATE =
"create table NotificationTemplate (mvccVersion LONG default 0 not null,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,notificationTemplateId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,objectDefinitionId LONG,body TEXT null,description VARCHAR(255) null,editorType VARCHAR(75) null,name STRING null,recipientType VARCHAR(75) null,subject STRING null,system_ BOOLEAN,type_ VARCHAR(255) null)";
public static final String TABLE_SQL_DROP =
"drop table NotificationTemplate";
public static final String ORDER_BY_JPQL =
" ORDER BY notificationTemplate.notificationTemplateId ASC";
public static final String ORDER_BY_SQL =
" ORDER BY NotificationTemplate.notificationTemplateId ASC";
public static final String ORDER_BY_SQL_INLINE_DISTINCT =
" ORDER BY notificationTemplate.notificationTemplateId ASC";
public static final String DATA_SOURCE = "liferayDataSource";
public static final String SESSION_FACTORY = "liferaySessionFactory";
public static final String TX_MANAGER = "liferayTransactionManager";
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)}
*/
@Deprecated
public static final long COMPANYID_COLUMN_BITMASK = 1L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)}
*/
@Deprecated
public static final long EXTERNALREFERENCECODE_COLUMN_BITMASK = 2L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)}
*/
@Deprecated
public static final long UUID_COLUMN_BITMASK = 4L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnBitmask(String)}
*/
@Deprecated
public static final long NOTIFICATIONTEMPLATEID_COLUMN_BITMASK = 8L;
/**
* @deprecated As of Athanasius (7.3.x), with no direct replacement
*/
@Deprecated
public static void setEntityCacheEnabled(boolean entityCacheEnabled) {
}
/**
* @deprecated As of Athanasius (7.3.x), with no direct replacement
*/
@Deprecated
public static void setFinderCacheEnabled(boolean finderCacheEnabled) {
}
public NotificationTemplateModelImpl() {
}
@Override
public long getPrimaryKey() {
return _notificationTemplateId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setNotificationTemplateId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _notificationTemplateId;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Class> getModelClass() {
return NotificationTemplate.class;
}
@Override
public String getModelClassName() {
return NotificationTemplate.class.getName();
}
@Override
public Map getModelAttributes() {
Map attributes = new HashMap();
Map>
attributeGetterFunctions = getAttributeGetterFunctions();
for (Map.Entry> entry :
attributeGetterFunctions.entrySet()) {
String attributeName = entry.getKey();
Function attributeGetterFunction =
entry.getValue();
attributes.put(
attributeName,
attributeGetterFunction.apply((NotificationTemplate)this));
}
return attributes;
}
@Override
public void setModelAttributes(Map attributes) {
Map>
attributeSetterBiConsumers = getAttributeSetterBiConsumers();
for (Map.Entry entry : attributes.entrySet()) {
String attributeName = entry.getKey();
BiConsumer attributeSetterBiConsumer =
attributeSetterBiConsumers.get(attributeName);
if (attributeSetterBiConsumer != null) {
attributeSetterBiConsumer.accept(
(NotificationTemplate)this, entry.getValue());
}
}
}
public Map>
getAttributeGetterFunctions() {
return AttributeGetterFunctionsHolder._attributeGetterFunctions;
}
public Map>
getAttributeSetterBiConsumers() {
return AttributeSetterBiConsumersHolder._attributeSetterBiConsumers;
}
private static class AttributeGetterFunctionsHolder {
private static final Map>
_attributeGetterFunctions;
static {
Map>
attributeGetterFunctions =
new LinkedHashMap
>();
attributeGetterFunctions.put(
"mvccVersion", NotificationTemplate::getMvccVersion);
attributeGetterFunctions.put("uuid", NotificationTemplate::getUuid);
attributeGetterFunctions.put(
"externalReferenceCode",
NotificationTemplate::getExternalReferenceCode);
attributeGetterFunctions.put(
"notificationTemplateId",
NotificationTemplate::getNotificationTemplateId);
attributeGetterFunctions.put(
"companyId", NotificationTemplate::getCompanyId);
attributeGetterFunctions.put(
"userId", NotificationTemplate::getUserId);
attributeGetterFunctions.put(
"userName", NotificationTemplate::getUserName);
attributeGetterFunctions.put(
"createDate", NotificationTemplate::getCreateDate);
attributeGetterFunctions.put(
"modifiedDate", NotificationTemplate::getModifiedDate);
attributeGetterFunctions.put(
"objectDefinitionId",
NotificationTemplate::getObjectDefinitionId);
attributeGetterFunctions.put("body", NotificationTemplate::getBody);
attributeGetterFunctions.put(
"description", NotificationTemplate::getDescription);
attributeGetterFunctions.put(
"editorType", NotificationTemplate::getEditorType);
attributeGetterFunctions.put("name", NotificationTemplate::getName);
attributeGetterFunctions.put(
"recipientType", NotificationTemplate::getRecipientType);
attributeGetterFunctions.put(
"subject", NotificationTemplate::getSubject);
attributeGetterFunctions.put(
"system", NotificationTemplate::getSystem);
attributeGetterFunctions.put("type", NotificationTemplate::getType);
_attributeGetterFunctions = Collections.unmodifiableMap(
attributeGetterFunctions);
}
}
private static class AttributeSetterBiConsumersHolder {
private static final Map
>
_attributeSetterBiConsumers;
static {
Map>
attributeSetterBiConsumers =
new LinkedHashMap
>();
attributeSetterBiConsumers.put(
"mvccVersion",
(BiConsumer)
NotificationTemplate::setMvccVersion);
attributeSetterBiConsumers.put(
"uuid",
(BiConsumer)
NotificationTemplate::setUuid);
attributeSetterBiConsumers.put(
"externalReferenceCode",
(BiConsumer)
NotificationTemplate::setExternalReferenceCode);
attributeSetterBiConsumers.put(
"notificationTemplateId",
(BiConsumer)
NotificationTemplate::setNotificationTemplateId);
attributeSetterBiConsumers.put(
"companyId",
(BiConsumer)
NotificationTemplate::setCompanyId);
attributeSetterBiConsumers.put(
"userId",
(BiConsumer)
NotificationTemplate::setUserId);
attributeSetterBiConsumers.put(
"userName",
(BiConsumer)
NotificationTemplate::setUserName);
attributeSetterBiConsumers.put(
"createDate",
(BiConsumer)
NotificationTemplate::setCreateDate);
attributeSetterBiConsumers.put(
"modifiedDate",
(BiConsumer)
NotificationTemplate::setModifiedDate);
attributeSetterBiConsumers.put(
"objectDefinitionId",
(BiConsumer)
NotificationTemplate::setObjectDefinitionId);
attributeSetterBiConsumers.put(
"body",
(BiConsumer)
NotificationTemplate::setBody);
attributeSetterBiConsumers.put(
"description",
(BiConsumer)
NotificationTemplate::setDescription);
attributeSetterBiConsumers.put(
"editorType",
(BiConsumer)
NotificationTemplate::setEditorType);
attributeSetterBiConsumers.put(
"name",
(BiConsumer)
NotificationTemplate::setName);
attributeSetterBiConsumers.put(
"recipientType",
(BiConsumer)
NotificationTemplate::setRecipientType);
attributeSetterBiConsumers.put(
"subject",
(BiConsumer)
NotificationTemplate::setSubject);
attributeSetterBiConsumers.put(
"system",
(BiConsumer)
NotificationTemplate::setSystem);
attributeSetterBiConsumers.put(
"type",
(BiConsumer)
NotificationTemplate::setType);
_attributeSetterBiConsumers = Collections.unmodifiableMap(
(Map)attributeSetterBiConsumers);
}
}
@JSON
@Override
public long getMvccVersion() {
return _mvccVersion;
}
@Override
public void setMvccVersion(long mvccVersion) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_mvccVersion = mvccVersion;
}
@JSON
@Override
public String getUuid() {
if (_uuid == null) {
return "";
}
else {
return _uuid;
}
}
@Override
public void setUuid(String uuid) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_uuid = uuid;
}
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnOriginalValue(String)}
*/
@Deprecated
public String getOriginalUuid() {
return getColumnOriginalValue("uuid_");
}
@JSON
@Override
public String getExternalReferenceCode() {
if (_externalReferenceCode == null) {
return "";
}
else {
return _externalReferenceCode;
}
}
@Override
public void setExternalReferenceCode(String externalReferenceCode) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_externalReferenceCode = externalReferenceCode;
}
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnOriginalValue(String)}
*/
@Deprecated
public String getOriginalExternalReferenceCode() {
return getColumnOriginalValue("externalReferenceCode");
}
@JSON
@Override
public long getNotificationTemplateId() {
return _notificationTemplateId;
}
@Override
public void setNotificationTemplateId(long notificationTemplateId) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_notificationTemplateId = notificationTemplateId;
}
@JSON
@Override
public long getCompanyId() {
return _companyId;
}
@Override
public void setCompanyId(long companyId) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_companyId = companyId;
}
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnOriginalValue(String)}
*/
@Deprecated
public long getOriginalCompanyId() {
return GetterUtil.getLong(
this.getColumnOriginalValue("companyId"));
}
@JSON
@Override
public long getUserId() {
return _userId;
}
@Override
public void setUserId(long userId) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_userId = userId;
}
@Override
public String getUserUuid() {
try {
User user = UserLocalServiceUtil.getUserById(getUserId());
return user.getUuid();
}
catch (PortalException portalException) {
return "";
}
}
@Override
public void setUserUuid(String userUuid) {
}
@JSON
@Override
public String getUserName() {
if (_userName == null) {
return "";
}
else {
return _userName;
}
}
@Override
public void setUserName(String userName) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_userName = userName;
}
@JSON
@Override
public Date getCreateDate() {
return _createDate;
}
@Override
public void setCreateDate(Date createDate) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_createDate = createDate;
}
@JSON
@Override
public Date getModifiedDate() {
return _modifiedDate;
}
public boolean hasSetModifiedDate() {
return _setModifiedDate;
}
@Override
public void setModifiedDate(Date modifiedDate) {
_setModifiedDate = true;
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_modifiedDate = modifiedDate;
}
@JSON
@Override
public long getObjectDefinitionId() {
return _objectDefinitionId;
}
@Override
public void setObjectDefinitionId(long objectDefinitionId) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_objectDefinitionId = objectDefinitionId;
}
@JSON
@Override
public String getBody() {
if (_body == null) {
return "";
}
else {
return _body;
}
}
@Override
public String getBody(Locale locale) {
String languageId = LocaleUtil.toLanguageId(locale);
return getBody(languageId);
}
@Override
public String getBody(Locale locale, boolean useDefault) {
String languageId = LocaleUtil.toLanguageId(locale);
return getBody(languageId, useDefault);
}
@Override
public String getBody(String languageId) {
return LocalizationUtil.getLocalization(getBody(), languageId);
}
@Override
public String getBody(String languageId, boolean useDefault) {
return LocalizationUtil.getLocalization(
getBody(), languageId, useDefault);
}
@Override
public String getBodyCurrentLanguageId() {
return _bodyCurrentLanguageId;
}
@JSON
@Override
public String getBodyCurrentValue() {
Locale locale = getLocale(_bodyCurrentLanguageId);
return getBody(locale);
}
@Override
public Map getBodyMap() {
return LocalizationUtil.getLocalizationMap(getBody());
}
@Override
public void setBody(String body) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_body = body;
}
@Override
public void setBody(String body, Locale locale) {
setBody(body, locale, LocaleUtil.getDefault());
}
@Override
public void setBody(String body, Locale locale, Locale defaultLocale) {
String languageId = LocaleUtil.toLanguageId(locale);
String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
if (Validator.isNotNull(body)) {
setBody(
LocalizationUtil.updateLocalization(
getBody(), "Body", body, languageId, defaultLanguageId));
}
else {
setBody(
LocalizationUtil.removeLocalization(
getBody(), "Body", languageId));
}
}
@Override
public void setBodyCurrentLanguageId(String languageId) {
_bodyCurrentLanguageId = languageId;
}
@Override
public void setBodyMap(Map bodyMap) {
setBodyMap(bodyMap, LocaleUtil.getDefault());
}
@Override
public void setBodyMap(Map bodyMap, Locale defaultLocale) {
if (bodyMap == null) {
return;
}
setBody(
LocalizationUtil.updateLocalization(
bodyMap, getBody(), "Body",
LocaleUtil.toLanguageId(defaultLocale)));
}
@JSON
@Override
public String getDescription() {
if (_description == null) {
return "";
}
else {
return _description;
}
}
@Override
public void setDescription(String description) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_description = description;
}
@JSON
@Override
public String getEditorType() {
if (_editorType == null) {
return "";
}
else {
return _editorType;
}
}
@Override
public void setEditorType(String editorType) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_editorType = editorType;
}
@JSON
@Override
public String getName() {
if (_name == null) {
return "";
}
else {
return _name;
}
}
@Override
public String getName(Locale locale) {
String languageId = LocaleUtil.toLanguageId(locale);
return getName(languageId);
}
@Override
public String getName(Locale locale, boolean useDefault) {
String languageId = LocaleUtil.toLanguageId(locale);
return getName(languageId, useDefault);
}
@Override
public String getName(String languageId) {
return LocalizationUtil.getLocalization(getName(), languageId);
}
@Override
public String getName(String languageId, boolean useDefault) {
return LocalizationUtil.getLocalization(
getName(), languageId, useDefault);
}
@Override
public String getNameCurrentLanguageId() {
return _nameCurrentLanguageId;
}
@JSON
@Override
public String getNameCurrentValue() {
Locale locale = getLocale(_nameCurrentLanguageId);
return getName(locale);
}
@Override
public Map getNameMap() {
return LocalizationUtil.getLocalizationMap(getName());
}
@Override
public void setName(String name) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_name = name;
}
@Override
public void setName(String name, Locale locale) {
setName(name, locale, LocaleUtil.getDefault());
}
@Override
public void setName(String name, Locale locale, Locale defaultLocale) {
String languageId = LocaleUtil.toLanguageId(locale);
String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
if (Validator.isNotNull(name)) {
setName(
LocalizationUtil.updateLocalization(
getName(), "Name", name, languageId, defaultLanguageId));
}
else {
setName(
LocalizationUtil.removeLocalization(
getName(), "Name", languageId));
}
}
@Override
public void setNameCurrentLanguageId(String languageId) {
_nameCurrentLanguageId = languageId;
}
@Override
public void setNameMap(Map nameMap) {
setNameMap(nameMap, LocaleUtil.getDefault());
}
@Override
public void setNameMap(Map nameMap, Locale defaultLocale) {
if (nameMap == null) {
return;
}
setName(
LocalizationUtil.updateLocalization(
nameMap, getName(), "Name",
LocaleUtil.toLanguageId(defaultLocale)));
}
@JSON
@Override
public String getRecipientType() {
if (_recipientType == null) {
return "";
}
else {
return _recipientType;
}
}
@Override
public void setRecipientType(String recipientType) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_recipientType = recipientType;
}
@JSON
@Override
public String getSubject() {
if (_subject == null) {
return "";
}
else {
return _subject;
}
}
@Override
public String getSubject(Locale locale) {
String languageId = LocaleUtil.toLanguageId(locale);
return getSubject(languageId);
}
@Override
public String getSubject(Locale locale, boolean useDefault) {
String languageId = LocaleUtil.toLanguageId(locale);
return getSubject(languageId, useDefault);
}
@Override
public String getSubject(String languageId) {
return LocalizationUtil.getLocalization(getSubject(), languageId);
}
@Override
public String getSubject(String languageId, boolean useDefault) {
return LocalizationUtil.getLocalization(
getSubject(), languageId, useDefault);
}
@Override
public String getSubjectCurrentLanguageId() {
return _subjectCurrentLanguageId;
}
@JSON
@Override
public String getSubjectCurrentValue() {
Locale locale = getLocale(_subjectCurrentLanguageId);
return getSubject(locale);
}
@Override
public Map getSubjectMap() {
return LocalizationUtil.getLocalizationMap(getSubject());
}
@Override
public void setSubject(String subject) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_subject = subject;
}
@Override
public void setSubject(String subject, Locale locale) {
setSubject(subject, locale, LocaleUtil.getDefault());
}
@Override
public void setSubject(
String subject, Locale locale, Locale defaultLocale) {
String languageId = LocaleUtil.toLanguageId(locale);
String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
if (Validator.isNotNull(subject)) {
setSubject(
LocalizationUtil.updateLocalization(
getSubject(), "Subject", subject, languageId,
defaultLanguageId));
}
else {
setSubject(
LocalizationUtil.removeLocalization(
getSubject(), "Subject", languageId));
}
}
@Override
public void setSubjectCurrentLanguageId(String languageId) {
_subjectCurrentLanguageId = languageId;
}
@Override
public void setSubjectMap(Map subjectMap) {
setSubjectMap(subjectMap, LocaleUtil.getDefault());
}
@Override
public void setSubjectMap(
Map subjectMap, Locale defaultLocale) {
if (subjectMap == null) {
return;
}
setSubject(
LocalizationUtil.updateLocalization(
subjectMap, getSubject(), "Subject",
LocaleUtil.toLanguageId(defaultLocale)));
}
@JSON
@Override
public boolean getSystem() {
return _system;
}
@JSON
@Override
public boolean isSystem() {
return _system;
}
@Override
public void setSystem(boolean system) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_system = system;
}
@JSON
@Override
public String getType() {
if (_type == null) {
return "";
}
else {
return _type;
}
}
@Override
public void setType(String type) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_type = type;
}
@Override
public StagedModelType getStagedModelType() {
return new StagedModelType(
PortalUtil.getClassNameId(NotificationTemplate.class.getName()));
}
public long getColumnBitmask() {
if (_columnBitmask > 0) {
return _columnBitmask;
}
if ((_columnOriginalValues == null) ||
(_columnOriginalValues == Collections.EMPTY_MAP)) {
return 0;
}
for (Map.Entry entry :
_columnOriginalValues.entrySet()) {
if (!Objects.equals(
entry.getValue(), getColumnValue(entry.getKey()))) {
_columnBitmask |= _columnBitmasks.get(entry.getKey());
}
}
return _columnBitmask;
}
@Override
public ExpandoBridge getExpandoBridge() {
return ExpandoBridgeFactoryUtil.getExpandoBridge(
getCompanyId(), NotificationTemplate.class.getName(),
getPrimaryKey());
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
ExpandoBridge expandoBridge = getExpandoBridge();
expandoBridge.setAttributes(serviceContext);
}
@Override
public String[] getAvailableLanguageIds() {
Set availableLanguageIds = new TreeSet();
Map bodyMap = getBodyMap();
for (Map.Entry entry : bodyMap.entrySet()) {
Locale locale = entry.getKey();
String value = entry.getValue();
if (Validator.isNotNull(value)) {
availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
}
}
Map nameMap = getNameMap();
for (Map.Entry entry : nameMap.entrySet()) {
Locale locale = entry.getKey();
String value = entry.getValue();
if (Validator.isNotNull(value)) {
availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
}
}
Map subjectMap = getSubjectMap();
for (Map.Entry entry : subjectMap.entrySet()) {
Locale locale = entry.getKey();
String value = entry.getValue();
if (Validator.isNotNull(value)) {
availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
}
}
return availableLanguageIds.toArray(
new String[availableLanguageIds.size()]);
}
@Override
public String getDefaultLanguageId() {
String xml = getBody();
if (xml == null) {
return "";
}
Locale defaultLocale = LocaleUtil.getDefault();
return LocalizationUtil.getDefaultLanguageId(xml, defaultLocale);
}
@Override
public void prepareLocalizedFieldsForImport() throws LocaleException {
Locale defaultLocale = LocaleUtil.fromLanguageId(
getDefaultLanguageId());
Locale[] availableLocales = LocaleUtil.fromLanguageIds(
getAvailableLanguageIds());
Locale defaultImportLocale = LocalizationUtil.getDefaultImportLocale(
NotificationTemplate.class.getName(), getPrimaryKey(),
defaultLocale, availableLocales);
prepareLocalizedFieldsForImport(defaultImportLocale);
}
@Override
@SuppressWarnings("unused")
public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
throws LocaleException {
Locale defaultLocale = LocaleUtil.getDefault();
String modelDefaultLanguageId = getDefaultLanguageId();
String body = getBody(defaultLocale);
if (Validator.isNull(body)) {
setBody(getBody(modelDefaultLanguageId), defaultLocale);
}
else {
setBody(getBody(defaultLocale), defaultLocale, defaultLocale);
}
String name = getName(defaultLocale);
if (Validator.isNull(name)) {
setName(getName(modelDefaultLanguageId), defaultLocale);
}
else {
setName(getName(defaultLocale), defaultLocale, defaultLocale);
}
String subject = getSubject(defaultLocale);
if (Validator.isNull(subject)) {
setSubject(getSubject(modelDefaultLanguageId), defaultLocale);
}
else {
setSubject(getSubject(defaultLocale), defaultLocale, defaultLocale);
}
}
@Override
public NotificationTemplate toEscapedModel() {
if (_escapedModel == null) {
Function
escapedModelProxyProviderFunction =
EscapedModelProxyProviderFunctionHolder.
_escapedModelProxyProviderFunction;
_escapedModel = escapedModelProxyProviderFunction.apply(
new AutoEscapeBeanHandler(this));
}
return _escapedModel;
}
@Override
public Object clone() {
NotificationTemplateImpl notificationTemplateImpl =
new NotificationTemplateImpl();
notificationTemplateImpl.setMvccVersion(getMvccVersion());
notificationTemplateImpl.setUuid(getUuid());
notificationTemplateImpl.setExternalReferenceCode(
getExternalReferenceCode());
notificationTemplateImpl.setNotificationTemplateId(
getNotificationTemplateId());
notificationTemplateImpl.setCompanyId(getCompanyId());
notificationTemplateImpl.setUserId(getUserId());
notificationTemplateImpl.setUserName(getUserName());
notificationTemplateImpl.setCreateDate(getCreateDate());
notificationTemplateImpl.setModifiedDate(getModifiedDate());
notificationTemplateImpl.setObjectDefinitionId(getObjectDefinitionId());
notificationTemplateImpl.setBody(getBody());
notificationTemplateImpl.setDescription(getDescription());
notificationTemplateImpl.setEditorType(getEditorType());
notificationTemplateImpl.setName(getName());
notificationTemplateImpl.setRecipientType(getRecipientType());
notificationTemplateImpl.setSubject(getSubject());
notificationTemplateImpl.setSystem(isSystem());
notificationTemplateImpl.setType(getType());
notificationTemplateImpl.resetOriginalValues();
return notificationTemplateImpl;
}
@Override
public NotificationTemplate cloneWithOriginalValues() {
NotificationTemplateImpl notificationTemplateImpl =
new NotificationTemplateImpl();
notificationTemplateImpl.setMvccVersion(
this.getColumnOriginalValue("mvccVersion"));
notificationTemplateImpl.setUuid(
this.getColumnOriginalValue("uuid_"));
notificationTemplateImpl.setExternalReferenceCode(
this.getColumnOriginalValue("externalReferenceCode"));
notificationTemplateImpl.setNotificationTemplateId(
this.getColumnOriginalValue("notificationTemplateId"));
notificationTemplateImpl.setCompanyId(
this.getColumnOriginalValue("companyId"));
notificationTemplateImpl.setUserId(
this.getColumnOriginalValue("userId"));
notificationTemplateImpl.setUserName(
this.getColumnOriginalValue("userName"));
notificationTemplateImpl.setCreateDate(
this.getColumnOriginalValue("createDate"));
notificationTemplateImpl.setModifiedDate(
this.getColumnOriginalValue("modifiedDate"));
notificationTemplateImpl.setObjectDefinitionId(
this.getColumnOriginalValue("objectDefinitionId"));
notificationTemplateImpl.setBody(
this.getColumnOriginalValue("body"));
notificationTemplateImpl.setDescription(
this.getColumnOriginalValue("description"));
notificationTemplateImpl.setEditorType(
this.getColumnOriginalValue("editorType"));
notificationTemplateImpl.setName(
this.getColumnOriginalValue("name"));
notificationTemplateImpl.setRecipientType(
this.getColumnOriginalValue("recipientType"));
notificationTemplateImpl.setSubject(
this.getColumnOriginalValue("subject"));
notificationTemplateImpl.setSystem(
this.getColumnOriginalValue("system_"));
notificationTemplateImpl.setType(
this.getColumnOriginalValue("type_"));
return notificationTemplateImpl;
}
@Override
public int compareTo(NotificationTemplate notificationTemplate) {
long primaryKey = notificationTemplate.getPrimaryKey();
if (getPrimaryKey() < primaryKey) {
return -1;
}
else if (getPrimaryKey() > primaryKey) {
return 1;
}
else {
return 0;
}
}
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!(object instanceof NotificationTemplate)) {
return false;
}
NotificationTemplate notificationTemplate =
(NotificationTemplate)object;
long primaryKey = notificationTemplate.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
/**
* @deprecated As of Athanasius (7.3.x), with no direct replacement
*/
@Deprecated
@Override
public boolean isEntityCacheEnabled() {
return true;
}
/**
* @deprecated As of Athanasius (7.3.x), with no direct replacement
*/
@Deprecated
@Override
public boolean isFinderCacheEnabled() {
return true;
}
@Override
public void resetOriginalValues() {
_columnOriginalValues = Collections.emptyMap();
_setModifiedDate = false;
_columnBitmask = 0;
}
@Override
public CacheModel toCacheModel() {
NotificationTemplateCacheModel notificationTemplateCacheModel =
new NotificationTemplateCacheModel();
notificationTemplateCacheModel.mvccVersion = getMvccVersion();
notificationTemplateCacheModel.uuid = getUuid();
String uuid = notificationTemplateCacheModel.uuid;
if ((uuid != null) && (uuid.length() == 0)) {
notificationTemplateCacheModel.uuid = null;
}
notificationTemplateCacheModel.externalReferenceCode =
getExternalReferenceCode();
String externalReferenceCode =
notificationTemplateCacheModel.externalReferenceCode;
if ((externalReferenceCode != null) &&
(externalReferenceCode.length() == 0)) {
notificationTemplateCacheModel.externalReferenceCode = null;
}
notificationTemplateCacheModel.notificationTemplateId =
getNotificationTemplateId();
notificationTemplateCacheModel.companyId = getCompanyId();
notificationTemplateCacheModel.userId = getUserId();
notificationTemplateCacheModel.userName = getUserName();
String userName = notificationTemplateCacheModel.userName;
if ((userName != null) && (userName.length() == 0)) {
notificationTemplateCacheModel.userName = null;
}
Date createDate = getCreateDate();
if (createDate != null) {
notificationTemplateCacheModel.createDate = createDate.getTime();
}
else {
notificationTemplateCacheModel.createDate = Long.MIN_VALUE;
}
Date modifiedDate = getModifiedDate();
if (modifiedDate != null) {
notificationTemplateCacheModel.modifiedDate =
modifiedDate.getTime();
}
else {
notificationTemplateCacheModel.modifiedDate = Long.MIN_VALUE;
}
notificationTemplateCacheModel.objectDefinitionId =
getObjectDefinitionId();
notificationTemplateCacheModel.body = getBody();
String body = notificationTemplateCacheModel.body;
if ((body != null) && (body.length() == 0)) {
notificationTemplateCacheModel.body = null;
}
notificationTemplateCacheModel.description = getDescription();
String description = notificationTemplateCacheModel.description;
if ((description != null) && (description.length() == 0)) {
notificationTemplateCacheModel.description = null;
}
notificationTemplateCacheModel.editorType = getEditorType();
String editorType = notificationTemplateCacheModel.editorType;
if ((editorType != null) && (editorType.length() == 0)) {
notificationTemplateCacheModel.editorType = null;
}
notificationTemplateCacheModel.name = getName();
String name = notificationTemplateCacheModel.name;
if ((name != null) && (name.length() == 0)) {
notificationTemplateCacheModel.name = null;
}
notificationTemplateCacheModel.recipientType = getRecipientType();
String recipientType = notificationTemplateCacheModel.recipientType;
if ((recipientType != null) && (recipientType.length() == 0)) {
notificationTemplateCacheModel.recipientType = null;
}
notificationTemplateCacheModel.subject = getSubject();
String subject = notificationTemplateCacheModel.subject;
if ((subject != null) && (subject.length() == 0)) {
notificationTemplateCacheModel.subject = null;
}
notificationTemplateCacheModel.system = isSystem();
notificationTemplateCacheModel.type = getType();
String type = notificationTemplateCacheModel.type;
if ((type != null) && (type.length() == 0)) {
notificationTemplateCacheModel.type = null;
}
return notificationTemplateCacheModel;
}
@Override
public String toString() {
Map>
attributeGetterFunctions = getAttributeGetterFunctions();
StringBundler sb = new StringBundler(
(5 * attributeGetterFunctions.size()) + 2);
sb.append("{");
for (Map.Entry> entry :
attributeGetterFunctions.entrySet()) {
String attributeName = entry.getKey();
Function attributeGetterFunction =
entry.getValue();
sb.append("\"");
sb.append(attributeName);
sb.append("\": ");
Object value = attributeGetterFunction.apply(
(NotificationTemplate)this);
if (value == null) {
sb.append("null");
}
else if (value instanceof Blob || value instanceof Date ||
value instanceof Map || value instanceof String) {
sb.append(
"\"" + StringUtil.replace(value.toString(), "\"", "'") +
"\"");
}
else {
sb.append(value);
}
sb.append(", ");
}
if (sb.index() > 1) {
sb.setIndex(sb.index() - 1);
}
sb.append("}");
return sb.toString();
}
private static class EscapedModelProxyProviderFunctionHolder {
private static final Function
_escapedModelProxyProviderFunction =
ProxyUtil.getProxyProviderFunction(
NotificationTemplate.class, ModelWrapper.class);
}
private long _mvccVersion;
private String _uuid;
private String _externalReferenceCode;
private long _notificationTemplateId;
private long _companyId;
private long _userId;
private String _userName;
private Date _createDate;
private Date _modifiedDate;
private boolean _setModifiedDate;
private long _objectDefinitionId;
private String _body;
private String _bodyCurrentLanguageId;
private String _description;
private String _editorType;
private String _name;
private String _nameCurrentLanguageId;
private String _recipientType;
private String _subject;
private String _subjectCurrentLanguageId;
private boolean _system;
private String _type;
public T getColumnValue(String columnName) {
columnName = _attributeNames.getOrDefault(columnName, columnName);
Function function =
AttributeGetterFunctionsHolder._attributeGetterFunctions.get(
columnName);
if (function == null) {
throw new IllegalArgumentException(
"No attribute getter function found for " + columnName);
}
return (T)function.apply((NotificationTemplate)this);
}
public T getColumnOriginalValue(String columnName) {
if (_columnOriginalValues == null) {
return null;
}
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
return (T)_columnOriginalValues.get(columnName);
}
private void _setColumnOriginalValues() {
_columnOriginalValues = new HashMap();
_columnOriginalValues.put("mvccVersion", _mvccVersion);
_columnOriginalValues.put("uuid_", _uuid);
_columnOriginalValues.put(
"externalReferenceCode", _externalReferenceCode);
_columnOriginalValues.put(
"notificationTemplateId", _notificationTemplateId);
_columnOriginalValues.put("companyId", _companyId);
_columnOriginalValues.put("userId", _userId);
_columnOriginalValues.put("userName", _userName);
_columnOriginalValues.put("createDate", _createDate);
_columnOriginalValues.put("modifiedDate", _modifiedDate);
_columnOriginalValues.put("objectDefinitionId", _objectDefinitionId);
_columnOriginalValues.put("body", _body);
_columnOriginalValues.put("description", _description);
_columnOriginalValues.put("editorType", _editorType);
_columnOriginalValues.put("name", _name);
_columnOriginalValues.put("recipientType", _recipientType);
_columnOriginalValues.put("subject", _subject);
_columnOriginalValues.put("system_", _system);
_columnOriginalValues.put("type_", _type);
}
private static final Map _attributeNames;
static {
Map attributeNames = new HashMap<>();
attributeNames.put("uuid_", "uuid");
attributeNames.put("system_", "system");
attributeNames.put("type_", "type");
_attributeNames = Collections.unmodifiableMap(attributeNames);
}
private transient Map _columnOriginalValues;
public static long getColumnBitmask(String columnName) {
return _columnBitmasks.get(columnName);
}
private static final Map _columnBitmasks;
static {
Map columnBitmasks = new HashMap<>();
columnBitmasks.put("mvccVersion", 1L);
columnBitmasks.put("uuid_", 2L);
columnBitmasks.put("externalReferenceCode", 4L);
columnBitmasks.put("notificationTemplateId", 8L);
columnBitmasks.put("companyId", 16L);
columnBitmasks.put("userId", 32L);
columnBitmasks.put("userName", 64L);
columnBitmasks.put("createDate", 128L);
columnBitmasks.put("modifiedDate", 256L);
columnBitmasks.put("objectDefinitionId", 512L);
columnBitmasks.put("body", 1024L);
columnBitmasks.put("description", 2048L);
columnBitmasks.put("editorType", 4096L);
columnBitmasks.put("name", 8192L);
columnBitmasks.put("recipientType", 16384L);
columnBitmasks.put("subject", 32768L);
columnBitmasks.put("system_", 65536L);
columnBitmasks.put("type_", 131072L);
_columnBitmasks = Collections.unmodifiableMap(columnBitmasks);
}
private long _columnBitmask;
private NotificationTemplate _escapedModel;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy