protected void deleteLDAPServer(ActionRequest actionRequest) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    long ldapServerId = ParamUtil.getLong(actionRequest, "ldapServerId");

    // Remove preferences

    String postfix = LDAPSettingsUtil.getPropertyPostfix(ldapServerId);

    String[] keys = new String[_KEYS.length];

    for (int i = 0; i < _KEYS.length; i++) {
      keys[i] = _KEYS[i] + postfix;
    }

    CompanyServiceUtil.removePreferences(themeDisplay.getCompanyId(), keys);

    // Update preferences

    PortletPreferences preferences = PrefsPropsUtil.getPreferences(themeDisplay.getCompanyId());

    UnicodeProperties properties = new UnicodeProperties();

    String ldapServerIds = preferences.getValue("ldap.server.ids", StringPool.BLANK);

    ldapServerIds = StringUtil.remove(ldapServerIds, String.valueOf(ldapServerId));

    properties.put("ldap.server.ids", ldapServerIds);

    CompanyServiceUtil.updatePreferences(themeDisplay.getCompanyId(), properties);
  }
  public Message updateFlag(long messageId, int flag, boolean value)
      throws PortalException, SystemException {

    String flagString = String.valueOf(flag);

    Message message = messagePersistence.findByPrimaryKey(messageId);

    String flags = message.getFlags();

    if (value && !StringUtil.contains(flags, flagString)) {
      message.setFlags(StringUtil.add(flags, flagString));
    } else if (!value && StringUtil.contains(flags, flagString)) {
      message.setFlags(StringUtil.remove(flags, flagString));
    }

    return messagePersistence.update(message, false);
  }
 public void removeStateMinPortletId(String portletId) {
   setStateMin(StringUtil.remove(getStateMin(), portletId));
 }
  public void removePortletId(long userId, String portletId, boolean cleanUp) {

    try {
      Portlet portlet = PortletLocalServiceUtil.getPortletById(getCompanyId(), portletId);

      if (portlet == null) {
        _log.error("Portlet " + portletId + " cannot be removed because it is not registered");

        return;
      }

      PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();

      if (!LayoutPermissionUtil.contains(permissionChecker, getLayout(), ActionKeys.UPDATE)
          && !isCustomizable()) {

        return;
      }
    } catch (Exception e) {
      _log.error(e, e);
    }

    List<String> columns = getColumns();

    for (int i = 0; i < columns.size(); i++) {
      String columnId = columns.get(i);

      if (isCustomizable() && isColumnDisabled(columnId)) {
        continue;
      }

      String columnValue = StringPool.BLANK;

      if (hasUserPreferences()) {
        columnValue = getUserPreference(columnId);
      } else {
        columnValue = getTypeSettingsProperties().getProperty(columnId);
      }

      columnValue = StringUtil.remove(columnValue, portletId);

      if (hasUserPreferences()) {
        setUserPreference(columnId, columnValue);

        try {
          String rootPortletId = PortletConstants.getRootPortletId(portletId);

          ResourceLocalServiceUtil.deleteResource(
              getCompanyId(),
              rootPortletId,
              ResourceConstants.SCOPE_INDIVIDUAL,
              PortletPermissionUtil.getPrimaryKey(getPlid(), portletId));
        } catch (Exception e) {
        }
      } else {
        getTypeSettingsProperties().setProperty(columnId, columnValue);
      }
    }

    if (cleanUp) {
      removeStatesPortletId(portletId);
      removeModesPortletId(portletId);

      try {
        onRemoveFromLayout(portletId);
      } catch (Exception e) {
        _log.error("Unable to fire portlet layout listener event", e);
      }
    }
  }
 public void removeModePrintPortletId(String portletId) {
   setModePrint(StringUtil.remove(getModePrint(), portletId));
 }
 public void removeModePreviewPortletId(String portletId) {
   setModePreview(StringUtil.remove(getModePreview(), portletId));
 }
 public void removeModeHelpPortletId(String portletId) {
   setModeHelp(StringUtil.remove(getModeHelp(), portletId));
 }
 public void removeModeEditGuestPortletId(String portletId) {
   setModeEditGuest(StringUtil.remove(getModeEditGuest(), portletId));
 }
 public void removeModeEditDefaultsPortletId(String portletId) {
   setModeEditDefaults(StringUtil.remove(getModeEditDefaults(), portletId));
 }
 public void removeModeConfigPortletId(String portletId) {
   setModeConfig(StringUtil.remove(getModeConfig(), portletId));
 }