Show TOC

Background documentationChanging Module Settings Locate this document in the navigation structure

 

You can access and change the runtime settings of module properties, as illustrated in the following example:

Example Example

  1. private void changeModuleSettings(IPortalComponentRequest request)
        {
        	IModuleContext moduleContext = ModuleHelper.getModuleContext(request);
    
        	// Get property value
        	String modulePropertyValue = moduleContext.getProperty("propertyID");
    
        	// Set property value
        	IWorkspacesRuntime workspacesRuntime = RuntimeFactory.getWorkspacesRuntime();
    		IModuleSettingsFactory moduleSettingsFactory = (IModuleSettingsFactory)workspacesRuntime.getService(IModuleContextFactory.class);
    		IModuleSettings moduleSettings = moduleSettingsFactory.getModuleSettings(moduleContext);
    
    		moduleSettings.getModuleProperty("propertyID").setValue("newValue");
    		moduleSettingsFactory.saveModuleSettings(moduleSettings);
    
    		// Iterate through all properties
    		IModuleProperty[] moduleProperties = moduleSettings.getModuleProperties();
    
    		for(int i=0; imoduleProperties.length; i++)
    		{
    			IModuleProperty moduleProperty = moduleProperties[i];
    
    			// Do something
    		}    	    	    	
    }
End of the source code.

Package

The relevant API is contained in the com.sap.workspaces.module.settings.property package.