@Override
  public void setTitleMap(Map<Locale, String> titleMap, Locale defaultLocale) {
    if (titleMap == null) {
      return;
    }

    ClassLoader portalClassLoader = PortalClassLoaderUtil.getClassLoader();

    Thread currentThread = Thread.currentThread();

    ClassLoader contextClassLoader = currentThread.getContextClassLoader();

    try {
      if (contextClassLoader != portalClassLoader) {
        currentThread.setContextClassLoader(portalClassLoader);
      }

      setTitle(
          LocalizationUtil.updateLocalization(
              titleMap, getTitle(), "Title", LocaleUtil.toLanguageId(defaultLocale)));
    } finally {
      if (contextClassLoader != portalClassLoader) {
        currentThread.setContextClassLoader(contextClassLoader);
      }
    }
  }
  @Override
  public void setTitle(String title, Locale locale, Locale defaultLocale) {
    String languageId = LocaleUtil.toLanguageId(locale);
    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);

    if (Validator.isNotNull(title)) {
      setTitle(
          LocalizationUtil.updateLocalization(
              getTitle(), "Title", title, languageId, defaultLanguageId));
    } else {
      setTitle(LocalizationUtil.removeLocalization(getTitle(), "Title", languageId));
    }
  }
  @Override
  @SuppressWarnings("unused")
  public void prepareLocalizedFieldsForImport(Locale defaultImportLocale) throws LocaleException {
    Locale defaultLocale = LocaleUtil.getDefault();

    String modelDefaultLanguageId = getDefaultLanguageId();

    String title = getTitle(defaultLocale);

    if (Validator.isNull(title)) {
      setTitle(getTitle(modelDefaultLanguageId), defaultLocale);
    } else {
      setTitle(getTitle(defaultLocale), defaultLocale, defaultLocale);
    }
  }
  @Override
  public Object clone() {
    KaleoDraftDefinitionClp clone = new KaleoDraftDefinitionClp();

    clone.setKaleoDraftDefinitionId(getKaleoDraftDefinitionId());
    clone.setGroupId(getGroupId());
    clone.setCompanyId(getCompanyId());
    clone.setUserId(getUserId());
    clone.setUserName(getUserName());
    clone.setCreateDate(getCreateDate());
    clone.setModifiedDate(getModifiedDate());
    clone.setName(getName());
    clone.setTitle(getTitle());
    clone.setContent(getContent());
    clone.setVersion(getVersion());
    clone.setDraftVersion(getDraftVersion());

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

    if (kaleoDraftDefinitionId != null) {
      setKaleoDraftDefinitionId(kaleoDraftDefinitionId);
    }

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

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

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

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

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

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

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

    if (userName != null) {
      setUserName(userName);
    }

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

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

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

    if (modifiedDate != null) {
      setModifiedDate(modifiedDate);
    }

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

    if (name != null) {
      setName(name);
    }

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

    if (title != null) {
      setTitle(title);
    }

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

    if (content != null) {
      setContent(content);
    }

    Integer version = (Integer) attributes.get("version");

    if (version != null) {
      setVersion(version);
    }

    Integer draftVersion = (Integer) attributes.get("draftVersion");

    if (draftVersion != null) {
      setDraftVersion(draftVersion);
    }
  }
 @Override
 public void setTitle(String title, Locale locale) {
   setTitle(title, locale, LocaleUtil.getDefault());
 }