package com.chenyang.nse.bussiness.engine.infa.powercenter961.simplesubdata;

import com.chenyang.nse.bussiness.commmon.ApplicationConstants;
import com.chenyang.nse.bussiness.engine.infa.InfoProperty;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.CONFIG;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.FOLDER;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.MAPPING;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.POWERMART;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.REPOSITORY;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.SOURCE;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.TARGET;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.WORKFLOW;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.createdata.Configutil;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.createdata.Folderutil;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.createdata.Powermartutil;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.createdata.Repositoryutil;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.pubbean.MappingBean;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.pubbean.MappingPramaBean;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.pubbean.SourceBean;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.pubbean.TargetBean;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.pubbean.WorkflowBean;
import com.chenyang.nse.bussiness.engine.infa.powercenter961.pubtool.ToObjutil;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

public class ChildSeCollectiveUtil {
   public void seChildMethod(String taskname, String repositoryName, String dataBaseType, String foldername, String owner, String shaerd, String group, List<SourceBean> sb, List<TargetBean> tb, String mappingname, List<MappingBean> mb, String workflowname, InfoProperty tengine, List<WorkflowBean> wb, List<MappingPramaBean> paramList, String paramfilepath) throws Exception {
      new POWERMART();
      Powermartutil pu = new Powermartutil();
      POWERMART powermart = pu.getPowermart();
      new REPOSITORY();
      Repositoryutil ru = new Repositoryutil();
      REPOSITORY repository = ru.getREPOSITORY(repositoryName, dataBaseType);
      new FOLDER();
      Folderutil fu = new Folderutil();
      FOLDER folder = fu.getFolder(foldername, owner, shaerd, group);
      ChildSeSourceUtil gsu = new ChildSeSourceUtil();
      if (sb != null && sb.size() > 0) {
         new ArrayList();
         List<SOURCE> gtu = gsu.getSeChildSource(sb);
         if (gtu != null && gtu.size() > 0) {
            for(int i = 0; i < gtu.size(); ++i) {
               folder.getFOLDERVERSIONOrCONFIGOrSCHEDULEROrTASKOrSESSIONOrWORKLETOrWORKFLOWOrSOURCEOrTARGETOrTRANSFORMATIONOrMAPPLETOrMAPPINGOrSHORTCUTOrEXPRMACRO().add(gtu.get(i));
            }
         }
      }

      ChildSeTargetUtil gtu = new ChildSeTargetUtil();
      if (tb != null && tb.size() > 0) {
         new ArrayList();
         List<TARGET> var32 = gtu.getSeChildTarget(tb);
         if (var32 != null && var32.size() > 0) {
            for(int i = 0; i < var32.size(); ++i) {
               folder.getFOLDERVERSIONOrCONFIGOrSCHEDULEROrTASKOrSESSIONOrWORKLETOrWORKFLOWOrSOURCEOrTARGETOrTRANSFORMATIONOrMAPPLETOrMAPPINGOrSHORTCUTOrEXPRMACRO().add(var32.get(i));
            }
         }
      }

      ChildSeMappingUtil mgu = new ChildSeMappingUtil();
      if (mb != null && mb.size() > 0) {
         new MAPPING();
         MAPPING var34 = mgu.getSeChildMapping(mappingname, mb, paramList);
         folder.getFOLDERVERSIONOrCONFIGOrSCHEDULEROrTASKOrSESSIONOrWORKLETOrWORKFLOWOrSOURCEOrTARGETOrTRANSFORMATIONOrMAPPLETOrMAPPINGOrSHORTCUTOrEXPRMACRO().add(var34);
      }

      new CONFIG();
      Configutil cu = new Configutil();
      CONFIG var35 = cu.getConfig();
      folder.getFOLDERVERSIONOrCONFIGOrSCHEDULEROrTASKOrSESSIONOrWORKLETOrWORKFLOWOrSOURCEOrTARGETOrTRANSFORMATIONOrMAPPLETOrMAPPINGOrSHORTCUTOrEXPRMACRO().add(var35);
      ChildSeWorkflowUtil gwf = new ChildSeWorkflowUtil();
      if (wb != null && wb.size() > 0) {
         new WORKFLOW();
         WORKFLOW alllist = gwf.getSeChildWorkflow(mappingname, workflowname, tengine.getInteservicename(), tengine.getDomainname(), wb, paramfilepath);
         folder.getFOLDERVERSIONOrCONFIGOrSCHEDULEROrTASKOrSESSIONOrWORKLETOrWORKFLOWOrSOURCEOrTARGETOrTRANSFORMATIONOrMAPPLETOrMAPPINGOrSHORTCUTOrEXPRMACRO().add(alllist);
      }

      repository.getFOLDER().add(folder);
      powermart.getREPOSITORY().add(repository);
      List<Object> alllist = new ArrayList();
      alllist.add(powermart);
      OutputStream f = null;
      OutputStream var37 = new FileOutputStream(ApplicationConstants.exefile_path + taskname + ".xml");
      ToObjutil.marshal("com.chenyang.nse.bussiness.xmlbean", alllist, var37, "");
   }
}
