For maintenance purposes, the portal periodically goes into write-protect mode, which may have an impact on write operations in workspaces. If your code attempts to perform a write operation when the portal is in write-protect mode, a runtime exception WRITEPROTECT_MODE_EXCEPTION is thrown.
You can use the API to check if the portal is in write-protect mode, as follows:
public void detectWriteProtectMode() { IWriteProtectMode writeProtectMode= (IWriteProtectMode)RuntimeFactory.getWorkspacesRuntime().getService(IWriteProtectMode.class); if (writeProtectMode.isWriteProtectMode()) { // Generate a message or display UI in read-only mode } else { // Proceed to save } }
Alternatively, you can call the writeProtectMode.assertWriteProtectOff method that throws a runtime exception in write-protect mode, and handle this exception.
The relevant API is contained in the com.sap.workspaces.authoring package.