/** The main method that fetches the Value-objects for this use-case */
  public String doDeleteProperty() throws Exception {
    validateSecurityCode();

    Map args = new HashMap();
    args.put("globalKey", "infoglue");
    PropertySet ps = PropertySetManager.getInstance("jdbc", args);

    ps.remove("serverNode_" + this.getServerNodeId() + "_" + key);

    try {
      CacheController.clearServerNodeProperty(true);
      InfoGlueAuthenticationFilter.initializeCMSProperties();
    } catch (SystemException e) {
      e.printStackTrace();
    }

    NotificationMessage notificationMessage =
        new NotificationMessage(
            "ViewServerNodePropertiesAction.doSave():",
            "ServerNodeProperties",
            this.getInfoGluePrincipal().getName(),
            NotificationMessage.SYSTEM,
            "0",
            "ServerNodeProperties");
    // ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
    RemoteCacheUpdater.getSystemNotificationMessages().add(notificationMessage);

    return "save";
  }
  /**
   * This method saves all application settings by grabbing the stated parameter values from the
   * request.
   */
  public String doSave() throws Exception {
    validateSecurityCode();

    Map args = new HashMap();
    args.put("globalKey", "infoglue");
    PropertySet ps = PropertySetManager.getInstance("jdbc", args);

    populate(ps, "isPageCacheOn");
    populate(ps, "useSelectivePageCacheUpdate");
    populate(ps, "expireCacheAutomatically");
    populate(ps, "cacheExpireInterval");
    populate(ps, "deliverRequestTimeout");
    populate(ps, "liveDeliverRequestTimeout");
    populate(ps, "killLiveRequestWhichTimedout");
    populate(ps, "useHighLoadLimiter");
    populate(ps, "maxActiveRequests");
    populate(ps, "maxRequestTime");
    populate(ps, "session.timeout");
    populate(ps, "compressPageCache");
    populate(ps, "compressPageResponse");
    populate(ps, "disableDecoratedFinalRendering");
    populate(ps, "siteNodesToRecacheOnPublishing");
    populate(ps, "recachePublishingMethod");
    populate(ps, "recacheUrl");
    populate(ps, "useUpdateSecurity");
    populate(ps, "allowXForwardedIPCheck");

    populate(ps, "allowedAdminIP");
    String allowedAdminIP = this.getRequest().getParameter("allowedAdminIP");
    if (allowedAdminIP != null && !allowedAdminIP.equals(""))
      ServerNodeController.getController().setAllowedAdminIP(allowedAdminIP);

    populate(ps, "pageKey");
    populate(ps, "componentKey");
    populateData(ps, "cacheSettings");
    populateData(ps, "extraPublicationPersistentCacheNames");
    populate(ps, "cmsBaseUrl");
    populate(ps, "cmsFullBaseUrl");
    populate(ps, "componentEditorUrl");
    populate(ps, "componentRendererUrl");
    populate(ps, "componentRendererAction");
    populate(ps, "editOnSiteUrl");
    populate(ps, "useFreeMarker");
    populate(ps, "webServerAddress");
    populate(ps, "applicationBaseAction");
    populate(ps, "digitalAssetBaseUrl");
    populate(ps, "imagesBaseUrl");
    populate(ps, "digitalAssetPath");
    populate(ps, "urlFormatting");
    populate(ps, "enableNiceURI");
    populate(ps, "enableNiceURIInWorking");
    populate(ps, "enableNiceURIForLanguage");
    populate(ps, "enableDiskAssets");
    populate(ps, "disableAssetDeletionInWorkThread");
    populate(ps, "disableAssetDeletionInLiveThread");
    populate(ps, "niceURIEncoding");
    populate(ps, "niceURIAttributeName");
    populateData(ps, "niceURICharacterReplacingMapping");
    populate(ps, "niceURIUseLowerCase");
    populate(ps, "niceURIDefaultReplacementCharacter");
    populate(ps, "niceURIDisableNiceURIForContent");
    populate(ps, "niceURIDefaultReplacementCharacterForContent");
    populate(ps, "duplicateAssetsBetweenVersions");
    populate(ps, "requestArgumentDelimiter");
    populate(ps, "errorHandling");
    populate(ps, "errorUrl");
    populate(ps, "errorBusyUrl");
    populate(ps, "externalThumbnailGeneration");
    populate(ps, "URIEncoding");
    populate(ps, "workflowEncoding");
    populate(ps, "formsEncoding");
    populate(ps, "uploadFromEncoding");
    populate(ps, "uploadToEncoding");
    populate(ps, "assetKeyFromEncoding");
    populate(ps, "assetKeyToEncoding");
    populate(ps, "enableCustomCharactersParsing");
    populate(ps, "customCharactersForConversion");
    populate(ps, "useShortTableNames");
    populate(ps, "useImprovedContentCategorySearch");
    populate(ps, "logDatabaseMessages");
    populate(ps, "statistics.enabled");
    populate(ps, "statisticsLogPath");
    populate(ps, "statisticsLogOneFilePerDay");
    populate(ps, "statisticsLogger");
    populate(ps, "contactPersonEmailMetaInfoAttribute");
    populate(ps, "notifyResponsibleOnReferenceChange");
    populate(ps, "enablePortal");
    populate(ps, "portletBase");
    populate(ps, "mail.smtp.host");
    populate(ps, "mail.smtp.port");
    populate(ps, "mail.smtp.auth");
    populate(ps, "mail.smtp.user");
    populate(ps, "mail.smtp.password");
    populate(ps, "mail.contentType");
    populate(ps, "systemEmailSender");
    populate(ps, "warningEmailReceiver");
    populate(ps, "emailRecipientLimit");
    populate(ps, "loginUrl");
    populate(ps, "logoutUrl");
    populate(ps, "invalidLoginUrl");
    populate(ps, "successLoginBaseUrl");
    populate(ps, "authenticatorClass");
    populate(ps, "authorizerClass");
    populate(ps, "serverName");
    populate(ps, "authConstraint");
    populate(ps, "extraParametersFile");
    populateData(ps, "extraSecurityParameters");
    populate(ps, "casValidateUrl");
    populate(ps, "casProxyValidateUrl");
    populate(ps, "casServiceUrl");
    populate(ps, "casLogoutUrl");
    populate(ps, "ipAddressesToFallbackToBasicAuth");

    populate(ps, "deliver_loginUrl");
    populate(ps, "deliver_logoutUrl");
    populate(ps, "deliver_invalidLoginUrl");
    populate(ps, "deliver_successLoginBaseUrl");
    populate(ps, "deliver_authenticatorClass");
    populate(ps, "deliver_authorizerClass");
    populate(ps, "deliver_serverName");
    populate(ps, "deliver_authConstraint");
    populate(ps, "deliver_extraParametersFile");
    populateData(ps, "deliver_extraSecurityParameters");
    populate(ps, "deliver_security.anonymous.username");
    populate(ps, "deliver_security.anonymous.password");
    populate(ps, "deliver_casValidateUrl");
    populate(ps, "deliver_casProxyValidateUrl");
    populate(ps, "deliver_casServiceUrl");
    populate(ps, "deliver_casLogoutUrl");

    populate(ps, "workingStyleInformation");
    populate(ps, "finalStyleInformation");
    populate(ps, "publishStyleInformation");
    populate(ps, "publishedStyleInformation");
    populateData(ps, "customContentTypeIcons");
    populateData(ps, "shortcuts");
    populateData(ps, "WYSIWYGToolbarComboPreviewCSS");
    populateData(ps, "WYSIWYGEditorAreaCSS");

    populate(ps, "disableImageEditor");
    populate(ps, "hideProtectedProperties");

    populate(ps, "protectContentTypes");
    populate(ps, "protectWorkflows");
    populate(ps, "protectCategories");

    populate(ps, "internalSearchEngine");
    populate(ps, "allowOverrideModifyer");

    populate(ps, "useSimpleComponentDialog");
    populate(ps, "hideAccessRightsIfNotAllowedToManage");
    populate(ps, "onlyAllowFolderType");
    populate(ps, "allowedFolderContentTypeNames");
    populate(ps, "skipResultDialogIfPossible");

    populate(ps, "maxRows");
    populate(ps, "maxNumberOfAssetInSearches");
    populate(ps, "gaCode");
    populate(ps, "componentBindningAssetBrowser");
    populate(ps, "prefferedWYSIWYG");

    populate(ps, "defaultNumberOfYearsBeforeExpire");
    populate(ps, "defaultNumberOfMonthsBeforeRedirectExpire");
    populate(ps, "defaultNumberOfMonthsBeforeSystemRedirectExpire");
    populate(ps, "enableDateTimeDirectEditing");
    populate(ps, "showContentVersionFirst");
    populate(ps, "tree");
    populate(ps, "treemode");
    populate(ps, "disableCustomIcons");
    populate(ps, "showComponentsFirst");
    populate(ps, "showAllWorkflows");
    populate(ps, "editOnSight");
    populate(ps, "previewDeliveryUrl");
    populate(ps, "stagingDeliveryUrl");
    populateData(ps, "internalDeliveryUrls");
    populateData(ps, "publicDeliveryUrls");
    populateData(ps, "toolLanguages");
    populateData(ps, "deploymentServers");
    populateData(ps, "vcServers");
    populate(ps, "decoratedPageInvoker");
    populate(ps, "defaultRepositoryAccessRoles");

    populate(ps, "edition.pageSize");
    populate(ps, "content.tree.sort");
    populate(ps, "structure.tree.sort");
    populate(ps, "structure.tree.isHidden");
    populate(ps, "content.tree.hideForbidden");
    populate(ps, "structure.tree.hideForbidden");
    populate(ps, "enforceRigidContentAccess");
    populate(ps, "disableEmptyUrls");
    populate(ps, "cacheUpdateAction");
    populate(ps, "logPath");

    populate(ps, "logTransactions");
    populate(ps, "enableExtranetCookies");
    populate(ps, "useAlternativeBrowserLanguageCheck");
    populate(ps, "caseSensitiveRedirects");
    populate(ps, "useDNSNameInURI");

    populate(ps, "extranetCookieTimeout");
    populate(ps, "webServicesBaseUrl");
    populate(ps, "livePublicationThreadClass");
    populate(ps, "publicationThreadDelay");
    populate(ps, "pathsToRecacheOnPublishing");
    populate(ps, "disableTemplateDebug");
    populate(ps, "exportFormat");
    populate(ps, "dbRelease");
    populate(ps, "dbUser");
    populate(ps, "dbPassword");
    populate(ps, "masterServer");
    populate(ps, "slaveServer");
    populate(ps, "buildName");
    populate(ps, "adminToolsPath");
    populate(ps, "dbScriptPath");
    populate(ps, "digitalAssetUploadPath");
    populate(ps, "inputCharacterEncoding");
    populate(ps, "deliver_inputCharacterEncoding");
    populate(ps, "protectDeliverWorking");
    populate(ps, "protectDeliverPreview");
    populate(ps, "forceIdentityCheck");
    populate(ps, "allowCrossSiteSubmitToPublish");
    populate(ps, "usePasswordEncryption");
    populate(ps, "helpUrl");
    populateData(ps, "headerHTML");

    populate(ps, "allowPublicationEventFilter");
    populate(ps, "defaultPublicationEventFilter");

    populate(ps, "numberOfVersionsToKeepDuringClean");
    populate(ps, "keepOnlyOldPublishedVersionsDuringClean");
    populate(ps, "minimumTimeBetweenVersionsDuringClean");
    populateData(ps, "assetUploadTransformationsSettings");

    populate(ps, "setDerivedLastModifiedInLive");
    populate(ps, "standardResponseHeaders");
    populate(ps, "maxNumberOfVersionsForDerivedLastModifiedInLive");
    populate(ps, "allowInternalCallsBasedOnIP");

    populate(ps, "assetFileNameForm");

    populate(ps, "deriveProtocolWhenUsingProtocolRedirects");
    populate(ps, "useAccessBasedProtocolRedirects");
    populate(ps, "unprotectedProtocolName");
    populate(ps, "protectedProtocolName");
    populate(ps, "unprotectedProtocolPort");
    populate(ps, "protectedProtocolPort");
    populate(ps, "accessBasedProtocolRedirectHTTPCode");
    populate(ps, "redirectStatusCode");

    populate(ps, "indexDigitalAssetContent");

    populate(ps, "allowedDirectLoginNames");

    populate(ps, "onlyShowReferenceIfLatestVersion");
    populate(ps, "registryContactMailLanguage");

    try {
      UserControllerProxy.getController().updateAnonymousUserPassword();
    } catch (SystemException e) {
      e.printStackTrace();
    }

    try {
      CacheController.clearServerNodeProperty(true);
      InfoGlueAuthenticationFilter.initializeCMSProperties();
    } catch (SystemException e) {
      e.printStackTrace();
    }

    NotificationMessage notificationMessage =
        new NotificationMessage(
            "ViewServerNodePropertiesAction.doSave():",
            "ServerNodeProperties",
            this.getInfoGluePrincipal().getName(),
            NotificationMessage.SYSTEM,
            "0",
            "ServerNodeProperties");
    // ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
    RemoteCacheUpdater.getSystemNotificationMessages().add(notificationMessage);

    return "save";
  }