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));
    }
  }
  public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
    if (nameMap == null) {
      return;
    }

    setName(
        LocalizationUtil.updateLocalization(
            nameMap, getName(), "Name", LocaleUtil.toLanguageId(defaultLocale)));
  }
  @SuppressWarnings("unused")
  public void prepareLocalizedFieldsForImport(Locale defaultImportLocale) throws LocaleException {
    Locale defaultLocale = LocaleUtil.getDefault();

    String modelDefaultLanguageId = getDefaultLanguageId();

    String name = getName(defaultLocale);

    if (Validator.isNull(name)) {
      setName(getName(modelDefaultLanguageId), defaultLocale);
    } else {
      setName(getName(defaultLocale), defaultLocale, defaultLocale);
    }

    String description = getDescription(defaultLocale);

    if (Validator.isNull(description)) {
      setDescription(getDescription(modelDefaultLanguageId), defaultLocale);
    } else {
      setDescription(getDescription(defaultLocale), defaultLocale, defaultLocale);
    }
  }
 public void setName(String name, Locale locale) {
   setName(name, locale, LocaleUtil.getSiteDefault());
 }
  public void setModelAttributes(Map<String, Object> attributes) {
    String uuid = (String) attributes.get("uuid");

    if (uuid != null) {
      setUuid(uuid);
    }

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

    if (calendarId != null) {
      setCalendarId(calendarId);
    }

    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);
    }

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

    if (resourceBlockId != null) {
      setResourceBlockId(resourceBlockId);
    }

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

    if (calendarResourceId != null) {
      setCalendarResourceId(calendarResourceId);
    }

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

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

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

    if (description != null) {
      setDescription(description);
    }

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

    if (color != null) {
      setColor(color);
    }

    Boolean defaultCalendar = (Boolean) attributes.get("defaultCalendar");

    if (defaultCalendar != null) {
      setDefaultCalendar(defaultCalendar);
    }

    Boolean enableComments = (Boolean) attributes.get("enableComments");

    if (enableComments != null) {
      setEnableComments(enableComments);
    }

    Boolean enableRatings = (Boolean) attributes.get("enableRatings");

    if (enableRatings != null) {
      setEnableRatings(enableRatings);
    }
  }
 @Override
 @SuppressWarnings("unused")
 public void prepareLocalizedFieldsForImport(Locale defaultImportLocale) throws LocaleException {
   setName(getName(defaultImportLocale), defaultImportLocale, defaultImportLocale);
   setDescription(getDescription(defaultImportLocale), defaultImportLocale, defaultImportLocale);
 }