*/
public Module createModule(UserAccount account, Map<String, String> moduleProperties, Map<String, byte[]> binaryModuleProperties, Map<String, DataExporter> moduleExporters) {
final UserAccountImpl accountImpl = (UserAccountImpl) account;
// add the properties and save the object
final ModuleImpl module = new ModuleImpl();
module.setAccount(accountImpl);
module.setAccountId(accountImpl.getId());
if (moduleProperties != null) {
module.setModuleProperties(moduleProperties);
}
if (binaryModuleProperties != null) {
module.setBinaryModuleProperties(binaryModuleProperties);
}
if (moduleExporters != null) {
module.setModuleExporters(moduleExporters);
}
// set the module name
String moduleName = moduleProperties.get(Module.PROPERTY_MODULE_NAME);
if (moduleName == null) {
logger.warn("No module name defined.");
moduleName = "Module " + System.currentTimeMillis();
module.getModuleProperties().put(Module.PROPERTY_MODULE_NAME, moduleName);
}
module.setName(moduleName);
// save the module
accountImpl.getTransactionTemplate().execute(
new TransactionCallbackWithoutResult() {
public void doInTransactionWithoutResult(TransactionStatus status) {