lunes, 22 de febrero de 2016

WCC: Check if Framework Folders is enabled using RIDC

Useful snippet of code for check if your WebCenter Content is using Folders_g or Framework Folders as the Foldering Service in your RIDC Code.

The clue is the use of CONFIG_INFO IDC Service.

private synchronized void checkFrameworkFoldersEnabled() throws IdcClientException {
    final String METHOD_NAME = "checkFrameworkFoldersEnabled";
    logger.entering(CLASS_NAME, METHOD_NAME);
    // Get IdcClient and IdcContext if necessary
 if (!configChecked) {
        DataBinder binder = idcClient.createBinder();
        binder.putLocal("IdcService", "CONFIG_INFO");
        DataBinder rb = idcClient.sendRequest(defaultIdcContext, binder).getResponseAsBinder();
        DataResultSet resultSet = rb.getResultSet("EnabledComponents");
        List<DataObject> components = resultSet.getRows();
        for (DataObject component : components) {
            if (("FrameworkFolders".equals(component.get("name"))) && ("Enabled".equals(component.get("status")))) {
                folderingService = "FrameworkFolders";
                break;
            }
            if (("Folders_g".equals(component.get("name"))) && ("Enabled".equals(component.get("status")))) {
                folderingService = "Folders_g";
                break;
            }
        }
        if (folderingService == null) {
            if (logger.isWarning()) {
                logger.warning(CLASS_NAME, METHOD_NAME, "Not able to determine Foldering Service on Content Server, defaulting to Folders_g");
            }
            folderingService =  "Folders_g";
        }
        configChecked = true;
    }
    if (logger.isInfo()) {
        logger.info(CLASS_NAME, METHOD_NAME, "Current RIDC Foldering Service: " + folderingService);
    }
    logger.exiting(CLASS_NAME, METHOD_NAME);
}

2 comentarios: