Skip to content

Instantly share code, notes, and snippets.

@SinTeZWh1te
Created April 12, 2023 19:57
Show Gist options
  • Save SinTeZWh1te/8d2cd29da804377929ef612308c91f56 to your computer and use it in GitHub Desktop.
Save SinTeZWh1te/8d2cd29da804377929ef612308c91f56 to your computer and use it in GitHub Desktop.
package ru.test.bgbilling.kernel.scripts.global;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import ru.bitel.bgbilling.kernel.container.managed.ServerContext;
import ru.bitel.bgbilling.kernel.script.server.dev.GlobalScriptBase;
import ru.bitel.bgbilling.plugins.notification.common.bean.ContractNotification;
import ru.bitel.bgbilling.plugins.notification.common.service.ContractNotificationService;
import ru.bitel.bgbilling.server.util.Setup;
import ru.bitel.common.sql.ConnectionSet;
import java.sql.Connection;
import java.util.Date;
/**
* @author sintezwh1te
*/
public class AddNotificationForContract
extends GlobalScriptBase {
private static final Logger logger = LogManager.getLogger();
@Override
public void execute(Setup setup, ConnectionSet connectionSet)
throws Exception {
Connection con = connectionSet.getConnection();
ServerContext serverContext = ServerContext.get();
ContractNotificationService contractNotificationService = serverContext.getService(ContractNotificationService.class, 0);
ContractNotification contractNotification = new ContractNotification();
contractNotification.setContractId(14842);
contractNotification.setTitle("Важное уведомление!");
contractNotification.setMessage("Hello from Hell!");
contractNotification.setDateTime(new Date());
contractNotificationService.contractNotificationUpdate(contractNotification.getContractId(), contractNotification);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment