Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ============================================================================
- //
- // Copyright (c) 2006-2015, Talend Inc.
- //
- // This source code has been automatically generated by_Talend Open Studio for ESB
- // / Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- package local_project.penetapan_0_1;
- import routines.aaa;
- import routines.KoreksiRoutine;
- import routines.DataOperation;
- import routines.TalendDataGenerator;
- import routines.Relational;
- import routines.Mathematical;
- import routines.PenetapanRoutine;
- import routines.updatePendapatan;
- import routines.Numeric;
- import routines.PembatalanRoutine;
- import routines.TalendString;
- import routines.StringHandling;
- import routines.TalendDate;
- import routines.KeringananRoutine;
- import routines.GenerateNtpd;
- import routines.system.*;
- import routines.system.api.*;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.List;
- import java.math.BigDecimal;
- import java.io.ByteArrayOutputStream;
- import java.io.ByteArrayInputStream;
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.ObjectOutputStream;
- import java.io.ObjectInputStream;
- import java.io.IOException;
- import java.util.Comparator;
- @SuppressWarnings("unused")
- /**
- * Job: Penetapan Purpose: Penetapan<br>
- * Description: Penetapan <br>
- * @author user@talend.com
- * @version 6.3.0.20161026_1219
- * @status
- */
- public class Penetapan implements TalendJob {
- public final Object obj = new Object();
- // for transmiting parameters purpose
- private Object valueObject = null;
- public Object getValueObject() {
- return this.valueObject;
- }
- public void setValueObject(Object valueObject) {
- this.valueObject = valueObject;
- }
- private final static String defaultCharset = java.nio.charset.Charset
- .defaultCharset().name();
- private final static String utf8Charset = "UTF-8";
- // create and load default properties
- private java.util.Properties defaultProps = new java.util.Properties();
- // create application properties with default
- public class ContextProperties extends java.util.Properties {
- private static final long serialVersionUID = 1L;
- public ContextProperties(java.util.Properties properties) {
- super(properties);
- }
- public ContextProperties() {
- super();
- }
- public void synchronizeContext() {
- }
- }
- private ContextProperties context = new ContextProperties();
- public ContextProperties getContext() {
- return this.context;
- }
- private final String jobVersion = "0.1";
- private final String jobName = "Penetapan";
- private final String projectName = "LOCAL_PROJECT";
- public Integer errorCode = null;
- private String currentComponent = "";
- private final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
- private final static java.util.Map<String, Object> junitGlobalMap = new java.util.HashMap<String, Object>();
- private final java.util.Map<String, Long> start_Hash = new java.util.HashMap<String, Long>();
- private final java.util.Map<String, Long> end_Hash = new java.util.HashMap<String, Long>();
- private final java.util.Map<String, Boolean> ok_Hash = new java.util.HashMap<String, Boolean>();
- public final java.util.List<String[]> globalBuffer = new java.util.ArrayList<String[]>();
- // OSGi DataSource
- private final static String KEY_DB_DATASOURCES = "KEY_DB_DATASOURCES";
- public void setDataSources(
- java.util.Map<String, javax.sql.DataSource> dataSources) {
- java.util.Map<String, routines.system.TalendDataSource> talendDataSources = new java.util.HashMap<String, routines.system.TalendDataSource>();
- for (java.util.Map.Entry<String, javax.sql.DataSource> dataSourceEntry : dataSources
- .entrySet()) {
- talendDataSources.put(
- dataSourceEntry.getKey(),
- new routines.system.TalendDataSource(dataSourceEntry
- .getValue()));
- }
- globalMap.put(KEY_DB_DATASOURCES, talendDataSources);
- }
- private final java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
- private final java.io.PrintStream errorMessagePS = new java.io.PrintStream(
- new java.io.BufferedOutputStream(baos));
- public String getExceptionStackTrace() {
- if ("failure".equals(this.getStatus())) {
- errorMessagePS.flush();
- return baos.toString();
- }
- return null;
- }
- private Exception exception;
- public Exception getException() {
- if ("failure".equals(this.getStatus())) {
- return this.exception;
- }
- return null;
- }
- private class TalendException extends Exception {
- private static final long serialVersionUID = 1L;
- private java.util.Map<String, Object> globalMap = null;
- private Exception e = null;
- private String currentComponent = null;
- private String virtualComponentName = null;
- public void setVirtualComponentName(String virtualComponentName) {
- this.virtualComponentName = virtualComponentName;
- }
- private TalendException(Exception e, String errorComponent,
- final java.util.Map<String, Object> globalMap) {
- this.currentComponent = errorComponent;
- this.globalMap = globalMap;
- this.e = e;
- }
- public Exception getException() {
- return this.e;
- }
- public String getCurrentComponent() {
- return this.currentComponent;
- }
- public String getExceptionCauseMessage(Exception e) {
- Throwable cause = e;
- String message = null;
- int i = 10;
- while (null != cause && 0 < i--) {
- message = cause.getMessage();
- if (null == message) {
- cause = cause.getCause();
- } else {
- break;
- }
- }
- if (null == message) {
- message = e.getClass().getName();
- }
- return message;
- }
- @Override
- public void printStackTrace() {
- if (!(e instanceof TalendException || e instanceof TDieException)) {
- if (virtualComponentName != null
- && currentComponent.indexOf(virtualComponentName + "_") == 0) {
- globalMap.put(virtualComponentName + "_ERROR_MESSAGE",
- getExceptionCauseMessage(e));
- }
- globalMap.put(currentComponent + "_ERROR_MESSAGE",
- getExceptionCauseMessage(e));
- System.err
- .println("Exception in component " + currentComponent);
- }
- if (!(e instanceof TDieException)) {
- if (e instanceof TalendException) {
- e.printStackTrace();
- } else {
- e.printStackTrace();
- e.printStackTrace(errorMessagePS);
- Penetapan.this.exception = e;
- }
- }
- if (!(e instanceof TalendException)) {
- try {
- for (java.lang.reflect.Method m : this.getClass()
- .getEnclosingClass().getMethods()) {
- if (m.getName().compareTo(currentComponent + "_error") == 0) {
- m.invoke(Penetapan.this, new Object[] { e,
- currentComponent, globalMap });
- break;
- }
- }
- if (!(e instanceof TDieException)) {
- }
- } catch (Exception e) {
- this.e.printStackTrace();
- }
- }
- }
- }
- public void tRESTResponse_1_error(Exception exception,
- String errorComponent, final java.util.Map<String, Object> globalMap)
- throws TalendException {
- end_Hash.put(errorComponent, System.currentTimeMillis());
- status = "failure";
- tRESTRequest_1_Loop_onSubJobError(exception, errorComponent, globalMap);
- }
- public void tMysqlOutput_1_error(Exception exception,
- String errorComponent, final java.util.Map<String, Object> globalMap)
- throws TalendException {
- end_Hash.put(errorComponent, System.currentTimeMillis());
- status = "failure";
- tRESTRequest_1_Loop_onSubJobError(exception, errorComponent, globalMap);
- }
- public void tRESTRequest_1_Loop_error(Exception exception,
- String errorComponent, final java.util.Map<String, Object> globalMap)
- throws TalendException {
- tRESTRequest_1_In_error(exception, errorComponent, globalMap);
- }
- public void tRESTRequest_1_In_error(Exception exception,
- String errorComponent, final java.util.Map<String, Object> globalMap)
- throws TalendException {
- end_Hash.put(errorComponent, System.currentTimeMillis());
- status = "failure";
- tRESTRequest_1_Loop_onSubJobError(exception, errorComponent, globalMap);
- }
- public void tXMLMap_1_TXMLMAP_OUT_error(Exception exception,
- String errorComponent, final java.util.Map<String, Object> globalMap)
- throws TalendException {
- tXMLMap_1_TXMLMAP_IN_error(exception, errorComponent, globalMap);
- }
- public void tXMLMap_1_TXMLMAP_IN_error(Exception exception,
- String errorComponent, final java.util.Map<String, Object> globalMap)
- throws TalendException {
- end_Hash.put(errorComponent, System.currentTimeMillis());
- status = "failure";
- tRESTRequest_1_Loop_onSubJobError(exception, errorComponent, globalMap);
- }
- public void tRESTRequest_1_Loop_onSubJobError(Exception exception,
- String errorComponent, final java.util.Map<String, Object> globalMap)
- throws TalendException {
- resumeUtil.addLog("SYSTEM_LOG", "NODE:" + errorComponent, "", Thread
- .currentThread().getId() + "", "FATAL", "",
- exception.getMessage(),
- ResumeUtil.getExceptionStackTrace(exception), "");
- }
- private boolean runInTalendEsbRuntimeContainer = false;
- public void setRunInTalendEsbRuntimeContainer(boolean flag) {
- runInTalendEsbRuntimeContainer = flag;
- }
- private boolean restTalendJobAlreadyStarted = false;
- /**
- * REST provider implementation
- */
- @javax.ws.rs.Path("/")
- public static class RestServiceProviderImpl4TalendJob {
- @javax.ws.rs.core.Context
- private org.apache.cxf.jaxrs.ext.MessageContext messageContext;
- private final Penetapan job;
- public RestServiceProviderImpl4TalendJob(Penetapan job) {
- this.job = job;
- }
- private void populateRequestWithJobContext(
- java.util.Map<String, Object> requestGlobalMap, Penetapan job) {
- // pass job DataSources
- java.util.Map<String, routines.system.TalendDataSource> talendDataSources = (java.util.Map<String, routines.system.TalendDataSource>) job.globalMap
- .get(KEY_DB_DATASOURCES);
- if (null != talendDataSources) {
- java.util.Map<String, routines.system.TalendDataSource> restDataSources = new java.util.HashMap<String, routines.system.TalendDataSource>();
- for (java.util.Map.Entry<String, routines.system.TalendDataSource> talendDataSourceEntry : talendDataSources
- .entrySet()) {
- restDataSources.put(talendDataSourceEntry.getKey(),
- new routines.system.TalendDataSource(
- talendDataSourceEntry.getValue()
- .getRawDataSource()));
- }
- requestGlobalMap.put(KEY_DB_DATASOURCES, restDataSources);
- }
- // pass job shared connections
- requestGlobalMap.putAll(job.getSharedConnections4REST());
- // pass job concurrent map
- requestGlobalMap.put("concurrentHashMap",
- job.globalMap.get("concurrentHashMap"));
- }
- private void closePassedDataSourceConnections(
- java.util.Map<String, Object> requestGlobalMap) {
- // close connections in passed job DataSources
- try {
- java.util.Map<String, routines.system.TalendDataSource> restDataSources = (java.util.Map<String, routines.system.TalendDataSource>) requestGlobalMap
- .get(KEY_DB_DATASOURCES);
- if (null != restDataSources) {
- for (routines.system.TalendDataSource restDataSource : restDataSources
- .values()) {
- restDataSource.close();
- }
- }
- } catch (Throwable e) {
- e.printStackTrace(System.err);
- }
- }
- private javax.ws.rs.core.Response processRequest(
- java.util.Map<String, Object> request) {
- final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
- try {
- globalMap.put("restRequest", request);
- populateRequestWithJobContext(globalMap, job);
- job.tRESTRequest_1_LoopProcess(globalMap);
- java.util.Map<String, Object> response = (java.util.Map<String, Object>) globalMap
- .get("restResponse");
- Object responseBody = null;
- Integer status = null;
- java.util.Map<String, String> headers = null;
- if (null != response) {
- Object dropJsonRootProp = response
- .get("drop.json.root.element");
- Boolean dropJsonRoot = (null == dropJsonRootProp) ? false
- : (Boolean) dropJsonRootProp;
- messageContext.put("drop.json.root.element",
- dropJsonRoot.toString());
- responseBody = response.get("BODY");
- status = (Integer) response.get("STATUS");
- headers = (java.util.Map<String, String>) response
- .get("HEADERS");
- }
- if (null == status) {
- status = (request.containsKey("STATUS")) ? (Integer) request
- .get("STATUS") : 404;
- }
- javax.ws.rs.core.Response.ResponseBuilder responseBuilder = javax.ws.rs.core.Response
- .status(status).entity(responseBody);
- if (headers != null) {
- for (java.util.Map.Entry<String, String> header : headers
- .entrySet()) {
- responseBuilder.header(header.getKey(),
- header.getValue());
- }
- }
- return responseBuilder.build();
- } catch (Throwable ex) {
- ex.printStackTrace();
- throw new javax.ws.rs.WebApplicationException(ex, 500);
- } finally {
- // close DB connections
- closePassedDataSourceConnections(globalMap);
- }
- }
- private javax.ws.rs.core.Response processStreamingResponseRequest(
- final java.util.Map<String, Object> request) {
- javax.ws.rs.core.StreamingOutput streamingOutput = new javax.ws.rs.core.StreamingOutput() {
- public void write(java.io.OutputStream output) {
- final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
- try {
- globalMap.put("restResponseStream", output);
- globalMap.put("restRequest", request);
- populateRequestWithJobContext(globalMap, job);
- job.tRESTRequest_1_LoopProcess(globalMap);
- if (globalMap
- .containsKey("restResponseWrappingClosure")) {
- output.write(((String) globalMap
- .get("restResponseWrappingClosure"))
- .getBytes());
- }
- } catch (Throwable ex) {
- ex.printStackTrace();
- throw new javax.ws.rs.WebApplicationException(ex, 500);
- } finally {
- // close DB connections
- closePassedDataSourceConnections(globalMap);
- }
- }
- };
- return javax.ws.rs.core.Response.ok().entity(streamingOutput)
- .build();
- }
- @javax.ws.rs.POST()
- @javax.ws.rs.Path("/")
- @javax.ws.rs.Consumes({ "application/json" })
- @javax.ws.rs.Produces({ "application/json" })
- public javax.ws.rs.core.Response in(
- org.dom4j.Document body
- ) {
- java.util.Map<String, Object> request_tRESTRequest_1 = new java.util.HashMap<String, Object>();
- request_tRESTRequest_1.put("VERB", "POST");
- request_tRESTRequest_1.put("OPERATION", "in");
- request_tRESTRequest_1.put("PATTERN", "/");
- request_tRESTRequest_1.put("BODY", body);
- populateRequestInfo(request_tRESTRequest_1, messageContext);
- java.util.Map<String, Object> parameters_tRESTRequest_1 = new java.util.HashMap<String, Object>();
- request_tRESTRequest_1.put("PARAMS", parameters_tRESTRequest_1);
- return processStreamingResponseRequest(request_tRESTRequest_1);
- }
- public javax.ws.rs.core.Response handleWrongRequest(
- org.apache.cxf.jaxrs.ext.MessageContext context, int status,
- String error) {
- // System.out.println("wrong call [uri: " +
- // context.getUriInfo().getPath() + " ; method: " +
- // context.getRequest().getMethod() + " ; status: " + status +
- // " ; error: " + error + "]");
- java.util.Map<String, Object> wrongRequest = new java.util.HashMap<String, Object>();
- wrongRequest.put("ERROR", error);
- wrongRequest.put("STATUS", status);
- wrongRequest.put("VERB", context.getRequest().getMethod());
- wrongRequest.put("URI", context.getUriInfo().getPath());
- wrongRequest.put("URI_BASE", context.getUriInfo().getBaseUri()
- .toString());
- wrongRequest.put("URI_ABSOLUTE", context.getUriInfo()
- .getAbsolutePath().toString());
- wrongRequest.put("URI_REQUEST", context.getUriInfo()
- .getRequestUri().toString());
- return processRequest(wrongRequest);
- }
- private void populateRequestInfo(java.util.Map<String, Object> request,
- org.apache.cxf.jaxrs.ext.MessageContext context) {
- final javax.ws.rs.core.UriInfo ui = context.getUriInfo();
- request.put("URI", ui.getPath());
- request.put("URI_BASE", ui.getBaseUri().toString());
- request.put("URI_ABSOLUTE", ui.getAbsolutePath().toString());
- request.put("URI_REQUEST", ui.getRequestUri().toString());
- request.put("ALL_HEADER_PARAMS", context.getHttpHeaders()
- .getRequestHeaders());
- request.put("ALL_QUERY_PARAMS", ui.getQueryParameters());
- javax.ws.rs.core.SecurityContext securityContext = context
- .getSecurityContext();
- if (null != securityContext
- && null != securityContext.getUserPrincipal()) {
- request.put("PRINCIPAL_NAME", securityContext
- .getUserPrincipal().getName());
- }
- request.put("CorrelationID", context.get("CorrelationID"));
- request.put("MESSAGE_CONTEXT", context);
- }
- private void populateMultipartRequestInfo(
- java.util.Map<String, Object> request,
- org.apache.cxf.jaxrs.ext.MessageContext context,
- java.util.List<String> partNames) {
- java.util.Map<String, String> attachmentFilenames = new java.util.HashMap<String, String>();
- 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>>>();
- for (String partName : partNames) {
- org.apache.cxf.jaxrs.ext.multipart.Attachment attachment = getFirstMatchingPart(
- context, partName);
- if (null != attachment) {
- attachmentHeaders.put(partName, attachment.getHeaders());
- if (null != attachment.getContentDisposition()) {
- String filename = attachment.getContentDisposition()
- .getParameter("filename");
- if (null != filename) {
- attachmentFilenames.put(partName, filename);
- }
- }
- }
- }
- request.put("ATTACHMENT_HEADERS", attachmentHeaders);
- request.put("ATTACHMENT_FILENAMES", attachmentFilenames);
- }
- private static org.apache.cxf.jaxrs.ext.multipart.Attachment getFirstMatchingPart(
- org.apache.cxf.jaxrs.ext.MessageContext context, String partName) {
- List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments = org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils
- .getAttachments(context);
- for (org.apache.cxf.jaxrs.ext.multipart.Attachment attachment : attachments) {
- if (partName.equals(attachment.getContentId())) {
- return attachment;
- }
- org.apache.cxf.jaxrs.ext.multipart.ContentDisposition cd = attachment
- .getContentDisposition();
- if (null != cd && partName.equals(cd.getParameter("name"))) {
- return attachment;
- }
- }
- // unexpected
- throw new javax.ws.rs.InternalServerErrorException();
- }
- }
- public static class ExceptionMapper4TalendJobRestService extends
- org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper {
- @javax.ws.rs.core.Context
- private org.apache.cxf.jaxrs.ext.MessageContext messageContext;
- private RestServiceProviderImpl4TalendJob provider;
- public ExceptionMapper4TalendJobRestService(
- RestServiceProviderImpl4TalendJob provider) {
- this.provider = provider;
- }
- public javax.ws.rs.core.Response toResponse(
- javax.ws.rs.WebApplicationException ex) {
- String error = null;
- javax.ws.rs.core.Response response = ex.getResponse();
- if (null != response && null != response.getEntity()) {
- error = response.getEntity().toString();
- }
- response = super.toResponse(ex);
- if (null == error) {
- if (null != response && null != response.getEntity()) {
- error = response.getEntity().toString();
- } else {
- error = null == ex.getCause() ? ex.getMessage() : ex
- .getCause().getMessage();
- }
- }
- response = provider.handleWrongRequest(messageContext,
- response.getStatus(), error);
- java.util.List<javax.ws.rs.core.MediaType> accepts = messageContext
- .getHttpHeaders().getAcceptableMediaTypes();
- javax.ws.rs.core.MediaType responseType = accepts.isEmpty() ? null
- : accepts.get(0);
- if (responseType == null
- || !responseType.getSubtype().equals("xml")
- && !responseType.getSubtype().equals("json")) {
- responseType = javax.ws.rs.core.MediaType.APPLICATION_XML_TYPE;
- }
- javax.ws.rs.core.Response r = javax.ws.rs.core.Response
- .status(response.getStatus()).entity(response.getEntity())
- .type(responseType).build();
- if (response.getHeaders() != null) {
- r.getHeaders().putAll(response.getHeaders());
- }
- return r;
- }
- }
- private String checkEndpointUrl(String url) {
- final String defaultEndpointUrl = "http://127.0.0.1:8090/";
- String endpointUrl = url;
- if (null == endpointUrl || endpointUrl.trim().isEmpty()) {
- endpointUrl = defaultEndpointUrl;
- } else if (!endpointUrl.contains("://")) { // relative
- if (endpointUrl.startsWith("/")) {
- endpointUrl = endpointUrl.substring(1);
- }
- endpointUrl = defaultEndpointUrl + endpointUrl;
- }
- // test for busy
- java.net.URI endpointURI = java.net.URI.create(endpointUrl);
- String host = endpointURI.getHost();
- try {
- if (java.net.InetAddress.getByName(host).isLoopbackAddress()) {
- int port = endpointURI.getPort();
- java.net.ServerSocket ss = null;
- try {
- ss = new java.net.ServerSocket(port);
- } catch (IOException e) {
- // rethrow exception
- throw new IllegalArgumentException(
- "Cannot start provider with uri: " + endpointUrl
- + ". Port " + port + " already in use.");
- } finally {
- if (ss != null) {
- try {
- ss.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- try {
- // ok, let's doublecheck for silent listeners
- java.net.Socket cs = new java.net.Socket(host, port);
- // if succeed - somebody silently listening, fail!
- cs.close();
- // rethrow exception
- throw new IllegalArgumentException(
- "Cannot start provider with uri: " + endpointUrl
- + ". Port " + port + " already in use.");
- } catch (IOException e) {
- // ok, nobody listens, proceed
- }
- }
- } catch (java.net.UnknownHostException e) {
- // ignore
- }
- return endpointUrl;
- }
- public static class StreamingDOM4JProvider extends
- org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider {
- public static final String SUPRESS_XML_DECLARATION = "supress.xml.declaration";
- public void writeTo(org.dom4j.Document doc, Class<?> cls,
- java.lang.reflect.Type type,
- java.lang.annotation.Annotation[] anns,
- javax.ws.rs.core.MediaType mt,
- javax.ws.rs.core.MultivaluedMap<String, Object> headers,
- java.io.OutputStream os) throws java.io.IOException,
- javax.ws.rs.WebApplicationException {
- if (mt.getSubtype().contains("xml")) {
- org.dom4j.io.XMLWriter writer;
- if (org.apache.cxf.jaxrs.utils.JAXRSUtils.getCurrentMessage()
- .getExchange().containsKey(SUPRESS_XML_DECLARATION)) {
- org.dom4j.io.OutputFormat format = new org.dom4j.io.OutputFormat();
- format.setSuppressDeclaration(true);
- writer = new org.dom4j.io.XMLWriter(os, format);
- } else {
- writer = new org.dom4j.io.XMLWriter(os);
- }
- writer.write(doc);
- writer.flush();
- } else {
- super.writeTo(doc, cls, type, anns, mt, headers, os);
- }
- }
- }
- Thread4RestServiceProviderEndpoint thread4RestServiceProviderEndpoint = null;
- class Thread4RestServiceProviderEndpoint extends Thread {
- private final String endpointUrl;
- private final Penetapan job;
- private org.apache.cxf.endpoint.Server server;
- public Thread4RestServiceProviderEndpoint(Penetapan job,
- String endpointUrl) {
- this.job = job;
- this.endpointUrl = endpointUrl;
- }
- public void run() {
- try {
- RestServiceProviderImpl4TalendJob provider = new RestServiceProviderImpl4TalendJob(
- job);
- org.apache.cxf.jaxrs.JAXRSServerFactoryBean sf = new org.apache.cxf.jaxrs.JAXRSServerFactoryBean();
- java.util.List<Object> providers = new java.util.ArrayList<Object>();
- providers
- .add(new ExceptionMapper4TalendJobRestService(provider));
- providers.add(new StreamingDOM4JProvider());
- org.apache.cxf.jaxrs.provider.json.JSONProvider jsonProvider = new org.apache.cxf.jaxrs.provider.json.JSONProvider();
- jsonProvider.setIgnoreNamespaces(true);
- jsonProvider.setAttributesToElements(true);
- jsonProvider.setConvertTypesToStrings(false);
- providers.add(jsonProvider);
- sf.setProviders(providers);
- sf.setTransportId("http://cxf.apache.org/transports/http");
- sf.setResourceClasses(RestServiceProviderImpl4TalendJob.class);
- sf.setResourceProvider(
- RestServiceProviderImpl4TalendJob.class,
- new org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider(
- provider));
- sf.setAddress(endpointUrl);
- final java.util.List<org.apache.cxf.feature.Feature> features = new java.util.ArrayList<org.apache.cxf.feature.Feature>();
- sf.setFeatures(features);
- server = sf.create();
- // System.out.println("REST service [endpoint: " + endpointUrl +
- // "] published");
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- public void stopEndpoint() {
- if (null != server) {
- server.stop();
- server.destroy();
- // System.out.println("REST service [endpoint: " + endpointUrl +
- // "] unpublished");
- }
- }
- }
- public static class penetapanStruct implements
- routines.system.IPersistableRow<penetapanStruct> {
- final static byte[] commonByteArrayLock_LOCAL_PROJECT_Penetapan = new byte[0];
- static byte[] commonByteArray_LOCAL_PROJECT_Penetapan = new byte[0];
- public routines.system.Document body;
- public routines.system.Document getBody() {
- return this.body;
- }
- public void readData(ObjectInputStream dis) {
- synchronized (commonByteArrayLock_LOCAL_PROJECT_Penetapan) {
- try {
- int length = 0;
- this.body = (routines.system.Document) dis.readObject();
- } catch (IOException e) {
- throw new RuntimeException(e);
- } catch (ClassNotFoundException eCNFE) {
- throw new RuntimeException(eCNFE);
- }
- }
- }
- public void writeData(ObjectOutputStream dos) {
- try {
- // Document
- dos.writeObject(this.body);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- sb.append("[");
- sb.append("body=" + String.valueOf(body));
- sb.append("]");
- return sb.toString();
- }
- /**
- * Compare keys
- */
- public int compareTo(penetapanStruct other) {
- int returnValue = -1;
- return returnValue;
- }
- private int checkNullsAndCompare(Object object1, Object object2) {
- int returnValue = 0;
- if (object1 instanceof Comparable && object2 instanceof Comparable) {
- returnValue = ((Comparable) object1).compareTo(object2);
- } else if (object1 != null && object2 != null) {
- returnValue = compareStrings(object1.toString(),
- object2.toString());
- } else if (object1 == null && object2 != null) {
- returnValue = 1;
- } else if (object1 != null && object2 == null) {
- returnValue = -1;
- } else {
- returnValue = 0;
- }
- return returnValue;
- }
- private int compareStrings(String string1, String string2) {
- return string1.compareTo(string2);
- }
- }
- public static class insert_pendapatanStruct implements
- routines.system.IPersistableRow<insert_pendapatanStruct> {
- final static byte[] commonByteArrayLock_LOCAL_PROJECT_Penetapan = new byte[0];
- static byte[] commonByteArray_LOCAL_PROJECT_Penetapan = new byte[0];
- public String no_penetapan;
- public String getNo_penetapan() {
- return this.no_penetapan;
- }
- public String kode_penetapan;
- public String getKode_penetapan() {
- return this.kode_penetapan;
- }
- public String jenis_id;
- public String getJenis_id() {
- return this.jenis_id;
- }
- public String no_id;
- public String getNo_id() {
- return this.no_id;
- }
- public String nama;
- public String getNama() {
- return this.nama;
- }
- public String alamat;
- public String getAlamat() {
- return this.alamat;
- }
- public String kode_rekening_pokok;
- public String getKode_rekening_pokok() {
- return this.kode_rekening_pokok;
- }
- public String jumlah_pokok;
- public String getJumlah_pokok() {
- return this.jumlah_pokok;
- }
- public String kode_rekening_denda;
- public String getKode_rekening_denda() {
- return this.kode_rekening_denda;
- }
- public String jumlah_denda;
- public String getJumlah_denda() {
- return this.jumlah_denda;
- }
- public String nama_retribusi;
- public String getNama_retribusi() {
- return this.nama_retribusi;
- }
- public java.util.Date tgl_penetapan;
- public java.util.Date getTgl_penetapan() {
- return this.tgl_penetapan;
- }
- public java.util.Date tgl_jatuh_tempo;
- public java.util.Date getTgl_jatuh_tempo() {
- return this.tgl_jatuh_tempo;
- }
- public String matauang;
- public String getMatauang() {
- return this.matauang;
- }
- public String ukpd_id;
- public String getUkpd_id() {
- return this.ukpd_id;
- }
- public String skpd_id;
- public String getSkpd_id() {
- return this.skpd_id;
- }
- public String periode_izin;
- public String getPeriode_izin() {
- return this.periode_izin;
- }
- private String readString(ObjectInputStream dis) throws IOException {
- String strReturn = null;
- int length = 0;
- length = dis.readInt();
- if (length == -1) {
- strReturn = null;
- } else {
- if (length > commonByteArray_LOCAL_PROJECT_Penetapan.length) {
- if (length < 1024
- && commonByteArray_LOCAL_PROJECT_Penetapan.length == 0) {
- commonByteArray_LOCAL_PROJECT_Penetapan = new byte[1024];
- } else {
- commonByteArray_LOCAL_PROJECT_Penetapan = new byte[2 * length];
- }
- }
- dis.readFully(commonByteArray_LOCAL_PROJECT_Penetapan, 0,
- length);
- strReturn = new String(commonByteArray_LOCAL_PROJECT_Penetapan,
- 0, length, utf8Charset);
- }
- return strReturn;
- }
- private void writeString(String str, ObjectOutputStream dos)
- throws IOException {
- if (str == null) {
- dos.writeInt(-1);
- } else {
- byte[] byteArray = str.getBytes(utf8Charset);
- dos.writeInt(byteArray.length);
- dos.write(byteArray);
- }
- }
- private java.util.Date readDate(ObjectInputStream dis)
- throws IOException {
- java.util.Date dateReturn = null;
- int length = 0;
- length = dis.readByte();
- if (length == -1) {
- dateReturn = null;
- } else {
- dateReturn = new Date(dis.readLong());
- }
- return dateReturn;
- }
- private void writeDate(java.util.Date date1, ObjectOutputStream dos)
- throws IOException {
- if (date1 == null) {
- dos.writeByte(-1);
- } else {
- dos.writeByte(0);
- dos.writeLong(date1.getTime());
- }
- }
- public void readData(ObjectInputStream dis) {
- synchronized (commonByteArrayLock_LOCAL_PROJECT_Penetapan) {
- try {
- int length = 0;
- this.no_penetapan = readString(dis);
- this.kode_penetapan = readString(dis);
- this.jenis_id = readString(dis);
- this.no_id = readString(dis);
- this.nama = readString(dis);
- this.alamat = readString(dis);
- this.kode_rekening_pokok = readString(dis);
- this.jumlah_pokok = readString(dis);
- this.kode_rekening_denda = readString(dis);
- this.jumlah_denda = readString(dis);
- this.nama_retribusi = readString(dis);
- this.tgl_penetapan = readDate(dis);
- this.tgl_jatuh_tempo = readDate(dis);
- this.matauang = readString(dis);
- this.ukpd_id = readString(dis);
- this.skpd_id = readString(dis);
- this.periode_izin = readString(dis);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- }
- public void writeData(ObjectOutputStream dos) {
- try {
- // String
- writeString(this.no_penetapan, dos);
- // String
- writeString(this.kode_penetapan, dos);
- // String
- writeString(this.jenis_id, dos);
- // String
- writeString(this.no_id, dos);
- // String
- writeString(this.nama, dos);
- // String
- writeString(this.alamat, dos);
- // String
- writeString(this.kode_rekening_pokok, dos);
- // String
- writeString(this.jumlah_pokok, dos);
- // String
- writeString(this.kode_rekening_denda, dos);
- // String
- writeString(this.jumlah_denda, dos);
- // String
- writeString(this.nama_retribusi, dos);
- // java.util.Date
- writeDate(this.tgl_penetapan, dos);
- // java.util.Date
- writeDate(this.tgl_jatuh_tempo, dos);
- // String
- writeString(this.matauang, dos);
- // String
- writeString(this.ukpd_id, dos);
- // String
- writeString(this.skpd_id, dos);
- // String
- writeString(this.periode_izin, dos);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- sb.append("[");
- sb.append("no_penetapan=" + no_penetapan);
- sb.append(",kode_penetapan=" + kode_penetapan);
- sb.append(",jenis_id=" + jenis_id);
- sb.append(",no_id=" + no_id);
- sb.append(",nama=" + nama);
- sb.append(",alamat=" + alamat);
- sb.append(",kode_rekening_pokok=" + kode_rekening_pokok);
- sb.append(",jumlah_pokok=" + jumlah_pokok);
- sb.append(",kode_rekening_denda=" + kode_rekening_denda);
- sb.append(",jumlah_denda=" + jumlah_denda);
- sb.append(",nama_retribusi=" + nama_retribusi);
- sb.append(",tgl_penetapan=" + String.valueOf(tgl_penetapan));
- sb.append(",tgl_jatuh_tempo=" + String.valueOf(tgl_jatuh_tempo));
- sb.append(",matauang=" + matauang);
- sb.append(",ukpd_id=" + ukpd_id);
- sb.append(",skpd_id=" + skpd_id);
- sb.append(",periode_izin=" + periode_izin);
- sb.append("]");
- return sb.toString();
- }
- /**
- * Compare keys
- */
- public int compareTo(insert_pendapatanStruct other) {
- int returnValue = -1;
- return returnValue;
- }
- private int checkNullsAndCompare(Object object1, Object object2) {
- int returnValue = 0;
- if (object1 instanceof Comparable && object2 instanceof Comparable) {
- returnValue = ((Comparable) object1).compareTo(object2);
- } else if (object1 != null && object2 != null) {
- returnValue = compareStrings(object1.toString(),
- object2.toString());
- } else if (object1 == null && object2 != null) {
- returnValue = 1;
- } else if (object1 != null && object2 == null) {
- returnValue = -1;
- } else {
- returnValue = 0;
- }
- return returnValue;
- }
- private int compareStrings(String string1, String string2) {
- return string1.compareTo(string2);
- }
- }
- public static class inStruct implements
- routines.system.IPersistableRow<inStruct> {
- final static byte[] commonByteArrayLock_LOCAL_PROJECT_Penetapan = new byte[0];
- static byte[] commonByteArray_LOCAL_PROJECT_Penetapan = new byte[0];
- public routines.system.Document body;
- public routines.system.Document getBody() {
- return this.body;
- }
- public void readData(ObjectInputStream dis) {
- synchronized (commonByteArrayLock_LOCAL_PROJECT_Penetapan) {
- try {
- int length = 0;
- this.body = (routines.system.Document) dis.readObject();
- } catch (IOException e) {
- throw new RuntimeException(e);
- } catch (ClassNotFoundException eCNFE) {
- throw new RuntimeException(eCNFE);
- }
- }
- }
- public void writeData(ObjectOutputStream dos) {
- try {
- // Document
- dos.writeObject(this.body);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- sb.append("[");
- sb.append("body=" + String.valueOf(body));
- sb.append("]");
- return sb.toString();
- }
- /**
- * Compare keys
- */
- public int compareTo(inStruct other) {
- int returnValue = -1;
- return returnValue;
- }
- private int checkNullsAndCompare(Object object1, Object object2) {
- int returnValue = 0;
- if (object1 instanceof Comparable && object2 instanceof Comparable) {
- returnValue = ((Comparable) object1).compareTo(object2);
- } else if (object1 != null && object2 != null) {
- returnValue = compareStrings(object1.toString(),
- object2.toString());
- } else if (object1 == null && object2 != null) {
- returnValue = 1;
- } else if (object1 != null && object2 == null) {
- returnValue = -1;
- } else {
- returnValue = 0;
- }
- return returnValue;
- }
- private int compareStrings(String string1, String string2) {
- return string1.compareTo(string2);
- }
- }
- public void tRESTRequest_1_LoopProcess(
- final java.util.Map<String, Object> globalMap)
- throws TalendException {
- globalMap.put("tRESTRequest_1_Loop_SUBPROCESS_STATE", 0);
- final boolean execStat = this.execStat;
- String currentVirtualComponent = null;
- String iterateId = "";
- String currentComponent = "";
- java.util.Map<String, Object> resourceMap = new java.util.HashMap<String, Object>();
- try {
- String currentMethodName = new java.lang.Exception()
- .getStackTrace()[0].getMethodName();
- boolean resumeIt = currentMethodName.equals(resumeEntryMethodName);
- if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start
- // the
- // resume
- globalResumeTicket = true;
- inStruct in = new inStruct();
- penetapanStruct penetapan = new penetapanStruct();
- insert_pendapatanStruct insert_pendapatan = new insert_pendapatanStruct();
- /**
- * [tRESTRequest_1_Loop begin ] start
- */
- int NB_ITERATE_tRESTRequest_1_In = 0; // for statistics
- ok_Hash.put("tRESTRequest_1_Loop", false);
- start_Hash.put("tRESTRequest_1_Loop",
- System.currentTimeMillis());
- currentVirtualComponent = "tRESTRequest_1";
- currentComponent = "tRESTRequest_1_Loop";
- int tos_count_tRESTRequest_1_Loop = 0;
- class BytesLimit65535_tRESTRequest_1_Loop {
- public void limitLog4jByte() throws Exception {
- }
- }
- new BytesLimit65535_tRESTRequest_1_Loop().limitLog4jByte();
- in = null;
- int nb_line_tRESTRequest_1 = 0;
- try {
- java.util.Map<String, Object> requestMessage_tRESTRequest_1 = (java.util.Map<String, Object>) globalMap
- .get("restRequest");
- if (null == requestMessage_tRESTRequest_1) {
- if (restTalendJobAlreadyStarted) {
- throw new RuntimeException(
- "request is not provided");
- } else {
- if (!runInTalendEsbRuntimeContainer
- && null == thread4RestServiceProviderEndpoint) {
- String endpointUrl_tRESTRequest_1 = checkEndpointUrl("http://localhost:8088/penetapan");
- // *** external thread for endpoint
- // initialization
- thread4RestServiceProviderEndpoint = new Thread4RestServiceProviderEndpoint(
- this, endpointUrl_tRESTRequest_1);
- thread4RestServiceProviderEndpoint.start();
- // *** external thread for endpoint
- // initialization
- }
- restTalendJobAlreadyStarted = true;
- Thread.currentThread();
- try {
- while (true) {
- Thread.sleep(60000);
- }
- } catch (InterruptedException e_tRESTRequest_1) {
- // e_tRESTRequest_1.printStackTrace();
- // throw new TalendException(e_tRESTRequest_1,
- // "wholeJob", globalMap);
- }
- }
- return;
- }
- /**
- * [tRESTRequest_1_Loop begin ] stop
- */
- /**
- * [tRESTRequest_1_Loop main ] start
- */
- currentVirtualComponent = "tRESTRequest_1";
- currentComponent = "tRESTRequest_1_Loop";
- tos_count_tRESTRequest_1_Loop++;
- /**
- * [tRESTRequest_1_Loop main ] stop
- */
- NB_ITERATE_tRESTRequest_1_In++;
- /**
- * [tXMLMap_1_TXMLMAP_OUT begin ] start
- */
- ok_Hash.put("tXMLMap_1_TXMLMAP_OUT", false);
- start_Hash.put("tXMLMap_1_TXMLMAP_OUT",
- System.currentTimeMillis());
- currentVirtualComponent = "tXMLMap_1";
- currentComponent = "tXMLMap_1_TXMLMAP_OUT";
- int tos_count_tXMLMap_1_TXMLMAP_OUT = 0;
- class BytesLimit65535_tXMLMap_1_TXMLMAP_OUT {
- public void limitLog4jByte() throws Exception {
- }
- }
- new BytesLimit65535_tXMLMap_1_TXMLMAP_OUT()
- .limitLog4jByte();
- // ===============================input xml init
- // part===============================
- class XML_API_tXMLMap_1_TXMLMAP_OUT {
- public boolean isDefNull(org.dom4j.Node node)
- throws javax.xml.transform.TransformerException {
- if (node != null
- && node instanceof org.dom4j.Element) {
- org.dom4j.Attribute attri = ((org.dom4j.Element) node)
- .attribute("nil");
- if (attri != null
- && ("true").equals(attri.getText())) {
- return true;
- }
- }
- return false;
- }
- public boolean isMissing(org.dom4j.Node node)
- throws javax.xml.transform.TransformerException {
- return node == null ? true : false;
- }
- public boolean isEmpty(org.dom4j.Node node)
- throws javax.xml.transform.TransformerException {
- if (node != null) {
- return node.getText().length() == 0;
- }
- return false;
- }
- }
- class Var__tXMLMap_1_TXMLMAP_OUT__Struct {
- String Var1;
- String kode_skpd;
- String kode_bas;
- String tgl_skprd;
- String no_npwpr;
- String no_nopprd;
- String kode_loket;
- String action;
- String status;
- String Var2;
- }
- Var__tXMLMap_1_TXMLMAP_OUT__Struct Var__tXMLMap_1_TXMLMAP_OUT = new Var__tXMLMap_1_TXMLMAP_OUT__Struct();
- // ###############################
- // # Outputs initialization
- penetapanStruct penetapan_tmp = new penetapanStruct();
- penetapanStruct penetapan_save = null;
- // the aggregate variable
- penetapanStruct penetapan_aggregate = null;
- insert_pendapatanStruct insert_pendapatan_tmp = new insert_pendapatanStruct();
- insert_pendapatanStruct insert_pendapatan_save = null;
- // the aggregate variable
- insert_pendapatanStruct insert_pendapatan_aggregate = null;
- // init the resultset for aggregate
- java.util.List<Object> allOutsForAggregate_tXMLMap_1 = new java.util.ArrayList<Object>();
- globalMap.put("allOutsForAggregate_tXMLMap_1",
- allOutsForAggregate_tXMLMap_1);
- // ###############################
- class TreeNode_API_tXMLMap_1_TXMLMAP_OUT {
- java.util.Map<String, String> xpath_value_map = new java.util.HashMap<String, String>();
- void clear() {
- xpath_value_map.clear();
- }
- void put(String xpath, String value) {
- xpath_value_map.put(xpath, value);
- }
- String get_null(String xpath) {
- return null;
- }
- String get_String(String xpath) {
- return xpath_value_map.get(xpath);
- }
- }
- TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI_tXMLMap_1_TXMLMAP_OUT = new TreeNode_API_tXMLMap_1_TXMLMAP_OUT();
- NameSpaceTool nsTool_tXMLMap_1_TXMLMAP_OUT = new NameSpaceTool();
- int nb_line_tXMLMap_1_TXMLMAP_OUT = 0;
- XML_API_tXMLMap_1_TXMLMAP_OUT xml_api_tXMLMap_1_TXMLMAP_OUT = new XML_API_tXMLMap_1_TXMLMAP_OUT();
- // the map store the previous value of aggregate columns
- java.util.Map<String, Object> aggregateCacheMap_tXMLMap_1_TXMLMAP_OUT = new java.util.HashMap<String, Object>();
- class GenerateDocument_penetapan {
- TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI = null;
- java.util.Map<String, Object> valueMap = null;
- routines.system.DocumentGenerateOrderHelper orderHelper = new routines.system.DocumentGenerateOrderHelper(
- 1);
- org.dom4j.Document doc = null;
- org.dom4j.Element root4Group = null;
- org.dom4j.io.OutputFormat format = null;
- java.util.List<java.util.List<String>> groupbyList = null;
- java.util.List<org.dom4j.Element> groupElementList = null;
- int order = 0;
- boolean isFirst = true;
- boolean needRoot = true;
- String currentValue = null;
- org.dom4j.Element subTreeLoopParent0 = null;
- public boolean subTreeLoop0 = false;
- public GenerateDocument_penetapan() {
- // this.treeNodeAPI = treeNodeAPI;
- valueMap = new java.util.HashMap<String, Object>();
- groupbyList = new java.util.ArrayList<java.util.List<String>>();
- groupElementList = new java.util.ArrayList<org.dom4j.Element>();
- doc = org.dom4j.DocumentHelper.createDocument();
- format = org.dom4j.io.OutputFormat
- .createPrettyPrint();
- format.setTrimText(false);
- }
- public org.dom4j.Document getDocument() {
- return this.doc;
- }
- // We generate the TreeNode_API object only if there is
- // a document in the main input table.
- void generateElements(
- TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI,
- boolean isInnerJoin, inStruct in,
- Var__tXMLMap_1_TXMLMAP_OUT__Struct Var) {
- /*
- * if(this.treeNodeAPI==null) { this.treeNodeAPI =
- * treeNodeAPI; }
- */
- org.dom4j.Element subTreeRootParent = null;
- // build root xml tree
- if (needRoot) {
- needRoot = false;
- org.dom4j.Element root = null;
- root = org.dom4j.DocumentHelper
- .createElement("ReqBody");
- doc.add(root);
- subTreeRootParent = root;
- org.dom4j.Element root_0 = null;
- root_0 = root.addElement("message");
- valueMap.put("root_0", Var.Var2);
- if (valueMap.get("root_0") != null) {
- routines.system.NestXMLTool.setText(root_0,
- FormatterUtils.format(Var.Var2,
- null));
- }
- root4Group = subTreeRootParent;
- } else {
- subTreeRootParent = root4Group;
- }
- /* build group xml tree */
- boolean isNewElement = false;
- isNewElement = false;
- }
- }
- GenerateDocument_penetapan gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT = new GenerateDocument_penetapan();
- boolean docAlreadyInstanciate_penetapan = false;
- class GenerateDocument_webservice_sipkd {
- TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI = null;
- java.util.Map<String, Object> valueMap = null;
- routines.system.DocumentGenerateOrderHelper orderHelper = new routines.system.DocumentGenerateOrderHelper(
- 1);
- org.dom4j.Document doc = null;
- org.dom4j.Element root4Group = null;
- org.dom4j.io.OutputFormat format = null;
- java.util.List<java.util.List<String>> groupbyList = null;
- java.util.List<org.dom4j.Element> groupElementList = null;
- int order = 0;
- boolean isFirst = true;
- boolean needRoot = true;
- String currentValue = null;
- org.dom4j.Element subTreeLoopParent0 = null;
- public boolean subTreeLoop0 = false;
- public GenerateDocument_webservice_sipkd() {
- // this.treeNodeAPI = treeNodeAPI;
- valueMap = new java.util.HashMap<String, Object>();
- groupbyList = new java.util.ArrayList<java.util.List<String>>();
- groupElementList = new java.util.ArrayList<org.dom4j.Element>();
- doc = org.dom4j.DocumentHelper.createDocument();
- format = org.dom4j.io.OutputFormat
- .createPrettyPrint();
- format.setTrimText(false);
- }
- public org.dom4j.Document getDocument() {
- return this.doc;
- }
- // We generate the TreeNode_API object only if there is
- // a document in the main input table.
- void generateElements(
- TreeNode_API_tXMLMap_1_TXMLMAP_OUT treeNodeAPI,
- boolean isInnerJoin, inStruct in,
- Var__tXMLMap_1_TXMLMAP_OUT__Struct Var) {
- /*
- * if(this.treeNodeAPI==null) { this.treeNodeAPI =
- * treeNodeAPI; }
- */
- org.dom4j.Element subTreeRootParent = null;
- // build root xml tree
- if (needRoot) {
- needRoot = false;
- org.dom4j.Element root = null;
- root = org.dom4j.DocumentHelper
- .createElement("ReqBody");
- doc.add(root);
- subTreeRootParent = root;
- org.dom4j.Element root_1 = null;
- root_1 = root.addElement("TAHUN_ANGG");
- valueMap.put("root_1", Var.Var1);
- if (valueMap.get("root_1") != null) {
- routines.system.NestXMLTool.setText(root_1,
- FormatterUtils.format(Var.Var1,
- null));
- }
- org.dom4j.Element root_2 = null;
- root_2 = root.addElement("TAHUN_PRBYR");
- valueMap.put("root_2", Var.Var1);
- if (valueMap.get("root_2") != null) {
- routines.system.NestXMLTool.setText(root_2,
- FormatterUtils.format(Var.Var1,
- null));
- }
- org.dom4j.Element root_3 = null;
- root_3 = root.addElement("KODE_JENIS");
- valueMap.put(
- "root_3",
- treeNodeAPI
- .get_String("in.body:/penetapan/jenis_id"));
- if (valueMap.get("root_3") != null) {
- routines.system.NestXMLTool
- .setText(
- root_3,
- FormatterUtils.format(
- treeNodeAPI
- .get_String("in.body:/penetapan/jenis_id"),
- null));
- }
- org.dom4j.Element root_4 = null;
- root_4 = root.addElement("KODE_SKPD");
- valueMap.put("root_4", Var.kode_skpd);
- if (valueMap.get("root_4") != null) {
- routines.system.NestXMLTool.setText(root_4,
- FormatterUtils.format(
- Var.kode_skpd, null));
- }
- org.dom4j.Element root_5 = null;
- root_5 = root.addElement("NO_SKPRD");
- valueMap.put(
- "root_5",
- treeNodeAPI
- .get_String("in.body:/penetapan/no_ketetapan"));
- if (valueMap.get("root_5") != null) {
- routines.system.NestXMLTool
- .setText(
- root_5,
- FormatterUtils.format(
- treeNodeAPI
- .get_String("in.body:/penetapan/no_ketetapan"),
- null));
- }
- org.dom4j.Element root_6 = null;
- root_6 = root.addElement("TGL_SKPRD");
- valueMap.put("root_6", Var.tgl_skprd);
- if (valueMap.get("root_6") != null) {
- routines.system.NestXMLTool.setText(root_6,
- FormatterUtils.format(
- Var.tgl_skprd, null));
- }
- org.dom4j.Element root_7 = null;
- root_7 = root.addElement("KODE_BAS");
- valueMap.put("root_7", Var.kode_bas);
- if (valueMap.get("root_7") != null) {
- routines.system.NestXMLTool.setText(root_7,
- FormatterUtils.format(Var.kode_bas,
- null));
- }
- org.dom4j.Element root_8 = null;
- root_8 = root.addElement("NILAI_BAYAR");
- valueMap.put(
- "root_8",
- treeNodeAPI
- .get_String("in.body:/penetapan/jumlah_pokok"));
- if (valueMap.get("root_8") != null) {
- routines.system.NestXMLTool
- .setText(
- root_8,
- FormatterUtils.format(
- treeNodeAPI
- .get_String("in.body:/penetapan/jumlah_pokok"),
- null));
- }
- org.dom4j.Element root_9 = null;
- root_9 = root.addElement("NAMA_WPR");
- valueMap.put("root_9", treeNodeAPI
- .get_String("in.body:/penetapan/nama"));
- if (valueMap.get("root_9") != null) {
- routines.system.NestXMLTool
- .setText(
- root_9,
- FormatterUtils.format(
- treeNodeAPI
- .get_String("in.body:/penetapan/nama"),
- null));
- }
- org.dom4j.Element root_10 = null;
- root_10 = root.addElement("ALAMAT_WPR");
- valueMap.put(
- "root_10",
- treeNodeAPI
- .get_String("in.body:/penetapan/alamat"));
- if (valueMap.get("root_10") != null) {
- routines.system.NestXMLTool
- .setText(
- root_10,
- FormatterUtils.format(
- treeNodeAPI
- .get_String("in.body:/penetapan/alamat"),
- null));
- }
- org.dom4j.Element root_11 = null;
- root_11 = root.addElement("NO_NPWPR");
- valueMap.put("root_11", Var.no_npwpr);
- if (valueMap.get("root_11") != null) {
- routines.system.NestXMLTool.setText(
- root_11, FormatterUtils.format(
- Var.no_npwpr, null));
- }
- org.dom4j.Element root_12 = null;
- root_12 = root.addElement("NAMA_OPR");
- valueMap.put("root_12", treeNodeAPI
- .get_String("in.body:/penetapan/nama"));
- if (valueMap.get("root_12") != null) {
- routines.system.NestXMLTool
- .setText(
- root_12,
- FormatterUtils.format(
- treeNodeAPI
- .get_String("in.body:/penetapan/nama"),
- null));
- }
- org.dom4j.Element root_13 = null;
- root_13 = root.addElement("ALAMAT_OPR");
- valueMap.put(
- "root_13",
- treeNodeAPI
- .get_String("in.body:/penetapan/alamat"));
- if (valueMap.get("root_13") != null) {
- routines.system.NestXMLTool
- .setText(
- root_13,
- FormatterUtils.format(
- treeNodeAPI
- .get_String("in.body:/penetapan/alamat"),
- null));
- }
- org.dom4j.Element root_14 = null;
- root_14 = root.addElement("NO_NOPRD");
- valueMap.put("root_14", Var.no_nopprd);
- if (valueMap.get("root_14") != null) {
- routines.system.NestXMLTool.setText(
- root_14, FormatterUtils.format(
- Var.no_nopprd, null));
- }
- org.dom4j.Element root_15 = null;
- root_15 = root.addElement("KODE_LOKET");
- valueMap.put("root_15", Var.kode_loket);
- if (valueMap.get("root_15") != null) {
- routines.system.NestXMLTool.setText(
- root_15, FormatterUtils.format(
- Var.kode_loket, null));
- }
- org.dom4j.Element root_16 = null;
- root_16 = root.addElement("ACTION");
- valueMap.put("root_16", Var.action);
- if (valueMap.get("root_16") != null) {
- routines.system.NestXMLTool.setText(
- root_16, FormatterUtils.format(
- Var.action, null));
- }
- org.dom4j.Element root_17 = null;
- root_17 = root.addElement("STATUS");
- valueMap.put("root_17", Var.status);
- if (valueMap.get("root_17") != null) {
- routines.system.NestXMLTool.setText(
- root_17, FormatterUtils.format(
- Var.status, null));
- }
- root4Group = subTreeRootParent;
- } else {
- subTreeRootParent = root4Group;
- }
- /* build group xml tree */
- boolean isNewElement = false;
- isNewElement = false;
- }
- }
- GenerateDocument_webservice_sipkd gen_Doc_webservice_sipkd_tXMLMap_1_TXMLMAP_OUT = new GenerateDocument_webservice_sipkd();
- boolean docAlreadyInstanciate_webservice_sipkd = false;
- /**
- * [tXMLMap_1_TXMLMAP_OUT begin ] stop
- */
- /**
- * [tRESTRequest_1_In begin ] start
- */
- ok_Hash.put("tRESTRequest_1_In", false);
- start_Hash.put("tRESTRequest_1_In",
- System.currentTimeMillis());
- currentVirtualComponent = "tRESTRequest_1";
- currentComponent = "tRESTRequest_1_In";
- int tos_count_tRESTRequest_1_In = 0;
- class BytesLimit65535_tRESTRequest_1_In {
- public void limitLog4jByte() throws Exception {
- }
- }
- new BytesLimit65535_tRESTRequest_1_In().limitLog4jByte();
- /**
- * [tRESTRequest_1_In begin ] stop
- */
- /**
- * [tRESTRequest_1_In main ] start
- */
- currentVirtualComponent = "tRESTRequest_1";
- currentComponent = "tRESTRequest_1_In";
- if (requestMessage_tRESTRequest_1.containsKey("ERROR")) { // wrong
- // request
- // received
- in = null;
- } else { // non-error (not wrong request)
- String matchedUriPattern_tRESTRequest_1 = (String) requestMessage_tRESTRequest_1
- .get("PATTERN");
- String matchedFlow_tRESTRequest_1 = (String) requestMessage_tRESTRequest_1
- .get("OPERATION");
- java.util.Map<String, Object> params_tRESTRequest_1 = (java.util.Map<String, Object>) requestMessage_tRESTRequest_1
- .get("PARAMS");
- if (matchedFlow_tRESTRequest_1.equals("in")) {
- in = new inStruct();
- Object bodyObject_tRESTRequest_1 = requestMessage_tRESTRequest_1
- .get("BODY");
- if (null != bodyObject_tRESTRequest_1) {
- routines.system.Document body_tRESTRequest_1 = new routines.system.Document();
- body_tRESTRequest_1
- .setDocument((org.dom4j.Document) bodyObject_tRESTRequest_1);
- in.body = body_tRESTRequest_1;
- }
- } else { // non matched flow
- in = null;
- }
- }
- globalMap.put("tRESTRequest_1_URI",
- (String) requestMessage_tRESTRequest_1.get("URI"));
- globalMap.put("tRESTRequest_1_URI_BASE",
- (String) requestMessage_tRESTRequest_1
- .get("URI_BASE"));
- globalMap.put("tRESTRequest_1_URI_ABSOLUTE",
- (String) requestMessage_tRESTRequest_1
- .get("URI_ABSOLUTE"));
- globalMap.put("tRESTRequest_1_URI_REQUEST",
- (String) requestMessage_tRESTRequest_1
- .get("URI_REQUEST"));
- globalMap.put("tRESTRequest_1_HTTP_METHOD",
- (String) requestMessage_tRESTRequest_1.get("VERB"));
- globalMap.put("tRESTRequest_1_ATTACHMENT_HEADERS",
- requestMessage_tRESTRequest_1
- .get("ATTACHMENT_HEADERS"));
- globalMap.put("tRESTRequest_1_ATTACHMENT_FILENAMES",
- requestMessage_tRESTRequest_1
- .get("ATTACHMENT_FILENAMES"));
- globalMap.put("tRESTRequest_1_PRINCIPAL_NAME",
- (String) requestMessage_tRESTRequest_1
- .get("PRINCIPAL_NAME"));
- globalMap.put("tRESTRequest_1_CORRELATION_ID",
- (String) requestMessage_tRESTRequest_1
- .get("CorrelationID"));
- tos_count_tRESTRequest_1_In++;
- /**
- * [tRESTRequest_1_In main ] stop
- */
- // Start of branch "in"
- if (in != null) {
- /**
- * [tXMLMap_1_TXMLMAP_OUT main ] start
- */
- currentVirtualComponent = "tXMLMap_1";
- currentComponent = "tXMLMap_1_TXMLMAP_OUT";
- boolean rejectedInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
- boolean rejectedDocInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
- boolean mainRowRejected_tXMLMap_1_TXMLMAP_OUT = false;
- boolean isMatchDocRowtXMLMap_1_TXMLMAP_OUT = false;
- gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT = new GenerateDocument_penetapan();
- penetapan_tmp = new penetapanStruct();
- penetapan_tmp.body = null;
- // init document to flat tool
- routines.system.DocumentToFlat docToFlat_tXMLMap_1_TXMLMAP_OUT = new routines.system.DocumentToFlat();
- docToFlat_tXMLMap_1_TXMLMAP_OUT
- .setOriginalLoop("/penetapan");
- docToFlat_tXMLMap_1_TXMLMAP_OUT.setIsOptional(false);
- if (in.body == null || in.body.getDocument() == null) {
- throw new RuntimeException("in.body can't be empty");
- }
- org.dom4j.Document doc_tXMLMap_1_TXMLMAP_OUT = in.body
- .getDocument();
- docToFlat_tXMLMap_1_TXMLMAP_OUT
- .setDoc(doc_tXMLMap_1_TXMLMAP_OUT);
- docToFlat_tXMLMap_1_TXMLMAP_OUT.setDefineNS(false);
- docToFlat_tXMLMap_1_TXMLMAP_OUT
- .setNamespaceTool(nsTool_tXMLMap_1_TXMLMAP_OUT);
- // old version, find NS from doc
- nsTool_tXMLMap_1_TXMLMAP_OUT
- .countNSMap(doc_tXMLMap_1_TXMLMAP_OUT
- .getRootElement());
- java.util.HashMap<String, String> xmlNameSpaceMap_tXMLMap_1_TXMLMAP_OUT = nsTool_tXMLMap_1_TXMLMAP_OUT.xmlNameSpaceMap;
- docToFlat_tXMLMap_1_TXMLMAP_OUT
- .setXmlNameSpaceMap(xmlNameSpaceMap_tXMLMap_1_TXMLMAP_OUT);
- String[] absolutePathMappings_tXMLMap_1_TXMLMAP_OUT = new String[17];
- String[] relativePathMappings_tXMLMap_1_TXMLMAP_OUT = new String[17];
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[0] = "in.body:/penetapan/nama_retribusi";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[0] = "nama_retribusi";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[1] = "in.body:/penetapan/no_ketetapan";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[1] = "no_ketetapan";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[2] = "in.body:/penetapan/jumlah_denda";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[2] = "jumlah_denda";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[3] = "in.body:/penetapan/nama";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[3] = "nama";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[4] = "in.body:/penetapan/ukpd_id";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[4] = "ukpd_id";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[5] = "in.body:/penetapan/tgl_jatuh_tempo";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[5] = "tgl_jatuh_tempo";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[6] = "in.body:/penetapan/periode_izin";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[6] = "periode_izin";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[7] = "in.body:/penetapan/kode_rekening_denda";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[7] = "kode_rekening_denda";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[8] = "in.body:/penetapan/tgl_penetapan";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[8] = "tgl_penetapan";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[9] = "in.body:/penetapan/jenis_id";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[9] = "jenis_id";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[10] = "in.body:/penetapan/matauang";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[10] = "matauang";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[11] = "in.body:/penetapan/alamat";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[11] = "alamat";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[12] = "in.body:/penetapan/jumlah_pokok";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[12] = "jumlah_pokok";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[13] = "in.body:/penetapan/skpd_id";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[13] = "skpd_id";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[14] = "in.body:/penetapan/no_id";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[14] = "no_id";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[15] = "in.body:/penetapan/kode_rekening_pokok";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[15] = "kode_rekening_pokok";
- absolutePathMappings_tXMLMap_1_TXMLMAP_OUT[16] = "in.body:/penetapan/kode_bayar";
- relativePathMappings_tXMLMap_1_TXMLMAP_OUT[16] = "kode_bayar";
- docToFlat_tXMLMap_1_TXMLMAP_OUT
- .setAbsolutePathMappings(absolutePathMappings_tXMLMap_1_TXMLMAP_OUT);
- docToFlat_tXMLMap_1_TXMLMAP_OUT
- .setCurrentRelativePathMappings(relativePathMappings_tXMLMap_1_TXMLMAP_OUT);
- // generate document to flat data
- docToFlat_tXMLMap_1_TXMLMAP_OUT.flat();
- // get flat data
- java.util.List<java.util.Map<String, String>> resultSet_tXMLMap_1_TXMLMAP_OUT = docToFlat_tXMLMap_1_TXMLMAP_OUT
- .getResultSet();
- for (java.util.Map<String, String> oneRow_tXMLMap_1_TXMLMAP_OUT : resultSet_tXMLMap_1_TXMLMAP_OUT) { // G_TXM_M_001
- nb_line_tXMLMap_1_TXMLMAP_OUT++;
- rejectedInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
- rejectedDocInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
- mainRowRejected_tXMLMap_1_TXMLMAP_OUT = false;
- isMatchDocRowtXMLMap_1_TXMLMAP_OUT = false;
- treeNodeAPI_tXMLMap_1_TXMLMAP_OUT.clear();
- for (java.util.Map.Entry<String, String> entry_tXMLMap_1_TXMLMAP_OUT : oneRow_tXMLMap_1_TXMLMAP_OUT
- .entrySet()) {
- treeNodeAPI_tXMLMap_1_TXMLMAP_OUT.put(
- entry_tXMLMap_1_TXMLMAP_OUT.getKey(),
- entry_tXMLMap_1_TXMLMAP_OUT.getValue());
- }
- { // start of Var scope
- // ###############################
- // # Vars tables
- Var__tXMLMap_1_TXMLMAP_OUT__Struct Var = Var__tXMLMap_1_TXMLMAP_OUT;
- Var.Var1 = TalendDate.getDate("yyyy");
- Var.kode_skpd = "22";
- Var.kode_bas = "1";
- Var.tgl_skprd = "06-12-2011%2014:00:00";
- Var.no_npwpr = "11";
- Var.no_nopprd = "11";
- Var.kode_loket = "11";
- Var.action = "ADD";
- Var.status = "1";
- Var.Var2 = null;
- // ###############################
- // # Output tables
- penetapan = null;
- insert_pendapatan = null;
- // # Output table : 'penetapan'
- gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT = new GenerateDocument_penetapan();
- penetapan_tmp = new penetapanStruct();
- gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT
- .generateElements(
- treeNodeAPI_tXMLMap_1_TXMLMAP_OUT,
- rejectedDocInnerJoin_tXMLMap_1_TXMLMAP_OUT,
- in, Var);
- if (penetapan_tmp.body == null) {
- penetapan_tmp.body = new routines.system.Document();
- penetapan_tmp.body
- .setDocument(gen_Doc_penetapan_tXMLMap_1_TXMLMAP_OUT
- .getDocument());
- // construct the resultset when there is no
- // aggregate column for the out table
- allOutsForAggregate_tXMLMap_1
- .add(penetapan_tmp);
- }
- // # Output table : 'insert_pendapatan'
- insert_pendapatan_tmp = new insert_pendapatanStruct();
- insert_pendapatan_tmp.no_penetapan = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/no_ketetapan");
- insert_pendapatan_tmp.kode_penetapan = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/kode_bayar");
- insert_pendapatan_tmp.jenis_id = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/jenis_id");
- insert_pendapatan_tmp.no_id = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/no_id");
- insert_pendapatan_tmp.nama = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/nama");
- insert_pendapatan_tmp.alamat = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/alamat");
- insert_pendapatan_tmp.kode_rekening_pokok = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/kode_rekening_pokok");
- insert_pendapatan_tmp.jumlah_pokok = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/jumlah_pokok");
- insert_pendapatan_tmp.kode_rekening_denda = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/kode_rekening_denda");
- insert_pendapatan_tmp.jumlah_denda = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/jumlah_denda");
- insert_pendapatan_tmp.nama_retribusi = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/nama_retribusi");
- insert_pendapatan_tmp.tgl_penetapan = TalendDate
- .parseDate(
- "yyyy-MM-dd",
- treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/tgl_penetapan"));
- insert_pendapatan_tmp.tgl_jatuh_tempo = TalendDate
- .parseDate(
- "yyyy-MM-dd",
- treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/tgl_jatuh_tempo"));
- insert_pendapatan_tmp.matauang = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/matauang");
- insert_pendapatan_tmp.ukpd_id = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/ukpd_id");
- insert_pendapatan_tmp.skpd_id = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/skpd_id");
- insert_pendapatan_tmp.periode_izin = treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
- .get_String("in.body:/penetapan/periode_izin");
- allOutsForAggregate_tXMLMap_1
- .add(insert_pendapatan_tmp);
- // ###############################
- } // end of Var scope
- rejectedInnerJoin_tXMLMap_1_TXMLMAP_OUT = false;
- }// G_TXM_M_001 close
- tos_count_tXMLMap_1_TXMLMAP_OUT++;
- /**
- * [tXMLMap_1_TXMLMAP_OUT main ] stop
- */
- } // End of branch "in"
- /**
- * [tRESTRequest_1_In end ] start
- */
- currentVirtualComponent = "tRESTRequest_1";
- currentComponent = "tRESTRequest_1_In";
- ok_Hash.put("tRESTRequest_1_In", true);
- end_Hash.put("tRESTRequest_1_In",
- System.currentTimeMillis());
- /**
- * [tRESTRequest_1_In end ] stop
- */
- /**
- * [tXMLMap_1_TXMLMAP_OUT end ] start
- */
- currentVirtualComponent = "tXMLMap_1";
- currentComponent = "tXMLMap_1_TXMLMAP_OUT";
- ok_Hash.put("tXMLMap_1_TXMLMAP_OUT", true);
- end_Hash.put("tXMLMap_1_TXMLMAP_OUT",
- System.currentTimeMillis());
- /**
- * [tXMLMap_1_TXMLMAP_OUT end ] stop
- */
- /**
- * [tRESTResponse_1 begin ] start
- */
- ok_Hash.put("tRESTResponse_1", false);
- start_Hash.put("tRESTResponse_1",
- System.currentTimeMillis());
- currentComponent = "tRESTResponse_1";
- int tos_count_tRESTResponse_1 = 0;
- class BytesLimit65535_tRESTResponse_1 {
- public void limitLog4jByte() throws Exception {
- }
- }
- new BytesLimit65535_tRESTResponse_1().limitLog4jByte();
- /**
- * [tRESTResponse_1 begin ] stop
- */
- /**
- * [tMysqlOutput_1 begin ] start
- */
- ok_Hash.put("tMysqlOutput_1", false);
- start_Hash
- .put("tMysqlOutput_1", System.currentTimeMillis());
- currentComponent = "tMysqlOutput_1";
- int tos_count_tMysqlOutput_1 = 0;
- class BytesLimit65535_tMysqlOutput_1 {
- public void limitLog4jByte() throws Exception {
- }
- }
- new BytesLimit65535_tMysqlOutput_1().limitLog4jByte();
- int nb_line_tMysqlOutput_1 = 0;
- int nb_line_update_tMysqlOutput_1 = 0;
- int nb_line_inserted_tMysqlOutput_1 = 0;
- int nb_line_deleted_tMysqlOutput_1 = 0;
- int nb_line_rejected_tMysqlOutput_1 = 0;
- int deletedCount_tMysqlOutput_1 = 0;
- int updatedCount_tMysqlOutput_1 = 0;
- int insertedCount_tMysqlOutput_1 = 0;
- int rejectedCount_tMysqlOutput_1 = 0;
- String tableName_tMysqlOutput_1 = "pendapatan";
- boolean whetherReject_tMysqlOutput_1 = false;
- java.util.Calendar calendar_tMysqlOutput_1 = java.util.Calendar
- .getInstance();
- calendar_tMysqlOutput_1.set(1, 0, 1, 0, 0, 0);
- long year1_tMysqlOutput_1 = calendar_tMysqlOutput_1
- .getTime().getTime();
- calendar_tMysqlOutput_1.set(10000, 0, 1, 0, 0, 0);
- long year10000_tMysqlOutput_1 = calendar_tMysqlOutput_1
- .getTime().getTime();
- long date_tMysqlOutput_1;
- java.sql.Connection conn_tMysqlOutput_1 = null;
- String dbProperties_tMysqlOutput_1 = "noDatetimeStringSync=true";
- String url_tMysqlOutput_1 = null;
- if (dbProperties_tMysqlOutput_1 == null
- || dbProperties_tMysqlOutput_1.trim().length() == 0) {
- url_tMysqlOutput_1 = "jdbc:mysql://" + "localhost"
- + ":" + "3306" + "/" + "masterpendapatan" + "?"
- + "rewriteBatchedStatements=true";
- } else {
- String properties_tMysqlOutput_1 = "noDatetimeStringSync=true";
- if (!properties_tMysqlOutput_1
- .contains("rewriteBatchedStatements")) {
- properties_tMysqlOutput_1 += "&rewriteBatchedStatements=true";
- }
- url_tMysqlOutput_1 = "jdbc:mysql://" + "localhost"
- + ":" + "3306" + "/" + "masterpendapatan" + "?"
- + properties_tMysqlOutput_1;
- }
- String driverClass_tMysqlOutput_1 = "org.gjt.mm.mysql.Driver";
- String dbUser_tMysqlOutput_1 = "root";
- final String decryptedPassword_tMysqlOutput_1 = routines.system.PasswordEncryptUtil
- .decryptPassword("f4f7aba1746784ea");
- String dbPwd_tMysqlOutput_1 = decryptedPassword_tMysqlOutput_1;
- java.lang.Class.forName(driverClass_tMysqlOutput_1);
- conn_tMysqlOutput_1 = java.sql.DriverManager.getConnection(
- url_tMysqlOutput_1, dbUser_tMysqlOutput_1,
- dbPwd_tMysqlOutput_1);
- resourceMap.put("conn_tMysqlOutput_1", conn_tMysqlOutput_1);
- conn_tMysqlOutput_1.setAutoCommit(false);
- int commitEvery_tMysqlOutput_1 = 10000;
- int commitCounter_tMysqlOutput_1 = 0;
- int count_tMysqlOutput_1 = 0;
- String insert_tMysqlOutput_1 = "INSERT INTO `"
- + "pendapatan"
- + "` (`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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- int batchSize_tMysqlOutput_1 = 100;
- int batchSizeCounter_tMysqlOutput_1 = 0;
- java.sql.PreparedStatement pstmt_tMysqlOutput_1 = conn_tMysqlOutput_1
- .prepareStatement(insert_tMysqlOutput_1);
- /**
- * [tMysqlOutput_1 begin ] stop
- */
- /**
- * [tXMLMap_1_TXMLMAP_IN begin ] start
- */
- ok_Hash.put("tXMLMap_1_TXMLMAP_IN", false);
- start_Hash.put("tXMLMap_1_TXMLMAP_IN",
- System.currentTimeMillis());
- currentVirtualComponent = "tXMLMap_1";
- currentComponent = "tXMLMap_1_TXMLMAP_IN";
- int tos_count_tXMLMap_1_TXMLMAP_IN = 0;
- class BytesLimit65535_tXMLMap_1_TXMLMAP_IN {
- public void limitLog4jByte() throws Exception {
- }
- }
- new BytesLimit65535_tXMLMap_1_TXMLMAP_IN().limitLog4jByte();
- java.util.List<Object> outs_tXMLMap_1 = (java.util.List<Object>) globalMap
- .get("allOutsForAggregate_tXMLMap_1");
- for (Object row_out_tXMLMap_1_TXMLMAP_IN : outs_tXMLMap_1) {// TD512
- /**
- * [tXMLMap_1_TXMLMAP_IN begin ] stop
- */
- /**
- * [tXMLMap_1_TXMLMAP_IN main ] start
- */
- currentVirtualComponent = "tXMLMap_1";
- currentComponent = "tXMLMap_1_TXMLMAP_IN";
- penetapan = null;
- if (row_out_tXMLMap_1_TXMLMAP_IN != null
- && row_out_tXMLMap_1_TXMLMAP_IN instanceof penetapanStruct) {
- penetapan = (penetapanStruct) row_out_tXMLMap_1_TXMLMAP_IN;
- routines.system.NestXMLTool.generateOk(
- penetapan.body, false);
- }
- insert_pendapatan = null;
- if (row_out_tXMLMap_1_TXMLMAP_IN != null
- && row_out_tXMLMap_1_TXMLMAP_IN instanceof insert_pendapatanStruct) {
- insert_pendapatan = (insert_pendapatanStruct) row_out_tXMLMap_1_TXMLMAP_IN;
- }
- tos_count_tXMLMap_1_TXMLMAP_IN++;
- /**
- * [tXMLMap_1_TXMLMAP_IN main ] stop
- */
- // Start of branch "penetapan"
- if (penetapan != null) {
- /**
- * [tRESTResponse_1 main ] start
- */
- currentComponent = "tRESTResponse_1";
- java.io.OutputStream outputStream_tRESTResponse_1 = (java.io.OutputStream) globalMap
- .get("restResponseStream");
- boolean responseAlreadySent_tRESTResponse_1 = globalMap
- .containsKey("restResponse");
- if (null == outputStream_tRESTResponse_1
- && responseAlreadySent_tRESTResponse_1) {
- throw new RuntimeException(
- "Rest response already sent.");
- } else if (!globalMap.containsKey("restRequest")) {
- throw new RuntimeException(
- "Not received rest request yet.");
- } else {
- Integer restProviderStatusCode_tRESTResponse_1 = 200;
- Object restProviderResponse_tRESTResponse_1 = null;
- if (null != penetapan.body) {
- restProviderResponse_tRESTResponse_1 = penetapan.body
- .getDocument();
- }
- java.util.Map<String, String> restProviderResponseHeaders_tRESTResponse_1 = new java.util.TreeMap<String, String>(
- String.CASE_INSENSITIVE_ORDER);
- java.util.Map<String, Object> restRequest_tRESTResponse_1 = (java.util.Map<String, Object>) globalMap
- .get("restRequest");
- org.apache.cxf.jaxrs.ext.MessageContext messageContext_tRESTResponse_1 = (org.apache.cxf.jaxrs.ext.MessageContext) restRequest_tRESTResponse_1
- .get("MESSAGE_CONTEXT");
- if (null == outputStream_tRESTResponse_1) {
- java.util.Map<String, Object> restResponse_tRESTResponse_1 = new java.util.HashMap<String, Object>();
- restResponse_tRESTResponse_1
- .put("BODY",
- restProviderResponse_tRESTResponse_1);
- restResponse_tRESTResponse_1
- .put("STATUS",
- restProviderStatusCode_tRESTResponse_1);
- restResponse_tRESTResponse_1
- .put("HEADERS",
- restProviderResponseHeaders_tRESTResponse_1);
- restResponse_tRESTResponse_1.put(
- "drop.json.root.element",
- Boolean.valueOf(false));
- globalMap.put("restResponse",
- restResponse_tRESTResponse_1);
- } else {
- javax.ws.rs.core.MediaType responseMediaType_tRESTResponse_1 = null;
- if (!responseAlreadySent_tRESTResponse_1) {
- org.apache.cxf.jaxrs.utils.JAXRSUtils
- .getCurrentMessage()
- .getExchange()
- .put(StreamingDOM4JProvider.SUPRESS_XML_DECLARATION,
- true);
- messageContext_tRESTResponse_1
- .put(org.apache.cxf.message.Message.RESPONSE_CODE,
- restProviderStatusCode_tRESTResponse_1);
- javax.ws.rs.core.MultivaluedMap<String, String> headersMultivaluedMap_tRESTResponse_1 = new org.apache.cxf.jaxrs.impl.MetadataMap<String, String>();
- for (java.util.Map.Entry<String, String> multivaluedHeader : restProviderResponseHeaders_tRESTResponse_1
- .entrySet()) {
- headersMultivaluedMap_tRESTResponse_1
- .putSingle(
- multivaluedHeader
- .getKey(),
- multivaluedHeader
- .getValue());
- }
- messageContext_tRESTResponse_1
- .put(org.apache.cxf.message.Message.PROTOCOL_HEADERS,
- headersMultivaluedMap_tRESTResponse_1);
- // String
- // responseContentType_tRESTResponse_1 =
- // (String)
- // messageContext_tRESTResponse_1.get(org.apache.cxf.message.Message.CONTENT_TYPE);
- String responseContentType_tRESTResponse_1 = (String) org.apache.cxf.jaxrs.utils.JAXRSUtils
- .getCurrentMessage()
- .getExchange()
- .get(org.apache.cxf.message.Message.CONTENT_TYPE);
- if (null == responseContentType_tRESTResponse_1) {
- // this should not be needed, just
- // in case. set it to the first
- // value in the sorted list returned
- // from HttpHeaders
- responseMediaType_tRESTResponse_1 = messageContext_tRESTResponse_1
- .getHttpHeaders()
- .getAcceptableMediaTypes()
- .get(0);
- } else {
- responseMediaType_tRESTResponse_1 = org.apache.cxf.jaxrs.utils.JAXRSUtils
- .toMediaType(responseContentType_tRESTResponse_1);
- }
- globalMap
- .put("restResponseMediaType",
- responseMediaType_tRESTResponse_1);
- String responseMediaSubType_tRESTResponse_1 = responseMediaType_tRESTResponse_1
- .getSubtype();
- if (responseMediaSubType_tRESTResponse_1
- .equals("xml")
- || responseMediaSubType_tRESTResponse_1
- .endsWith("+xml")) {
- outputStream_tRESTResponse_1
- .write("<wrapper>"
- .getBytes());
- globalMap
- .put("restResponseWrappingClosure",
- "</wrapper>");
- }
- if (responseMediaSubType_tRESTResponse_1
- .equals("json")
- || responseMediaSubType_tRESTResponse_1
- .endsWith("+json")) {
- outputStream_tRESTResponse_1
- .write("[".getBytes());
- globalMap
- .put("restResponseWrappingClosure",
- "]");
- }
- globalMap.put("restResponse", true);
- } else {
- responseMediaType_tRESTResponse_1 = (javax.ws.rs.core.MediaType) globalMap
- .get("restResponseMediaType");
- }
- if (null != restProviderResponse_tRESTResponse_1) {
- String responseMediaSubType_tRESTResponse_1 = responseMediaType_tRESTResponse_1
- .getSubtype();
- if (responseMediaSubType_tRESTResponse_1
- .equals("json")
- || responseMediaSubType_tRESTResponse_1
- .endsWith("+json")) {
- if (globalMap
- .containsKey("restResponseJsonStarted")) {
- outputStream_tRESTResponse_1
- .write(",".getBytes());
- } else {
- globalMap
- .put("restResponseJsonStarted",
- true);
- }
- }
- Class<? extends Object> responseBodyClass_tRESTResponse_1 = restProviderResponse_tRESTResponse_1
- .getClass();
- javax.ws.rs.ext.Providers messageBodyProviders_tRESTResponse_1 = messageContext_tRESTResponse_1
- .getProviders();
- javax.ws.rs.ext.MessageBodyWriter messageBodyWriter_tRESTResponse_1 = messageBodyProviders_tRESTResponse_1
- .getMessageBodyWriter(
- responseBodyClass_tRESTResponse_1,
- responseBodyClass_tRESTResponse_1,
- null,
- responseMediaType_tRESTResponse_1);
- messageBodyWriter_tRESTResponse_1
- .writeTo(
- restProviderResponse_tRESTResponse_1,
- responseBodyClass_tRESTResponse_1,
- responseBodyClass_tRESTResponse_1,
- new java.lang.annotation.Annotation[] {},
- responseMediaType_tRESTResponse_1,
- null,
- outputStream_tRESTResponse_1);
- }
- // initial variant
- // outputStream_tRESTResponse_1.write(String.valueOf(restProviderResponse_tRESTResponse_1).getBytes());
- outputStream_tRESTResponse_1.flush();
- }
- }
- tos_count_tRESTResponse_1++;
- /**
- * [tRESTResponse_1 main ] stop
- */
- } // End of branch "penetapan"
- // Start of branch "insert_pendapatan"
- if (insert_pendapatan != null) {
- /**
- * [tMysqlOutput_1 main ] start
- */
- currentComponent = "tMysqlOutput_1";
- whetherReject_tMysqlOutput_1 = false;
- if (insert_pendapatan.no_penetapan == null) {
- pstmt_tMysqlOutput_1.setNull(1,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(1,
- insert_pendapatan.no_penetapan);
- }
- if (insert_pendapatan.kode_penetapan == null) {
- pstmt_tMysqlOutput_1.setNull(2,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(2,
- insert_pendapatan.kode_penetapan);
- }
- if (insert_pendapatan.jenis_id == null) {
- pstmt_tMysqlOutput_1.setNull(3,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(3,
- insert_pendapatan.jenis_id);
- }
- if (insert_pendapatan.no_id == null) {
- pstmt_tMysqlOutput_1.setNull(4,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(4,
- insert_pendapatan.no_id);
- }
- if (insert_pendapatan.nama == null) {
- pstmt_tMysqlOutput_1.setNull(5,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(5,
- insert_pendapatan.nama);
- }
- if (insert_pendapatan.alamat == null) {
- pstmt_tMysqlOutput_1.setNull(6,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(6,
- insert_pendapatan.alamat);
- }
- if (insert_pendapatan.kode_rekening_pokok == null) {
- pstmt_tMysqlOutput_1.setNull(7,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(7,
- insert_pendapatan.kode_rekening_pokok);
- }
- if (insert_pendapatan.jumlah_pokok == null) {
- pstmt_tMysqlOutput_1.setNull(8,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(8,
- insert_pendapatan.jumlah_pokok);
- }
- if (insert_pendapatan.kode_rekening_denda == null) {
- pstmt_tMysqlOutput_1.setNull(9,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(9,
- insert_pendapatan.kode_rekening_denda);
- }
- if (insert_pendapatan.jumlah_denda == null) {
- pstmt_tMysqlOutput_1.setNull(10,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(10,
- insert_pendapatan.jumlah_denda);
- }
- if (insert_pendapatan.nama_retribusi == null) {
- pstmt_tMysqlOutput_1.setNull(11,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(11,
- insert_pendapatan.nama_retribusi);
- }
- if (insert_pendapatan.tgl_penetapan != null) {
- date_tMysqlOutput_1 = insert_pendapatan.tgl_penetapan
- .getTime();
- if (date_tMysqlOutput_1 < year1_tMysqlOutput_1
- || date_tMysqlOutput_1 >= year10000_tMysqlOutput_1) {
- pstmt_tMysqlOutput_1.setString(12,
- "0000-00-00 00:00:00");
- } else {
- pstmt_tMysqlOutput_1.setTimestamp(12,
- new java.sql.Timestamp(
- date_tMysqlOutput_1));
- }
- } else {
- pstmt_tMysqlOutput_1.setNull(12,
- java.sql.Types.DATE);
- }
- if (insert_pendapatan.tgl_jatuh_tempo != null) {
- date_tMysqlOutput_1 = insert_pendapatan.tgl_jatuh_tempo
- .getTime();
- if (date_tMysqlOutput_1 < year1_tMysqlOutput_1
- || date_tMysqlOutput_1 >= year10000_tMysqlOutput_1) {
- pstmt_tMysqlOutput_1.setString(13,
- "0000-00-00 00:00:00");
- } else {
- pstmt_tMysqlOutput_1.setTimestamp(13,
- new java.sql.Timestamp(
- date_tMysqlOutput_1));
- }
- } else {
- pstmt_tMysqlOutput_1.setNull(13,
- java.sql.Types.DATE);
- }
- if (insert_pendapatan.matauang == null) {
- pstmt_tMysqlOutput_1.setNull(14,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(14,
- insert_pendapatan.matauang);
- }
- if (insert_pendapatan.ukpd_id == null) {
- pstmt_tMysqlOutput_1.setNull(15,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(15,
- insert_pendapatan.ukpd_id);
- }
- if (insert_pendapatan.skpd_id == null) {
- pstmt_tMysqlOutput_1.setNull(16,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(16,
- insert_pendapatan.skpd_id);
- }
- if (insert_pendapatan.periode_izin == null) {
- pstmt_tMysqlOutput_1.setNull(17,
- java.sql.Types.VARCHAR);
- } else {
- pstmt_tMysqlOutput_1.setString(17,
- insert_pendapatan.periode_izin);
- }
- pstmt_tMysqlOutput_1.addBatch();
- nb_line_tMysqlOutput_1++;
- batchSizeCounter_tMysqlOutput_1++;
- if (batchSize_tMysqlOutput_1 <= batchSizeCounter_tMysqlOutput_1) {
- try {
- int countSum_tMysqlOutput_1 = 0;
- for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1
- .executeBatch()) {
- countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
- : 1);
- }
- insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
- } catch (java.sql.BatchUpdateException e) {
- int countSum_tMysqlOutput_1 = 0;
- for (int countEach_tMysqlOutput_1 : e
- .getUpdateCounts()) {
- countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
- : countEach_tMysqlOutput_1);
- }
- insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
- System.err.println(e.getMessage());
- }
- batchSizeCounter_tMysqlOutput_1 = 0;
- }
- commitCounter_tMysqlOutput_1++;
- if (commitEvery_tMysqlOutput_1 <= commitCounter_tMysqlOutput_1) {
- try {
- int countSum_tMysqlOutput_1 = 0;
- for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1
- .executeBatch()) {
- countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
- : 1);
- }
- insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
- } catch (java.sql.BatchUpdateException e) {
- int countSum_tMysqlOutput_1 = 0;
- for (int countEach_tMysqlOutput_1 : e
- .getUpdateCounts()) {
- countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
- : countEach_tMysqlOutput_1);
- }
- insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
- System.err.println(e.getMessage());
- }
- conn_tMysqlOutput_1.commit();
- commitCounter_tMysqlOutput_1 = 0;
- }
- tos_count_tMysqlOutput_1++;
- /**
- * [tMysqlOutput_1 main ] stop
- */
- } // End of branch "insert_pendapatan"
- /**
- * [tXMLMap_1_TXMLMAP_IN end ] start
- */
- currentVirtualComponent = "tXMLMap_1";
- currentComponent = "tXMLMap_1_TXMLMAP_IN";
- }// TD512
- ok_Hash.put("tXMLMap_1_TXMLMAP_IN", true);
- end_Hash.put("tXMLMap_1_TXMLMAP_IN",
- System.currentTimeMillis());
- /**
- * [tXMLMap_1_TXMLMAP_IN end ] stop
- */
- /**
- * [tRESTResponse_1 end ] start
- */
- currentComponent = "tRESTResponse_1";
- ok_Hash.put("tRESTResponse_1", true);
- end_Hash.put("tRESTResponse_1", System.currentTimeMillis());
- /**
- * [tRESTResponse_1 end ] stop
- */
- /**
- * [tMysqlOutput_1 end ] start
- */
- currentComponent = "tMysqlOutput_1";
- try {
- if (batchSizeCounter_tMysqlOutput_1 != 0) {
- int countSum_tMysqlOutput_1 = 0;
- for (int countEach_tMysqlOutput_1 : pstmt_tMysqlOutput_1
- .executeBatch()) {
- countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
- : 1);
- }
- insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
- }
- } catch (java.sql.BatchUpdateException e) {
- int countSum_tMysqlOutput_1 = 0;
- for (int countEach_tMysqlOutput_1 : e.getUpdateCounts()) {
- countSum_tMysqlOutput_1 += (countEach_tMysqlOutput_1 < 0 ? 0
- : countEach_tMysqlOutput_1);
- }
- insertedCount_tMysqlOutput_1 += countSum_tMysqlOutput_1;
- globalMap.put(currentComponent + "_ERROR_MESSAGE",
- e.getMessage());
- System.err.println(e.getMessage());
- }
- batchSizeCounter_tMysqlOutput_1 = 0;
- if (pstmt_tMysqlOutput_1 != null) {
- pstmt_tMysqlOutput_1.close();
- }
- if (commitCounter_tMysqlOutput_1 > 0) {
- conn_tMysqlOutput_1.commit();
- }
- conn_tMysqlOutput_1.close();
- resourceMap.put("finish_tMysqlOutput_1", true);
- nb_line_deleted_tMysqlOutput_1 = nb_line_deleted_tMysqlOutput_1
- + deletedCount_tMysqlOutput_1;
- nb_line_update_tMysqlOutput_1 = nb_line_update_tMysqlOutput_1
- + updatedCount_tMysqlOutput_1;
- nb_line_inserted_tMysqlOutput_1 = nb_line_inserted_tMysqlOutput_1
- + insertedCount_tMysqlOutput_1;
- nb_line_rejected_tMysqlOutput_1 = nb_line_rejected_tMysqlOutput_1
- + rejectedCount_tMysqlOutput_1;
- globalMap.put("tMysqlOutput_1_NB_LINE",
- nb_line_tMysqlOutput_1);
- globalMap.put("tMysqlOutput_1_NB_LINE_UPDATED",
- nb_line_update_tMysqlOutput_1);
- globalMap.put("tMysqlOutput_1_NB_LINE_INSERTED",
- nb_line_inserted_tMysqlOutput_1);
- globalMap.put("tMysqlOutput_1_NB_LINE_DELETED",
- nb_line_deleted_tMysqlOutput_1);
- globalMap.put("tMysqlOutput_1_NB_LINE_REJECTED",
- nb_line_rejected_tMysqlOutput_1);
- ok_Hash.put("tMysqlOutput_1", true);
- end_Hash.put("tMysqlOutput_1", System.currentTimeMillis());
- /**
- * [tMysqlOutput_1 end ] stop
- */
- /**
- * [tRESTRequest_1_Loop end ] start
- */
- currentVirtualComponent = "tRESTRequest_1";
- currentComponent = "tRESTRequest_1_Loop";
- } catch (Throwable e_tRESTRequest_1) {
- if (e_tRESTRequest_1 instanceof Exception) {
- new TalendException((Exception) e_tRESTRequest_1,
- currentComponent, globalMap).printStackTrace();
- } else {
- new TalendException(new RuntimeException(
- e_tRESTRequest_1), currentComponent, globalMap)
- .printStackTrace();
- }
- if (!globalMap.containsKey("restResponse")) {
- java.util.Map<String, Object> restFault_tRESTRequest_1 = new java.util.HashMap<String, Object>();
- restFault_tRESTRequest_1.put("STATUS", 500);
- restFault_tRESTRequest_1.put("BODY",
- e_tRESTRequest_1.getMessage());
- globalMap.put("restResponse", restFault_tRESTRequest_1);
- }
- return;
- }
- nb_line_tRESTRequest_1++;
- globalMap.put("tRESTRequest_1_NB_LINE", nb_line_tRESTRequest_1);
- ok_Hash.put("tRESTRequest_1_Loop", true);
- end_Hash.put("tRESTRequest_1_Loop", System.currentTimeMillis());
- /**
- * [tRESTRequest_1_Loop end ] stop
- */
- }// end the resume
- } catch (java.lang.Exception e) {
- TalendException te = new TalendException(e, currentComponent,
- globalMap);
- te.setVirtualComponentName(currentVirtualComponent);
- throw te;
- } catch (java.lang.Error error) {
- throw error;
- } finally {
- try {
- /**
- * [tRESTRequest_1_Loop finally ] start
- */
- currentVirtualComponent = "tRESTRequest_1";
- currentComponent = "tRESTRequest_1_Loop";
- /**
- * [tRESTRequest_1_Loop finally ] stop
- */
- /**
- * [tRESTRequest_1_In finally ] start
- */
- currentVirtualComponent = "tRESTRequest_1";
- currentComponent = "tRESTRequest_1_In";
- /**
- * [tRESTRequest_1_In finally ] stop
- */
- /**
- * [tXMLMap_1_TXMLMAP_OUT finally ] start
- */
- currentVirtualComponent = "tXMLMap_1";
- currentComponent = "tXMLMap_1_TXMLMAP_OUT";
- /**
- * [tXMLMap_1_TXMLMAP_OUT finally ] stop
- */
- /**
- * [tXMLMap_1_TXMLMAP_IN finally ] start
- */
- currentVirtualComponent = "tXMLMap_1";
- currentComponent = "tXMLMap_1_TXMLMAP_IN";
- /**
- * [tXMLMap_1_TXMLMAP_IN finally ] stop
- */
- /**
- * [tRESTResponse_1 finally ] start
- */
- currentComponent = "tRESTResponse_1";
- /**
- * [tRESTResponse_1 finally ] stop
- */
- /**
- * [tMysqlOutput_1 finally ] start
- */
- currentComponent = "tMysqlOutput_1";
- if (resourceMap.get("finish_tMysqlOutput_1") == null) {
- if (resourceMap.get("conn_tMysqlOutput_1") != null) {
- try {
- ((java.sql.Connection) resourceMap
- .get("conn_tMysqlOutput_1")).close();
- } catch (java.sql.SQLException sqlEx_tMysqlOutput_1) {
- String errorMessage_tMysqlOutput_1 = "failed to close the connection in tMysqlOutput_1 :"
- + sqlEx_tMysqlOutput_1.getMessage();
- System.err.println(errorMessage_tMysqlOutput_1);
- }
- }
- }
- /**
- * [tMysqlOutput_1 finally ] stop
- */
- } catch (java.lang.Exception e) {
- // ignore
- } catch (java.lang.Error error) {
- // ignore
- }
- resourceMap = null;
- }
- globalMap.put("tRESTRequest_1_Loop_SUBPROCESS_STATE", 1);
- }
- public String resuming_logs_dir_path = null;
- public String resuming_checkpoint_path = null;
- public String parent_part_launcher = null;
- private String resumeEntryMethodName = null;
- private boolean globalResumeTicket = false;
- public boolean watch = false;
- // portStats is null, it means don't execute the statistics
- public Integer portStats = null;
- public int portTraces = 4334;
- public String clientHost;
- public String defaultClientHost = "localhost";
- public String contextStr = "Default";
- public boolean isDefaultContext = true;
- public String pid = "0";
- public String rootPid = null;
- public String fatherPid = null;
- public String fatherNode = null;
- public long startTime = 0;
- public boolean isChildJob = false;
- public String log4jLevel = "";
- private boolean execStat = true;
- private ThreadLocal<java.util.Map<String, String>> threadLocal = new ThreadLocal<java.util.Map<String, String>>() {
- protected java.util.Map<String, String> initialValue() {
- java.util.Map<String, String> threadRunResultMap = new java.util.HashMap<String, String>();
- threadRunResultMap.put("errorCode", null);
- threadRunResultMap.put("status", "");
- return threadRunResultMap;
- };
- };
- private java.util.Properties context_param = new java.util.Properties();
- public java.util.Map<String, Object> parentContextMap = new java.util.HashMap<String, Object>();
- public String status = "";
- public static void main(String[] args) {
- final Penetapan PenetapanClass = new Penetapan();
- int exitCode = PenetapanClass.runJobInTOS(args);
- System.exit(exitCode);
- }
- public String[][] runJob(String[] args) {
- int exitCode = runJobInTOS(args);
- String[][] bufferValue = new String[][] { { Integer.toString(exitCode) } };
- return bufferValue;
- }
- public boolean hastBufferOutputComponent() {
- boolean hastBufferOutput = false;
- return hastBufferOutput;
- }
- public int runJobInTOS(String[] args) {
- // reset status
- status = "";
- String lastStr = "";
- for (String arg : args) {
- if (arg.equalsIgnoreCase("--context_param")) {
- lastStr = arg;
- } else if (lastStr.equals("")) {
- evalParam(arg);
- } else {
- evalParam(lastStr + " " + arg);
- lastStr = "";
- }
- }
- if (clientHost == null) {
- clientHost = defaultClientHost;
- }
- if (pid == null || "0".equals(pid)) {
- pid = TalendString.getAsciiRandomString(6);
- }
- if (rootPid == null) {
- rootPid = pid;
- }
- if (fatherPid == null) {
- fatherPid = pid;
- } else {
- isChildJob = true;
- }
- try {
- // call job/subjob with an existing context, like:
- // --context=production. if without this parameter, there will use
- // the default context instead.
- java.io.InputStream inContext = Penetapan.class.getClassLoader()
- .getResourceAsStream(
- "local_project/penetapan_0_1/contexts/"
- + contextStr + ".properties");
- if (isDefaultContext && inContext == null) {
- } else {
- if (inContext != null) {
- // defaultProps is in order to keep the original context
- // value
- defaultProps.load(inContext);
- inContext.close();
- context = new ContextProperties(defaultProps);
- } else {
- // print info and job continue to run, for case:
- // context_param is not empty.
- System.err.println("Could not find the context "
- + contextStr);
- }
- }
- if (!context_param.isEmpty()) {
- context.putAll(context_param);
- }
- } catch (java.io.IOException ie) {
- System.err.println("Could not load context " + contextStr);
- ie.printStackTrace();
- }
- // get context value from parent directly
- if (parentContextMap != null && !parentContextMap.isEmpty()) {
- }
- // Resume: init the resumeUtil
- resumeEntryMethodName = ResumeUtil
- .getResumeEntryMethodName(resuming_checkpoint_path);
- resumeUtil = new ResumeUtil(resuming_logs_dir_path, isChildJob, rootPid);
- resumeUtil.initCommonInfo(pid, rootPid, fatherPid, projectName,
- jobName, contextStr, jobVersion);
- List<String> parametersToEncrypt = new java.util.ArrayList<String>();
- // Resume: jobStart
- resumeUtil.addLog("JOB_STARTED", "JOB:" + jobName,
- parent_part_launcher, Thread.currentThread().getId() + "", "",
- "", "", "",
- resumeUtil.convertToJsonText(context, parametersToEncrypt));
- java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap = new java.util.concurrent.ConcurrentHashMap<Object, Object>();
- globalMap.put("concurrentHashMap", concurrentHashMap);
- long startUsedMemory = Runtime.getRuntime().totalMemory()
- - Runtime.getRuntime().freeMemory();
- long endUsedMemory = 0;
- long end = 0;
- startTime = System.currentTimeMillis();
- this.globalResumeTicket = true;// to run tPreJob
- this.globalResumeTicket = false;// to run others jobs
- try {
- errorCode = null;
- tRESTRequest_1_LoopProcess(globalMap);
- if (!"failure".equals(status)) {
- status = "end";
- }
- } catch (TalendException e_tRESTRequest_1_Loop) {
- globalMap.put("tRESTRequest_1_Loop_SUBPROCESS_STATE", -1);
- e_tRESTRequest_1_Loop.printStackTrace();
- }
- this.globalResumeTicket = true;// to run tPostJob
- end = System.currentTimeMillis();
- if (watch) {
- System.out.println((end - startTime) + " milliseconds");
- }
- endUsedMemory = Runtime.getRuntime().totalMemory()
- - Runtime.getRuntime().freeMemory();
- if (false) {
- System.out.println((endUsedMemory - startUsedMemory)
- + " bytes memory increase when running : Penetapan");
- }
- int returnCode = 0;
- if (errorCode == null) {
- returnCode = status != null && status.equals("failure") ? 1 : 0;
- } else {
- returnCode = errorCode.intValue();
- }
- resumeUtil.addLog("JOB_ENDED", "JOB:" + jobName, parent_part_launcher,
- Thread.currentThread().getId() + "", "", "" + returnCode, "",
- "", "");
- return returnCode;
- }
- // only for OSGi env
- public void destroy() {
- }
- private java.util.Map<String, Object> getSharedConnections4REST() {
- java.util.Map<String, Object> connections = new java.util.HashMap<String, Object>();
- return connections;
- }
- private void evalParam(String arg) {
- if (arg.startsWith("--resuming_logs_dir_path")) {
- resuming_logs_dir_path = arg.substring(25);
- } else if (arg.startsWith("--resuming_checkpoint_path")) {
- resuming_checkpoint_path = arg.substring(27);
- } else if (arg.startsWith("--parent_part_launcher")) {
- parent_part_launcher = arg.substring(23);
- } else if (arg.startsWith("--watch")) {
- watch = true;
- } else if (arg.startsWith("--stat_port=")) {
- String portStatsStr = arg.substring(12);
- if (portStatsStr != null && !portStatsStr.equals("null")) {
- portStats = Integer.parseInt(portStatsStr);
- }
- } else if (arg.startsWith("--trace_port=")) {
- portTraces = Integer.parseInt(arg.substring(13));
- } else if (arg.startsWith("--client_host=")) {
- clientHost = arg.substring(14);
- } else if (arg.startsWith("--context=")) {
- contextStr = arg.substring(10);
- isDefaultContext = false;
- } else if (arg.startsWith("--father_pid=")) {
- fatherPid = arg.substring(13);
- } else if (arg.startsWith("--root_pid=")) {
- rootPid = arg.substring(11);
- } else if (arg.startsWith("--father_node=")) {
- fatherNode = arg.substring(14);
- } else if (arg.startsWith("--pid=")) {
- pid = arg.substring(6);
- } else if (arg.startsWith("--context_param")) {
- String keyValue = arg.substring(16);
- int index = -1;
- if (keyValue != null && (index = keyValue.indexOf('=')) > -1) {
- if (fatherPid == null) {
- context_param.put(keyValue.substring(0, index),
- replaceEscapeChars(keyValue.substring(index + 1)));
- } else { // the subjob won't escape the especial chars
- context_param.put(keyValue.substring(0, index),
- keyValue.substring(index + 1));
- }
- }
- } else if (arg.startsWith("--log4jLevel=")) {
- log4jLevel = arg.substring(13);
- }
- }
- private final String[][] escapeChars = { { "\\\\", "\\" }, { "\\n", "\n" },
- { "\\'", "\'" }, { "\\r", "\r" }, { "\\f", "\f" }, { "\\b", "\b" },
- { "\\t", "\t" } };
- private String replaceEscapeChars(String keyValue) {
- if (keyValue == null || ("").equals(keyValue.trim())) {
- return keyValue;
- }
- StringBuilder result = new StringBuilder();
- int currIndex = 0;
- while (currIndex < keyValue.length()) {
- int index = -1;
- // judege if the left string includes escape chars
- for (String[] strArray : escapeChars) {
- index = keyValue.indexOf(strArray[0], currIndex);
- if (index >= 0) {
- result.append(keyValue.substring(currIndex,
- index + strArray[0].length()).replace(strArray[0],
- strArray[1]));
- currIndex = index + strArray[0].length();
- break;
- }
- }
- // if the left string doesn't include escape chars, append the left
- // into the result
- if (index < 0) {
- result.append(keyValue.substring(currIndex));
- currIndex = currIndex + keyValue.length();
- }
- }
- return result.toString();
- }
- public Integer getErrorCode() {
- return errorCode;
- }
- public String getStatus() {
- return status;
- }
- ResumeUtil resumeUtil = null;
- }
- /************************************************************************************************
- * 99604 characters generated by Talend Open Studio for ESB on the December 22,
- * 2016 3:27:57 PM WIB
- ************************************************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement