| | |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | | import de.hsadmin.core.qserv.CompoundProcessor; |
| | | import de.hsadmin.core.qserv.EntityProcessorFactory; |
| | | import de.hsadmin.core.qserv.MailerProcessor; |
| | | //import de.hsadmin.core.qserv.MailerProcessor; |
| | | import de.hsadmin.core.qserv.Processor; |
| | | import de.hsadmin.core.qserv.ProcessorException; |
| | | import de.hsadmin.core.qserv.ShellProcessor; |
| | |
| | | EntityManager em, T entity) throws ProcessorException { |
| | | Pac pac = (Pac) entity; |
| | | String pacName = pac.getName(); |
| | | String customerEMail = pac.getCustomer().getContractualContact().getEmail(); |
| | | // String customerEMail = pac.getCustomer().getContractualContact().getEmail(); |
| | | Hive hive = pac.getHive(); |
| | | UnixUser unixUser = getPacAdminUser(pac); |
| | | String password = PasswordTool.generatePassword(); |
| | | Map<String, String> hiveValues = fillHiveValues(hive); |
| | | List<Map<String, String>> pacValuesList = fillPacValuesList(hive, null); |
| | | Map<String, String> emailVars = fillEMailValues(pacName, customerEMail, password); |
| | | // Map<String, String> emailVars = fillEMailValues(pacName, customerEMail, password); |
| | | Processor priProcessor = new CompoundProcessor( |
| | | createAddUserProc(pacName, unixUser, password), |
| | | createSetQuotaProc(pac), |
| | |
| | | createMakePacDirectoryStructure(unixUser), |
| | | createIfUp(pacName)); |
| | | WaitingTasksProcessor secProcessor = new WaitingTasksProcessor(priProcessor); |
| | | secProcessor.appendProcessor(pac.getHiveName(), createSendEMailProc(pacName, customerEMail, emailVars), "send email to customer"); |
| | | // secProcessor.appendProcessor(pac.getHiveName(), createSendEMailProc(pacName, customerEMail, emailVars), "send email to customer"); |
| | | return secProcessor; |
| | | } |
| | | |
| | |
| | | ); |
| | | } |
| | | |
| | | private Processor createSendEMailProc(String pacName, |
| | | String customerEMail, Map<String, String> emailVars) throws ProcessorException { |
| | | return new MailerProcessor( |
| | | customerEMail, |
| | | "Zugangsdaten des neue Hostsharing Pakets " + pacName, |
| | | "/de/hsadmin/mods/pac/email_new_pac_account.jtpl", |
| | | emailVars |
| | | ); |
| | | } |
| | | // private Processor createSendEMailProc(String pacName, |
| | | // String customerEMail, Map<String, String> emailVars) throws ProcessorException { |
| | | // return new MailerProcessor( |
| | | // customerEMail, |
| | | // "Zugangsdaten des neue Hostsharing Pakets " + pacName, |
| | | // "/de/hsadmin/mods/pac/email_new_pac_account.jtpl", |
| | | // emailVars |
| | | // ); |
| | | // } |
| | | |
| | | private Processor createIfUp(String pacName) { |
| | | return new ShellProcessor("ifup eth0:" + pacName); |
| | |
| | | return pacValuesList; |
| | | } |
| | | |
| | | private Map<String, String> fillEMailValues(String pacName, |
| | | String customerEMail, String password) { |
| | | Map<String, String> emailVars = new HashMap<String, String>(); |
| | | emailVars.put("PAC", pacName); |
| | | emailVars.put("PASSWORD", password); |
| | | emailVars.put("CUST_EMAIL", customerEMail); |
| | | return emailVars; |
| | | } |
| | | // private Map<String, String> fillEMailValues(String pacName, |
| | | // String customerEMail, String password) { |
| | | // Map<String, String> emailVars = new HashMap<String, String>(); |
| | | // emailVars.put("PAC", pacName); |
| | | // emailVars.put("PASSWORD", password); |
| | | // emailVars.put("CUST_EMAIL", customerEMail); |
| | | // return emailVars; |
| | | // } |
| | | |
| | | } |