Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2016
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 105.80 KB | None | 0 0
  1. // ============================================================================
  2. //
  3. // Copyright (c) 2006-2015, Talend Inc.
  4. //
  5. // This source code has been automatically generated by_Talend Open Studio for ESB
  6. // / Licensed under the Apache License, Version 2.0 (the "License");
  7. // you may not use this file except in compliance with the License.
  8. // You may obtain a copy of the License at
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16.  
  17. package local_project.penetapan_0_1;
  18.  
  19. import routines.aaa;
  20. import routines.KoreksiRoutine;
  21. import routines.DataOperation;
  22. import routines.TalendDataGenerator;
  23. import routines.Relational;
  24. import routines.Mathematical;
  25. import routines.PenetapanRoutine;
  26. import routines.updatePendapatan;
  27. import routines.Numeric;
  28. import routines.PembatalanRoutine;
  29. import routines.TalendString;
  30. import routines.StringHandling;
  31. import routines.TalendDate;
  32. import routines.KeringananRoutine;
  33. import routines.GenerateNtpd;
  34. import routines.system.*;
  35. import routines.system.api.*;
  36. import java.text.ParseException;
  37. import java.text.SimpleDateFormat;
  38. import java.util.Date;
  39. import java.util.List;
  40. import java.math.BigDecimal;
  41. import java.io.ByteArrayOutputStream;
  42. import java.io.ByteArrayInputStream;
  43. import java.io.DataInputStream;
  44. import java.io.DataOutputStream;
  45. import java.io.ObjectOutputStream;
  46. import java.io.ObjectInputStream;
  47. import java.io.IOException;
  48. import java.util.Comparator;
  49.  
  50. @SuppressWarnings("unused")
  51. /**
  52.  * Job: Penetapan Purpose: Penetapan<br>
  53.  * Description: Penetapan <br>
  54.  * @author user@talend.com
  55.  * @version 6.3.0.20161026_1219
  56.  * @status
  57.  */
  58. public class Penetapan implements TalendJob {
  59.  
  60.     public final Object obj = new Object();
  61.  
  62.     // for transmiting parameters purpose
  63.     private Object valueObject = null;
  64.  
  65.     public Object getValueObject() {
  66.         return this.valueObject;
  67.     }
  68.  
  69.     public void setValueObject(Object valueObject) {
  70.         this.valueObject = valueObject;
  71.     }
  72.  
  73.     private final static String defaultCharset = java.nio.charset.Charset
  74.             .defaultCharset().name();
  75.  
  76.     private final static String utf8Charset = "UTF-8";
  77.  
  78.     // create and load default properties
  79.     private java.util.Properties defaultProps = new java.util.Properties();
  80.  
  81.     // create application properties with default
  82.     public class ContextProperties extends java.util.Properties {
  83.  
  84.         private static final long serialVersionUID = 1L;
  85.  
  86.         public ContextProperties(java.util.Properties properties) {
  87.             super(properties);
  88.         }
  89.  
  90.         public ContextProperties() {
  91.             super();
  92.         }
  93.  
  94.         public void synchronizeContext() {
  95.  
  96.         }
  97.  
  98.     }
  99.  
  100.     private ContextProperties context = new ContextProperties();
  101.  
  102.     public ContextProperties getContext() {
  103.         return this.context;
  104.     }
  105.  
  106.     private final String jobVersion = "0.1";
  107.     private final String jobName = "Penetapan";
  108.     private final String projectName = "LOCAL_PROJECT";
  109.     public Integer errorCode = null;
  110.     private String currentComponent = "";
  111.  
  112.     private final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
  113.     private final static java.util.Map<String, Object> junitGlobalMap = new java.util.HashMap<String, Object>();
  114.  
  115.     private final java.util.Map<String, Long> start_Hash = new java.util.HashMap<String, Long>();
  116.     private final java.util.Map<String, Long> end_Hash = new java.util.HashMap<String, Long>();
  117.     private final java.util.Map<String, Boolean> ok_Hash = new java.util.HashMap<String, Boolean>();
  118.     public final java.util.List<String[]> globalBuffer = new java.util.ArrayList<String[]>();
  119.  
  120.     // OSGi DataSource
  121.     private final static String KEY_DB_DATASOURCES = "KEY_DB_DATASOURCES";
  122.  
  123.     public void setDataSources(
  124.             java.util.Map<String, javax.sql.DataSource> dataSources) {
  125.         java.util.Map<String, routines.system.TalendDataSource> talendDataSources = new java.util.HashMap<String, routines.system.TalendDataSource>();
  126.         for (java.util.Map.Entry<String, javax.sql.DataSource> dataSourceEntry : dataSources
  127.                 .entrySet()) {
  128.             talendDataSources.put(
  129.                     dataSourceEntry.getKey(),
  130.                     new routines.system.TalendDataSource(dataSourceEntry
  131.                             .getValue()));
  132.         }
  133.         globalMap.put(KEY_DB_DATASOURCES, talendDataSources);
  134.     }
  135.  
  136.     private final java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
  137.     private final java.io.PrintStream errorMessagePS = new java.io.PrintStream(
  138.             new java.io.BufferedOutputStream(baos));
  139.  
  140.     public String getExceptionStackTrace() {
  141.         if ("failure".equals(this.getStatus())) {
  142.             errorMessagePS.flush();
  143.             return baos.toString();
  144.         }
  145.         return null;
  146.     }
  147.  
  148.     private Exception exception;
  149.  
  150.     public Exception getException() {
  151.         if ("failure".equals(this.getStatus())) {
  152.             return this.exception;
  153.         }
  154.         return null;
  155.     }
  156.  
  157.     private class TalendException extends Exception {
  158.  
  159.         private static final long serialVersionUID = 1L;
  160.  
  161.         private java.util.Map<String, Object> globalMap = null;
  162.         private Exception e = null;
  163.         private String currentComponent = null;
  164.         private String virtualComponentName = null;
  165.  
  166.         public void setVirtualComponentName(String virtualComponentName) {
  167.             this.virtualComponentName = virtualComponentName;
  168.         }
  169.  
  170.         private TalendException(Exception e, String errorComponent,
  171.                 final java.util.Map<String, Object> globalMap) {
  172.             this.currentComponent = errorComponent;
  173.             this.globalMap = globalMap;
  174.             this.e = e;
  175.         }
  176.  
  177.         public Exception getException() {
  178.             return this.e;
  179.         }
  180.  
  181.         public String getCurrentComponent() {
  182.             return this.currentComponent;
  183.         }
  184.  
  185.         public String getExceptionCauseMessage(Exception e) {
  186.             Throwable cause = e;
  187.             String message = null;
  188.             int i = 10;
  189.             while (null != cause && 0 < i--) {
  190.                 message = cause.getMessage();
  191.                 if (null == message) {
  192.                     cause = cause.getCause();
  193.                 } else {
  194.                     break;
  195.                 }
  196.             }
  197.             if (null == message) {
  198.                 message = e.getClass().getName();
  199.             }
  200.             return message;
  201.         }
  202.  
  203.         @Override
  204.         public void printStackTrace() {
  205.             if (!(e instanceof TalendException || e instanceof TDieException)) {
  206.                 if (virtualComponentName != null
  207.                         && currentComponent.indexOf(virtualComponentName + "_") == 0) {
  208.                     globalMap.put(virtualComponentName + "_ERROR_MESSAGE",
  209.                             getExceptionCauseMessage(e));
  210.                 }
  211.                 globalMap.put(currentComponent + "_ERROR_MESSAGE",
  212.                         getExceptionCauseMessage(e));
  213.                 System.err
  214.                         .println("Exception in component " + currentComponent);
  215.             }
  216.             if (!(e instanceof TDieException)) {
  217.                 if (e instanceof TalendException) {
  218.                     e.printStackTrace();
  219.                 } else {
  220.                     e.printStackTrace();
  221.                     e.printStackTrace(errorMessagePS);
  222.                     Penetapan.this.exception = e;
  223.                 }
  224.             }
  225.             if (!(e instanceof TalendException)) {
  226.                 try {
  227.                     for (java.lang.reflect.Method m : this.getClass()
  228.                             .getEnclosingClass().getMethods()) {
  229.                         if (m.getName().compareTo(currentComponent + "_error") == 0) {
  230.                             m.invoke(Penetapan.this, new Object[] { e,
  231.                                     currentComponent, globalMap });
  232.                             break;
  233.                         }
  234.                     }
  235.  
  236.                     if (!(e instanceof TDieException)) {
  237.                     }
  238.                 } catch (Exception e) {
  239.                     this.e.printStackTrace();
  240.                 }
  241.             }
  242.         }
  243.     }
  244.  
  245.     public void tRESTResponse_1_error(Exception exception,
  246.             String errorComponent, final java.util.Map<String, Object> globalMap)
  247.             throws TalendException {
  248.  
  249.         end_Hash.put(errorComponent, System.currentTimeMillis());
  250.  
  251.         status = "failure";
  252.  
  253.         tRESTRequest_1_Loop_onSubJobError(exception, errorComponent, globalMap);
  254.     }
  255.  
  256.     public void tMysqlOutput_1_error(Exception exception,
  257.             String errorComponent, final java.util.Map<String, Object> globalMap)
  258.             throws TalendException {
  259.  
  260.         end_Hash.put(errorComponent, System.currentTimeMillis());
  261.  
  262.         status = "failure";
  263.  
  264.         tRESTRequest_1_Loop_onSubJobError(exception, errorComponent, globalMap);
  265.     }
  266.  
  267.     public void tRESTRequest_1_Loop_error(Exception exception,
  268.             String errorComponent, final java.util.Map<String, Object> globalMap)
  269.             throws TalendException {
  270.  
  271.         tRESTRequest_1_In_error(exception, errorComponent, globalMap);
  272.  
  273.     }
  274.  
  275.     public void tRESTRequest_1_In_error(Exception exception,
  276.             String errorComponent, final java.util.Map<String, Object> globalMap)
  277.             throws TalendException {
  278.  
  279.         end_Hash.put(errorComponent, System.currentTimeMillis());
  280.  
  281.         status = "failure";
  282.  
  283.         tRESTRequest_1_Loop_onSubJobError(exception, errorComponent, globalMap);
  284.     }
  285.  
  286.     public void tXMLMap_1_TXMLMAP_OUT_error(Exception exception,
  287.             String errorComponent, final java.util.Map<String, Object> globalMap)
  288.             throws TalendException {
  289.  
  290.         tXMLMap_1_TXMLMAP_IN_error(exception, errorComponent, globalMap);
  291.  
  292.     }
  293.  
  294.     public void tXMLMap_1_TXMLMAP_IN_error(Exception exception,
  295.             String errorComponent, final java.util.Map<String, Object> globalMap)
  296.             throws TalendException {
  297.  
  298.         end_Hash.put(errorComponent, System.currentTimeMillis());
  299.  
  300.         status = "failure";
  301.  
  302.         tRESTRequest_1_Loop_onSubJobError(exception, errorComponent, globalMap);
  303.     }
  304.  
  305.     public void tRESTRequest_1_Loop_onSubJobError(Exception exception,
  306.             String errorComponent, final java.util.Map<String, Object> globalMap)
  307.             throws TalendException {
  308.  
  309.         resumeUtil.addLog("SYSTEM_LOG", "NODE:" + errorComponent, "", Thread
  310.                 .currentThread().getId() + "", "FATAL", "",
  311.                 exception.getMessage(),
  312.                 ResumeUtil.getExceptionStackTrace(exception), "");
  313.  
  314.     }
  315.  
  316.     private boolean runInTalendEsbRuntimeContainer = false;
  317.  
  318.     public void setRunInTalendEsbRuntimeContainer(boolean flag) {
  319.         runInTalendEsbRuntimeContainer = flag;
  320.     }
  321.  
  322.     private boolean restTalendJobAlreadyStarted = false;
  323.  
  324.     /**
  325.      * REST provider implementation
  326.      */
  327.     @javax.ws.rs.Path("/")
  328.     public static class RestServiceProviderImpl4TalendJob {
  329.  
  330.         @javax.ws.rs.core.Context
  331.         private org.apache.cxf.jaxrs.ext.MessageContext messageContext;
  332.  
  333.         private final Penetapan job;
  334.  
  335.         public RestServiceProviderImpl4TalendJob(Penetapan job) {
  336.             this.job = job;
  337.         }
  338.  
  339.         private void populateRequestWithJobContext(
  340.                 java.util.Map<String, Object> requestGlobalMap, Penetapan job) {
  341.             // pass job DataSources
  342.             java.util.Map<String, routines.system.TalendDataSource> talendDataSources = (java.util.Map<String, routines.system.TalendDataSource>) job.globalMap
  343.                     .get(KEY_DB_DATASOURCES);
  344.             if (null != talendDataSources) {
  345.                 java.util.Map<String, routines.system.TalendDataSource> restDataSources = new java.util.HashMap<String, routines.system.TalendDataSource>();
  346.                 for (java.util.Map.Entry<String, routines.system.TalendDataSource> talendDataSourceEntry : talendDataSources
  347.                         .entrySet()) {
  348.                     restDataSources.put(talendDataSourceEntry.getKey(),
  349.                             new routines.system.TalendDataSource(
  350.                                     talendDataSourceEntry.getValue()
  351.                                             .getRawDataSource()));
  352.                 }
  353.                 requestGlobalMap.put(KEY_DB_DATASOURCES, restDataSources);
  354.             }
  355.  
  356.             // pass job shared connections
  357.             requestGlobalMap.putAll(job.getSharedConnections4REST());
  358.  
  359.             // pass job concurrent map
  360.             requestGlobalMap.put("concurrentHashMap",
  361.                     job.globalMap.get("concurrentHashMap"));
  362.         }
  363.  
  364.         private void closePassedDataSourceConnections(
  365.                 java.util.Map<String, Object> requestGlobalMap) {
  366.             // close connections in passed job DataSources
  367.             try {
  368.                 java.util.Map<String, routines.system.TalendDataSource> restDataSources = (java.util.Map<String, routines.system.TalendDataSource>) requestGlobalMap
  369.                         .get(KEY_DB_DATASOURCES);
  370.                 if (null != restDataSources) {
  371.                     for (routines.system.TalendDataSource restDataSource : restDataSources
  372.                             .values()) {
  373.                         restDataSource.close();
  374.                     }
  375.                 }
  376.             } catch (Throwable e) {
  377.                 e.printStackTrace(System.err);
  378.             }
  379.         }
  380.  
  381.         private javax.ws.rs.core.Response processRequest(
  382.                 java.util.Map<String, Object> request) {
  383.             final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
  384.             try {
  385.                 globalMap.put("restRequest", request);
  386.  
  387.                 populateRequestWithJobContext(globalMap, job);
  388.  
  389.                 job.tRESTRequest_1_LoopProcess(globalMap);
  390.  
  391.                 java.util.Map<String, Object> response = (java.util.Map<String, Object>) globalMap
  392.                         .get("restResponse");
  393.  
  394.                 Object responseBody = null;
  395.                 Integer status = null;
  396.                 java.util.Map<String, String> headers = null;
  397.                 if (null != response) {
  398.                     Object dropJsonRootProp = response
  399.                             .get("drop.json.root.element");
  400.                     Boolean dropJsonRoot = (null == dropJsonRootProp) ? false
  401.                             : (Boolean) dropJsonRootProp;
  402.                     messageContext.put("drop.json.root.element",
  403.                             dropJsonRoot.toString());
  404.  
  405.                     responseBody = response.get("BODY");
  406.                     status = (Integer) response.get("STATUS");
  407.                     headers = (java.util.Map<String, String>) response
  408.                             .get("HEADERS");
  409.                 }
  410.                 if (null == status) {
  411.                     status = (request.containsKey("STATUS")) ? (Integer) request
  412.                             .get("STATUS") : 404;
  413.                 }
  414.  
  415.                 javax.ws.rs.core.Response.ResponseBuilder responseBuilder = javax.ws.rs.core.Response
  416.                         .status(status).entity(responseBody);
  417.                 if (headers != null) {
  418.                     for (java.util.Map.Entry<String, String> header : headers
  419.                             .entrySet()) {
  420.                         responseBuilder.header(header.getKey(),
  421.                                 header.getValue());
  422.                     }
  423.                 }
  424.  
  425.                 return responseBuilder.build();
  426.  
  427.             } catch (Throwable ex) {
  428.                 ex.printStackTrace();
  429.                 throw new javax.ws.rs.WebApplicationException(ex, 500);
  430.             } finally {
  431.                 // close DB connections
  432.                 closePassedDataSourceConnections(globalMap);
  433.             }
  434.         }
  435.  
  436.         private javax.ws.rs.core.Response processStreamingResponseRequest(
  437.                 final java.util.Map<String, Object> request) {
  438.  
  439.             javax.ws.rs.core.StreamingOutput streamingOutput = new javax.ws.rs.core.StreamingOutput() {
  440.                 public void write(java.io.OutputStream output) {
  441.                     final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
  442.                     try {
  443.                         globalMap.put("restResponseStream", output);
  444.  
  445.                         globalMap.put("restRequest", request);
  446.  
  447.                         populateRequestWithJobContext(globalMap, job);
  448.  
  449.                         job.tRESTRequest_1_LoopProcess(globalMap);
  450.  
  451.                         if (globalMap
  452.                                 .containsKey("restResponseWrappingClosure")) {
  453.                             output.write(((String) globalMap
  454.                                     .get("restResponseWrappingClosure"))
  455.                                     .getBytes());
  456.                         }
  457.                     } catch (Throwable ex) {
  458.                         ex.printStackTrace();
  459.                         throw new javax.ws.rs.WebApplicationException(ex, 500);
  460.                     } finally {
  461.                         // close DB connections
  462.                         closePassedDataSourceConnections(globalMap);
  463.                     }
  464.                 }
  465.             };
  466.  
  467.             return javax.ws.rs.core.Response.ok().entity(streamingOutput)
  468.                     .build();
  469.         }
  470.  
  471.         @javax.ws.rs.POST()
  472.         @javax.ws.rs.Path("/")
  473.         @javax.ws.rs.Consumes({ "application/json" })
  474.         @javax.ws.rs.Produces({ "application/json" })
  475.         public javax.ws.rs.core.Response in(
  476.  
  477.         org.dom4j.Document body
  478.  
  479.         ) {
  480.             java.util.Map<String, Object> request_tRESTRequest_1 = new java.util.HashMap<String, Object>();
  481.             request_tRESTRequest_1.put("VERB", "POST");
  482.             request_tRESTRequest_1.put("OPERATION", "in");
  483.             request_tRESTRequest_1.put("PATTERN", "/");
  484.  
  485.             request_tRESTRequest_1.put("BODY", body);
  486.  
  487.             populateRequestInfo(request_tRESTRequest_1, messageContext);
  488.  
  489.             java.util.Map<String, Object> parameters_tRESTRequest_1 = new java.util.HashMap<String, Object>();
  490.  
  491.             request_tRESTRequest_1.put("PARAMS", parameters_tRESTRequest_1);
  492.  
  493.             return processStreamingResponseRequest(request_tRESTRequest_1);
  494.         }
  495.  
  496.         public javax.ws.rs.core.Response handleWrongRequest(
  497.                 org.apache.cxf.jaxrs.ext.MessageContext context, int status,
  498.                 String error) {
  499.  
  500.             // System.out.println("wrong call [uri: " +
  501.             // context.getUriInfo().getPath() + " ; method: " +
  502.             // context.getRequest().getMethod() + " ; status: " + status +
  503.             // " ; error: " + error + "]");
  504.  
  505.             java.util.Map<String, Object> wrongRequest = new java.util.HashMap<String, Object>();
  506.             wrongRequest.put("ERROR", error);
  507.             wrongRequest.put("STATUS", status);
  508.             wrongRequest.put("VERB", context.getRequest().getMethod());
  509.             wrongRequest.put("URI", context.getUriInfo().getPath());
  510.             wrongRequest.put("URI_BASE", context.getUriInfo().getBaseUri()
  511.                     .toString());
  512.             wrongRequest.put("URI_ABSOLUTE", context.getUriInfo()
  513.                     .getAbsolutePath().toString());
  514.             wrongRequest.put("URI_REQUEST", context.getUriInfo()
  515.                     .getRequestUri().toString());
  516.  
  517.             return processRequest(wrongRequest);
  518.         }
  519.  
  520.         private void populateRequestInfo(java.util.Map<String, Object> request,
  521.                 org.apache.cxf.jaxrs.ext.MessageContext context) {
  522.             final javax.ws.rs.core.UriInfo ui = context.getUriInfo();
  523.  
  524.             request.put("URI", ui.getPath());
  525.             request.put("URI_BASE", ui.getBaseUri().toString());
  526.             request.put("URI_ABSOLUTE", ui.getAbsolutePath().toString());
  527.             request.put("URI_REQUEST", ui.getRequestUri().toString());
  528.  
  529.             request.put("ALL_HEADER_PARAMS", context.getHttpHeaders()
  530.                     .getRequestHeaders());
  531.             request.put("ALL_QUERY_PARAMS", ui.getQueryParameters());
  532.  
  533.             javax.ws.rs.core.SecurityContext securityContext = context
  534.                     .getSecurityContext();
  535.             if (null != securityContext
  536.                     && null != securityContext.getUserPrincipal()) {
  537.                 request.put("PRINCIPAL_NAME", securityContext
  538.                         .getUserPrincipal().getName());
  539.             }
  540.  
  541.             request.put("CorrelationID", context.get("CorrelationID"));
  542.  
  543.             request.put("MESSAGE_CONTEXT", context);
  544.         }
  545.  
  546.         private void populateMultipartRequestInfo(
  547.                 java.util.Map<String, Object> request,
  548.                 org.apache.cxf.jaxrs.ext.MessageContext context,
  549.                 java.util.List<String> partNames) {
  550.             java.util.Map<String, String> attachmentFilenames = new java.util.HashMap<String, String>();
  551.  
  552.             java.util.Map<String, java.util.Map<String, java.util.List<String>>> attachmentHeaders = new java.util.HashMap<String, java.util.Map<String, java.util.List<String>>>();
  553.  
  554.             for (String partName : partNames) {
  555.                 org.apache.cxf.jaxrs.ext.multipart.Attachment attachment = getFirstMatchingPart(
  556.                         context, partName);
  557.                 if (null != attachment) {
  558.                     attachmentHeaders.put(partName, attachment.getHeaders());
  559.                     if (null != attachment.getContentDisposition()) {
  560.                         String filename = attachment.getContentDisposition()
  561.                                 .getParameter("filename");
  562.                         if (null != filename) {
  563.                             attachmentFilenames.put(partName, filename);
  564.                         }
  565.                     }
  566.                 }
  567.             }
  568.  
  569.             request.put("ATTACHMENT_HEADERS", attachmentHeaders);
  570.             request.put("ATTACHMENT_FILENAMES", attachmentFilenames);
  571.         }
  572.  
  573.         private static org.apache.cxf.jaxrs.ext.multipart.Attachment getFirstMatchingPart(
  574.                 org.apache.cxf.jaxrs.ext.MessageContext context, String partName) {
  575.             List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments = org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils
  576.                     .getAttachments(context);
  577.             for (org.apache.cxf.jaxrs.ext.multipart.Attachment attachment : attachments) {
  578.                 if (partName.equals(attachment.getContentId())) {
  579.                     return attachment;
  580.                 }
  581.                 org.apache.cxf.jaxrs.ext.multipart.ContentDisposition cd = attachment
  582.                         .getContentDisposition();
  583.                 if (null != cd && partName.equals(cd.getParameter("name"))) {
  584.                     return attachment;
  585.                 }
  586.             }
  587.             // unexpected
  588.             throw new javax.ws.rs.InternalServerErrorException();
  589.         }
  590.     }
  591.  
  592.     public static class ExceptionMapper4TalendJobRestService extends
  593.             org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper {
  594.  
  595.         @javax.ws.rs.core.Context
  596.         private org.apache.cxf.jaxrs.ext.MessageContext messageContext;
  597.  
  598.         private RestServiceProviderImpl4TalendJob provider;
  599.  
  600.         public ExceptionMapper4TalendJobRestService(
  601.                 RestServiceProviderImpl4TalendJob provider) {
  602.             this.provider = provider;
  603.         }
  604.  
  605.         public javax.ws.rs.core.Response toResponse(
  606.                 javax.ws.rs.WebApplicationException ex) {
  607.             String error = null;
  608.             javax.ws.rs.core.Response response = ex.getResponse();
  609.             if (null != response && null != response.getEntity()) {
  610.                 error = response.getEntity().toString();
  611.             }
  612.             response = super.toResponse(ex);
  613.             if (null == error) {
  614.                 if (null != response && null != response.getEntity()) {
  615.                     error = response.getEntity().toString();
  616.                 } else {
  617.                     error = null == ex.getCause() ? ex.getMessage() : ex
  618.                             .getCause().getMessage();
  619.                 }
  620.             }
  621.             response = provider.handleWrongRequest(messageContext,
  622.                     response.getStatus(), error);
  623.  
  624.             java.util.List<javax.ws.rs.core.MediaType> accepts = messageContext
  625.                     .getHttpHeaders().getAcceptableMediaTypes();
  626.             javax.ws.rs.core.MediaType responseType = accepts.isEmpty() ? null
  627.                     : accepts.get(0);
  628.  
  629.             if (responseType == null
  630.                     || !responseType.getSubtype().equals("xml")
  631.                     && !responseType.getSubtype().equals("json")) {
  632.                 responseType = javax.ws.rs.core.MediaType.APPLICATION_XML_TYPE;
  633.             }
  634.  
  635.             javax.ws.rs.core.Response r = javax.ws.rs.core.Response
  636.                     .status(response.getStatus()).entity(response.getEntity())
  637.                     .type(responseType).build();
  638.  
  639.             if (response.getHeaders() != null) {
  640.                 r.getHeaders().putAll(response.getHeaders());
  641.             }
  642.  
  643.             return r;
  644.         }
  645.     }
  646.  
  647.     private String checkEndpointUrl(String url) {
  648.         final String defaultEndpointUrl = "http://127.0.0.1:8090/";
  649.  
  650.         String endpointUrl = url;
  651.         if (null == endpointUrl || endpointUrl.trim().isEmpty()) {
  652.             endpointUrl = defaultEndpointUrl;
  653.         } else if (!endpointUrl.contains("://")) { // relative
  654.             if (endpointUrl.startsWith("/")) {
  655.                 endpointUrl = endpointUrl.substring(1);
  656.             }
  657.             endpointUrl = defaultEndpointUrl + endpointUrl;
  658.         }
  659.  
  660.         // test for busy
  661.         java.net.URI endpointURI = java.net.URI.create(endpointUrl);
  662.         String host = endpointURI.getHost();
  663.         try {
  664.             if (java.net.InetAddress.getByName(host).isLoopbackAddress()) {
  665.                 int port = endpointURI.getPort();
  666.                 java.net.ServerSocket ss = null;
  667.                 try {
  668.                     ss = new java.net.ServerSocket(port);
  669.                 } catch (IOException e) {
  670.                     // rethrow exception
  671.                     throw new IllegalArgumentException(
  672.                             "Cannot start provider with uri: " + endpointUrl
  673.                                     + ". Port " + port + " already in use.");
  674.                 } finally {
  675.                     if (ss != null) {
  676.                         try {
  677.                             ss.close();
  678.                         } catch (IOException e) {
  679.                             // ignore
  680.                         }
  681.                     }
  682.                 }
  683.                 try {
  684.                     // ok, let's doublecheck for silent listeners
  685.                     java.net.Socket cs = new java.net.Socket(host, port);
  686.                     // if succeed - somebody silently listening, fail!
  687.                     cs.close();
  688.                     // rethrow exception
  689.                     throw new IllegalArgumentException(
  690.                             "Cannot start provider with uri: " + endpointUrl
  691.                                     + ". Port " + port + " already in use.");
  692.                 } catch (IOException e) {
  693.                     // ok, nobody listens, proceed
  694.                 }
  695.             }
  696.         } catch (java.net.UnknownHostException e) {
  697.             // ignore
  698.         }
  699.  
  700.         return endpointUrl;
  701.     }
  702.  
  703.     public static class StreamingDOM4JProvider extends
  704.             org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider {
  705.  
  706.         public static final String SUPRESS_XML_DECLARATION = "supress.xml.declaration";
  707.  
  708.         public void writeTo(org.dom4j.Document doc, Class<?> cls,
  709.                 java.lang.reflect.Type type,
  710.                 java.lang.annotation.Annotation[] anns,
  711.                 javax.ws.rs.core.MediaType mt,
  712.                 javax.ws.rs.core.MultivaluedMap<String, Object> headers,
  713.                 java.io.OutputStream os) throws java.io.IOException,
  714.                 javax.ws.rs.WebApplicationException {
  715.             if (mt.getSubtype().contains("xml")) {
  716.                 org.dom4j.io.XMLWriter writer;
  717.                 if (org.apache.cxf.jaxrs.utils.JAXRSUtils.getCurrentMessage()
  718.                         .getExchange().containsKey(SUPRESS_XML_DECLARATION)) {
  719.                     org.dom4j.io.OutputFormat format = new org.dom4j.io.OutputFormat();
  720.                     format.setSuppressDeclaration(true);
  721.                     writer = new org.dom4j.io.XMLWriter(os, format);
  722.                 } else {
  723.                     writer = new org.dom4j.io.XMLWriter(os);
  724.                 }
  725.                 writer.write(doc);
  726.                 writer.flush();
  727.             } else {
  728.                 super.writeTo(doc, cls, type, anns, mt, headers, os);
  729.             }
  730.         }
  731.     }
  732.  
  733.     Thread4RestServiceProviderEndpoint thread4RestServiceProviderEndpoint = null;
  734.  
  735.     class Thread4RestServiceProviderEndpoint extends Thread {
  736.  
  737.         private final String endpointUrl;
  738.  
  739.         private final Penetapan job;
  740.  
  741.         private org.apache.cxf.endpoint.Server server;
  742.  
  743.         public Thread4RestServiceProviderEndpoint(Penetapan job,
  744.                 String endpointUrl) {
  745.             this.job = job;
  746.             this.endpointUrl = endpointUrl;
  747.         }
  748.  
  749.         public void run() {
  750.             try {
  751.                 RestServiceProviderImpl4TalendJob provider = new RestServiceProviderImpl4TalendJob(
  752.                         job);
  753.  
  754.                 org.apache.cxf.jaxrs.JAXRSServerFactoryBean sf = new org.apache.cxf.jaxrs.JAXRSServerFactoryBean();
  755.                 java.util.List<Object> providers = new java.util.ArrayList<Object>();
  756.                 providers
  757.                         .add(new ExceptionMapper4TalendJobRestService(provider));
  758.                 providers.add(new StreamingDOM4JProvider());
  759.                 org.apache.cxf.jaxrs.provider.json.JSONProvider jsonProvider = new org.apache.cxf.jaxrs.provider.json.JSONProvider();
  760.                 jsonProvider.setIgnoreNamespaces(true);
  761.                 jsonProvider.setAttributesToElements(true);
  762.  
  763.                 jsonProvider.setConvertTypesToStrings(false);
  764.  
  765.                 providers.add(jsonProvider);
  766.                 sf.setProviders(providers);
  767.                 sf.setTransportId("http://cxf.apache.org/transports/http");
  768.                 sf.setResourceClasses(RestServiceProviderImpl4TalendJob.class);
  769.                 sf.setResourceProvider(
  770.                         RestServiceProviderImpl4TalendJob.class,
  771.                         new org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider(
  772.                                 provider));
  773.                 sf.setAddress(endpointUrl);
  774.  
  775.                 final java.util.List<org.apache.cxf.feature.Feature> features = new java.util.ArrayList<org.apache.cxf.feature.Feature>();
  776.  
  777.                 sf.setFeatures(features);
  778.  
  779.                 server = sf.create();
  780.  
  781.                 // System.out.println("REST service [endpoint: " + endpointUrl +
  782.                 // "] published");
  783.             } catch (Throwable e) {
  784.                 e.printStackTrace();
  785.             }
  786.         }
  787.  
  788.         public void stopEndpoint() {
  789.             if (null != server) {
  790.                 server.stop();
  791.                 server.destroy();
  792.                 // System.out.println("REST service [endpoint: " + endpointUrl +
  793.                 // "] unpublished");
  794.             }
  795.         }
  796.     }
  797.  
  798.     public static class penetapanStruct implements
  799.             routines.system.IPersistableRow<penetapanStruct> {
  800.         final static byte[] commonByteArrayLock_LOCAL_PROJECT_Penetapan = new byte[0];
  801.         static byte[] commonByteArray_LOCAL_PROJECT_Penetapan = new byte[0];
  802.  
  803.         public routines.system.Document body;
  804.  
  805.         public routines.system.Document getBody() {
  806.             return this.body;
  807.         }
  808.  
  809.         public void readData(ObjectInputStream dis) {
  810.  
  811.             synchronized (commonByteArrayLock_LOCAL_PROJECT_Penetapan) {
  812.  
  813.                 try {
  814.  
  815.                     int length = 0;
  816.  
  817.                     this.body = (routines.system.Document) dis.readObject();
  818.  
  819.                 } catch (IOException e) {
  820.                     throw new RuntimeException(e);
  821.  
  822.                 } catch (ClassNotFoundException eCNFE) {
  823.                     throw new RuntimeException(eCNFE);
  824.  
  825.                 }
  826.  
  827.             }
  828.  
  829.         }
  830.  
  831.         public void writeData(ObjectOutputStream dos) {
  832.             try {
  833.  
  834.                 // Document
  835.  
  836.                 dos.writeObject(this.body);
  837.  
  838.             } catch (IOException e) {
  839.                 throw new RuntimeException(e);
  840.             }
  841.  
  842.         }
  843.  
  844.         public String toString() {
  845.  
  846.             StringBuilder sb = new StringBuilder();
  847.             sb.append(super.toString());
  848.             sb.append("[");
  849.             sb.append("body=" + String.valueOf(body));
  850.             sb.append("]");
  851.  
  852.             return sb.toString();
  853.         }
  854.  
  855.         /**
  856.          * Compare keys
  857.          */
  858.         public int compareTo(penetapanStruct other) {
  859.  
  860.             int returnValue = -1;
  861.  
  862.             return returnValue;
  863.         }
  864.  
  865.         private int checkNullsAndCompare(Object object1, Object object2) {
  866.             int returnValue = 0;
  867.             if (object1 instanceof Comparable && object2 instanceof Comparable) {
  868.                 returnValue = ((Comparable) object1).compareTo(object2);
  869.             } else if (object1 != null && object2 != null) {
  870.                 returnValue = compareStrings(object1.toString(),
  871.                         object2.toString());
  872.             } else if (object1 == null && object2 != null) {
  873.                 returnValue = 1;
  874.             } else if (object1 != null && object2 == null) {
  875.                 returnValue = -1;
  876.             } else {
  877.                 returnValue = 0;
  878.             }
  879.  
  880.             return returnValue;
  881.         }
  882.  
  883.         private int compareStrings(String string1, String string2) {
  884.             return string1.compareTo(string2);
  885.         }
  886.  
  887.     }
  888.  
  889.     public static class insert_pendapatanStruct implements
  890.             routines.system.IPersistableRow<insert_pendapatanStruct> {
  891.         final static byte[] commonByteArrayLock_LOCAL_PROJECT_Penetapan = new byte[0];
  892.         static byte[] commonByteArray_LOCAL_PROJECT_Penetapan = new byte[0];
  893.  
  894.         public String no_penetapan;
  895.  
  896.         public String getNo_penetapan() {
  897.             return this.no_penetapan;
  898.         }
  899.  
  900.         public String kode_penetapan;
  901.  
  902.         public String getKode_penetapan() {
  903.             return this.kode_penetapan;
  904.         }
  905.  
  906.         public String jenis_id;
  907.  
  908.         public String getJenis_id() {
  909.             return this.jenis_id;
  910.         }
  911.  
  912.         public String no_id;
  913.  
  914.         public String getNo_id() {
  915.             return this.no_id;
  916.         }
  917.  
  918.         public String nama;
  919.  
  920.         public String getNama() {
  921.             return this.nama;
  922.         }
  923.  
  924.         public String alamat;
  925.  
  926.         public String getAlamat() {
  927.             return this.alamat;
  928.         }
  929.  
  930.         public String kode_rekening_pokok;
  931.  
  932.         public String getKode_rekening_pokok() {
  933.             return this.kode_rekening_pokok;
  934.         }
  935.  
  936.         public String jumlah_pokok;
  937.  
  938.         public String getJumlah_pokok() {
  939.             return this.jumlah_pokok;
  940.         }
  941.  
  942.         public String kode_rekening_denda;
  943.  
  944.         public String getKode_rekening_denda() {
  945.             return this.kode_rekening_denda;
  946.         }
  947.  
  948.         public String jumlah_denda;
  949.  
  950.         public String getJumlah_denda() {
  951.             return this.jumlah_denda;
  952.         }
  953.  
  954.         public String nama_retribusi;
  955.  
  956.         public String getNama_retribusi() {
  957.             return this.nama_retribusi;
  958.         }
  959.  
  960.         public java.util.Date tgl_penetapan;
  961.  
  962.         public java.util.Date getTgl_penetapan() {
  963.             return this.tgl_penetapan;
  964.         }
  965.  
  966.         public java.util.Date tgl_jatuh_tempo;
  967.  
  968.         public java.util.Date getTgl_jatuh_tempo() {
  969.             return this.tgl_jatuh_tempo;
  970.         }
  971.  
  972.         public String matauang;
  973.  
  974.         public String getMatauang() {
  975.             return this.matauang;
  976.         }
  977.  
  978.         public String ukpd_id;
  979.  
  980.         public String getUkpd_id() {
  981.             return this.ukpd_id;
  982.         }
  983.  
  984.         public String skpd_id;
  985.  
  986.         public String getSkpd_id() {
  987.             return this.skpd_id;
  988.         }
  989.  
  990.         public String periode_izin;
  991.  
  992.         public String getPeriode_izin() {
  993.             return this.periode_izin;
  994.         }
  995.  
  996.         private String readString(ObjectInputStream dis) throws IOException {
  997.             String strReturn = null;
  998.             int length = 0;
  999.             length = dis.readInt();
  1000.             if (length == -1) {
  1001.                 strReturn = null;
  1002.             } else {
  1003.                 if (length > commonByteArray_LOCAL_PROJECT_Penetapan.length) {
  1004.                     if (length < 1024
  1005.                             && commonByteArray_LOCAL_PROJECT_Penetapan.length == 0) {
  1006.                         commonByteArray_LOCAL_PROJECT_Penetapan = new byte[1024];
  1007.                     } else {
  1008.                         commonByteArray_LOCAL_PROJECT_Penetapan = new byte[2 * length];
  1009.                     }
  1010.                 }
  1011.                 dis.readFully(commonByteArray_LOCAL_PROJECT_Penetapan, 0,
  1012.                         length);
  1013.                 strReturn = new String(commonByteArray_LOCAL_PROJECT_Penetapan,
  1014.                         0, length, utf8Charset);
  1015.             }
  1016.             return strReturn;
  1017.         }
  1018.  
  1019.         private void writeString(String str, ObjectOutputStream dos)
  1020.                 throws IOException {
  1021.             if (str == null) {
  1022.                 dos.writeInt(-1);
  1023.             } else {
  1024.                 byte[] byteArray = str.getBytes(utf8Charset);
  1025.                 dos.writeInt(byteArray.length);
  1026.                 dos.write(byteArray);
  1027.             }
  1028.         }
  1029.  
  1030.         private java.util.Date readDate(ObjectInputStream dis)
  1031.                 throws IOException {
  1032.             java.util.Date dateReturn = null;
  1033.             int length = 0;
  1034.             length = dis.readByte();
  1035.             if (length == -1) {
  1036.                 dateReturn = null;
  1037.             } else {
  1038.                 dateReturn = new Date(dis.readLong());
  1039.             }
  1040.             return dateReturn;
  1041.         }
  1042.  
  1043.         private void writeDate(java.util.Date date1, ObjectOutputStream dos)
  1044.                 throws IOException {
  1045.             if (date1 == null) {
  1046.                 dos.writeByte(-1);
  1047.             } else {
  1048.                 dos.writeByte(0);
  1049.                 dos.writeLong(date1.getTime());
  1050.             }
  1051.         }
  1052.  
  1053.         public void readData(ObjectInputStream dis) {
  1054.  
  1055.             synchronized (commonByteArrayLock_LOCAL_PROJECT_Penetapan) {
  1056.  
  1057.                 try {
  1058.  
  1059.                     int length = 0;
  1060.  
  1061.                     this.no_penetapan = readString(dis);
  1062.  
  1063.                     this.kode_penetapan = readString(dis);
  1064.  
  1065.                     this.jenis_id = readString(dis);
  1066.  
  1067.                     this.no_id = readString(dis);
  1068.  
  1069.                     this.nama = readString(dis);
  1070.  
  1071.                     this.alamat = readString(dis);
  1072.  
  1073.                     this.kode_rekening_pokok = readString(dis);
  1074.  
  1075.                     this.jumlah_pokok = readString(dis);
  1076.  
  1077.                     this.kode_rekening_denda = readString(dis);
  1078.  
  1079.                     this.jumlah_denda = readString(dis);
  1080.  
  1081.                     this.nama_retribusi = readString(dis);
  1082.  
  1083.                     this.tgl_penetapan = readDate(dis);
  1084.  
  1085.                     this.tgl_jatuh_tempo = readDate(dis);
  1086.  
  1087.                     this.matauang = readString(dis);
  1088.  
  1089.                     this.ukpd_id = readString(dis);
  1090.  
  1091.                     this.skpd_id = readString(dis);
  1092.  
  1093.                     this.periode_izin = readString(dis);
  1094.  
  1095.                 } catch (IOException e) {
  1096.                     throw new RuntimeException(e);
  1097.  
  1098.                 }
  1099.  
  1100.             }
  1101.  
  1102.         }
  1103.  
  1104.         public void writeData(ObjectOutputStream dos) {
  1105.             try {
  1106.  
  1107.                 // String
  1108.  
  1109.                 writeString(this.no_penetapan, dos);
  1110.  
  1111.                 // String
  1112.  
  1113.                 writeString(this.kode_penetapan, dos);
  1114.  
  1115.                 // String
  1116.  
  1117.                 writeString(this.jenis_id, dos);
  1118.  
  1119.                 // String
  1120.  
  1121.                 writeString(this.no_id, dos);
  1122.  
  1123.                 // String
  1124.  
  1125.                 writeString(this.nama, dos);
  1126.  
  1127.                 // String
  1128.  
  1129.                 writeString(this.alamat, dos);
  1130.  
  1131.                 // String
  1132.  
  1133.                 writeString(this.kode_rekening_pokok, dos);
  1134.  
  1135.                 // String
  1136.  
  1137.                 writeString(this.jumlah_pokok, dos);
  1138.  
  1139.                 // String
  1140.  
  1141.                 writeString(this.kode_rekening_denda, dos);
  1142.  
  1143.                 // String
  1144.  
  1145.                 writeString(this.jumlah_denda, dos);
  1146.  
  1147.                 // String
  1148.  
  1149.                 writeString(this.nama_retribusi, dos);
  1150.  
  1151.                 // java.util.Date
  1152.  
  1153.                 writeDate(this.tgl_penetapan, dos);
  1154.  
  1155.                 // java.util.Date
  1156.  
  1157.                 writeDate(this.tgl_jatuh_tempo, dos);
  1158.  
  1159.                 // String
  1160.  
  1161.                 writeString(this.matauang, dos);
  1162.  
  1163.                 // String
  1164.  
  1165.                 writeString(this.ukpd_id, dos);
  1166.  
  1167.                 // String
  1168.  
  1169.                 writeString(this.skpd_id, dos);
  1170.  
  1171.                 // String
  1172.  
  1173.                 writeString(this.periode_izin, dos);
  1174.  
  1175.             } catch (IOException e) {
  1176.                 throw new RuntimeException(e);
  1177.             }
  1178.  
  1179.         }
  1180.  
  1181.         public String toString() {
  1182.  
  1183.             StringBuilder sb = new StringBuilder();
  1184.             sb.append(super.toString());
  1185.             sb.append("[");
  1186.             sb.append("no_penetapan=" + no_penetapan);
  1187.             sb.append(",kode_penetapan=" + kode_penetapan);
  1188.             sb.append(",jenis_id=" + jenis_id);
  1189.             sb.append(",no_id=" + no_id);
  1190.             sb.append(",nama=" + nama);
  1191.             sb.append(",alamat=" + alamat);
  1192.             sb.append(",kode_rekening_pokok=" + kode_rekening_pokok);
  1193.             sb.append(",jumlah_pokok=" + jumlah_pokok);
  1194.             sb.append(",kode_rekening_denda=" + kode_rekening_denda);
  1195.             sb.append(",jumlah_denda=" + jumlah_denda);
  1196.             sb.append(",nama_retribusi=" + nama_retribusi);
  1197.             sb.append(",tgl_penetapan=" + String.valueOf(tgl_penetapan));
  1198.             sb.append(",tgl_jatuh_tempo=" + String.valueOf(tgl_jatuh_tempo));
  1199.             sb.append(",matauang=" + matauang);
  1200.             sb.append(",ukpd_id=" + ukpd_id);
  1201.             sb.append(",skpd_id=" + skpd_id);
  1202.             sb.append(",periode_izin=" + periode_izin);
  1203.             sb.append("]");
  1204.  
  1205.             return sb.toString();
  1206.         }
  1207.  
  1208.         /**
  1209.          * Compare keys
  1210.          */
  1211.         public int compareTo(insert_pendapatanStruct other) {
  1212.  
  1213.             int returnValue = -1;
  1214.  
  1215.             return returnValue;
  1216.         }
  1217.  
  1218.         private int checkNullsAndCompare(Object object1, Object object2) {
  1219.             int returnValue = 0;
  1220.             if (object1 instanceof Comparable && object2 instanceof Comparable) {
  1221.                 returnValue = ((Comparable) object1).compareTo(object2);
  1222.             } else if (object1 != null && object2 != null) {
  1223.                 returnValue = compareStrings(object1.toString(),
  1224.                         object2.toString());
  1225.             } else if (object1 == null && object2 != null) {
  1226.                 returnValue = 1;
  1227.             } else if (object1 != null && object2 == null) {
  1228.                 returnValue = -1;
  1229.             } else {
  1230.                 returnValue = 0;
  1231.             }
  1232.  
  1233.             return returnValue;
  1234.         }
  1235.  
  1236.         private int compareStrings(String string1, String string2) {
  1237.             return string1.compareTo(string2);
  1238.         }
  1239.  
  1240.     }
  1241.  
  1242.     public static class inStruct implements
  1243.             routines.system.IPersistableRow<inStruct> {
  1244.         final static byte[] commonByteArrayLock_LOCAL_PROJECT_Penetapan = new byte[0];
  1245.         static byte[] commonByteArray_LOCAL_PROJECT_Penetapan = new byte[0];
  1246.  
  1247.         public routines.system.Document body;
  1248.  
  1249.         public routines.system.Document getBody() {
  1250.             return this.body;
  1251.         }
  1252.  
  1253.         public void readData(ObjectInputStream dis) {
  1254.  
  1255.             synchronized (commonByteArrayLock_LOCAL_PROJECT_Penetapan) {
  1256.  
  1257.                 try {
  1258.  
  1259.                     int length = 0;
  1260.  
  1261.                     this.body = (routines.system.Document) dis.readObject();
  1262.  
  1263.                 } catch (IOException e) {
  1264.                     throw new RuntimeException(e);
  1265.  
  1266.                 } catch (ClassNotFoundException eCNFE) {
  1267.                     throw new RuntimeException(eCNFE);
  1268.  
  1269.                 }
  1270.  
  1271.             }
  1272.  
  1273.         }
  1274.  
  1275.         public void writeData(ObjectOutputStream dos) {
  1276.             try {
  1277.  
  1278.                 // Document
  1279.  
  1280.                 dos.writeObject(this.body);
  1281.  
  1282.             } catch (IOException e) {
  1283.                 throw new RuntimeException(e);
  1284.             }
  1285.  
  1286.         }
  1287.  
  1288.         public String toString() {
  1289.  
  1290.             StringBuilder sb = new StringBuilder();
  1291.             sb.append(super.toString());
  1292.             sb.append("[");
  1293.             sb.append("body=" + String.valueOf(body));
  1294.             sb.append("]");
  1295.  
  1296.             return sb.toString();
  1297.         }
  1298.  
  1299.         /**
  1300.          * Compare keys
  1301.          */
  1302.         public int compareTo(inStruct other) {
  1303.  
  1304.             int returnValue = -1;
  1305.  
  1306.             return returnValue;
  1307.         }
  1308.  
  1309.         private int checkNullsAndCompare(Object object1, Object object2) {
  1310.             int returnValue = 0;
  1311.             if (object1 instanceof Comparable && object2 instanceof Comparable) {
  1312.                 returnValue = ((Comparable) object1).compareTo(object2);
  1313.             } else if (object1 != null && object2 != null) {
  1314.                 returnValue = compareStrings(object1.toString(),
  1315.                         object2.toString());
  1316.             } else if (object1 == null && object2 != null) {
  1317.                 returnValue = 1;
  1318.             } else if (object1 != null && object2 == null) {
  1319.                 returnValue = -1;
  1320.             } else {
  1321.                 returnValue = 0;
  1322.             }
  1323.  
  1324.             return returnValue;
  1325.         }
  1326.  
  1327.         private int compareStrings(String string1, String string2) {
  1328.             return string1.compareTo(string2);
  1329.         }
  1330.  
  1331.     }
  1332.  
  1333.     public void tRESTRequest_1_LoopProcess(
  1334.             final java.util.Map<String, Object> globalMap)
  1335.             throws TalendException {
  1336.         globalMap.put("tRESTRequest_1_Loop_SUBPROCESS_STATE", 0);
  1337.  
  1338.         final boolean execStat = this.execStat;
  1339.         String currentVirtualComponent = null;
  1340.  
  1341.         String iterateId = "";
  1342.  
  1343.         String currentComponent = "";
  1344.         java.util.Map<String, Object> resourceMap = new java.util.HashMap<String, Object>();
  1345.  
  1346.         try {
  1347.  
  1348.             String currentMethodName = new java.lang.Exception()
  1349.                     .getStackTrace()[0].getMethodName();
  1350.             boolean resumeIt = currentMethodName.equals(resumeEntryMethodName);
  1351.             if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start
  1352.                                                                                     // the
  1353.                                                                                     // resume
  1354.                 globalResumeTicket = true;
  1355.  
  1356.                 inStruct in = new inStruct();
  1357.                 penetapanStruct penetapan = new penetapanStruct();
  1358.                 insert_pendapatanStruct insert_pendapatan = new insert_pendapatanStruct();
  1359.  
  1360.                 /**
  1361.                  * [tRESTRequest_1_Loop begin ] start
  1362.                  */
  1363.  
  1364.                 int NB_ITERATE_tRESTRequest_1_In = 0; // for statistics
  1365.  
  1366.                 ok_Hash.put("tRESTRequest_1_Loop", false);
  1367.                 start_Hash.put("tRESTRequest_1_Loop",
  1368.                         System.currentTimeMillis());
  1369.  
  1370.                 currentVirtualComponent = "tRESTRequest_1";
  1371.  
  1372.                 currentComponent = "tRESTRequest_1_Loop";
  1373.  
  1374.                 int tos_count_tRESTRequest_1_Loop = 0;
  1375.  
  1376.                 class BytesLimit65535_tRESTRequest_1_Loop {
  1377.                     public void limitLog4jByte() throws Exception {
  1378.  
  1379.                     }
  1380.                 }
  1381.  
  1382.                 new BytesLimit65535_tRESTRequest_1_Loop().limitLog4jByte();
  1383.  
  1384.                 in = null;
  1385.  
  1386.                 int nb_line_tRESTRequest_1 = 0;
  1387.  
  1388.                 try {
  1389.  
  1390.                     java.util.Map<String, Object> requestMessage_tRESTRequest_1 = (java.util.Map<String, Object>) globalMap
  1391.                             .get("restRequest");
  1392.  
  1393.                     if (null == requestMessage_tRESTRequest_1) {
  1394.  
  1395.                         if (restTalendJobAlreadyStarted) {
  1396.                             throw new RuntimeException(
  1397.                                     "request is not provided");
  1398.                         } else {
  1399.                             if (!runInTalendEsbRuntimeContainer
  1400.                                     && null == thread4RestServiceProviderEndpoint) {
  1401.                                 String endpointUrl_tRESTRequest_1 = checkEndpointUrl("http://localhost:8088/penetapan");
  1402.                                 // *** external thread for endpoint
  1403.                                 // initialization
  1404.                                 thread4RestServiceProviderEndpoint = new Thread4RestServiceProviderEndpoint(
  1405.                                         this, endpointUrl_tRESTRequest_1);
  1406.                                 thread4RestServiceProviderEndpoint.start();
  1407.                                 // *** external thread for endpoint
  1408.                                 // initialization
  1409.                             }
  1410.  
  1411.                             restTalendJobAlreadyStarted = true;
  1412.  
  1413.                             Thread.currentThread();
  1414.                             try {
  1415.                                 while (true) {
  1416.                                     Thread.sleep(60000);
  1417.                                 }
  1418.                             } catch (InterruptedException e_tRESTRequest_1) {
  1419.                                 // e_tRESTRequest_1.printStackTrace();
  1420.                                 // throw new TalendException(e_tRESTRequest_1,
  1421.                                 // "wholeJob", globalMap);
  1422.                             }
  1423.                         }
  1424.                         return;
  1425.                     }
  1426.  
  1427.                     /**
  1428.                      * [tRESTRequest_1_Loop begin ] stop
  1429.                      */
  1430.  
  1431.                     /**
  1432.                      * [tRESTRequest_1_Loop main ] start
  1433.                      */
  1434.  
  1435.                     currentVirtualComponent = "tRESTRequest_1";
  1436.  
  1437.                     currentComponent = "tRESTRequest_1_Loop";
  1438.  
  1439.                     tos_count_tRESTRequest_1_Loop++;
  1440.  
  1441.                     /**
  1442.                      * [tRESTRequest_1_Loop main ] stop
  1443.                      */
  1444.                     NB_ITERATE_tRESTRequest_1_In++;
  1445.  
  1446.                     /**
  1447.                      * [tXMLMap_1_TXMLMAP_OUT begin ] start
  1448.                      */
  1449.  
  1450.                     ok_Hash.put("tXMLMap_1_TXMLMAP_OUT", false);
  1451.                     start_Hash.put("tXMLMap_1_TXMLMAP_OUT",
  1452.                             System.currentTimeMillis());
  1453.  
  1454.                     currentVirtualComponent = "tXMLMap_1";
  1455.  
  1456.                     currentComponent = "tXMLMap_1_TXMLMAP_OUT";
  1457.  
  1458.                     int tos_count_tXMLMap_1_TXMLMAP_OUT = 0;
  1459.  
  1460.                     class BytesLimit65535_tXMLMap_1_TXMLMAP_OUT {
  1461.                         public void limitLog4jByte() throws Exception {
  1462.  
  1463.                         }
  1464.                     }
  1465.  
  1466.                     new BytesLimit65535_tXMLMap_1_TXMLMAP_OUT()
  1467.                             .limitLog4jByte();
  1468.  
  1469.                     // ===============================input xml init
  1470.                     // part===============================
  1471.                     class XML_API_tXMLMap_1_TXMLMAP_OUT {
  1472.                         public boolean isDefNull(org.dom4j.Node node)
  1473.                                 throws javax.xml.transform.TransformerException {
  1474.                             if (node != null
  1475.                                     && node instanceof org.dom4j.Element) {
  1476.                                 org.dom4j.Attribute attri = ((org.dom4j.Element) node)
  1477.                                         .attribute("nil");
  1478.                                 if (attri != null
  1479.                                         && ("true").equals(attri.getText())) {
  1480.                                     return true;
  1481.                                 }
  1482.                             }
  1483.                             return false;
  1484.                         }
  1485.  
  1486.                         public boolean isMissing(org.dom4j.Node node)
  1487.                                 throws javax.xml.transform.TransformerException {
  1488.                             return node == null ? true : false;
  1489.                         }
  1490.  
  1491.                         public boolean isEmpty(org.dom4j.Node node)
  1492.                                 throws javax.xml.transform.TransformerException {
  1493.                             if (node != null) {
  1494.                                 return node.getText().length() == 0;
  1495.                             }
  1496.                             return false;
  1497.                         }
  1498.                     }
  1499.                     class Var__tXMLMap_1_TXMLMAP_OUT__Struct {
  1500.                         String Var1;
  1501.                         String kode_skpd;
  1502.                         String kode_bas;
  1503.                         String tgl_skprd;
  1504.                         String no_npwpr;
  1505.                         String no_nopprd;
  1506.                         String kode_loket;
  1507.                         String action;
  1508.                         String status;
  1509.                         String Var2;
  1510.                     }
  1511.                     Var__tXMLMap_1_TXMLMAP_OUT__Struct Var__tXMLMap_1_TXMLMAP_OUT = new Var__tXMLMap_1_TXMLMAP_OUT__Struct();
  1512.                     // ###############################
  1513.                     // # Outputs initialization
  1514.                     penetapanStruct penetapan_tmp = new penetapanStruct();
  1515.                     penetapanStruct penetapan_save = null;
  1516.                     // the aggregate variable
  1517.                     penetapanStruct penetapan_aggregate = null;
  1518.                     insert_pendapatanStruct insert_pendapatan_tmp = new insert_pendapatanStruct();
  1519.                     insert_pendapatanStruct insert_pendapatan_save = null;
  1520.                     // the aggregate variable
  1521.                     insert_pendapatanStruct insert_pendapatan_aggregate = null;
  1522.                     // init the resultset for aggregate
  1523.                     java.util.List<Object> allOutsForAggregate_tXMLMap_1 = new java.util.ArrayList<Object>();
  1524.                     globalMap.put("allOutsForAggregate_tXMLMap_1",
  1525.                             allOutsForAggregate_tXMLMap_1);
  1526.                     // ###############################
  1527.                     class TreeNode_API_tXMLMap_1_TXMLMAP_OUT {
  1528.                         java.util.Map<String, String> xpath_value_map = new java.util.HashMap<String, String>();
  1529.  
  1530.                         void clear() {
  1531.                             xpath_value_map.clear();
  1532.                         }
  1533.  
  1534.                         void put(String xpath, String value) {
  1535.                             xpath_value_map.put(xpath, value);
  1536.                         }
  1537.  
  1538.                         String get_null(String xpath) {
  1539.                             return null;
  1540.                         }
  1541.  
  1542.                         String get_String(String xpath) {
  1543.                             return xpath_value_map.get(xpath);
  1544.                         }
  1545.                     }
  1546.                     TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI_tXMLMap_1_TXMLMAP_OUT = new TreeNode_API_tXMLMap_1_TXMLMAP_OUT();
  1547.                     NameSpaceTool nsTool_tXMLMap_1_TXMLMAP_OUT = new NameSpaceTool();
  1548.                     int nb_line_tXMLMap_1_TXMLMAP_OUT = 0;
  1549.  
  1550.                     XML_API_tXMLMap_1_TXMLMAP_OUT xml_api_tXMLMap_1_TXMLMAP_OUT = new XML_API_tXMLMap_1_TXMLMAP_OUT();
  1551.  
  1552.                     // the map store the previous value of aggregate columns
  1553.                     java.util.Map<String, Object> aggregateCacheMap_tXMLMap_1_TXMLMAP_OUT = new java.util.HashMap<String, Object>();
  1554.  
  1555.                     class GenerateDocument_penetapan {
  1556.  
  1557.                         TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI = null;
  1558.                         java.util.Map<String, Object> valueMap = null;
  1559.  
  1560.                         routines.system.DocumentGenerateOrderHelper orderHelper = new routines.system.DocumentGenerateOrderHelper(
  1561.                                 1);
  1562.  
  1563.                         org.dom4j.Document doc = null;
  1564.  
  1565.                         org.dom4j.Element root4Group = null;
  1566.  
  1567.                         org.dom4j.io.OutputFormat format = null;
  1568.  
  1569.                         java.util.List<java.util.List<String>> groupbyList = null;
  1570.                         java.util.List<org.dom4j.Element> groupElementList = null;
  1571.                         int order = 0;
  1572.  
  1573.                         boolean isFirst = true;
  1574.  
  1575.                         boolean needRoot = true;
  1576.  
  1577.                         String currentValue = null;
  1578.  
  1579.                         org.dom4j.Element subTreeLoopParent0 = null;
  1580.                         public boolean subTreeLoop0 = false;
  1581.  
  1582.                         public GenerateDocument_penetapan() {
  1583.                             // this.treeNodeAPI = treeNodeAPI;
  1584.  
  1585.                             valueMap = new java.util.HashMap<String, Object>();
  1586.  
  1587.                             groupbyList = new java.util.ArrayList<java.util.List<String>>();
  1588.                             groupElementList = new java.util.ArrayList<org.dom4j.Element>();
  1589.  
  1590.                             doc = org.dom4j.DocumentHelper.createDocument();
  1591.                             format = org.dom4j.io.OutputFormat
  1592.                                     .createPrettyPrint();
  1593.                             format.setTrimText(false);
  1594.                         }
  1595.  
  1596.                         public org.dom4j.Document getDocument() {
  1597.                             return this.doc;
  1598.                         }
  1599.  
  1600.                         // We generate the TreeNode_API object only if there is
  1601.                         // a document in the main input table.
  1602.                         void generateElements(
  1603.                                 TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI,
  1604.                                 boolean isInnerJoin, inStruct in,
  1605.                                 Var__tXMLMap_1_TXMLMAP_OUT__Struct Var) {
  1606.  
  1607.                             /*
  1608.                              * if(this.treeNodeAPI==null) { this.treeNodeAPI =
  1609.                              * treeNodeAPI; }
  1610.                              */
  1611.  
  1612.                             org.dom4j.Element subTreeRootParent = null;
  1613.                             // build root xml tree
  1614.                             if (needRoot) {
  1615.                                 needRoot = false;
  1616.                                 org.dom4j.Element root = null;
  1617.                                 root = org.dom4j.DocumentHelper
  1618.                                         .createElement("ReqBody");
  1619.                                 doc.add(root);
  1620.                                 subTreeRootParent = root;
  1621.                                 org.dom4j.Element root_0 = null;
  1622.                                 root_0 = root.addElement("message");
  1623.                                 valueMap.put("root_0", Var.Var2);
  1624.                                 if (valueMap.get("root_0") != null) {
  1625.                                     routines.system.NestXMLTool.setText(root_0,
  1626.                                             FormatterUtils.format(Var.Var2,
  1627.                                                     null));
  1628.                                 }
  1629.                                 root4Group = subTreeRootParent;
  1630.                             } else {
  1631.                                 subTreeRootParent = root4Group;
  1632.                             }
  1633.                             /* build group xml tree */
  1634.                             boolean isNewElement = false;
  1635.                             isNewElement = false;
  1636.                         }
  1637.                     }
  1638.  
  1639.                     GenerateDocument_penetapan gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT = new GenerateDocument_penetapan();
  1640.                     boolean docAlreadyInstanciate_penetapan = false;
  1641.  
  1642.                     class GenerateDocument_webservice_sipkd {
  1643.  
  1644.                         TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI = null;
  1645.                         java.util.Map<String, Object> valueMap = null;
  1646.  
  1647.                         routines.system.DocumentGenerateOrderHelper orderHelper = new routines.system.DocumentGenerateOrderHelper(
  1648.                                 1);
  1649.  
  1650.                         org.dom4j.Document doc = null;
  1651.  
  1652.                         org.dom4j.Element root4Group = null;
  1653.  
  1654.                         org.dom4j.io.OutputFormat format = null;
  1655.  
  1656.                         java.util.List<java.util.List<String>> groupbyList = null;
  1657.                         java.util.List<org.dom4j.Element> groupElementList = null;
  1658.                         int order = 0;
  1659.  
  1660.                         boolean isFirst = true;
  1661.  
  1662.                         boolean needRoot = true;
  1663.  
  1664.                         String currentValue = null;
  1665.  
  1666.                         org.dom4j.Element subTreeLoopParent0 = null;
  1667.                         public boolean subTreeLoop0 = false;
  1668.  
  1669.                         public GenerateDocument_webservice_sipkd() {
  1670.                             // this.treeNodeAPI = treeNodeAPI;
  1671.  
  1672.                             valueMap = new java.util.HashMap<String, Object>();
  1673.  
  1674.                             groupbyList = new java.util.ArrayList<java.util.List<String>>();
  1675.                             groupElementList = new java.util.ArrayList<org.dom4j.Element>();
  1676.  
  1677.                             doc = org.dom4j.DocumentHelper.createDocument();
  1678.                             format = org.dom4j.io.OutputFormat
  1679.                                     .createPrettyPrint();
  1680.                             format.setTrimText(false);
  1681.                         }
  1682.  
  1683.                         public org.dom4j.Document getDocument() {
  1684.                             return this.doc;
  1685.                         }
  1686.  
  1687.                         // We generate the TreeNode_API object only if there is
  1688.                         // a document in the main input table.
  1689.                         void generateElements(
  1690.                                 TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI,
  1691.                                 boolean isInnerJoin, inStruct in,
  1692.                                 Var__tXMLMap_1_TXMLMAP_OUT__Struct Var) {
  1693.  
  1694.                             /*
  1695.                              * if(this.treeNodeAPI==null) { this.treeNodeAPI =
  1696.                              * treeNodeAPI; }
  1697.                              */
  1698.  
  1699.                             org.dom4j.Element subTreeRootParent = null;
  1700.                             // build root xml tree
  1701.                             if (needRoot) {
  1702.                                 needRoot = false;
  1703.                                 org.dom4j.Element root = null;
  1704.                                 root = org.dom4j.DocumentHelper
  1705.                                         .createElement("ReqBody");
  1706.                                 doc.add(root);
  1707.                                 subTreeRootParent = root;
  1708.                                 org.dom4j.Element root_1 = null;
  1709.                                 root_1 = root.addElement("TAHUN_ANGG");
  1710.                                 valueMap.put("root_1", Var.Var1);
  1711.                                 if (valueMap.get("root_1") != null) {
  1712.                                     routines.system.NestXMLTool.setText(root_1,
  1713.                                             FormatterUtils.format(Var.Var1,
  1714.                                                     null));
  1715.                                 }
  1716.                                 org.dom4j.Element root_2 = null;
  1717.                                 root_2 = root.addElement("TAHUN_PRBYR");
  1718.                                 valueMap.put("root_2", Var.Var1);
  1719.                                 if (valueMap.get("root_2") != null) {
  1720.                                     routines.system.NestXMLTool.setText(root_2,
  1721.                                             FormatterUtils.format(Var.Var1,
  1722.                                                     null));
  1723.                                 }
  1724.                                 org.dom4j.Element root_3 = null;
  1725.                                 root_3 = root.addElement("KODE_JENIS");
  1726.                                 valueMap.put(
  1727.                                         "root_3",
  1728.                                         treeNodeAPI
  1729.                                                 .get_String("in.body:/penetapan/jenis_id"));
  1730.                                 if (valueMap.get("root_3") != null) {
  1731.                                     routines.system.NestXMLTool
  1732.                                             .setText(
  1733.                                                     root_3,
  1734.                                                     FormatterUtils.format(
  1735.                                                             treeNodeAPI
  1736.                                                                     .get_String("in.body:/penetapan/jenis_id"),
  1737.                                                             null));
  1738.                                 }
  1739.                                 org.dom4j.Element root_4 = null;
  1740.                                 root_4 = root.addElement("KODE_SKPD");
  1741.                                 valueMap.put("root_4", Var.kode_skpd);
  1742.                                 if (valueMap.get("root_4") != null) {
  1743.                                     routines.system.NestXMLTool.setText(root_4,
  1744.                                             FormatterUtils.format(
  1745.                                                     Var.kode_skpd, null));
  1746.                                 }
  1747.                                 org.dom4j.Element root_5 = null;
  1748.                                 root_5 = root.addElement("NO_SKPRD");
  1749.                                 valueMap.put(
  1750.                                         "root_5",
  1751.                                         treeNodeAPI
  1752.                                                 .get_String("in.body:/penetapan/no_ketetapan"));
  1753.                                 if (valueMap.get("root_5") != null) {
  1754.                                     routines.system.NestXMLTool
  1755.                                             .setText(
  1756.                                                     root_5,
  1757.                                                     FormatterUtils.format(
  1758.                                                             treeNodeAPI
  1759.                                                                     .get_String("in.body:/penetapan/no_ketetapan"),
  1760.                                                             null));
  1761.                                 }
  1762.                                 org.dom4j.Element root_6 = null;
  1763.                                 root_6 = root.addElement("TGL_SKPRD");
  1764.                                 valueMap.put("root_6", Var.tgl_skprd);
  1765.                                 if (valueMap.get("root_6") != null) {
  1766.                                     routines.system.NestXMLTool.setText(root_6,
  1767.                                             FormatterUtils.format(
  1768.                                                     Var.tgl_skprd, null));
  1769.                                 }
  1770.                                 org.dom4j.Element root_7 = null;
  1771.                                 root_7 = root.addElement("KODE_BAS");
  1772.                                 valueMap.put("root_7", Var.kode_bas);
  1773.                                 if (valueMap.get("root_7") != null) {
  1774.                                     routines.system.NestXMLTool.setText(root_7,
  1775.                                             FormatterUtils.format(Var.kode_bas,
  1776.                                                     null));
  1777.                                 }
  1778.                                 org.dom4j.Element root_8 = null;
  1779.                                 root_8 = root.addElement("NILAI_BAYAR");
  1780.                                 valueMap.put(
  1781.                                         "root_8",
  1782.                                         treeNodeAPI
  1783.                                                 .get_String("in.body:/penetapan/jumlah_pokok"));
  1784.                                 if (valueMap.get("root_8") != null) {
  1785.                                     routines.system.NestXMLTool
  1786.                                             .setText(
  1787.                                                     root_8,
  1788.                                                     FormatterUtils.format(
  1789.                                                             treeNodeAPI
  1790.                                                                     .get_String("in.body:/penetapan/jumlah_pokok"),
  1791.                                                             null));
  1792.                                 }
  1793.                                 org.dom4j.Element root_9 = null;
  1794.                                 root_9 = root.addElement("NAMA_WPR");
  1795.                                 valueMap.put("root_9", treeNodeAPI
  1796.                                         .get_String("in.body:/penetapan/nama"));
  1797.                                 if (valueMap.get("root_9") != null) {
  1798.                                     routines.system.NestXMLTool
  1799.                                             .setText(
  1800.                                                     root_9,
  1801.                                                     FormatterUtils.format(
  1802.                                                             treeNodeAPI
  1803.                                                                     .get_String("in.body:/penetapan/nama"),
  1804.                                                             null));
  1805.                                 }
  1806.                                 org.dom4j.Element root_10 = null;
  1807.                                 root_10 = root.addElement("ALAMAT_WPR");
  1808.                                 valueMap.put(
  1809.                                         "root_10",
  1810.                                         treeNodeAPI
  1811.                                                 .get_String("in.body:/penetapan/alamat"));
  1812.                                 if (valueMap.get("root_10") != null) {
  1813.                                     routines.system.NestXMLTool
  1814.                                             .setText(
  1815.                                                     root_10,
  1816.                                                     FormatterUtils.format(
  1817.                                                             treeNodeAPI
  1818.                                                                     .get_String("in.body:/penetapan/alamat"),
  1819.                                                             null));
  1820.                                 }
  1821.                                 org.dom4j.Element root_11 = null;
  1822.                                 root_11 = root.addElement("NO_NPWPR");
  1823.                                 valueMap.put("root_11", Var.no_npwpr);
  1824.                                 if (valueMap.get("root_11") != null) {
  1825.                                     routines.system.NestXMLTool.setText(
  1826.                                             root_11, FormatterUtils.format(
  1827.                                                     Var.no_npwpr, null));
  1828.                                 }
  1829.                                 org.dom4j.Element root_12 = null;
  1830.                                 root_12 = root.addElement("NAMA_OPR");
  1831.                                 valueMap.put("root_12", treeNodeAPI
  1832.                                         .get_String("in.body:/penetapan/nama"));
  1833.                                 if (valueMap.get("root_12") != null) {
  1834.                                     routines.system.NestXMLTool
  1835.                                             .setText(
  1836.                                                     root_12,
  1837.                                                     FormatterUtils.format(
  1838.                                                             treeNodeAPI
  1839.                                                                     .get_String("in.body:/penetapan/nama"),
  1840.                                                             null));
  1841.                                 }
  1842.                                 org.dom4j.Element root_13 = null;
  1843.                                 root_13 = root.addElement("ALAMAT_OPR");
  1844.                                 valueMap.put(
  1845.                                         "root_13",
  1846.                                         treeNodeAPI
  1847.                                                 .get_String("in.body:/penetapan/alamat"));
  1848.                                 if (valueMap.get("root_13") != null) {
  1849.                                     routines.system.NestXMLTool
  1850.                                             .setText(
  1851.                                                     root_13,
  1852.                                                     FormatterUtils.format(
  1853.                                                             treeNodeAPI
  1854.                                                                     .get_String("in.body:/penetapan/alamat"),
  1855.                                                             null));
  1856.                                 }
  1857.                                 org.dom4j.Element root_14 = null;
  1858.                                 root_14 = root.addElement("NO_NOPRD");
  1859.                                 valueMap.put("root_14", Var.no_nopprd);
  1860.                                 if (valueMap.get("root_14") != null) {
  1861.                                     routines.system.NestXMLTool.setText(
  1862.                                             root_14, FormatterUtils.format(
  1863.                                                     Var.no_nopprd, null));
  1864.                                 }
  1865.                                 org.dom4j.Element root_15 = null;
  1866.                                 root_15 = root.addElement("KODE_LOKET");
  1867.                                 valueMap.put("root_15", Var.kode_loket);
  1868.                                 if (valueMap.get("root_15") != null) {
  1869.                                     routines.system.NestXMLTool.setText(
  1870.                                             root_15, FormatterUtils.format(
  1871.                                                     Var.kode_loket, null));
  1872.                                 }
  1873.                                 org.dom4j.Element root_16 = null;
  1874.                                 root_16 = root.addElement("ACTION");
  1875.                                 valueMap.put("root_16", Var.action);
  1876.                                 if (valueMap.get("root_16") != null) {
  1877.                                     routines.system.NestXMLTool.setText(
  1878.                                             root_16, FormatterUtils.format(
  1879.                                                     Var.action, null));
  1880.                                 }
  1881.                                 org.dom4j.Element root_17 = null;
  1882.                                 root_17 = root.addElement("STATUS");
  1883.                                 valueMap.put("root_17", Var.status);
  1884.                                 if (valueMap.get("root_17") != null) {
  1885.                                     routines.system.NestXMLTool.setText(
  1886.                                             root_17, FormatterUtils.format(
  1887.                                                     Var.status, null));
  1888.                                 }
  1889.                                 root4Group = subTreeRootParent;
  1890.                             } else {
  1891.                                 subTreeRootParent = root4Group;
  1892.                             }
  1893.                             /* build group xml tree */
  1894.                             boolean isNewElement = false;
  1895.                             isNewElement = false;
  1896.                         }
  1897.                     }
  1898.  
  1899.                     GenerateDocument_webservice_sipkd gen_Doc_webservice_sipkd_tXMLMap_1_TXMLMAP_OUT = new GenerateDocument_webservice_sipkd();
  1900.                     boolean docAlreadyInstanciate_webservice_sipkd = false;
  1901.  
  1902.                     /**
  1903.                      * [tXMLMap_1_TXMLMAP_OUT begin ] stop
  1904.                      */
  1905.  
  1906.                     /**
  1907.                      * [tRESTRequest_1_In begin ] start
  1908.                      */
  1909.  
  1910.                     ok_Hash.put("tRESTRequest_1_In", false);
  1911.                     start_Hash.put("tRESTRequest_1_In",
  1912.                             System.currentTimeMillis());
  1913.  
  1914.                     currentVirtualComponent = "tRESTRequest_1";
  1915.  
  1916.                     currentComponent = "tRESTRequest_1_In";
  1917.  
  1918.                     int tos_count_tRESTRequest_1_In = 0;
  1919.  
  1920.                     class BytesLimit65535_tRESTRequest_1_In {
  1921.                         public void limitLog4jByte() throws Exception {
  1922.  
  1923.                         }
  1924.                     }
  1925.  
  1926.                     new BytesLimit65535_tRESTRequest_1_In().limitLog4jByte();
  1927.  
  1928.                     /**
  1929.                      * [tRESTRequest_1_In begin ] stop
  1930.                      */
  1931.  
  1932.                     /**
  1933.                      * [tRESTRequest_1_In main ] start
  1934.                      */
  1935.  
  1936.                     currentVirtualComponent = "tRESTRequest_1";
  1937.  
  1938.                     currentComponent = "tRESTRequest_1_In";
  1939.  
  1940.                     if (requestMessage_tRESTRequest_1.containsKey("ERROR")) { // wrong
  1941.                                                                                 // request
  1942.                                                                                 // received
  1943.                         in = null;
  1944.                     } else { // non-error (not wrong request)
  1945.  
  1946.                         String matchedUriPattern_tRESTRequest_1 = (String) requestMessage_tRESTRequest_1
  1947.                                 .get("PATTERN");
  1948.                         String matchedFlow_tRESTRequest_1 = (String) requestMessage_tRESTRequest_1
  1949.                                 .get("OPERATION");
  1950.  
  1951.                         java.util.Map<String, Object> params_tRESTRequest_1 = (java.util.Map<String, Object>) requestMessage_tRESTRequest_1
  1952.                                 .get("PARAMS");
  1953.                         if (matchedFlow_tRESTRequest_1.equals("in")) {
  1954.                             in = new inStruct();
  1955.                             Object bodyObject_tRESTRequest_1 = requestMessage_tRESTRequest_1
  1956.                                     .get("BODY");
  1957.                             if (null != bodyObject_tRESTRequest_1) {
  1958.  
  1959.                                 routines.system.Document body_tRESTRequest_1 = new routines.system.Document();
  1960.                                 body_tRESTRequest_1
  1961.                                         .setDocument((org.dom4j.Document) bodyObject_tRESTRequest_1);
  1962.                                 in.body = body_tRESTRequest_1;
  1963.  
  1964.                             }
  1965.                         } else { // non matched flow
  1966.                             in = null;
  1967.                         }
  1968.  
  1969.                     }
  1970.  
  1971.                     globalMap.put("tRESTRequest_1_URI",
  1972.                             (String) requestMessage_tRESTRequest_1.get("URI"));
  1973.                     globalMap.put("tRESTRequest_1_URI_BASE",
  1974.                             (String) requestMessage_tRESTRequest_1
  1975.                                     .get("URI_BASE"));
  1976.                     globalMap.put("tRESTRequest_1_URI_ABSOLUTE",
  1977.                             (String) requestMessage_tRESTRequest_1
  1978.                                     .get("URI_ABSOLUTE"));
  1979.                     globalMap.put("tRESTRequest_1_URI_REQUEST",
  1980.                             (String) requestMessage_tRESTRequest_1
  1981.                                     .get("URI_REQUEST"));
  1982.                     globalMap.put("tRESTRequest_1_HTTP_METHOD",
  1983.                             (String) requestMessage_tRESTRequest_1.get("VERB"));
  1984.  
  1985.                     globalMap.put("tRESTRequest_1_ATTACHMENT_HEADERS",
  1986.                             requestMessage_tRESTRequest_1
  1987.                                     .get("ATTACHMENT_HEADERS"));
  1988.                     globalMap.put("tRESTRequest_1_ATTACHMENT_FILENAMES",
  1989.                             requestMessage_tRESTRequest_1
  1990.                                     .get("ATTACHMENT_FILENAMES"));
  1991.  
  1992.                     globalMap.put("tRESTRequest_1_PRINCIPAL_NAME",
  1993.                             (String) requestMessage_tRESTRequest_1
  1994.                                     .get("PRINCIPAL_NAME"));
  1995.                     globalMap.put("tRESTRequest_1_CORRELATION_ID",
  1996.                             (String) requestMessage_tRESTRequest_1
  1997.                                     .get("CorrelationID"));
  1998.  
  1999.                     tos_count_tRESTRequest_1_In++;
  2000.  
  2001.                     /**
  2002.                      * [tRESTRequest_1_In main ] stop
  2003.                      */
  2004.                     // Start of branch "in"
  2005.                     if (in != null) {
  2006.  
  2007.                         /**
  2008.                          * [tXMLMap_1_TXMLMAP_OUT main ] start
  2009.                          */
  2010.  
  2011.                         currentVirtualComponent = "tXMLMap_1";
  2012.  
  2013.                         currentComponent = "tXMLMap_1_TXMLMAP_OUT";
  2014.  
  2015.                         boolean rejectedInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
  2016.                         boolean rejectedDocInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
  2017.                         boolean mainRowRejected_tXMLMap_1_TXMLMAP_OUT = false;
  2018.                         boolean isMatchDocRowtXMLMap_1_TXMLMAP_OUT = false;
  2019.  
  2020.                         gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT = new GenerateDocument_penetapan();
  2021.  
  2022.                         penetapan_tmp = new penetapanStruct();
  2023.  
  2024.                         penetapan_tmp.body = null;
  2025.  
  2026.                         // init document to flat tool
  2027.                         routines.system.DocumentToFlat docToFlat_tXMLMap_1_TXMLMAP_OUT = new routines.system.DocumentToFlat();
  2028.                         docToFlat_tXMLMap_1_TXMLMAP_OUT
  2029.                                 .setOriginalLoop("/penetapan");
  2030.                         docToFlat_tXMLMap_1_TXMLMAP_OUT.setIsOptional(false);
  2031.                         if (in.body == null || in.body.getDocument() == null) {
  2032.                             throw new RuntimeException("in.body can't be empty");
  2033.                         }
  2034.                         org.dom4j.Document doc_tXMLMap_1_TXMLMAP_OUT = in.body
  2035.                                 .getDocument();
  2036.                         docToFlat_tXMLMap_1_TXMLMAP_OUT
  2037.                                 .setDoc(doc_tXMLMap_1_TXMLMAP_OUT);
  2038.                         docToFlat_tXMLMap_1_TXMLMAP_OUT.setDefineNS(false);
  2039.                         docToFlat_tXMLMap_1_TXMLMAP_OUT
  2040.                                 .setNamespaceTool(nsTool_tXMLMap_1_TXMLMAP_OUT);
  2041.  
  2042.                         // old version, find NS from doc
  2043.                         nsTool_tXMLMap_1_TXMLMAP_OUT
  2044.                                 .countNSMap(doc_tXMLMap_1_TXMLMAP_OUT
  2045.                                         .getRootElement());
  2046.                         java.util.HashMap<String, String> xmlNameSpaceMap_tXMLMap_1_TXMLMAP_OUT = nsTool_tXMLMap_1_TXMLMAP_OUT.xmlNameSpaceMap;
  2047.  
  2048.                         docToFlat_tXMLMap_1_TXMLMAP_OUT
  2049.                                 .setXmlNameSpaceMap(xmlNameSpaceMap_tXMLMap_1_TXMLMAP_OUT);
  2050.  
  2051.                         String[] absolutePathMappings_tXMLMap_1_TXMLMAP_OUT = new String[17];
  2052.                         String[] relativePathMappings_tXMLMap_1_TXMLMAP_OUT = new String[17];
  2053.  
  2054.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[0] = "in.body:/penetapan/nama_retribusi";
  2055.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[0] = "nama_retribusi";
  2056.  
  2057.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[1] = "in.body:/penetapan/no_ketetapan";
  2058.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[1] = "no_ketetapan";
  2059.  
  2060.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[2] = "in.body:/penetapan/jumlah_denda";
  2061.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[2] = "jumlah_denda";
  2062.  
  2063.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[3] = "in.body:/penetapan/nama";
  2064.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[3] = "nama";
  2065.  
  2066.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[4] = "in.body:/penetapan/ukpd_id";
  2067.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[4] = "ukpd_id";
  2068.  
  2069.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[5] = "in.body:/penetapan/tgl_jatuh_tempo";
  2070.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[5] = "tgl_jatuh_tempo";
  2071.  
  2072.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[6] = "in.body:/penetapan/periode_izin";
  2073.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[6] = "periode_izin";
  2074.  
  2075.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[7] = "in.body:/penetapan/kode_rekening_denda";
  2076.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[7] = "kode_rekening_denda";
  2077.  
  2078.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[8] = "in.body:/penetapan/tgl_penetapan";
  2079.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[8] = "tgl_penetapan";
  2080.  
  2081.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[9] = "in.body:/penetapan/jenis_id";
  2082.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[9] = "jenis_id";
  2083.  
  2084.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[10] = "in.body:/penetapan/matauang";
  2085.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[10] = "matauang";
  2086.  
  2087.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[11] = "in.body:/penetapan/alamat";
  2088.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[11] = "alamat";
  2089.  
  2090.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[12] = "in.body:/penetapan/jumlah_pokok";
  2091.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[12] = "jumlah_pokok";
  2092.  
  2093.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[13] = "in.body:/penetapan/skpd_id";
  2094.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[13] = "skpd_id";
  2095.  
  2096.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[14] = "in.body:/penetapan/no_id";
  2097.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[14] = "no_id";
  2098.  
  2099.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[15] = "in.body:/penetapan/kode_rekening_pokok";
  2100.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[15] = "kode_rekening_pokok";
  2101.  
  2102.                         absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[16] = "in.body:/penetapan/kode_bayar";
  2103.                         relativePathMappings_tXMLMap_1_TXMLMAP_OUT[16] = "kode_bayar";
  2104.  
  2105.                         docToFlat_tXMLMap_1_TXMLMAP_OUT
  2106.                                 .setAbsolutePathMappings(absolutePathMappings_tXMLMap_1_TXMLMAP_OUT);
  2107.                         docToFlat_tXMLMap_1_TXMLMAP_OUT
  2108.                                 .setCurrentRelativePathMappings(relativePathMappings_tXMLMap_1_TXMLMAP_OUT);
  2109.                         // generate document to flat data
  2110.                         docToFlat_tXMLMap_1_TXMLMAP_OUT.flat();
  2111.                         // get flat data
  2112.                         java.util.List<java.util.Map<String, String>> resultSet_tXMLMap_1_TXMLMAP_OUT = docToFlat_tXMLMap_1_TXMLMAP_OUT
  2113.                                 .getResultSet();
  2114.  
  2115.                         for (java.util.Map<String, String> oneRow_tXMLMap_1_TXMLMAP_OUT : resultSet_tXMLMap_1_TXMLMAP_OUT) { // G_TXM_M_001
  2116.                             nb_line_tXMLMap_1_TXMLMAP_OUT++;
  2117.                             rejectedInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
  2118.                             rejectedDocInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
  2119.                             mainRowRejected_tXMLMap_1_TXMLMAP_OUT = false;
  2120.                             isMatchDocRowtXMLMap_1_TXMLMAP_OUT = false;
  2121.  
  2122.                             treeNodeAPI_tXMLMap_1_TXMLMAP_OUT.clear();
  2123.                             for (java.util.Map.Entry<String, String> entry_tXMLMap_1_TXMLMAP_OUT : oneRow_tXMLMap_1_TXMLMAP_OUT
  2124.                                     .entrySet()) {
  2125.                                 treeNodeAPI_tXMLMap_1_TXMLMAP_OUT.put(
  2126.                                         entry_tXMLMap_1_TXMLMAP_OUT.getKey(),
  2127.                                         entry_tXMLMap_1_TXMLMAP_OUT.getValue());
  2128.                             }
  2129.  
  2130.                             { // start of Var scope
  2131.  
  2132.                                 // ###############################
  2133.                                 // # Vars tables
  2134.  
  2135.                                 Var__tXMLMap_1_TXMLMAP_OUT__Struct Var = Var__tXMLMap_1_TXMLMAP_OUT;
  2136.  
  2137.                                 Var.Var1 = TalendDate.getDate("yyyy");
  2138.  
  2139.                                 Var.kode_skpd = "22";
  2140.  
  2141.                                 Var.kode_bas = "1";
  2142.  
  2143.                                 Var.tgl_skprd = "06-12-2011%2014:00:00";
  2144.  
  2145.                                 Var.no_npwpr = "11";
  2146.  
  2147.                                 Var.no_nopprd = "11";
  2148.  
  2149.                                 Var.kode_loket = "11";
  2150.  
  2151.                                 Var.action = "ADD";
  2152.  
  2153.                                 Var.status = "1";
  2154.  
  2155.                                 Var.Var2 = null;
  2156.                                 // ###############################
  2157.                                 // # Output tables
  2158.  
  2159.                                 penetapan = null;
  2160.                                 insert_pendapatan = null;
  2161.  
  2162.                                 // # Output table : 'penetapan'
  2163.  
  2164.                                 gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT = new GenerateDocument_penetapan();
  2165.                                 penetapan_tmp = new penetapanStruct();
  2166.  
  2167.                                 gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT
  2168.                                         .generateElements(
  2169.                                                 treeNodeAPI_tXMLMap_1_TXMLMAP_OUT,
  2170.                                                 rejectedDocInnerJoin_tXMLMap_1_TXMLMAP_OUT,
  2171.                                                 in, Var);
  2172.  
  2173.                                 if (penetapan_tmp.body == null) {
  2174.                                     penetapan_tmp.body = new routines.system.Document();
  2175.                                     penetapan_tmp.body
  2176.                                             .setDocument(gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT
  2177.                                                     .getDocument());
  2178.                                     // construct the resultset when there is no
  2179.                                     // aggregate column for the out table
  2180.                                     allOutsForAggregate_tXMLMap_1
  2181.                                             .add(penetapan_tmp);
  2182.                                 }
  2183.  
  2184.                                 // # Output table : 'insert_pendapatan'
  2185.  
  2186.                                 insert_pendapatan_tmp = new insert_pendapatanStruct();
  2187.                                 insert_pendapatan_tmp.no_penetapan = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2188.                                         .get_String("in.body:/penetapan/no_ketetapan");
  2189.                                 insert_pendapatan_tmp.kode_penetapan = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2190.                                         .get_String("in.body:/penetapan/kode_bayar");
  2191.                                 insert_pendapatan_tmp.jenis_id = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2192.                                         .get_String("in.body:/penetapan/jenis_id");
  2193.                                 insert_pendapatan_tmp.no_id = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2194.                                         .get_String("in.body:/penetapan/no_id");
  2195.                                 insert_pendapatan_tmp.nama = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2196.                                         .get_String("in.body:/penetapan/nama");
  2197.                                 insert_pendapatan_tmp.alamat = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2198.                                         .get_String("in.body:/penetapan/alamat");
  2199.                                 insert_pendapatan_tmp.kode_rekening_pokok = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2200.                                         .get_String("in.body:/penetapan/kode_rekening_pokok");
  2201.                                 insert_pendapatan_tmp.jumlah_pokok = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2202.                                         .get_String("in.body:/penetapan/jumlah_pokok");
  2203.                                 insert_pendapatan_tmp.kode_rekening_denda = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2204.                                         .get_String("in.body:/penetapan/kode_rekening_denda");
  2205.                                 insert_pendapatan_tmp.jumlah_denda = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2206.                                         .get_String("in.body:/penetapan/jumlah_denda");
  2207.                                 insert_pendapatan_tmp.nama_retribusi = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2208.                                         .get_String("in.body:/penetapan/nama_retribusi");
  2209.                                 insert_pendapatan_tmp.tgl_penetapan = TalendDate
  2210.                                         .parseDate(
  2211.                                                 "yyyy-MM-dd",
  2212.                                                 treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2213.                                                         .get_String("in.body:/penetapan/tgl_penetapan"));
  2214.                                 insert_pendapatan_tmp.tgl_jatuh_tempo = TalendDate
  2215.                                         .parseDate(
  2216.                                                 "yyyy-MM-dd",
  2217.                                                 treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2218.                                                         .get_String("in.body:/penetapan/tgl_jatuh_tempo"));
  2219.                                 insert_pendapatan_tmp.matauang = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2220.                                         .get_String("in.body:/penetapan/matauang");
  2221.                                 insert_pendapatan_tmp.ukpd_id = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2222.                                         .get_String("in.body:/penetapan/ukpd_id");
  2223.                                 insert_pendapatan_tmp.skpd_id = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2224.                                         .get_String("in.body:/penetapan/skpd_id");
  2225.                                 insert_pendapatan_tmp.periode_izin = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
  2226.                                         .get_String("in.body:/penetapan/periode_izin");
  2227.                                 allOutsForAggregate_tXMLMap_1
  2228.                                         .add(insert_pendapatan_tmp);
  2229.  
  2230.                                 // ###############################
  2231.  
  2232.                             } // end of Var scope
  2233.  
  2234.                             rejectedInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
  2235.  
  2236.                         }// G_TXM_M_001 close
  2237.  
  2238.                         tos_count_tXMLMap_1_TXMLMAP_OUT++;
  2239.  
  2240.                         /**
  2241.                          * [tXMLMap_1_TXMLMAP_OUT main ] stop
  2242.                          */
  2243.  
  2244.                     } // End of branch "in"
  2245.  
  2246.                     /**
  2247.                      * [tRESTRequest_1_In end ] start
  2248.                      */
  2249.  
  2250.                     currentVirtualComponent = "tRESTRequest_1";
  2251.  
  2252.                     currentComponent = "tRESTRequest_1_In";
  2253.  
  2254.                     ok_Hash.put("tRESTRequest_1_In", true);
  2255.                     end_Hash.put("tRESTRequest_1_In",
  2256.                             System.currentTimeMillis());
  2257.  
  2258.                     /**
  2259.                      * [tRESTRequest_1_In end ] stop
  2260.                      */
  2261.  
  2262.                     /**
  2263.                      * [tXMLMap_1_TXMLMAP_OUT end ] start
  2264.                      */
  2265.  
  2266.                     currentVirtualComponent = "tXMLMap_1";
  2267.  
  2268.                     currentComponent = "tXMLMap_1_TXMLMAP_OUT";
  2269.  
  2270.                     ok_Hash.put("tXMLMap_1_TXMLMAP_OUT", true);
  2271.                     end_Hash.put("tXMLMap_1_TXMLMAP_OUT",
  2272.                             System.currentTimeMillis());
  2273.  
  2274.                     /**
  2275.                      * [tXMLMap_1_TXMLMAP_OUT end ] stop
  2276.                      */
  2277.  
  2278.                     /**
  2279.                      * [tRESTResponse_1 begin ] start
  2280.                      */
  2281.  
  2282.                     ok_Hash.put("tRESTResponse_1", false);
  2283.                     start_Hash.put("tRESTResponse_1",
  2284.                             System.currentTimeMillis());
  2285.  
  2286.                     currentComponent = "tRESTResponse_1";
  2287.  
  2288.                     int tos_count_tRESTResponse_1 = 0;
  2289.  
  2290.                     class BytesLimit65535_tRESTResponse_1 {
  2291.                         public void limitLog4jByte() throws Exception {
  2292.  
  2293.                         }
  2294.                     }
  2295.  
  2296.                     new BytesLimit65535_tRESTResponse_1().limitLog4jByte();
  2297.  
  2298.                     /**
  2299.                      * [tRESTResponse_1 begin ] stop
  2300.                      */
  2301.  
  2302.                     /**
  2303.                      * [tMysqlOutput_1 begin ] start
  2304.                      */
  2305.  
  2306.                     ok_Hash.put("tMysqlOutput_1", false);
  2307.                     start_Hash
  2308.                             .put("tMysqlOutput_1", System.currentTimeMillis());
  2309.  
  2310.                     currentComponent = "tMysqlOutput_1";
  2311.  
  2312.                     int tos_count_tMysqlOutput_1 = 0;
  2313.  
  2314.                     class BytesLimit65535_tMysqlOutput_1 {
  2315.                         public void limitLog4jByte() throws Exception {
  2316.  
  2317.                         }
  2318.                     }
  2319.  
  2320.                     new BytesLimit65535_tMysqlOutput_1().limitLog4jByte();
  2321.  
  2322.                     int nb_line_tMysqlOutput_1 = 0;
  2323.                     int nb_line_update_tMysqlOutput_1 = 0;
  2324.                     int nb_line_inserted_tMysqlOutput_1 = 0;
  2325.                     int nb_line_deleted_tMysqlOutput_1 = 0;
  2326.                     int nb_line_rejected_tMysqlOutput_1 = 0;
  2327.  
  2328.                     int deletedCount_tMysqlOutput_1 = 0;
  2329.                     int updatedCount_tMysqlOutput_1 = 0;
  2330.                     int insertedCount_tMysqlOutput_1 = 0;
  2331.  
  2332.                     int rejectedCount_tMysqlOutput_1 = 0;
  2333.  
  2334.                     String tableName_tMysqlOutput_1 = "pendapatan";
  2335.                     boolean whetherReject_tMysqlOutput_1 = false;
  2336.  
  2337.                     java.util.Calendar calendar_tMysqlOutput_1 = java.util.Calendar
  2338.                             .getInstance();
  2339.                     calendar_tMysqlOutput_1.set(1, 0, 1, 0, 0, 0);
  2340.                     long year1_tMysqlOutput_1 = calendar_tMysqlOutput_1
  2341.                             .getTime().getTime();
  2342.                     calendar_tMysqlOutput_1.set(10000, 0, 1, 0, 0, 0);
  2343.                     long year10000_tMysqlOutput_1 = calendar_tMysqlOutput_1
  2344.                             .getTime().getTime();
  2345.                     long date_tMysqlOutput_1;
  2346.  
  2347.                     java.sql.Connection conn_tMysqlOutput_1 = null;
  2348.                     String dbProperties_tMysqlOutput_1 = "noDatetimeStringSync=true";
  2349.                     String url_tMysqlOutput_1 = null;
  2350.                     if (dbProperties_tMysqlOutput_1 == null
  2351.                             || dbProperties_tMysqlOutput_1.trim().length() == 0) {
  2352.                         url_tMysqlOutput_1 = "jdbc:mysql://" + "localhost"
  2353.                                 + ":" + "3306" + "/" + "masterpendapatan" + "?"
  2354.                                 + "rewriteBatchedStatements=true";
  2355.                     } else {
  2356.                         String properties_tMysqlOutput_1 = "noDatetimeStringSync=true";
  2357.                         if (!properties_tMysqlOutput_1
  2358.                                 .contains("rewriteBatchedStatements")) {
  2359.                             properties_tMysqlOutput_1 += "&rewriteBatchedStatements=true";
  2360.                         }
  2361.  
  2362.                         url_tMysqlOutput_1 = "jdbc:mysql://" + "localhost"
  2363.                                 + ":" + "3306" + "/" + "masterpendapatan" + "?"
  2364.                                 + properties_tMysqlOutput_1;
  2365.                     }
  2366.                     String driverClass_tMysqlOutput_1 = "org.gjt.mm.mysql.Driver";
  2367.  
  2368.                     String dbUser_tMysqlOutput_1 = "root";
  2369.  
  2370.                     final String decryptedPassword_tMysqlOutput_1 = routines.system.PasswordEncryptUtil
  2371.                             .decryptPassword("f4f7aba1746784ea");
  2372.  
  2373.                     String dbPwd_tMysqlOutput_1 = decryptedPassword_tMysqlOutput_1;
  2374.                     java.lang.Class.forName(driverClass_tMysqlOutput_1);
  2375.  
  2376.                     conn_tMysqlOutput_1 = java.sql.DriverManager.getConnection(
  2377.                             url_tMysqlOutput_1, dbUser_tMysqlOutput_1,
  2378.                             dbPwd_tMysqlOutput_1);
  2379.  
  2380.                     resourceMap.put("conn_tMysqlOutput_1", conn_tMysqlOutput_1);
  2381.                     conn_tMysqlOutput_1.setAutoCommit(false);
  2382.                     int commitEvery_tMysqlOutput_1 = 10000;
  2383.                     int commitCounter_tMysqlOutput_1 = 0;
  2384.  
  2385.                     int count_tMysqlOutput_1 = 0;
  2386.  
  2387.                     String insert_tMysqlOutput_1 = "INSERT INTO `"
  2388.                             + "pendapatan"
  2389.                             + "` (`no_penetapan`,`kode_penetapan`,`jenis_id`,`no_id`,`nama`,`alamat`,`kode_rekening_pokok`,`jumlah_pokok`,`kode_rekening_denda`,`jumlah_denda`,`nama_retribusi`,`tgl_penetapan`,`tgl_jatuh_tempo`,`matauang`,`ukpd_id`,`skpd_id`,`periode_izin`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  2390.                     int batchSize_tMysqlOutput_1 = 100;
  2391.                     int batchSizeCounter_tMysqlOutput_1 = 0;
  2392.  
  2393.                     java.sql.PreparedStatement pstmt_tMysqlOutput_1 = conn_tMysqlOutput_1
  2394.                             .prepareStatement(insert_tMysqlOutput_1);
  2395.  
  2396.                     /**
  2397.                      * [tMysqlOutput_1 begin ] stop
  2398.                      */
  2399.  
  2400.                     /**
  2401.                      * [tXMLMap_1_TXMLMAP_IN begin ] start
  2402.                      */
  2403.  
  2404.                     ok_Hash.put("tXMLMap_1_TXMLMAP_IN", false);
  2405.                     start_Hash.put("tXMLMap_1_TXMLMAP_IN",
  2406.                             System.currentTimeMillis());
  2407.  
  2408.                     currentVirtualComponent = "tXMLMap_1";
  2409.  
  2410.                     currentComponent = "tXMLMap_1_TXMLMAP_IN";
  2411.  
  2412.                     int tos_count_tXMLMap_1_TXMLMAP_IN = 0;
  2413.  
  2414.                     class BytesLimit65535_tXMLMap_1_TXMLMAP_IN {
  2415.                         public void limitLog4jByte() throws Exception {
  2416.  
  2417.                         }
  2418.                     }
  2419.  
  2420.                     new BytesLimit65535_tXMLMap_1_TXMLMAP_IN().limitLog4jByte();
  2421.                     java.util.List<Object> outs_tXMLMap_1 = (java.util.List<Object>) globalMap
  2422.                             .get("allOutsForAggregate_tXMLMap_1");
  2423.                     for (Object row_out_tXMLMap_1_TXMLMAP_IN : outs_tXMLMap_1) {// TD512
  2424.  
  2425.                         /**
  2426.                          * [tXMLMap_1_TXMLMAP_IN begin ] stop
  2427.                          */
  2428.  
  2429.                         /**
  2430.                          * [tXMLMap_1_TXMLMAP_IN main ] start
  2431.                          */
  2432.  
  2433.                         currentVirtualComponent = "tXMLMap_1";
  2434.  
  2435.                         currentComponent = "tXMLMap_1_TXMLMAP_IN";
  2436.  
  2437.                         penetapan = null;
  2438.                         if (row_out_tXMLMap_1_TXMLMAP_IN != null
  2439.                                 && row_out_tXMLMap_1_TXMLMAP_IN instanceof penetapanStruct) {
  2440.                             penetapan = (penetapanStruct) row_out_tXMLMap_1_TXMLMAP_IN;
  2441.                             routines.system.NestXMLTool.generateOk(
  2442.                                     penetapan.body, false);
  2443.                         }
  2444.                         insert_pendapatan = null;
  2445.                         if (row_out_tXMLMap_1_TXMLMAP_IN != null
  2446.                                 && row_out_tXMLMap_1_TXMLMAP_IN instanceof insert_pendapatanStruct) {
  2447.                             insert_pendapatan = (insert_pendapatanStruct) row_out_tXMLMap_1_TXMLMAP_IN;
  2448.                         }
  2449.  
  2450.                         tos_count_tXMLMap_1_TXMLMAP_IN++;
  2451.  
  2452.                         /**
  2453.                          * [tXMLMap_1_TXMLMAP_IN main ] stop
  2454.                          */
  2455.                         // Start of branch "penetapan"
  2456.                         if (penetapan != null) {
  2457.  
  2458.                             /**
  2459.                              * [tRESTResponse_1 main ] start
  2460.                              */
  2461.  
  2462.                             currentComponent = "tRESTResponse_1";
  2463.  
  2464.                             java.io.OutputStream outputStream_tRESTResponse_1 = (java.io.OutputStream) globalMap
  2465.                                     .get("restResponseStream");
  2466.                             boolean responseAlreadySent_tRESTResponse_1 = globalMap
  2467.                                     .containsKey("restResponse");
  2468.  
  2469.                             if (null == outputStream_tRESTResponse_1
  2470.                                     && responseAlreadySent_tRESTResponse_1) {
  2471.                                 throw new RuntimeException(
  2472.                                         "Rest response already sent.");
  2473.                             } else if (!globalMap.containsKey("restRequest")) {
  2474.                                 throw new RuntimeException(
  2475.                                         "Not received rest request yet.");
  2476.                             } else {
  2477.                                 Integer restProviderStatusCode_tRESTResponse_1 = 200;
  2478.  
  2479.                                 Object restProviderResponse_tRESTResponse_1 = null;
  2480.                                 if (null != penetapan.body) {
  2481.                                     restProviderResponse_tRESTResponse_1 = penetapan.body
  2482.                                             .getDocument();
  2483.                                 }
  2484.  
  2485.                                 java.util.Map<String, String> restProviderResponseHeaders_tRESTResponse_1 = new java.util.TreeMap<String, String>(
  2486.                                         String.CASE_INSENSITIVE_ORDER);
  2487.  
  2488.                                 java.util.Map<String, Object> restRequest_tRESTResponse_1 = (java.util.Map<String, Object>) globalMap
  2489.                                         .get("restRequest");
  2490.                                 org.apache.cxf.jaxrs.ext.MessageContext messageContext_tRESTResponse_1 = (org.apache.cxf.jaxrs.ext.MessageContext) restRequest_tRESTResponse_1
  2491.                                         .get("MESSAGE_CONTEXT");
  2492.  
  2493.                                 if (null == outputStream_tRESTResponse_1) {
  2494.                                     java.util.Map<String, Object> restResponse_tRESTResponse_1 = new java.util.HashMap<String, Object>();
  2495.                                     restResponse_tRESTResponse_1
  2496.                                             .put("BODY",
  2497.                                                     restProviderResponse_tRESTResponse_1);
  2498.                                     restResponse_tRESTResponse_1
  2499.                                             .put("STATUS",
  2500.                                                     restProviderStatusCode_tRESTResponse_1);
  2501.                                     restResponse_tRESTResponse_1
  2502.                                             .put("HEADERS",
  2503.                                                     restProviderResponseHeaders_tRESTResponse_1);
  2504.                                     restResponse_tRESTResponse_1.put(
  2505.                                             "drop.json.root.element",
  2506.                                             Boolean.valueOf(false));
  2507.                                     globalMap.put("restResponse",
  2508.                                             restResponse_tRESTResponse_1);
  2509.  
  2510.                                 } else {
  2511.  
  2512.                                     javax.ws.rs.core.MediaType responseMediaType_tRESTResponse_1 = null;
  2513.                                     if (!responseAlreadySent_tRESTResponse_1) {
  2514.                                         org.apache.cxf.jaxrs.utils.JAXRSUtils
  2515.                                                 .getCurrentMessage()
  2516.                                                 .getExchange()
  2517.                                                 .put(StreamingDOM4JProvider.SUPRESS_XML_DECLARATION,
  2518.                                                         true);
  2519.  
  2520.                                         messageContext_tRESTResponse_1
  2521.                                                 .put(org.apache.cxf.message.Message.RESPONSE_CODE,
  2522.                                                         restProviderStatusCode_tRESTResponse_1);
  2523.                                         javax.ws.rs.core.MultivaluedMap<String, String> headersMultivaluedMap_tRESTResponse_1 = new org.apache.cxf.jaxrs.impl.MetadataMap<String, String>();
  2524.                                         for (java.util.Map.Entry<String, String> multivaluedHeader : restProviderResponseHeaders_tRESTResponse_1
  2525.                                                 .entrySet()) {
  2526.                                             headersMultivaluedMap_tRESTResponse_1
  2527.                                                     .putSingle(
  2528.                                                             multivaluedHeader
  2529.                                                                     .getKey(),
  2530.                                                             multivaluedHeader
  2531.                                                                     .getValue());
  2532.                                         }
  2533.                                         messageContext_tRESTResponse_1
  2534.                                                 .put(org.apache.cxf.message.Message.PROTOCOL_HEADERS,
  2535.                                                         headersMultivaluedMap_tRESTResponse_1);
  2536.  
  2537.                                         // String
  2538.                                         // responseContentType_tRESTResponse_1 =
  2539.                                         // (String)
  2540.                                         // messageContext_tRESTResponse_1.get(org.apache.cxf.message.Message.CONTENT_TYPE);
  2541.                                         String responseContentType_tRESTResponse_1 = (String) org.apache.cxf.jaxrs.utils.JAXRSUtils
  2542.                                                 .getCurrentMessage()
  2543.                                                 .getExchange()
  2544.                                                 .get(org.apache.cxf.message.Message.CONTENT_TYPE);
  2545.                                         if (null == responseContentType_tRESTResponse_1) {
  2546.                                             // this should not be needed, just
  2547.                                             // in case. set it to the first
  2548.                                             // value in the sorted list returned
  2549.                                             // from HttpHeaders
  2550.                                             responseMediaType_tRESTResponse_1 = messageContext_tRESTResponse_1
  2551.                                                     .getHttpHeaders()
  2552.                                                     .getAcceptableMediaTypes()
  2553.                                                     .get(0);
  2554.                                         } else {
  2555.                                             responseMediaType_tRESTResponse_1 = org.apache.cxf.jaxrs.utils.JAXRSUtils
  2556.                                                     .toMediaType(responseContentType_tRESTResponse_1);
  2557.                                         }
  2558.                                         globalMap
  2559.                                                 .put("restResponseMediaType",
  2560.                                                         responseMediaType_tRESTResponse_1);
  2561.  
  2562.                                         String responseMediaSubType_tRESTResponse_1 = responseMediaType_tRESTResponse_1
  2563.                                                 .getSubtype();
  2564.                                         if (responseMediaSubType_tRESTResponse_1
  2565.                                                 .equals("xml")
  2566.                                                 || responseMediaSubType_tRESTResponse_1
  2567.                                                         .endsWith("+xml")) {
  2568.                                             outputStream_tRESTResponse_1
  2569.                                                     .write("<wrapper>"
  2570.                                                             .getBytes());
  2571.                                             globalMap
  2572.                                                     .put("restResponseWrappingClosure",
  2573.                                                             "</wrapper>");
  2574.                                         }
  2575.                                         if (responseMediaSubType_tRESTResponse_1
  2576.                                                 .equals("json")
  2577.                                                 || responseMediaSubType_tRESTResponse_1
  2578.                                                         .endsWith("+json")) {
  2579.                                             outputStream_tRESTResponse_1
  2580.                                                     .write("[".getBytes());
  2581.                                             globalMap
  2582.                                                     .put("restResponseWrappingClosure",
  2583.                                                             "]");
  2584.                                         }
  2585.  
  2586.                                         globalMap.put("restResponse", true);
  2587.                                     } else {
  2588.                                         responseMediaType_tRESTResponse_1 = (javax.ws.rs.core.MediaType) globalMap
  2589.                                                 .get("restResponseMediaType");
  2590.                                     }
  2591.  
  2592.                                     if (null != restProviderResponse_tRESTResponse_1) {
  2593.                                         String responseMediaSubType_tRESTResponse_1 = responseMediaType_tRESTResponse_1
  2594.                                                 .getSubtype();
  2595.                                         if (responseMediaSubType_tRESTResponse_1
  2596.                                                 .equals("json")
  2597.                                                 || responseMediaSubType_tRESTResponse_1
  2598.                                                         .endsWith("+json")) {
  2599.                                             if (globalMap
  2600.                                                     .containsKey("restResponseJsonStarted")) {
  2601.                                                 outputStream_tRESTResponse_1
  2602.                                                         .write(",".getBytes());
  2603.                                             } else {
  2604.                                                 globalMap
  2605.                                                         .put("restResponseJsonStarted",
  2606.                                                                 true);
  2607.                                             }
  2608.                                         }
  2609.  
  2610.                                         Class<? extends Object> responseBodyClass_tRESTResponse_1 = restProviderResponse_tRESTResponse_1
  2611.                                                 .getClass();
  2612.                                         javax.ws.rs.ext.Providers messageBodyProviders_tRESTResponse_1 = messageContext_tRESTResponse_1
  2613.                                                 .getProviders();
  2614.                                         javax.ws.rs.ext.MessageBodyWriter messageBodyWriter_tRESTResponse_1 = messageBodyProviders_tRESTResponse_1
  2615.                                                 .getMessageBodyWriter(
  2616.                                                         responseBodyClass_tRESTResponse_1,
  2617.                                                         responseBodyClass_tRESTResponse_1,
  2618.                                                         null,
  2619.                                                         responseMediaType_tRESTResponse_1);
  2620.                                         messageBodyWriter_tRESTResponse_1
  2621.                                                 .writeTo(
  2622.                                                         restProviderResponse_tRESTResponse_1,
  2623.                                                         responseBodyClass_tRESTResponse_1,
  2624.                                                         responseBodyClass_tRESTResponse_1,
  2625.                                                         new java.lang.annotation.Annotation[] {},
  2626.                                                         responseMediaType_tRESTResponse_1,
  2627.                                                         null,
  2628.                                                         outputStream_tRESTResponse_1);
  2629.                                     }
  2630.                                     // initial variant
  2631.                                     // outputStream_tRESTResponse_1.write(String.valueOf(restProviderResponse_tRESTResponse_1).getBytes());
  2632.                                     outputStream_tRESTResponse_1.flush();
  2633.                                 }
  2634.                             }
  2635.  
  2636.                             tos_count_tRESTResponse_1++;
  2637.  
  2638.                             /**
  2639.                              * [tRESTResponse_1 main ] stop
  2640.                              */
  2641.  
  2642.                         } // End of branch "penetapan"
  2643.  
  2644.                         // Start of branch "insert_pendapatan"
  2645.                         if (insert_pendapatan != null) {
  2646.  
  2647.                             /**
  2648.                              * [tMysqlOutput_1 main ] start
  2649.                              */
  2650.  
  2651.                             currentComponent = "tMysqlOutput_1";
  2652.  
  2653.                             whetherReject_tMysqlOutput_1 = false;
  2654.                             if (insert_pendapatan.no_penetapan == null) {
  2655.                                 pstmt_tMysqlOutput_1.setNull(1,
  2656.                                         java.sql.Types.VARCHAR);
  2657.                             } else {
  2658.                                 pstmt_tMysqlOutput_1.setString(1,
  2659.                                         insert_pendapatan.no_penetapan);
  2660.                             }
  2661.  
  2662.                             if (insert_pendapatan.kode_penetapan == null) {
  2663.                                 pstmt_tMysqlOutput_1.setNull(2,
  2664.                                         java.sql.Types.VARCHAR);
  2665.                             } else {
  2666.                                 pstmt_tMysqlOutput_1.setString(2,
  2667.                                         insert_pendapatan.kode_penetapan);
  2668.                             }
  2669.  
  2670.                             if (insert_pendapatan.jenis_id == null) {
  2671.                                 pstmt_tMysqlOutput_1.setNull(3,
  2672.                                         java.sql.Types.VARCHAR);
  2673.                             } else {
  2674.                                 pstmt_tMysqlOutput_1.setString(3,
  2675.                                         insert_pendapatan.jenis_id);
  2676.                             }
  2677.  
  2678.                             if (insert_pendapatan.no_id == null) {
  2679.                                 pstmt_tMysqlOutput_1.setNull(4,
  2680.                                         java.sql.Types.VARCHAR);
  2681.                             } else {
  2682.                                 pstmt_tMysqlOutput_1.setString(4,
  2683.                                         insert_pendapatan.no_id);
  2684.                             }
  2685.  
  2686.                             if (insert_pendapatan.nama == null) {
  2687.                                 pstmt_tMysqlOutput_1.setNull(5,
  2688.                                         java.sql.Types.VARCHAR);
  2689.                             } else {
  2690.                                 pstmt_tMysqlOutput_1.setString(5,
  2691.                                         insert_pendapatan.nama);
  2692.                             }
  2693.  
  2694.                             if (insert_pendapatan.alamat == null) {
  2695.                                 pstmt_tMysqlOutput_1.setNull(6,
  2696.                                         java.sql.Types.VARCHAR);
  2697.                             } else {
  2698.                                 pstmt_tMysqlOutput_1.setString(6,
  2699.                                         insert_pendapatan.alamat);
  2700.                             }
  2701.  
  2702.                             if (insert_pendapatan.kode_rekening_pokok == null) {
  2703.                                 pstmt_tMysqlOutput_1.setNull(7,
  2704.                                         java.sql.Types.VARCHAR);
  2705.                             } else {
  2706.                                 pstmt_tMysqlOutput_1.setString(7,
  2707.                                         insert_pendapatan.kode_rekening_pokok);
  2708.                             }
  2709.  
  2710.                             if (insert_pendapatan.jumlah_pokok == null) {
  2711.                                 pstmt_tMysqlOutput_1.setNull(8,
  2712.                                         java.sql.Types.VARCHAR);
  2713.                             } else {
  2714.                                 pstmt_tMysqlOutput_1.setString(8,
  2715.                                         insert_pendapatan.jumlah_pokok);
  2716.                             }
  2717.  
  2718.                             if (insert_pendapatan.kode_rekening_denda == null) {
  2719.                                 pstmt_tMysqlOutput_1.setNull(9,
  2720.                                         java.sql.Types.VARCHAR);
  2721.                             } else {
  2722.                                 pstmt_tMysqlOutput_1.setString(9,
  2723.                                         insert_pendapatan.kode_rekening_denda);
  2724.                             }
  2725.  
  2726.                             if (insert_pendapatan.jumlah_denda == null) {
  2727.                                 pstmt_tMysqlOutput_1.setNull(10,
  2728.                                         java.sql.Types.VARCHAR);
  2729.                             } else {
  2730.                                 pstmt_tMysqlOutput_1.setString(10,
  2731.                                         insert_pendapatan.jumlah_denda);
  2732.                             }
  2733.  
  2734.                             if (insert_pendapatan.nama_retribusi == null) {
  2735.                                 pstmt_tMysqlOutput_1.setNull(11,
  2736.                                         java.sql.Types.VARCHAR);
  2737.                             } else {
  2738.                                 pstmt_tMysqlOutput_1.setString(11,
  2739.                                         insert_pendapatan.nama_retribusi);
  2740.                             }
  2741.  
  2742.                             if (insert_pendapatan.tgl_penetapan != null) {
  2743.                                 date_tMysqlOutput_1 = insert_pendapatan.tgl_penetapan
  2744.                                         .getTime();
  2745.                                 if (date_tMysqlOutput_1 < year1_tMysqlOutput_1
  2746.                                         || date_tMysqlOutput_1 >= year10000_tMysqlOutput_1) {
  2747.                                     pstmt_tMysqlOutput_1.setString(12,
  2748.                                             "0000-00-00 00:00:00");
  2749.                                 } else {
  2750.                                     pstmt_tMysqlOutput_1.setTimestamp(12,
  2751.                                             new java.sql.Timestamp(
  2752.                                                     date_tMysqlOutput_1));
  2753.                                 }
  2754.                             } else {
  2755.                                 pstmt_tMysqlOutput_1.setNull(12,
  2756.                                         java.sql.Types.DATE);
  2757.                             }
  2758.  
  2759.                             if (insert_pendapatan.tgl_jatuh_tempo != null) {
  2760.                                 date_tMysqlOutput_1 = insert_pendapatan.tgl_jatuh_tempo
  2761.                                         .getTime();
  2762.                                 if (date_tMysqlOutput_1 < year1_tMysqlOutput_1
  2763.                                         || date_tMysqlOutput_1 >= year10000_tMysqlOutput_1) {
  2764.                                     pstmt_tMysqlOutput_1.setString(13,
  2765.                                             "0000-00-00 00:00:00");
  2766.                                 } else {
  2767.                                     pstmt_tMysqlOutput_1.setTimestamp(13,
  2768.                                             new java.sql.Timestamp(
  2769.                                                     date_tMysqlOutput_1));
  2770.                                 }
  2771.                             } else {
  2772.                                 pstmt_tMysqlOutput_1.setNull(13,
  2773.                                         java.sql.Types.DATE);
  2774.                             }
  2775.  
  2776.                             if (insert_pendapatan.matauang == null) {
  2777.                                 pstmt_tMysqlOutput_1.setNull(14,
  2778.                                         java.sql.Types.VARCHAR);
  2779.                             } else {
  2780.                                 pstmt_tMysqlOutput_1.setString(14,
  2781.                                         insert_pendapatan.matauang);
  2782.                             }
  2783.  
  2784.                             if (insert_pendapatan.ukpd_id == null) {
  2785.                                 pstmt_tMysqlOutput_1.setNull(15,
  2786.                                         java.sql.Types.VARCHAR);
  2787.                             } else {
  2788.                                 pstmt_tMysqlOutput_1.setString(15,
  2789.                                         insert_pendapatan.ukpd_id);
  2790.                             }
  2791.  
  2792.                             if (insert_pendapatan.skpd_id == null) {
  2793.                                 pstmt_tMysqlOutput_1.setNull(16,
  2794.                                         java.sql.Types.VARCHAR);
  2795.                             } else {
  2796.                                 pstmt_tMysqlOutput_1.setString(16,
  2797.                                         insert_pendapatan.skpd_id);
  2798.                             }
  2799.  
  2800.                             if (insert_pendapatan.periode_izin == null) {
  2801.                                 pstmt_tMysqlOutput_1.setNull(17,
  2802.                                         java.sql.Types.VARCHAR);
  2803.                             } else {
  2804.                                 pstmt_tMysqlOutput_1.setString(17,
  2805.                                         insert_pendapatan.periode_izin);
  2806.                             }
  2807.  
  2808.                             pstmt_tMysqlOutput_1.addBatch();
  2809.                             nb_line_tMysqlOutput_1++;
  2810.  
  2811.                             batchSizeCounter_tMysqlOutput_1++;
  2812.                             if (batchSize_tMysqlOutput_1 <= batchSizeCounter_tMysqlOutput_1) {
  2813.                                 try {
  2814.                                     int countSum_tMysqlOutput_1 = 0;
  2815.                                     for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1
  2816.                                             .executeBatch()) {
  2817.                                         countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
  2818.                                                 : 1);
  2819.                                     }
  2820.                                     insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
  2821.                                 } catch (java.sql.BatchUpdateException e) {
  2822.                                     int countSum_tMysqlOutput_1 = 0;
  2823.                                     for (int countEach_tMysqlOutput_1 : e
  2824.                                             .getUpdateCounts()) {
  2825.                                         countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
  2826.                                                 : countEach_tMysqlOutput_1);
  2827.                                     }
  2828.                                     insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
  2829.                                     System.err.println(e.getMessage());
  2830.                                 }
  2831.  
  2832.                                 batchSizeCounter_tMysqlOutput_1 = 0;
  2833.                             }
  2834.                             commitCounter_tMysqlOutput_1++;
  2835.  
  2836.                             if (commitEvery_tMysqlOutput_1 <= commitCounter_tMysqlOutput_1) {
  2837.  
  2838.                                 try {
  2839.                                     int countSum_tMysqlOutput_1 = 0;
  2840.                                     for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1
  2841.                                             .executeBatch()) {
  2842.                                         countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
  2843.                                                 : 1);
  2844.                                     }
  2845.                                     insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
  2846.                                 } catch (java.sql.BatchUpdateException e) {
  2847.                                     int countSum_tMysqlOutput_1 = 0;
  2848.                                     for (int countEach_tMysqlOutput_1 : e
  2849.                                             .getUpdateCounts()) {
  2850.                                         countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
  2851.                                                 : countEach_tMysqlOutput_1);
  2852.                                     }
  2853.                                     insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
  2854.                                     System.err.println(e.getMessage());
  2855.  
  2856.                                 }
  2857.                                 conn_tMysqlOutput_1.commit();
  2858.                                 commitCounter_tMysqlOutput_1 = 0;
  2859.  
  2860.                             }
  2861.  
  2862.                             tos_count_tMysqlOutput_1++;
  2863.  
  2864.                             /**
  2865.                              * [tMysqlOutput_1 main ] stop
  2866.                              */
  2867.  
  2868.                         } // End of branch "insert_pendapatan"
  2869.  
  2870.                         /**
  2871.                          * [tXMLMap_1_TXMLMAP_IN end ] start
  2872.                          */
  2873.  
  2874.                         currentVirtualComponent = "tXMLMap_1";
  2875.  
  2876.                         currentComponent = "tXMLMap_1_TXMLMAP_IN";
  2877.  
  2878.                     }// TD512
  2879.  
  2880.                     ok_Hash.put("tXMLMap_1_TXMLMAP_IN", true);
  2881.                     end_Hash.put("tXMLMap_1_TXMLMAP_IN",
  2882.                             System.currentTimeMillis());
  2883.  
  2884.                     /**
  2885.                      * [tXMLMap_1_TXMLMAP_IN end ] stop
  2886.                      */
  2887.  
  2888.                     /**
  2889.                      * [tRESTResponse_1 end ] start
  2890.                      */
  2891.  
  2892.                     currentComponent = "tRESTResponse_1";
  2893.  
  2894.                     ok_Hash.put("tRESTResponse_1", true);
  2895.                     end_Hash.put("tRESTResponse_1", System.currentTimeMillis());
  2896.  
  2897.                     /**
  2898.                      * [tRESTResponse_1 end ] stop
  2899.                      */
  2900.  
  2901.                     /**
  2902.                      * [tMysqlOutput_1 end ] start
  2903.                      */
  2904.  
  2905.                     currentComponent = "tMysqlOutput_1";
  2906.  
  2907.                     try {
  2908.                         if (batchSizeCounter_tMysqlOutput_1 != 0) {
  2909.                             int countSum_tMysqlOutput_1 = 0;
  2910.  
  2911.                             for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1
  2912.                                     .executeBatch()) {
  2913.                                 countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
  2914.                                         : 1);
  2915.                             }
  2916.  
  2917.                             insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
  2918.  
  2919.                         }
  2920.  
  2921.                     } catch (java.sql.BatchUpdateException e) {
  2922.  
  2923.                         int countSum_tMysqlOutput_1 = 0;
  2924.                         for (int countEach_tMysqlOutput_1 : e.getUpdateCounts()) {
  2925.                             countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
  2926.                                     : countEach_tMysqlOutput_1);
  2927.                         }
  2928.  
  2929.                         insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
  2930.  
  2931.                         globalMap.put(currentComponent + "_ERROR_MESSAGE",
  2932.                                 e.getMessage());
  2933.                         System.err.println(e.getMessage());
  2934.  
  2935.                     }
  2936.                     batchSizeCounter_tMysqlOutput_1 = 0;
  2937.  
  2938.                     if (pstmt_tMysqlOutput_1 != null) {
  2939.  
  2940.                         pstmt_tMysqlOutput_1.close();
  2941.  
  2942.                     }
  2943.  
  2944.                     if (commitCounter_tMysqlOutput_1 > 0) {
  2945.  
  2946.                         conn_tMysqlOutput_1.commit();
  2947.  
  2948.                     }
  2949.  
  2950.                     conn_tMysqlOutput_1.close();
  2951.  
  2952.                     resourceMap.put("finish_tMysqlOutput_1", true);
  2953.  
  2954.                     nb_line_deleted_tMysqlOutput_1 = nb_line_deleted_tMysqlOutput_1
  2955.                             + deletedCount_tMysqlOutput_1;
  2956.                     nb_line_update_tMysqlOutput_1 = nb_line_update_tMysqlOutput_1
  2957.                             + updatedCount_tMysqlOutput_1;
  2958.                     nb_line_inserted_tMysqlOutput_1 = nb_line_inserted_tMysqlOutput_1
  2959.                             + insertedCount_tMysqlOutput_1;
  2960.                     nb_line_rejected_tMysqlOutput_1 = nb_line_rejected_tMysqlOutput_1
  2961.                             + rejectedCount_tMysqlOutput_1;
  2962.  
  2963.                     globalMap.put("tMysqlOutput_1_NB_LINE",
  2964.                             nb_line_tMysqlOutput_1);
  2965.                     globalMap.put("tMysqlOutput_1_NB_LINE_UPDATED",
  2966.                             nb_line_update_tMysqlOutput_1);
  2967.                     globalMap.put("tMysqlOutput_1_NB_LINE_INSERTED",
  2968.                             nb_line_inserted_tMysqlOutput_1);
  2969.                     globalMap.put("tMysqlOutput_1_NB_LINE_DELETED",
  2970.                             nb_line_deleted_tMysqlOutput_1);
  2971.                     globalMap.put("tMysqlOutput_1_NB_LINE_REJECTED",
  2972.                             nb_line_rejected_tMysqlOutput_1);
  2973.  
  2974.                     ok_Hash.put("tMysqlOutput_1", true);
  2975.                     end_Hash.put("tMysqlOutput_1", System.currentTimeMillis());
  2976.  
  2977.                     /**
  2978.                      * [tMysqlOutput_1 end ] stop
  2979.                      */
  2980.  
  2981.                     /**
  2982.                      * [tRESTRequest_1_Loop end ] start
  2983.                      */
  2984.  
  2985.                     currentVirtualComponent = "tRESTRequest_1";
  2986.  
  2987.                     currentComponent = "tRESTRequest_1_Loop";
  2988.  
  2989.                 } catch (Throwable e_tRESTRequest_1) {
  2990.                     if (e_tRESTRequest_1 instanceof Exception) {
  2991.                         new TalendException((Exception) e_tRESTRequest_1,
  2992.                                 currentComponent, globalMap).printStackTrace();
  2993.                     } else {
  2994.                         new TalendException(new RuntimeException(
  2995.                                 e_tRESTRequest_1), currentComponent, globalMap)
  2996.                                 .printStackTrace();
  2997.                     }
  2998.                     if (!globalMap.containsKey("restResponse")) {
  2999.                         java.util.Map<String, Object> restFault_tRESTRequest_1 = new java.util.HashMap<String, Object>();
  3000.                         restFault_tRESTRequest_1.put("STATUS", 500);
  3001.                         restFault_tRESTRequest_1.put("BODY",
  3002.                                 e_tRESTRequest_1.getMessage());
  3003.                         globalMap.put("restResponse", restFault_tRESTRequest_1);
  3004.                     }
  3005.                     return;
  3006.                 }
  3007.                 nb_line_tRESTRequest_1++;
  3008.                 globalMap.put("tRESTRequest_1_NB_LINE", nb_line_tRESTRequest_1);
  3009.  
  3010.                 ok_Hash.put("tRESTRequest_1_Loop", true);
  3011.                 end_Hash.put("tRESTRequest_1_Loop", System.currentTimeMillis());
  3012.  
  3013.                 /**
  3014.                  * [tRESTRequest_1_Loop end ] stop
  3015.                  */
  3016.             }// end the resume
  3017.  
  3018.         } catch (java.lang.Exception e) {
  3019.  
  3020.             TalendException te = new TalendException(e, currentComponent,
  3021.                     globalMap);
  3022.  
  3023.             te.setVirtualComponentName(currentVirtualComponent);
  3024.  
  3025.             throw te;
  3026.         } catch (java.lang.Error error) {
  3027.  
  3028.             throw error;
  3029.         } finally {
  3030.  
  3031.             try {
  3032.  
  3033.                 /**
  3034.                  * [tRESTRequest_1_Loop finally ] start
  3035.                  */
  3036.  
  3037.                 currentVirtualComponent = "tRESTRequest_1";
  3038.  
  3039.                 currentComponent = "tRESTRequest_1_Loop";
  3040.  
  3041.                 /**
  3042.                  * [tRESTRequest_1_Loop finally ] stop
  3043.                  */
  3044.  
  3045.                 /**
  3046.                  * [tRESTRequest_1_In finally ] start
  3047.                  */
  3048.  
  3049.                 currentVirtualComponent = "tRESTRequest_1";
  3050.  
  3051.                 currentComponent = "tRESTRequest_1_In";
  3052.  
  3053.                 /**
  3054.                  * [tRESTRequest_1_In finally ] stop
  3055.                  */
  3056.  
  3057.                 /**
  3058.                  * [tXMLMap_1_TXMLMAP_OUT finally ] start
  3059.                  */
  3060.  
  3061.                 currentVirtualComponent = "tXMLMap_1";
  3062.  
  3063.                 currentComponent = "tXMLMap_1_TXMLMAP_OUT";
  3064.  
  3065.                 /**
  3066.                  * [tXMLMap_1_TXMLMAP_OUT finally ] stop
  3067.                  */
  3068.  
  3069.                 /**
  3070.                  * [tXMLMap_1_TXMLMAP_IN finally ] start
  3071.                  */
  3072.  
  3073.                 currentVirtualComponent = "tXMLMap_1";
  3074.  
  3075.                 currentComponent = "tXMLMap_1_TXMLMAP_IN";
  3076.  
  3077.                 /**
  3078.                  * [tXMLMap_1_TXMLMAP_IN finally ] stop
  3079.                  */
  3080.  
  3081.                 /**
  3082.                  * [tRESTResponse_1 finally ] start
  3083.                  */
  3084.  
  3085.                 currentComponent = "tRESTResponse_1";
  3086.  
  3087.                 /**
  3088.                  * [tRESTResponse_1 finally ] stop
  3089.                  */
  3090.  
  3091.                 /**
  3092.                  * [tMysqlOutput_1 finally ] start
  3093.                  */
  3094.  
  3095.                 currentComponent = "tMysqlOutput_1";
  3096.  
  3097.                 if (resourceMap.get("finish_tMysqlOutput_1") == null) {
  3098.                     if (resourceMap.get("conn_tMysqlOutput_1") != null) {
  3099.                         try {
  3100.  
  3101.                             ((java.sql.Connection) resourceMap
  3102.                                     .get("conn_tMysqlOutput_1")).close();
  3103.  
  3104.                         } catch (java.sql.SQLException sqlEx_tMysqlOutput_1) {
  3105.                             String errorMessage_tMysqlOutput_1 = "failed to close the connection in tMysqlOutput_1 :"
  3106.                                     + sqlEx_tMysqlOutput_1.getMessage();
  3107.  
  3108.                             System.err.println(errorMessage_tMysqlOutput_1);
  3109.                         }
  3110.                     }
  3111.                 }
  3112.  
  3113.                 /**
  3114.                  * [tMysqlOutput_1 finally ] stop
  3115.                  */
  3116.  
  3117.             } catch (java.lang.Exception e) {
  3118.                 // ignore
  3119.             } catch (java.lang.Error error) {
  3120.                 // ignore
  3121.             }
  3122.             resourceMap = null;
  3123.         }
  3124.  
  3125.         globalMap.put("tRESTRequest_1_Loop_SUBPROCESS_STATE", 1);
  3126.     }
  3127.  
  3128.     public String resuming_logs_dir_path = null;
  3129.     public String resuming_checkpoint_path = null;
  3130.     public String parent_part_launcher = null;
  3131.     private String resumeEntryMethodName = null;
  3132.     private boolean globalResumeTicket = false;
  3133.  
  3134.     public boolean watch = false;
  3135.     // portStats is null, it means don't execute the statistics
  3136.     public Integer portStats = null;
  3137.     public int portTraces = 4334;
  3138.     public String clientHost;
  3139.     public String defaultClientHost = "localhost";
  3140.     public String contextStr = "Default";
  3141.     public boolean isDefaultContext = true;
  3142.     public String pid = "0";
  3143.     public String rootPid = null;
  3144.     public String fatherPid = null;
  3145.     public String fatherNode = null;
  3146.     public long startTime = 0;
  3147.     public boolean isChildJob = false;
  3148.     public String log4jLevel = "";
  3149.  
  3150.     private boolean execStat = true;
  3151.  
  3152.     private ThreadLocal<java.util.Map<String, String>> threadLocal = new ThreadLocal<java.util.Map<String, String>>() {
  3153.         protected java.util.Map<String, String> initialValue() {
  3154.             java.util.Map<String, String> threadRunResultMap = new java.util.HashMap<String, String>();
  3155.             threadRunResultMap.put("errorCode", null);
  3156.             threadRunResultMap.put("status", "");
  3157.             return threadRunResultMap;
  3158.         };
  3159.     };
  3160.  
  3161.     private java.util.Properties context_param = new java.util.Properties();
  3162.     public java.util.Map<String, Object> parentContextMap = new java.util.HashMap<String, Object>();
  3163.  
  3164.     public String status = "";
  3165.  
  3166.     public static void main(String[] args) {
  3167.         final Penetapan PenetapanClass = new Penetapan();
  3168.  
  3169.         int exitCode = PenetapanClass.runJobInTOS(args);
  3170.  
  3171.         System.exit(exitCode);
  3172.     }
  3173.  
  3174.     public String[][] runJob(String[] args) {
  3175.  
  3176.         int exitCode = runJobInTOS(args);
  3177.         String[][] bufferValue = new String[][] { { Integer.toString(exitCode) } };
  3178.  
  3179.         return bufferValue;
  3180.     }
  3181.  
  3182.     public boolean hastBufferOutputComponent() {
  3183.         boolean hastBufferOutput = false;
  3184.  
  3185.         return hastBufferOutput;
  3186.     }
  3187.  
  3188.     public int runJobInTOS(String[] args) {
  3189.         // reset status
  3190.         status = "";
  3191.  
  3192.         String lastStr = "";
  3193.         for (String arg : args) {
  3194.             if (arg.equalsIgnoreCase("--context_param")) {
  3195.                 lastStr = arg;
  3196.             } else if (lastStr.equals("")) {
  3197.                 evalParam(arg);
  3198.             } else {
  3199.                 evalParam(lastStr + " " + arg);
  3200.                 lastStr = "";
  3201.             }
  3202.         }
  3203.  
  3204.         if (clientHost == null) {
  3205.             clientHost = defaultClientHost;
  3206.         }
  3207.  
  3208.         if (pid == null || "0".equals(pid)) {
  3209.             pid = TalendString.getAsciiRandomString(6);
  3210.         }
  3211.  
  3212.         if (rootPid == null) {
  3213.             rootPid = pid;
  3214.         }
  3215.         if (fatherPid == null) {
  3216.             fatherPid = pid;
  3217.         } else {
  3218.             isChildJob = true;
  3219.         }
  3220.  
  3221.         try {
  3222.             // call job/subjob with an existing context, like:
  3223.             // --context=production. if without this parameter, there will use
  3224.             // the default context instead.
  3225.             java.io.InputStream inContext = Penetapan.class.getClassLoader()
  3226.                     .getResourceAsStream(
  3227.                             "local_project/penetapan_0_1/contexts/"
  3228.                                     + contextStr + ".properties");
  3229.             if (isDefaultContext && inContext == null) {
  3230.  
  3231.             } else {
  3232.                 if (inContext != null) {
  3233.                     // defaultProps is in order to keep the original context
  3234.                     // value
  3235.                     defaultProps.load(inContext);
  3236.                     inContext.close();
  3237.                     context = new ContextProperties(defaultProps);
  3238.                 } else {
  3239.                     // print info and job continue to run, for case:
  3240.                     // context_param is not empty.
  3241.                     System.err.println("Could not find the context "
  3242.                             + contextStr);
  3243.                 }
  3244.             }
  3245.  
  3246.             if (!context_param.isEmpty()) {
  3247.                 context.putAll(context_param);
  3248.             }
  3249.         } catch (java.io.IOException ie) {
  3250.             System.err.println("Could not load context " + contextStr);
  3251.             ie.printStackTrace();
  3252.         }
  3253.  
  3254.         // get context value from parent directly
  3255.         if (parentContextMap != null && !parentContextMap.isEmpty()) {
  3256.         }
  3257.  
  3258.         // Resume: init the resumeUtil
  3259.         resumeEntryMethodName = ResumeUtil
  3260.                 .getResumeEntryMethodName(resuming_checkpoint_path);
  3261.         resumeUtil = new ResumeUtil(resuming_logs_dir_path, isChildJob, rootPid);
  3262.         resumeUtil.initCommonInfo(pid, rootPid, fatherPid, projectName,
  3263.                 jobName, contextStr, jobVersion);
  3264.  
  3265.         List<String> parametersToEncrypt = new java.util.ArrayList<String>();
  3266.         // Resume: jobStart
  3267.         resumeUtil.addLog("JOB_STARTED", "JOB:" + jobName,
  3268.                 parent_part_launcher, Thread.currentThread().getId() + "", "",
  3269.                 "", "", "",
  3270.                 resumeUtil.convertToJsonText(context, parametersToEncrypt));
  3271.  
  3272.         java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap = new java.util.concurrent.ConcurrentHashMap<Object, Object>();
  3273.         globalMap.put("concurrentHashMap", concurrentHashMap);
  3274.  
  3275.         long startUsedMemory = Runtime.getRuntime().totalMemory()
  3276.                 - Runtime.getRuntime().freeMemory();
  3277.         long endUsedMemory = 0;
  3278.         long end = 0;
  3279.  
  3280.         startTime = System.currentTimeMillis();
  3281.  
  3282.         this.globalResumeTicket = true;// to run tPreJob
  3283.  
  3284.         this.globalResumeTicket = false;// to run others jobs
  3285.  
  3286.         try {
  3287.             errorCode = null;
  3288.             tRESTRequest_1_LoopProcess(globalMap);
  3289.             if (!"failure".equals(status)) {
  3290.                 status = "end";
  3291.             }
  3292.         } catch (TalendException e_tRESTRequest_1_Loop) {
  3293.             globalMap.put("tRESTRequest_1_Loop_SUBPROCESS_STATE", -1);
  3294.  
  3295.             e_tRESTRequest_1_Loop.printStackTrace();
  3296.  
  3297.         }
  3298.  
  3299.         this.globalResumeTicket = true;// to run tPostJob
  3300.  
  3301.         end = System.currentTimeMillis();
  3302.  
  3303.         if (watch) {
  3304.             System.out.println((end - startTime) + " milliseconds");
  3305.         }
  3306.  
  3307.         endUsedMemory = Runtime.getRuntime().totalMemory()
  3308.                 - Runtime.getRuntime().freeMemory();
  3309.         if (false) {
  3310.             System.out.println((endUsedMemory - startUsedMemory)
  3311.                     + " bytes memory increase when running : Penetapan");
  3312.         }
  3313.  
  3314.         int returnCode = 0;
  3315.         if (errorCode == null) {
  3316.             returnCode = status != null && status.equals("failure") ? 1 : 0;
  3317.         } else {
  3318.             returnCode = errorCode.intValue();
  3319.         }
  3320.         resumeUtil.addLog("JOB_ENDED", "JOB:" + jobName, parent_part_launcher,
  3321.                 Thread.currentThread().getId() + "", "", "" + returnCode, "",
  3322.                 "", "");
  3323.  
  3324.         return returnCode;
  3325.  
  3326.     }
  3327.  
  3328.     // only for OSGi env
  3329.     public void destroy() {
  3330.  
  3331.     }
  3332.  
  3333.     private java.util.Map<String, Object> getSharedConnections4REST() {
  3334.         java.util.Map<String, Object> connections = new java.util.HashMap<String, Object>();
  3335.  
  3336.         return connections;
  3337.     }
  3338.  
  3339.     private void evalParam(String arg) {
  3340.         if (arg.startsWith("--resuming_logs_dir_path")) {
  3341.             resuming_logs_dir_path = arg.substring(25);
  3342.         } else if (arg.startsWith("--resuming_checkpoint_path")) {
  3343.             resuming_checkpoint_path = arg.substring(27);
  3344.         } else if (arg.startsWith("--parent_part_launcher")) {
  3345.             parent_part_launcher = arg.substring(23);
  3346.         } else if (arg.startsWith("--watch")) {
  3347.             watch = true;
  3348.         } else if (arg.startsWith("--stat_port=")) {
  3349.             String portStatsStr = arg.substring(12);
  3350.             if (portStatsStr != null && !portStatsStr.equals("null")) {
  3351.                 portStats = Integer.parseInt(portStatsStr);
  3352.             }
  3353.         } else if (arg.startsWith("--trace_port=")) {
  3354.             portTraces = Integer.parseInt(arg.substring(13));
  3355.         } else if (arg.startsWith("--client_host=")) {
  3356.             clientHost = arg.substring(14);
  3357.         } else if (arg.startsWith("--context=")) {
  3358.             contextStr = arg.substring(10);
  3359.             isDefaultContext = false;
  3360.         } else if (arg.startsWith("--father_pid=")) {
  3361.             fatherPid = arg.substring(13);
  3362.         } else if (arg.startsWith("--root_pid=")) {
  3363.             rootPid = arg.substring(11);
  3364.         } else if (arg.startsWith("--father_node=")) {
  3365.             fatherNode = arg.substring(14);
  3366.         } else if (arg.startsWith("--pid=")) {
  3367.             pid = arg.substring(6);
  3368.         } else if (arg.startsWith("--context_param")) {
  3369.             String keyValue = arg.substring(16);
  3370.             int index = -1;
  3371.             if (keyValue != null && (index = keyValue.indexOf('=')) > -1) {
  3372.                 if (fatherPid == null) {
  3373.                     context_param.put(keyValue.substring(0, index),
  3374.                             replaceEscapeChars(keyValue.substring(index + 1)));
  3375.                 } else { // the subjob won't escape the especial chars
  3376.                     context_param.put(keyValue.substring(0, index),
  3377.                             keyValue.substring(index + 1));
  3378.                 }
  3379.             }
  3380.         } else if (arg.startsWith("--log4jLevel=")) {
  3381.             log4jLevel = arg.substring(13);
  3382.         }
  3383.  
  3384.     }
  3385.  
  3386.     private final String[][] escapeChars = { { "\\\\", "\\" }, { "\\n", "\n" },
  3387.             { "\\'", "\'" }, { "\\r", "\r" }, { "\\f", "\f" }, { "\\b", "\b" },
  3388.             { "\\t", "\t" } };
  3389.  
  3390.     private String replaceEscapeChars(String keyValue) {
  3391.  
  3392.         if (keyValue == null || ("").equals(keyValue.trim())) {
  3393.             return keyValue;
  3394.         }
  3395.  
  3396.         StringBuilder result = new StringBuilder();
  3397.         int currIndex = 0;
  3398.         while (currIndex < keyValue.length()) {
  3399.             int index = -1;
  3400.             // judege if the left string includes escape chars
  3401.             for (String[] strArray : escapeChars) {
  3402.                 index = keyValue.indexOf(strArray[0], currIndex);
  3403.                 if (index >= 0) {
  3404.  
  3405.                     result.append(keyValue.substring(currIndex,
  3406.                             index + strArray[0].length()).replace(strArray[0],
  3407.                             strArray[1]));
  3408.                     currIndex = index + strArray[0].length();
  3409.                     break;
  3410.                 }
  3411.             }
  3412.             // if the left string doesn't include escape chars, append the left
  3413.             // into the result
  3414.             if (index < 0) {
  3415.                 result.append(keyValue.substring(currIndex));
  3416.                 currIndex = currIndex + keyValue.length();
  3417.             }
  3418.         }
  3419.  
  3420.         return result.toString();
  3421.     }
  3422.  
  3423.     public Integer getErrorCode() {
  3424.         return errorCode;
  3425.     }
  3426.  
  3427.     public String getStatus() {
  3428.         return status;
  3429.     }
  3430.  
  3431.     ResumeUtil resumeUtil = null;
  3432. }
  3433. /************************************************************************************************
  3434.  * 99604 characters generated by Talend Open Studio for ESB on the December 22,
  3435.  * 2016 3:27:57 PM WIB
  3436.  ************************************************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement