protected UITypesConfiguration getConfiguration(DocumentModel currentDoc) { UITypesConfiguration configuration = null; try { LocalConfigurationService localConfigurationService = Framework.getService(LocalConfigurationService.class); configuration = localConfigurationService.getConfiguration( UITypesConfiguration.class, UI_TYPES_CONFIGURATION_FACET, currentDoc); } catch (Exception e) { log.error(e, e); } return configuration; }
@OperationMethod public DocumentModel run(DocumentModel doc) { if (!doc.hasFacet(SIMPLE_CONFIGURATION_FACET)) { doc.addFacet(SIMPLE_CONFIGURATION_FACET); doc = session.saveDocument(doc); } SimpleConfiguration simpleConfiguration = localConfigurationService.getConfiguration( SimpleConfiguration.class, SIMPLE_CONFIGURATION_FACET, doc); simpleConfiguration.putAll(parameters); simpleConfiguration.save(session); if (save) { doc = session.saveDocument(doc); } return doc; }