List of usage examples for java.util.concurrent ConcurrentHashMap putIfAbsent
public V putIfAbsent(K key, V value)
From source file:io.druid.indexing.kafka.supervisor.KafkaSupervisor.java
private void updatePartitionDataFromKafka() { Map<String, List<PartitionInfo>> topics; try {//from ww w. ja v a 2 s . c om topics = consumer.listTopics(); // updates the consumer's list of partitions from the brokers } catch (Exception e) { // calls to the consumer throw NPEs when the broker doesn't respond log.warn(e, "Unable to get partition data from Kafka for brokers [%s], are the brokers up?", ioConfig.getConsumerProperties().get(KafkaSupervisorIOConfig.BOOTSTRAP_SERVERS_KEY)); return; } List<PartitionInfo> partitions = topics.get(ioConfig.getTopic()); int numPartitions = (partitions != null ? partitions.size() : 0); log.debug("Found [%d] Kafka partitions for topic [%s]", numPartitions, ioConfig.getTopic()); for (int partition = 0; partition < numPartitions; partition++) { int taskGroupId = getTaskGroupIdForPartition(partition); partitionGroups.putIfAbsent(taskGroupId, new ConcurrentHashMap<Integer, Long>()); ConcurrentHashMap<Integer, Long> partitionMap = partitionGroups.get(taskGroupId); // The starting offset for a new partition in [partitionGroups] is initially set to NOT_SET; when a new task group // is created and is assigned partitions, if the offset in [partitionGroups] is NOT_SET it will take the starting // offset value from the metadata store, and if it can't find it there, from Kafka. Once a task begins // publishing, the offset in partitionGroups will be updated to the ending offset of the publishing-but-not-yet- // completed task, which will cause the next set of tasks to begin reading from where the previous task left // off. If that previous task now fails, we will set the offset in [partitionGroups] back to NOT_SET which will // cause successive tasks to again grab their starting offset from metadata store. This mechanism allows us to // start up successive tasks without waiting for the previous tasks to succeed and still be able to handle task // failures during publishing. if (partitionMap.putIfAbsent(partition, NOT_SET) == null) { log.info("New partition [%d] discovered for topic [%s], added to task group [%d]", partition, ioConfig.getTopic(), taskGroupId); } } }
From source file:org.apache.druid.indexing.kafka.supervisor.KafkaSupervisor.java
private void discoverTasks() throws ExecutionException, InterruptedException, TimeoutException { int taskCount = 0; List<String> futureTaskIds = Lists.newArrayList(); List<ListenableFuture<Boolean>> futures = Lists.newArrayList(); List<Task> tasks = taskStorage.getActiveTasks(); final Map<Integer, TaskGroup> taskGroupsToVerify = new HashMap<>(); for (Task task : tasks) { if (!(task instanceof KafkaIndexTask) || !dataSource.equals(task.getDataSource())) { continue; }/*from w w w.j a v a 2s . c o m*/ taskCount++; final KafkaIndexTask kafkaTask = (KafkaIndexTask) task; final String taskId = task.getId(); // Determine which task group this task belongs to based on one of the partitions handled by this task. If we // later determine that this task is actively reading, we will make sure that it matches our current partition // allocation (getTaskGroupIdForPartition(partition) should return the same value for every partition being read // by this task) and kill it if it is not compatible. If the task is instead found to be in the publishing // state, we will permit it to complete even if it doesn't match our current partition allocation to support // seamless schema migration. Iterator<Integer> it = kafkaTask.getIOConfig().getStartPartitions().getPartitionOffsetMap().keySet() .iterator(); final Integer taskGroupId = (it.hasNext() ? getTaskGroupIdForPartition(it.next()) : null); if (taskGroupId != null) { // check to see if we already know about this task, either in [taskGroups] or in [pendingCompletionTaskGroups] // and if not add it to taskGroups or pendingCompletionTaskGroups (if status = PUBLISHING) TaskGroup taskGroup = taskGroups.get(taskGroupId); if (!isTaskInPendingCompletionGroups(taskId) && (taskGroup == null || !taskGroup.tasks.containsKey(taskId))) { futureTaskIds.add(taskId); futures.add(Futures.transform(taskClient.getStatusAsync(taskId), new Function<KafkaIndexTask.Status, Boolean>() { @Override public Boolean apply(KafkaIndexTask.Status status) { try { log.debug("Task [%s], status [%s]", taskId, status); if (status == KafkaIndexTask.Status.PUBLISHING) { kafkaTask.getIOConfig().getStartPartitions().getPartitionOffsetMap() .keySet().forEach( partition -> addDiscoveredTaskToPendingCompletionTaskGroups( getTaskGroupIdForPartition(partition), taskId, kafkaTask.getIOConfig().getStartPartitions() .getPartitionOffsetMap())); // update partitionGroups with the publishing task's offsets (if they are greater than what is // existing) so that the next tasks will start reading from where this task left off Map<Integer, Long> publishingTaskEndOffsets = taskClient .getEndOffsets(taskId); for (Entry<Integer, Long> entry : publishingTaskEndOffsets.entrySet()) { Integer partition = entry.getKey(); Long offset = entry.getValue(); ConcurrentHashMap<Integer, Long> partitionOffsets = partitionGroups .get(getTaskGroupIdForPartition(partition)); boolean succeeded; do { succeeded = true; Long previousOffset = partitionOffsets.putIfAbsent(partition, offset); if (previousOffset != null && previousOffset < offset) { succeeded = partitionOffsets.replace(partition, previousOffset, offset); } } while (!succeeded); } } else { for (Integer partition : kafkaTask.getIOConfig().getStartPartitions() .getPartitionOffsetMap().keySet()) { if (!taskGroupId.equals(getTaskGroupIdForPartition(partition))) { log.warn( "Stopping task [%s] which does not match the expected partition allocation", taskId); try { stopTask(taskId, false).get(futureTimeoutInSeconds, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { log.warn(e, "Exception while stopping task"); } return false; } } // make sure the task's io and tuning configs match with the supervisor config // if it is current then only create corresponding taskGroup if it does not exist if (!isTaskCurrent(taskGroupId, taskId)) { log.info( "Stopping task [%s] which does not match the expected parameters and ingestion spec", taskId); try { stopTask(taskId, false).get(futureTimeoutInSeconds, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { log.warn(e, "Exception while stopping task"); } return false; } else { final TaskGroup taskGroup = taskGroups.computeIfAbsent(taskGroupId, k -> { log.info( "Creating a new task group for taskGroupId[%d]", taskGroupId); return new TaskGroup(taskGroupId, ImmutableMap.copyOf(kafkaTask.getIOConfig() .getStartPartitions() .getPartitionOffsetMap()), kafkaTask.getIOConfig().getMinimumMessageTime(), kafkaTask.getIOConfig() .getMaximumMessageTime()); }); taskGroupsToVerify.put(taskGroupId, taskGroup); final TaskData prevTaskData = taskGroup.tasks.putIfAbsent(taskId, new TaskData()); if (prevTaskData != null) { throw new ISE( "WTH? a taskData[%s] already exists for new task[%s]", prevTaskData, taskId); } } } return true; } catch (Throwable t) { log.error(t, "Something bad while discovering task [%s]", taskId); return null; } } }, workerExec)); } } } List<Boolean> results = Futures.successfulAsList(futures).get(futureTimeoutInSeconds, TimeUnit.SECONDS); for (int i = 0; i < results.size(); i++) { if (results.get(i) == null) { String taskId = futureTaskIds.get(i); log.warn("Task [%s] failed to return status, killing task", taskId); killTask(taskId); } } log.debug("Found [%d] Kafka indexing tasks for dataSource [%s]", taskCount, dataSource); // make sure the checkpoints are consistent with each other and with the metadata store verifyAndMergeCheckpoints(taskGroupsToVerify.values()); }
From source file:diffhunter.Indexer.java
public void Make_Index(Database hashdb, String file_name, String read_gene_location) throws FileNotFoundException, IOException { Set_Parameters();/*from ww w . j av a 2 s . c om*/ //System.out.print("Sasa"); ConcurrentHashMap<String, Map<Integer, Integer>> dic_gene_loc_count = new ConcurrentHashMap<>(); ArrayList<String> lines_from_bed_file = new ArrayList<>(); BufferedReader br = new BufferedReader(new FileReader(file_name)); String line = br.readLine(); List<String> toks = Arrays.asList(line.split("\t")); lines_from_bed_file.add(line); String last_Seen_chromosome = toks.get(0).replace("chr", ""); line = br.readLine(); lines_from_bed_file.add(line); toks = Arrays.asList(line.split("\t")); String new_chromosome = toks.get(0).replace("chr", ""); while (((line = br.readLine()) != null) || lines_from_bed_file.size() > 0) { if (line != null) { toks = Arrays.asList(line.split("\t")); new_chromosome = toks.get(0).replace("chr", ""); } // process the line. if (line == null || !new_chromosome.equals(last_Seen_chromosome)) { System.out.println("Processing chromosome" + "\t" + last_Seen_chromosome); last_Seen_chromosome = new_chromosome; lines_from_bed_file.parallelStream().forEach(content -> { List<String> inner_toks = Arrays.asList(content.split("\t")); //WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING //STRAND column count should be changed. String strand = inner_toks.get(5); String chromosome_ = inner_toks.get(0).replace("chr", ""); if (!dic_Loc_gene.get(strand).containsKey(chromosome_)) { return; } Integer start_loc = Integer.parseInt(inner_toks.get(1)); Integer end_loc = Integer.parseInt(inner_toks.get(2)); List<Interval<String>> res__ = dic_Loc_gene.get(strand).get(chromosome_).getIntervals(start_loc, end_loc); //IntervalTree<String> pot_gene_name=new IntervalTree<>(res__); // for (int z = 0; z < pot_gene_name.Intervals.Count; z++) //{ for (int z = 0; z < res__.size(); z++) { dic_gene_loc_count.putIfAbsent(res__.get(z).getData(), new HashMap<>()); String gene_symbol = res__.get(z).getData(); Integer temp_gene_start_loc = dic_genes.get(gene_symbol).start_loc; Integer temp_gene_end_loc = dic_genes.get(gene_symbol).end_loc; if (start_loc < temp_gene_start_loc) { start_loc = temp_gene_start_loc; } if (end_loc > temp_gene_end_loc) { end_loc = temp_gene_end_loc; } synchronized (dic_synchrinzer_genes.get(gene_symbol)) { for (int k = start_loc; k <= end_loc; k++) { Integer value_inside = 0; value_inside = dic_gene_loc_count.get(gene_symbol).get(k); dic_gene_loc_count.get(gene_symbol).put(k, value_inside == null ? 1 : (value_inside + 1)); } } } }); /* List<string> keys_ = dic_gene_loc_count.Keys.ToList(); List<string> alt_keys = new List<string>();// dic_gene_loc_count.Keys.ToList(); for (int i = 0; i < keys_.Count; i++) { Dictionary<int, int> dicccc_ = new Dictionary<int, int>(); dic_gene_loc_count[keys_[i]] = new Dictionary<int, int>(dic_gene_loc_count[keys_[i]].Where(x => x.Value >= 2).ToDictionary(x => x.Key, x => x.Value)); if (dic_gene_loc_count[keys_[i]].Count == 0) { dic_gene_loc_count.TryRemove(keys_[i], out dicccc_); continue; } hashdb.Put(Get_BDB(keys_[i]), Get_BDB_Dictionary(dic_gene_loc_count[keys_[i]])); alt_keys.Add(keys_[i]); dic_gene_loc_count.TryRemove(keys_[i], out dicccc_); }*/ ArrayList<String> keys_ = new ArrayList<>(dic_gene_loc_count.keySet()); ArrayList<String> alt_keys = new ArrayList<>(); for (int i = 0; i < keys_.size(); i++) { //LinkedHashMap<Integer, Integer> tmep_map = new LinkedHashMap<>(dic_gene_loc_count.get(keys_.get(i))); LinkedHashMap<Integer, Integer> tmep_map = new LinkedHashMap<>(); /*tmep_map = */ dic_gene_loc_count.get(keys_.get(i)).entrySet().stream().filter(p -> p.getValue() >= 2) .sorted(Comparator.comparing(E -> E.getKey())) .forEach((entry) -> tmep_map.put(entry.getKey(), entry.getValue()));//.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue())); if (tmep_map.isEmpty()) { dic_gene_loc_count.remove(keys_.get(i)); continue; } //Map<Integer, Integer> tmep_map1 = new LinkedHashMap<>(); //tmep_map1=sortByKey(tmep_map); //tmep_map.entrySet().stream().sorted(Comparator.comparing(E -> E.getKey())).forEach((entry) -> tmep_map1.put(entry.getKey(), entry.getValue())); //BerkeleyDB_Box box=new BerkeleyDB_Box(); hashdb.put(null, BerkeleyDB_Box.Get_BDB(keys_.get(i)), BerkeleyDB_Box.Get_BDB_Dictionary(tmep_map)); alt_keys.add(keys_.get(i)); dic_gene_loc_count.remove(keys_.get(i)); //dic_gene_loc_count.put(keys_.get(i),tmep_map); } hashdb.sync(); int a = 1111; /* hashdb.Sync(); File.AppendAllLines("InputDB\\" + Path.GetFileNameWithoutExtension(file_name) + "_genes.txt", alt_keys); //total_lines_processed_till_now += lines_from_bed_file.Count; //worker.ReportProgress(total_lines_processed_till_now / count_); lines_from_bed_file.Clear(); if (!reader.EndOfStream) { lines_from_bed_file.Add(_line_); } last_Seen_chromosome = new_choromosome;*/ lines_from_bed_file.clear(); if (line != null) { lines_from_bed_file.add(line); } Path p = Paths.get(file_name); file_name = p.getFileName().toString(); BufferedWriter output = new BufferedWriter(new FileWriter((Paths .get(read_gene_location, FilenameUtils.removeExtension(file_name) + ".txt").toString()), true)); for (String alt_key : alt_keys) { output.append(alt_key); output.newLine(); } output.close(); /*if (((line = br.readLine()) != null)) { lines_from_bed_file.add(line); toks=Arrays.asList(line.split("\t")); new_chromosome=toks.get(0).replace("chr", ""); }*/ //last_Seen_chromosome=new_chromosome; } else if (new_chromosome.equals(last_Seen_chromosome)) { lines_from_bed_file.add(line); } } br.close(); hashdb.sync(); hashdb.close(); }
From source file:org.apache.druid.indexing.kafka.supervisor.KafkaSupervisor.java
private void updatePartitionDataFromKafka() { Map<String, List<PartitionInfo>> topics; try {/*from w w w .j av a 2 s . c o m*/ synchronized (consumerLock) { topics = consumer.listTopics(); // updates the consumer's list of partitions from the brokers } } catch (Exception e) { // calls to the consumer throw NPEs when the broker doesn't respond log.warn(e, "Unable to get partition data from Kafka for brokers [%s], are the brokers up?", ioConfig.getConsumerProperties().get(KafkaSupervisorIOConfig.BOOTSTRAP_SERVERS_KEY)); return; } List<PartitionInfo> partitions = topics.get(ioConfig.getTopic()); if (partitions == null) { log.warn("No such topic [%s] found, list of discovered topics [%s]", ioConfig.getTopic(), topics.keySet()); } int numPartitions = (partitions != null ? partitions.size() : 0); log.debug("Found [%d] Kafka partitions for topic [%s]", numPartitions, ioConfig.getTopic()); for (int partition = 0; partition < numPartitions; partition++) { int taskGroupId = getTaskGroupIdForPartition(partition); ConcurrentHashMap<Integer, Long> partitionMap = partitionGroups.computeIfAbsent(taskGroupId, k -> new ConcurrentHashMap<>()); // The starting offset for a new partition in [partitionGroups] is initially set to NOT_SET; when a new task group // is created and is assigned partitions, if the offset in [partitionGroups] is NOT_SET it will take the starting // offset value from the metadata store, and if it can't find it there, from Kafka. Once a task begins // publishing, the offset in partitionGroups will be updated to the ending offset of the publishing-but-not-yet- // completed task, which will cause the next set of tasks to begin reading from where the previous task left // off. If that previous task now fails, we will set the offset in [partitionGroups] back to NOT_SET which will // cause successive tasks to again grab their starting offset from metadata store. This mechanism allows us to // start up successive tasks without waiting for the previous tasks to succeed and still be able to handle task // failures during publishing. if (partitionMap.putIfAbsent(partition, NOT_SET) == null) { log.info("New partition [%d] discovered for topic [%s], added to task group [%d]", partition, ioConfig.getTopic(), taskGroupId); } } }
From source file:org.wso2.carbon.event.output.adaptor.cassandra.CassandraEventAdaptorType.java
/** * @param outputEventMessageConfiguration * - topic name to publish messages * @param message - is and Object[]{Event, EventDefinition} * @param outputEventAdaptorConfiguration * * @param tenantId//w w w.j av a 2 s . c o m */ public void publish(OutputEventAdaptorMessageConfiguration outputEventMessageConfiguration, Object message, OutputEventAdaptorConfiguration outputEventAdaptorConfiguration, int tenantId) { ConcurrentHashMap<OutputEventAdaptorConfiguration, EventAdaptorInfo> cassandraClusterCache = null; if (message instanceof Map) { try { cassandraClusterCache = tenantedCassandraClusterCache.get(tenantId); if (null == cassandraClusterCache) { cassandraClusterCache = new ConcurrentHashMap<OutputEventAdaptorConfiguration, EventAdaptorInfo>(); if (null != tenantedCassandraClusterCache.putIfAbsent(tenantId, cassandraClusterCache)) { cassandraClusterCache = tenantedCassandraClusterCache.get(tenantId); } } EventAdaptorInfo eventAdaptorInfo = cassandraClusterCache.get(outputEventAdaptorConfiguration); if (null == eventAdaptorInfo) { Map<String, String> properties = outputEventAdaptorConfiguration.getOutputProperties(); Map<String, String> credentials = new HashMap<String, String>(); credentials.put("username", properties.get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_USER_NAME)); credentials.put("password", properties.get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_PASSWORD)); // cleaning existing cached copies. Cluster cluster = HFactory.getCluster( properties.get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_CLUSTER_NAME)); if (cluster != null) { HFactory.shutdownCluster(cluster); } cluster = HFactory.createCluster( properties.get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_CLUSTER_NAME), new CassandraHostConfigurator( properties.get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_HOSTNAME) + ":" + properties .get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_PORT)), credentials); if (cluster.getKnownPoolHosts(true).size() < 1) { // not properly connected. log.error("Cannot connect to the Cassandra cluster: " + cluster.getName() + ". Please check the configuration."); HFactory.shutdownCluster(cluster); return; } String indexAllColumnsString = properties .get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_INDEX_ALL_COLUMNS); boolean indexAllColumns = false; if (indexAllColumnsString != null && indexAllColumnsString.equals("true")) { indexAllColumns = true; } eventAdaptorInfo = new EventAdaptorInfo(cluster, indexAllColumns); if (null != cassandraClusterCache.putIfAbsent(outputEventAdaptorConfiguration, eventAdaptorInfo)) { eventAdaptorInfo = cassandraClusterCache.get(outputEventAdaptorConfiguration); } else { log.info("Initiated Cassandra Writer " + outputEventAdaptorConfiguration.getName()); } } String keySpaceName = outputEventMessageConfiguration.getOutputMessageProperties() .get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_KEY_SPACE_NAME); String columnFamilyName = outputEventMessageConfiguration.getOutputMessageProperties() .get(CassandraEventAdaptorConstants.ADAPTOR_CASSANDRA_COLUMN_FAMILY_NAME); MessageInfo messageInfo = eventAdaptorInfo.getMessageInfoMap().get(outputEventMessageConfiguration); if (null == messageInfo) { Keyspace keyspace = HFactory.createKeyspace(keySpaceName, eventAdaptorInfo.getCluster()); messageInfo = new MessageInfo(keyspace); if (null != eventAdaptorInfo.getMessageInfoMap().putIfAbsent(outputEventMessageConfiguration, messageInfo)) { messageInfo = eventAdaptorInfo.getMessageInfoMap().get(outputEventMessageConfiguration); } } if (eventAdaptorInfo.getCluster().describeKeyspace(keySpaceName) == null) { BasicColumnFamilyDefinition columnFamilyDefinition = new BasicColumnFamilyDefinition(); columnFamilyDefinition.setKeyspaceName(keySpaceName); columnFamilyDefinition.setName(columnFamilyName); columnFamilyDefinition.setComparatorType(ComparatorType.UTF8TYPE); columnFamilyDefinition.setDefaultValidationClass(ComparatorType.UTF8TYPE.getClassName()); columnFamilyDefinition.setKeyValidationClass(ComparatorType.UTF8TYPE.getClassName()); ColumnFamilyDefinition cfDef = new ThriftCfDef(columnFamilyDefinition); KeyspaceDefinition keyspaceDefinition = HFactory.createKeyspaceDefinition(keySpaceName, "org.apache.cassandra.locator.SimpleStrategy", 1, Arrays.asList(cfDef)); eventAdaptorInfo.getCluster().addKeyspace(keyspaceDefinition); KeyspaceDefinition fromCluster = eventAdaptorInfo.getCluster().describeKeyspace(keySpaceName); messageInfo.setColumnFamilyDefinition( new BasicColumnFamilyDefinition(fromCluster.getCfDefs().get(0))); } else { KeyspaceDefinition fromCluster = eventAdaptorInfo.getCluster().describeKeyspace(keySpaceName); for (ColumnFamilyDefinition columnFamilyDefinition : fromCluster.getCfDefs()) { if (columnFamilyDefinition.getName().equals(columnFamilyName)) { messageInfo.setColumnFamilyDefinition( new BasicColumnFamilyDefinition(columnFamilyDefinition)); break; } } } Mutator<String> mutator = HFactory.createMutator(messageInfo.getKeyspace(), sser); String uuid = UUID.randomUUID().toString(); for (Map.Entry<String, Object> entry : ((Map<String, Object>) message).entrySet()) { if (eventAdaptorInfo.isIndexAllColumns() && !messageInfo.getColumnNames().contains(entry.getKey())) { BasicColumnFamilyDefinition columnFamilyDefinition = messageInfo .getColumnFamilyDefinition(); BasicColumnDefinition columnDefinition = new BasicColumnDefinition(); columnDefinition.setName(StringSerializer.get().toByteBuffer(entry.getKey())); columnDefinition.setIndexType(ColumnIndexType.KEYS); columnDefinition.setIndexName( keySpaceName + "_" + columnFamilyName + "_" + entry.getKey() + "_Index"); columnDefinition.setValidationClass(ComparatorType.UTF8TYPE.getClassName()); columnFamilyDefinition.addColumnDefinition(columnDefinition); eventAdaptorInfo.getCluster().updateColumnFamily(new ThriftCfDef(columnFamilyDefinition)); messageInfo.getColumnNames().add(entry.getKey()); } mutator.insert(uuid, columnFamilyName, HFactory.createStringColumn(entry.getKey(), entry.getValue().toString())); } mutator.execute(); } catch (Throwable t) { if (cassandraClusterCache != null) { cassandraClusterCache.remove(outputEventAdaptorConfiguration); } log.error("Cannot connect to Cassandra: " + t.getMessage(), t); } } }
From source file:org.apache.slider.providers.agent.AgentProviderService.java
/** Publish component instance specific data if the component demands it */ protected void processAndPublishComponentSpecificExports(Map<String, String> ports, String containerId, String hostFqdn, String compName) { String portVarFormat = "${site.%s}"; String hostNamePattern = "${" + compName + "_HOST}"; List<ExportGroup> appExportGroups = getMetainfo().getApplication().getExportGroups(); Component component = getMetainfo().getApplicationComponent(compName); if (component != null && SliderUtils.isSet(component.getCompExports()) && appExportGroups != null && appExportGroups.size() > 0) { Set<String> compExports = new HashSet(); String compExportsStr = component.getCompExports(); for (String compExport : compExportsStr.split(",")) { if (compExport.trim().length() > 0) { compExports.add(compExport.trim()); }/*from w w w .j a v a 2s . c om*/ } Date now = new Date(); Set<String> modifiedGroups = new HashSet<String>(); for (ExportGroup exportGroup : appExportGroups) { List<Export> exports = exportGroup.getExports(); if (exports != null && !exports.isEmpty()) { String exportGroupName = exportGroup.getName(); ConcurrentHashMap<String, List<ExportEntry>> map = (ConcurrentHashMap<String, List<ExportEntry>>) getCurrentExports( exportGroupName); for (Export export : exports) { if (canBeExported(exportGroupName, export.getName(), compExports)) { log.info("Attempting to publish {} of group {} for component type {}", export.getName(), exportGroupName, compName); String templateToExport = export.getValue(); for (String portName : ports.keySet()) { boolean publishData = false; String portValPattern = String.format(portVarFormat, portName); if (templateToExport.contains(portValPattern)) { templateToExport = templateToExport.replace(portValPattern, ports.get(portName)); publishData = true; } if (templateToExport.contains(hostNamePattern)) { templateToExport = templateToExport.replace(hostNamePattern, hostFqdn); publishData = true; } if (publishData) { ExportEntry entryToAdd = new ExportEntry(); entryToAdd.setLevel(COMPONENT_TAG); entryToAdd.setValue(templateToExport); entryToAdd.setUpdatedTime(now.toString()); entryToAdd.setContainerId(containerId); entryToAdd.setTag(tags.getTag(compName, containerId)); List<ExportEntry> existingList = map.putIfAbsent(export.getName(), new CopyOnWriteArrayList(Arrays.asList(entryToAdd))); // in-place edit, no lock needed if (existingList != null) { boolean updatedInPlace = false; for (ExportEntry entry : existingList) { if (containerId.equalsIgnoreCase(entry.getContainerId())) { entryToAdd.setValue(templateToExport); entryToAdd.setUpdatedTime(now.toString()); updatedInPlace = true; } } if (!updatedInPlace) { existingList.add(entryToAdd); } } log.info("Publishing {} for name {} and container {}", templateToExport, export.getName(), containerId); modifiedGroups.add(exportGroupName); synchronized (containerExportsMap) { if (!containerExportsMap.containsKey(containerId)) { containerExportsMap.put(containerId, new HashSet<String>()); } Set<String> containerExportMaps = containerExportsMap.get(containerId); containerExportMaps .add(String.format("%s:%s", exportGroupName, export.getName())); } } } } } } } publishModifiedExportGroups(modifiedGroups); } }
From source file:org.wso2.carbon.event.output.adaptor.cassandraext.CassandraExtendedEventAdaptorType.java
/** * @param outputEventMessageConfiguration * - topic name to publish messages * @param message - is and Object[]{Event, EventDefinition} * @param outputEventAdaptorConfiguration * * @param tenantId//w ww .ja v a 2s . c om */ public void publish(OutputEventAdaptorMessageConfiguration outputEventMessageConfiguration, Object message, OutputEventAdaptorConfiguration outputEventAdaptorConfiguration, int tenantId) { ConcurrentHashMap<OutputEventAdaptorConfiguration, EventAdaptorInfo> cassandraClusterCache = null; if (message instanceof Map) { try { cassandraClusterCache = tenantedCassandraClusterCache.get(tenantId); if (null == cassandraClusterCache) { cassandraClusterCache = new ConcurrentHashMap<OutputEventAdaptorConfiguration, EventAdaptorInfo>(); if (null != tenantedCassandraClusterCache.putIfAbsent(tenantId, cassandraClusterCache)) { cassandraClusterCache = tenantedCassandraClusterCache.get(tenantId); } } String keySpaceName = outputEventMessageConfiguration.getOutputMessageProperties() .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_KEY_SPACE_NAME); String columnFamilyName = outputEventMessageConfiguration.getOutputMessageProperties() .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_COLUMN_FAMILY_NAME); EventAdaptorInfo eventAdaptorInfo = cassandraClusterCache.get(outputEventAdaptorConfiguration); if (null == eventAdaptorInfo) { Map<String, String> properties = outputEventAdaptorConfiguration.getOutputProperties(); String username = properties .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_USER_NAME); String password = properties .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_PASSWORD); String cassandraHost = properties .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_HOSTNAME); String cassandraPort = properties .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_PORT); String clusterName = properties .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_CLUSTER_NAME); Cluster.Builder clusterBuilder = Cluster.builder().addContactPoint(cassandraHost); if (cassandraPort != null && cassandraPort.length() > 0) { clusterBuilder.withPort(Integer.parseInt(cassandraPort)); } clusterBuilder.withClusterName(clusterName); if (username != null && username.length() > 0) { clusterBuilder.withCredentials(username, password); } Cluster cluster = clusterBuilder.build(); String indexAllColumnsString = properties .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_INDEX_ALL_COLUMNS); boolean indexAllColumns = false; if (indexAllColumnsString != null && indexAllColumnsString.equals("true")) { indexAllColumns = true; } eventAdaptorInfo = new EventAdaptorInfo(cluster, indexAllColumns); if (null != cassandraClusterCache.putIfAbsent(outputEventAdaptorConfiguration, eventAdaptorInfo)) { eventAdaptorInfo = cassandraClusterCache.get(outputEventAdaptorConfiguration); } else { log.info("Initiated Cassandra Writer " + outputEventAdaptorConfiguration.getName()); } } MessageInfo messageInfo = eventAdaptorInfo.getMessageInfoMap().get(outputEventMessageConfiguration); String executionMode = outputEventMessageConfiguration.getOutputMessageProperties() .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_EXECUTION_MODE); String updateColKeys = outputEventMessageConfiguration.getOutputMessageProperties() .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_INDEX_KEYS); if (null == messageInfo) { messageInfo = new MessageInfo(); // this is eternal and thread-safe. Session session = eventAdaptorInfo.getCluster().connect(keySpaceName); messageInfo.setSession(session); messageInfo.setInsertOrUpdate(executionMode.equalsIgnoreCase(resourceBundle.getString( CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_EXECUTION_MODE_UPDATE))); if (messageInfo.isInsertOrUpdate()) { ArrayList<String> keyList = new ArrayList<String>(); String[] keys = updateColKeys == null ? new String[0] : updateColKeys.trim().split(","); for (String key : keys) { keyList.add(key.trim()); } messageInfo.setKeyColumns(keyList); } messageInfo.setPrimaryKey(outputEventMessageConfiguration.getOutputMessageProperties() .get(CassandraExtendedEventAdaptorConstants.ADAPTOR_CASSANDRA_PRIMARY_KEY)); if (null != eventAdaptorInfo.getMessageInfoMap().putIfAbsent(outputEventMessageConfiguration, messageInfo)) { messageInfo = eventAdaptorInfo.getMessageInfoMap().get(outputEventMessageConfiguration); } } // customized code Session session = messageInfo.getSession(); Map<String, Object> attributeMap = (Map<String, Object>) message; // optional String primaryKey = messageInfo.getPrimaryKey(); if (primaryKey != null && primaryKey.trim().length() == 0) { // not configured properly. primaryKey = null; } // optional ArrayList<String> indexCols = messageInfo.getKeyColumns(); // create table and indexes if not exist. if (!messageInfo.isCfInitialized()) { try { session.execute("select * from " + columnFamilyName + " limit 1"); messageInfo.setCfInitialized(true); } catch (Exception ex) { // assuming table doesn't exist. StringBuilder creationQuery = new StringBuilder("create table " + columnFamilyName + " ("); if (primaryKey == null || primaryKey.length() == 0) { creationQuery.append("uuid_key text primary key, "); } for (String col : attributeMap.keySet()) { creationQuery.append(col).append(" ").append("text"); if (col.equals(primaryKey)) { creationQuery.append(" primary key"); } creationQuery.append(","); } String query = creationQuery.substring(0, creationQuery.length() - 1) + ")"; session.execute(query); // creating indexes if (indexCols != null) { for (String index : indexCols) { if (!index.equals(primaryKey)) { String indexQuery = "create index ind_" + columnFamilyName + "_" + index + " on " + columnFamilyName + " (" + index + ")"; session.execute(indexQuery); } } } messageInfo.setCfInitialized(true); } } // end of table creation // inserting and updating. if (messageInfo.isInsertOrUpdate()) { // checking whether the key cols values exist StringBuilder queryBuilder = new StringBuilder("update "); queryBuilder.append(columnFamilyName); queryBuilder.append(" set "); boolean addComma = false; for (Map.Entry<String, Object> entry : attributeMap.entrySet()) { if (!entry.getKey().equals(primaryKey)) { if (addComma) { queryBuilder.append(","); } queryBuilder.append(entry.getKey()); queryBuilder.append(" = '"); queryBuilder.append(entry.getValue()); queryBuilder.append("'"); addComma = true; } } queryBuilder.append(" where "); queryBuilder.append(primaryKey); queryBuilder.append(" = '"); queryBuilder.append(attributeMap.get(primaryKey)); queryBuilder.append("'"); session.execute(queryBuilder.toString()); } else { // inserting with uuid to allow duplicates // if user enters a primary key here, it will be similar to the update clause. StringBuilder queryBuilder = new StringBuilder("insert into "); queryBuilder.append(columnFamilyName); queryBuilder.append(" ("); boolean addComma = false; if (primaryKey == null) { queryBuilder.append("uuid_key, "); } for (Map.Entry<String, Object> entry : attributeMap.entrySet()) { if (addComma) { queryBuilder.append(", "); } queryBuilder.append(entry.getKey()); addComma = true; } queryBuilder.append(") values ("); if (primaryKey == null) { queryBuilder.append("'").append(UUID.randomUUID()).append("'"); queryBuilder.append(","); } addComma = false; for (Map.Entry<String, Object> entry : attributeMap.entrySet()) { if (addComma) { queryBuilder.append(","); } queryBuilder.append("'").append(entry.getValue()).append("'"); addComma = true; } queryBuilder.append(")"); session.execute(queryBuilder.toString()); } // end of customized code } catch (Throwable t) { if (cassandraClusterCache != null) { cassandraClusterCache.remove(outputEventAdaptorConfiguration); } log.error("Cannot connect to Cassandra: " + t.getMessage(), t); } } }
From source file:sqs_dwh.filter_049_0_1.filter_049.java
public void tFileInputLDIF_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//from www . j av a 2s.c om String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; decode_pwStruct decode_pw = new decode_pwStruct(); out_decode_pwStruct out_decode_pw = new out_decode_pwStruct(); row1Struct row1 = new row1Struct(); /** * [tFileOutputLDIF_1 begin ] start */ ok_Hash.put("tFileOutputLDIF_1", false); start_Hash.put("tFileOutputLDIF_1", System.currentTimeMillis()); currentComponent = "tFileOutputLDIF_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_row1 = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_row1.putIfAbsent("row1" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_row1 = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_row1 .get("row1" + iterateLoop); runStat.updateStatOnConnection("row1" + iterateId, stats_row1.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFileOutputLDIF_1 = 0; java.io.File file_tFileOutputLDIF_1 = new java.io.File( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/file4_prod2.ldif"); // create directory only if not exists java.io.File parentFile_tFileOutputLDIF_1 = file_tFileOutputLDIF_1.getParentFile(); if (parentFile_tFileOutputLDIF_1 != null && !parentFile_tFileOutputLDIF_1.exists()) { parentFile_tFileOutputLDIF_1.mkdirs(); } class Util_tFileOutputLDIF_1 { public void breakString(StringBuilder pw, String value, int max) { int leftToGo = value.length(); int written = 0; int maxChars = max; while (leftToGo > 0) { int toWrite = Math.min(maxChars, leftToGo); String s = value.substring(written, written + toWrite); if (written != 0) { pw.append(" " + s); } else { pw.append(s); maxChars -= 1; } written += toWrite; leftToGo -= toWrite; pw.append('\n'); } } public String getBase64StringOrNot(boolean encodingBase64, String srcData, String encoding) { String returnValue = ""; try { if (encodingBase64 && !netscape.ldap.util.LDIF.isPrintable(srcData.getBytes(encoding))) { returnValue = org.apache.commons.codec.binary.Base64 .encodeBase64String(srcData.getBytes(encoding)); } else { returnValue = srcData; } } catch (java.lang.Exception e) { e.printStackTrace(); } return returnValue; } } Util_tFileOutputLDIF_1 util_tFileOutputLDIF_1 = new Util_tFileOutputLDIF_1(); int nb_line_tFileOutputLDIF_1 = 0; final String dn_tFileOutputLDIF_1 = "dn: "; final String changetype_tFileOutputLDIF_1 = "changetype: "; final int wrap_tFileOutputLDIF_1 = 78; java.io.PrintWriter pw_tFileOutputLDIF_1 = new java.io.PrintWriter(file_tFileOutputLDIF_1, "ISO-8859-15"); if (file_tFileOutputLDIF_1.length() == 0) { pw_tFileOutputLDIF_1.write("version: 1\n"); } /** * [tFileOutputLDIF_1 begin ] stop */ /** * [tFilterRow_1 begin ] start */ ok_Hash.put("tFilterRow_1", false); start_Hash.put("tFilterRow_1", System.currentTimeMillis()); currentComponent = "tFilterRow_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_out_decode_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_out_decode_pw.putIfAbsent("out_decode_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_out_decode_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_out_decode_pw .get("out_decode_pw" + iterateLoop); runStat.updateStatOnConnection("out_decode_pw" + iterateId, stats_out_decode_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFilterRow_1 = 0; int nb_line_tFilterRow_1 = 0; int nb_line_ok_tFilterRow_1 = 0; int nb_line_reject_tFilterRow_1 = 0; class Operator_tFilterRow_1 { private String sErrorMsg = ""; private boolean bMatchFlag = true; private String sUnionFlag = "&&"; public Operator_tFilterRow_1(String unionFlag) { sUnionFlag = unionFlag; bMatchFlag = "||".equals(unionFlag) ? false : true; } public String getErrorMsg() { if (sErrorMsg != null && sErrorMsg.length() > 1) return sErrorMsg.substring(1); else return null; } public boolean getMatchFlag() { return bMatchFlag; } public void matches(boolean partMatched, String reason) { // no need to care about the next judgement if ("||".equals(sUnionFlag) && bMatchFlag) { return; } if (!partMatched) { sErrorMsg += "|" + reason; } if ("||".equals(sUnionFlag)) bMatchFlag = bMatchFlag || partMatched; else bMatchFlag = bMatchFlag && partMatched; } } /** * [tFilterRow_1 begin ] stop */ /** * [tMap_1 begin ] start */ ok_Hash.put("tMap_1", false); start_Hash.put("tMap_1", System.currentTimeMillis()); currentComponent = "tMap_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_decode_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_decode_pw.putIfAbsent("decode_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_decode_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_decode_pw .get("decode_pw" + iterateLoop); runStat.updateStatOnConnection("decode_pw" + iterateId, stats_decode_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tMap_1 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_1__Struct { } Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct(); // ############################### // ############################### // # Outputs initialization out_decode_pwStruct out_decode_pw_tmp = new out_decode_pwStruct(); // ############################### /** * [tMap_1 begin ] stop */ /** * [tFileInputLDIF_2 begin ] start */ ok_Hash.put("tFileInputLDIF_2", false); start_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); currentComponent = "tFileInputLDIF_2"; int tos_count_tFileInputLDIF_2 = 0; // ///////////////////////////////// netscape.ldap.util.LDIF ldif_tFileInputLDIF_2 = new netscape.ldap.util.LDIF( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/file4_prod1.ldif"); String[] filters_tFileInputLDIF_2 = new String[] { "dn", "objectClass", "uid", "spectos_loginName", "cn", "sn", "email", "preferredLanguage", "userPassword", "zupId", "userEnabled", }; String[] filters_binary_tFileInputLDIF_2 = new String[] { "dn;binary", "objectClass;binary", "uid;binary", "spectos_loginName;binary", "cn;binary", "sn;binary", "email;binary", "preferredLanguage;binary", "userPassword;binary", "zupId;binary", "userEnabled;binary", }; String[] results_tFileInputLDIF_2 = null; List<List<byte[]>> resultsBinary_tFileInputLDIF_2 = null; int nb_line_tFileInputLDIF_2 = 0; // ///////////////////////////////// for (netscape.ldap.util.LDIFRecord record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord(); record_tFileInputLDIF_2 != null; record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord()) { results_tFileInputLDIF_2 = new String[11]; resultsBinary_tFileInputLDIF_2 = new java.util.ArrayList<List<byte[]>>(); netscape.ldap.util.LDIFContent content_tFileInputLDIF_2 = record_tFileInputLDIF_2.getContent(); netscape.ldap.LDAPAttribute[] attributes_tFileInputLDIF_2 = null; switch (content_tFileInputLDIF_2.getType()) { case netscape.ldap.util.LDIFContent.ATTRIBUTE_CONTENT: netscape.ldap.util.LDIFAttributeContent attrContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAttributeContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = attrContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.ADD_CONTENT: netscape.ldap.util.LDIFAddContent addContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAddContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = addContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "add"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.MODIFICATION_CONTENT: netscape.ldap.util.LDIFModifyContent modifyContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModifyContent) content_tFileInputLDIF_2; netscape.ldap.LDAPModification[] modifications_tFileInputLDIF_2 = modifyContent_tFileInputLDIF_2 .getModifications(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (netscape.ldap.LDAPModification modification_tFileInputLDIF_2 : modifications_tFileInputLDIF_2) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = modification_tFileInputLDIF_2 .getAttribute(); if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modify"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); boolean firstLoop_tFileInputLDIF_2 = true; for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); if (firstLoop_tFileInputLDIF_2) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + ":" + value_tFileInputLDIF_2; } else { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } firstLoop_tFileInputLDIF_2 = false; } } } } } break; case netscape.ldap.util.LDIFContent.DELETE_CONTENT: // netscape.ldap.util.LDIFDeleteContent // deleteContent_tFileInputLDIF_2 = // (netscape.ldap.util.LDIFDeleteContent) // content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "delete"; } } break; case netscape.ldap.util.LDIFContent.MODDN_CONTENT: netscape.ldap.util.LDIFModDNContent moddnContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModDNContent) content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modrdn"; } else if ("newrdn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getRDN(); } else if ("deleteoldrdn" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = Boolean .toString(moddnContent_tFileInputLDIF_2.getDeleteOldRDN()); } else if ("newsuperior" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getNewParent(); } } break; default: } nb_line_tFileInputLDIF_2++; // for output decode_pw = null; boolean whetherReject_tFileInputLDIF_2 = false; decode_pw = new decode_pwStruct(); try { if (0 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[0] != null) { decode_pw.dn = results_tFileInputLDIF_2[0]; } else { decode_pw.dn = null; } if (1 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[1] != null) { decode_pw.objectClass = results_tFileInputLDIF_2[1]; } else { decode_pw.objectClass = null; } if (2 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[2] != null) { decode_pw.uid = results_tFileInputLDIF_2[2]; } else { decode_pw.uid = null; } if (3 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[3] != null) { decode_pw.spectos_loginName = results_tFileInputLDIF_2[3]; } else { decode_pw.spectos_loginName = null; } if (4 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[4] != null) { decode_pw.cn = results_tFileInputLDIF_2[4]; } else { decode_pw.cn = null; } if (5 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[5] != null) { decode_pw.sn = results_tFileInputLDIF_2[5]; } else { decode_pw.sn = null; } if (6 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[6] != null) { decode_pw.email = results_tFileInputLDIF_2[6]; } else { decode_pw.email = null; } if (7 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[7] != null) { decode_pw.preferredLanguage = results_tFileInputLDIF_2[7]; } else { decode_pw.preferredLanguage = null; } if (8 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[8] != null) { decode_pw.userPassword = results_tFileInputLDIF_2[8]; } else { decode_pw.userPassword = null; } if (9 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[9] != null) { decode_pw.zupId = results_tFileInputLDIF_2[9]; } else { decode_pw.zupId = null; } if (10 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[10] != null) { decode_pw.userEnabled = results_tFileInputLDIF_2[10]; } else { decode_pw.userEnabled = null; } } catch (java.lang.Exception e) { whetherReject_tFileInputLDIF_2 = true; System.err.println(e.getMessage()); decode_pw = null; } // ///////////////////////////////// /** * [tFileInputLDIF_2 begin ] stop */ /** * [tFileInputLDIF_2 main ] start */ currentComponent = "tFileInputLDIF_2"; tos_count_tFileInputLDIF_2++; /** * [tFileInputLDIF_2 main ] stop */ // Start of branch "decode_pw" if (decode_pw != null) { /** * [tMap_1 main ] start */ currentComponent = "tMap_1"; // decode_pw // decode_pw if (execStat) { runStat.updateStatOnConnection("decode_pw" + iterateId, 1, 1); } boolean hasCasePrimitiveKeyWithNull_tMap_1 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_1 = false; boolean mainRowRejected_tMap_1 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_1__Struct Var = Var__tMap_1;// ############################### // ############################### // # Output tables out_decode_pw = null; // # Output table : 'out_decode_pw' out_decode_pw_tmp.dn = decode_pw.dn; out_decode_pw_tmp.objectClass = decode_pw.objectClass; out_decode_pw_tmp.uid = decode_pw.uid; out_decode_pw_tmp.spectos_loginName = decode_pw.spectos_loginName; out_decode_pw_tmp.cn = decode_pw.cn; out_decode_pw_tmp.sn = decode_pw.sn; out_decode_pw_tmp.spectos_email = decode_pw.email; out_decode_pw_tmp.preferredLanguage = decode_pw.preferredLanguage; out_decode_pw_tmp.userPassword = decode_pw.userPassword; out_decode_pw = out_decode_pw_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_1 = false; tos_count_tMap_1++; /** * [tMap_1 main ] stop */ // Start of branch "out_decode_pw" if (out_decode_pw != null) { /** * [tFilterRow_1 main ] start */ currentComponent = "tFilterRow_1"; // out_decode_pw // out_decode_pw if (execStat) { runStat.updateStatOnConnection("out_decode_pw" + iterateId, 1, 1); } row1 = null; Operator_tFilterRow_1 ope_tFilterRow_1 = new Operator_tFilterRow_1("&&"); ope_tFilterRow_1.matches((out_decode_pw.cn.startsWith("049") == true ), "advanced condition failed"); if (ope_tFilterRow_1.getMatchFlag()) { if (row1 == null) { row1 = new row1Struct(); } row1.dn = out_decode_pw.dn; row1.objectClass = out_decode_pw.objectClass; row1.uid = out_decode_pw.uid; row1.spectos_loginName = out_decode_pw.spectos_loginName; row1.cn = out_decode_pw.cn; row1.sn = out_decode_pw.sn; row1.spectos_email = out_decode_pw.spectos_email; row1.preferredLanguage = out_decode_pw.preferredLanguage; row1.userPassword = out_decode_pw.userPassword; nb_line_ok_tFilterRow_1++; } else { nb_line_reject_tFilterRow_1++; } nb_line_tFilterRow_1++; tos_count_tFilterRow_1++; /** * [tFilterRow_1 main ] stop */ // Start of branch "row1" if (row1 != null) { /** * [tFileOutputLDIF_1 main ] start */ currentComponent = "tFileOutputLDIF_1"; // row1 // row1 if (execStat) { runStat.updateStatOnConnection("row1" + iterateId, 1, 1); } // //////////////////////// boolean encodingBase64 = false; StringBuilder sb_tFileOutputLDIF_1 = new StringBuilder(); boolean needSeparator_tFileOutputLDIF_1 = false; boolean canOutput_tFileOutputLDIF_1 = false; boolean isPrintable_tFileOutputLDIF_1 = false; encodingBase64 = false; String value_dn_tFileOutputLDIF_1 = ""; if (row1.dn != null && !("").equals(row1.dn)) { value_dn_tFileOutputLDIF_1 = row1.dn; util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, dn_tFileOutputLDIF_1 + value_dn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } encodingBase64 = false; String value_objectClass_tFileOutputLDIF_1 = ""; if (row1.objectClass != null && !("").equals(row1.objectClass)) { value_objectClass_tFileOutputLDIF_1 = row1.objectClass; String[] values_objectClass_tFileOutputLDIF_1 = value_objectClass_tFileOutputLDIF_1 .split(","); for (String item_tFileOutputLDIF_1 : values_objectClass_tFileOutputLDIF_1) { // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(item_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, // it must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } else { encodingBase64 = false; } // Add ":" to comply with base64 ldif // syntax item_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, item_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "objectClass: " + item_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_uid_tFileOutputLDIF_1 = ""; if (row1.uid != null && !("").equals(row1.uid)) { value_uid_tFileOutputLDIF_1 = row1.uid; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_uid_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_uid_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_uid_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "uid: " + value_uid_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_spectos_loginName_tFileOutputLDIF_1 = ""; if (row1.spectos_loginName != null && !("").equals(row1.spectos_loginName)) { value_spectos_loginName_tFileOutputLDIF_1 = row1.spectos_loginName; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_spectos_loginName_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_spectos_loginName_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_spectos_loginName_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "spectos_loginName: " + value_spectos_loginName_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_cn_tFileOutputLDIF_1 = ""; if (row1.cn != null && !("").equals(row1.cn)) { value_cn_tFileOutputLDIF_1 = row1.cn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_cn_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_cn_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_cn_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "cn: " + value_cn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_sn_tFileOutputLDIF_1 = ""; if (row1.sn != null && !("").equals(row1.sn)) { value_sn_tFileOutputLDIF_1 = row1.sn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_sn_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_sn_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_sn_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "sn: " + value_sn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_spectos_email_tFileOutputLDIF_1 = ""; if (row1.spectos_email != null && !("").equals(row1.spectos_email)) { value_spectos_email_tFileOutputLDIF_1 = row1.spectos_email; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_spectos_email_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_spectos_email_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_spectos_email_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "spectos_email: " + value_spectos_email_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_preferredLanguage_tFileOutputLDIF_1 = ""; if (row1.preferredLanguage != null && !("").equals(row1.preferredLanguage)) { value_preferredLanguage_tFileOutputLDIF_1 = row1.preferredLanguage; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_preferredLanguage_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_preferredLanguage_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_preferredLanguage_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "preferredLanguage: " + value_preferredLanguage_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_userPassword_tFileOutputLDIF_1 = ""; if (row1.userPassword != null && !("").equals(row1.userPassword)) { value_userPassword_tFileOutputLDIF_1 = row1.userPassword; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_userPassword_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_userPassword_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_userPassword_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "userPassword: " + value_userPassword_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } sb_tFileOutputLDIF_1.append('\n'); if (canOutput_tFileOutputLDIF_1) { pw_tFileOutputLDIF_1.write(sb_tFileOutputLDIF_1.toString()); nb_line_tFileOutputLDIF_1++; } // //////////////////////// tos_count_tFileOutputLDIF_1++; /** * [tFileOutputLDIF_1 main ] stop */ } // End of branch "row1" } // End of branch "out_decode_pw" } // End of branch "decode_pw" /** * [tFileInputLDIF_2 end ] start */ currentComponent = "tFileInputLDIF_2"; } globalMap.put("tFileInputLDIF_2_NB_LINE", nb_line_tFileInputLDIF_2); ok_Hash.put("tFileInputLDIF_2", true); end_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); /** * [tFileInputLDIF_2 end ] stop */ /** * [tMap_1 end ] start */ currentComponent = "tMap_1"; // ############################### // # Lookup hashes releasing // ############################### if (execStat) { runStat.updateStatOnConnection("decode_pw" + iterateId, 2, 0); } ok_Hash.put("tMap_1", true); end_Hash.put("tMap_1", System.currentTimeMillis()); /** * [tMap_1 end ] stop */ /** * [tFilterRow_1 end ] start */ currentComponent = "tFilterRow_1"; globalMap.put("tFilterRow_1_NB_LINE", nb_line_tFilterRow_1); globalMap.put("tFilterRow_1_NB_LINE_OK", nb_line_ok_tFilterRow_1); globalMap.put("tFilterRow_1_NB_LINE_REJECT", nb_line_reject_tFilterRow_1); if (execStat) { runStat.updateStatOnConnection("out_decode_pw" + iterateId, 2, 0); } ok_Hash.put("tFilterRow_1", true); end_Hash.put("tFilterRow_1", System.currentTimeMillis()); /** * [tFilterRow_1 end ] stop */ /** * [tFileOutputLDIF_1 end ] start */ currentComponent = "tFileOutputLDIF_1"; pw_tFileOutputLDIF_1.flush(); pw_tFileOutputLDIF_1.close(); globalMap.put("tFileOutputLDIF_1_NB_LINE", nb_line_tFileOutputLDIF_1); if (execStat) { runStat.updateStatOnConnection("row1" + iterateId, 2, 0); } ok_Hash.put("tFileOutputLDIF_1", true); end_Hash.put("tFileOutputLDIF_1", System.currentTimeMillis()); /** * [tFileOutputLDIF_1 end ] stop */ } // end the resume } catch (java.lang.Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { runStat.stopThreadStat(); throw new java.lang.Error(error); } globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 1); }
From source file:sqs_dwh.encode_ldap_sqs_0_1.encode_ldap_sqs.java
public void tFileInputLDIF_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//w ww.ja v a 2 s . c om String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; decode_pwStruct decode_pw = new decode_pwStruct(); out_decode_pwStruct out_decode_pw = new out_decode_pwStruct(); row1Struct row1 = new row1Struct(); /** * [tFileOutputLDIF_1 begin ] start */ ok_Hash.put("tFileOutputLDIF_1", false); start_Hash.put("tFileOutputLDIF_1", System.currentTimeMillis()); currentComponent = "tFileOutputLDIF_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_row1 = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_row1.putIfAbsent("row1" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_row1 = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_row1 .get("row1" + iterateLoop); runStat.updateStatOnConnection("row1" + iterateId, stats_row1.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFileOutputLDIF_1 = 0; java.io.File file_tFileOutputLDIF_1 = new java.io.File( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/file4_new.ldif"); // create directory only if not exists java.io.File parentFile_tFileOutputLDIF_1 = file_tFileOutputLDIF_1.getParentFile(); if (parentFile_tFileOutputLDIF_1 != null && !parentFile_tFileOutputLDIF_1.exists()) { parentFile_tFileOutputLDIF_1.mkdirs(); } class Util_tFileOutputLDIF_1 { public void breakString(StringBuilder pw, String value, int max) { int leftToGo = value.length(); int written = 0; int maxChars = max; while (leftToGo > 0) { int toWrite = Math.min(maxChars, leftToGo); String s = value.substring(written, written + toWrite); if (written != 0) { pw.append(" " + s); } else { pw.append(s); maxChars -= 1; } written += toWrite; leftToGo -= toWrite; pw.append('\n'); } } public String getBase64StringOrNot(boolean encodingBase64, String srcData, String encoding) { String returnValue = ""; try { if (encodingBase64 && !netscape.ldap.util.LDIF.isPrintable(srcData.getBytes(encoding))) { returnValue = org.apache.commons.codec.binary.Base64 .encodeBase64String(srcData.getBytes(encoding)); } else { returnValue = srcData; } } catch (java.lang.Exception e) { e.printStackTrace(); } return returnValue; } } Util_tFileOutputLDIF_1 util_tFileOutputLDIF_1 = new Util_tFileOutputLDIF_1(); int nb_line_tFileOutputLDIF_1 = 0; final String dn_tFileOutputLDIF_1 = "dn: "; final String changetype_tFileOutputLDIF_1 = "changetype: "; final int wrap_tFileOutputLDIF_1 = 78; java.io.PrintWriter pw_tFileOutputLDIF_1 = new java.io.PrintWriter(file_tFileOutputLDIF_1, "ISO-8859-15"); if (file_tFileOutputLDIF_1.length() == 0) { pw_tFileOutputLDIF_1.write("version: 1\n"); } /** * [tFileOutputLDIF_1 begin ] stop */ /** * [tFilterRow_1 begin ] start */ ok_Hash.put("tFilterRow_1", false); start_Hash.put("tFilterRow_1", System.currentTimeMillis()); currentComponent = "tFilterRow_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_out_decode_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_out_decode_pw.putIfAbsent("out_decode_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_out_decode_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_out_decode_pw .get("out_decode_pw" + iterateLoop); runStat.updateStatOnConnection("out_decode_pw" + iterateId, stats_out_decode_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFilterRow_1 = 0; int nb_line_tFilterRow_1 = 0; int nb_line_ok_tFilterRow_1 = 0; int nb_line_reject_tFilterRow_1 = 0; class Operator_tFilterRow_1 { private String sErrorMsg = ""; private boolean bMatchFlag = true; private String sUnionFlag = "&&"; public Operator_tFilterRow_1(String unionFlag) { sUnionFlag = unionFlag; bMatchFlag = "||".equals(unionFlag) ? false : true; } public String getErrorMsg() { if (sErrorMsg != null && sErrorMsg.length() > 1) return sErrorMsg.substring(1); else return null; } public boolean getMatchFlag() { return bMatchFlag; } public void matches(boolean partMatched, String reason) { // no need to care about the next judgement if ("||".equals(sUnionFlag) && bMatchFlag) { return; } if (!partMatched) { sErrorMsg += "|" + reason; } if ("||".equals(sUnionFlag)) bMatchFlag = bMatchFlag || partMatched; else bMatchFlag = bMatchFlag && partMatched; } } /** * [tFilterRow_1 begin ] stop */ /** * [tMap_1 begin ] start */ ok_Hash.put("tMap_1", false); start_Hash.put("tMap_1", System.currentTimeMillis()); currentComponent = "tMap_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_decode_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_decode_pw.putIfAbsent("decode_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_decode_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_decode_pw .get("decode_pw" + iterateLoop); runStat.updateStatOnConnection("decode_pw" + iterateId, stats_decode_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tMap_1 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_1__Struct { String var1; String var2; } Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct(); // ############################### // ############################### // # Outputs initialization out_decode_pwStruct out_decode_pw_tmp = new out_decode_pwStruct(); // ############################### /** * [tMap_1 begin ] stop */ /** * [tFileInputLDIF_2 begin ] start */ ok_Hash.put("tFileInputLDIF_2", false); start_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); currentComponent = "tFileInputLDIF_2"; int tos_count_tFileInputLDIF_2 = 0; // ///////////////////////////////// netscape.ldap.util.LDIF ldif_tFileInputLDIF_2 = new netscape.ldap.util.LDIF( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/file3.ldif"); String[] filters_tFileInputLDIF_2 = new String[] { "dn", "objectClass", "cn", "sn", "email", "givenName", "preferredLanguage", "userPassword", "zupId", "userEnabled", "debitorId", }; String[] filters_binary_tFileInputLDIF_2 = new String[] { "dn;binary", "objectClass;binary", "cn;binary", "sn;binary", "email;binary", "givenName;binary", "preferredLanguage;binary", "userPassword;binary", "zupId;binary", "userEnabled;binary", "debitorId;binary", }; String[] results_tFileInputLDIF_2 = null; List<List<byte[]>> resultsBinary_tFileInputLDIF_2 = null; int nb_line_tFileInputLDIF_2 = 0; // ///////////////////////////////// for (netscape.ldap.util.LDIFRecord record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord(); record_tFileInputLDIF_2 != null; record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord()) { results_tFileInputLDIF_2 = new String[11]; resultsBinary_tFileInputLDIF_2 = new java.util.ArrayList<List<byte[]>>(); netscape.ldap.util.LDIFContent content_tFileInputLDIF_2 = record_tFileInputLDIF_2.getContent(); netscape.ldap.LDAPAttribute[] attributes_tFileInputLDIF_2 = null; switch (content_tFileInputLDIF_2.getType()) { case netscape.ldap.util.LDIFContent.ATTRIBUTE_CONTENT: netscape.ldap.util.LDIFAttributeContent attrContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAttributeContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = attrContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.ADD_CONTENT: netscape.ldap.util.LDIFAddContent addContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAddContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = addContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "add"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.MODIFICATION_CONTENT: netscape.ldap.util.LDIFModifyContent modifyContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModifyContent) content_tFileInputLDIF_2; netscape.ldap.LDAPModification[] modifications_tFileInputLDIF_2 = modifyContent_tFileInputLDIF_2 .getModifications(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (netscape.ldap.LDAPModification modification_tFileInputLDIF_2 : modifications_tFileInputLDIF_2) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = modification_tFileInputLDIF_2 .getAttribute(); if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modify"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); boolean firstLoop_tFileInputLDIF_2 = true; for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); if (firstLoop_tFileInputLDIF_2) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + ":" + value_tFileInputLDIF_2; } else { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } firstLoop_tFileInputLDIF_2 = false; } } } } } break; case netscape.ldap.util.LDIFContent.DELETE_CONTENT: // netscape.ldap.util.LDIFDeleteContent // deleteContent_tFileInputLDIF_2 = // (netscape.ldap.util.LDIFDeleteContent) // content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "delete"; } } break; case netscape.ldap.util.LDIFContent.MODDN_CONTENT: netscape.ldap.util.LDIFModDNContent moddnContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModDNContent) content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modrdn"; } else if ("newrdn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getRDN(); } else if ("deleteoldrdn" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = Boolean .toString(moddnContent_tFileInputLDIF_2.getDeleteOldRDN()); } else if ("newsuperior" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getNewParent(); } } break; default: } nb_line_tFileInputLDIF_2++; // for output decode_pw = null; boolean whetherReject_tFileInputLDIF_2 = false; decode_pw = new decode_pwStruct(); try { if (0 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[0] != null) { decode_pw.dn = results_tFileInputLDIF_2[0]; } else { decode_pw.dn = null; } if (1 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[1] != null) { decode_pw.objectClass = results_tFileInputLDIF_2[1]; } else { decode_pw.objectClass = null; } if (2 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[2] != null) { decode_pw.cn = results_tFileInputLDIF_2[2]; } else { decode_pw.cn = null; } if (3 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[3] != null) { decode_pw.sn = results_tFileInputLDIF_2[3]; } else { decode_pw.sn = null; } if (4 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[4] != null) { decode_pw.email = results_tFileInputLDIF_2[4]; } else { decode_pw.email = null; } if (5 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[5] != null) { decode_pw.givenName = results_tFileInputLDIF_2[5]; } else { decode_pw.givenName = null; } if (6 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[6] != null) { decode_pw.preferredLanguage = results_tFileInputLDIF_2[6]; } else { decode_pw.preferredLanguage = null; } if (7 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[7] != null) { decode_pw.userPassword = results_tFileInputLDIF_2[7]; } else { decode_pw.userPassword = null; } if (8 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[8] != null) { decode_pw.zupId = results_tFileInputLDIF_2[8]; } else { decode_pw.zupId = null; } if (9 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[9] != null) { decode_pw.userEnabled = results_tFileInputLDIF_2[9]; } else { decode_pw.userEnabled = null; } if (10 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[10] != null) { decode_pw.debitorId = results_tFileInputLDIF_2[10]; } else { decode_pw.debitorId = null; } } catch (java.lang.Exception e) { whetherReject_tFileInputLDIF_2 = true; System.err.println(e.getMessage()); decode_pw = null; } // ///////////////////////////////// /** * [tFileInputLDIF_2 begin ] stop */ /** * [tFileInputLDIF_2 main ] start */ currentComponent = "tFileInputLDIF_2"; tos_count_tFileInputLDIF_2++; /** * [tFileInputLDIF_2 main ] stop */ // Start of branch "decode_pw" if (decode_pw != null) { /** * [tMap_1 main ] start */ currentComponent = "tMap_1"; // decode_pw // decode_pw if (execStat) { runStat.updateStatOnConnection("decode_pw" + iterateId, 1, 1); } boolean hasCasePrimitiveKeyWithNull_tMap_1 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_1 = false; boolean mainRowRejected_tMap_1 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_1__Struct Var = Var__tMap_1; Var.var1 = java.util.UUID.randomUUID().toString(); Var.var2 = decode_pw.dn.substring(decode_pw.dn.indexOf(","));// ############################### // ############################### // # Output tables out_decode_pw = null; // # Output table : 'out_decode_pw' out_decode_pw_tmp.dn = "uid=" + Var.var1 + Var.var2; out_decode_pw_tmp.objectClass = decode_pw.objectClass; out_decode_pw_tmp.uid = Var.var1; out_decode_pw_tmp.spectos_loginName = decode_pw.cn; out_decode_pw_tmp.cn = decode_pw.cn; out_decode_pw_tmp.sn = decode_pw.sn; out_decode_pw_tmp.spectos_email = decode_pw.email; out_decode_pw_tmp.preferredLanguage = decode_pw.preferredLanguage; out_decode_pw_tmp.userPassword = new String(org.apache.commons.codec.binary.Base64 .encodeBase64(decode_pw.userPassword.getBytes())); out_decode_pw_tmp.zupId = decode_pw.zupId; out_decode_pw_tmp.userEnabled = decode_pw.userEnabled; out_decode_pw_tmp.debitorId = decode_pw.debitorId; out_decode_pw = out_decode_pw_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_1 = false; tos_count_tMap_1++; /** * [tMap_1 main ] stop */ // Start of branch "out_decode_pw" if (out_decode_pw != null) { /** * [tFilterRow_1 main ] start */ currentComponent = "tFilterRow_1"; // out_decode_pw // out_decode_pw if (execStat) { runStat.updateStatOnConnection("out_decode_pw" + iterateId, 1, 1); } row1 = null; Operator_tFilterRow_1 ope_tFilterRow_1 = new Operator_tFilterRow_1("&&"); ope_tFilterRow_1.matches((out_decode_pw.cn.startsWith("049") == true ), "advanced condition failed"); if (ope_tFilterRow_1.getMatchFlag()) { if (row1 == null) { row1 = new row1Struct(); } row1.dn = out_decode_pw.dn; row1.objectClass = out_decode_pw.objectClass; row1.uid = out_decode_pw.uid; row1.spectos_loginName = out_decode_pw.spectos_loginName; row1.cn = out_decode_pw.cn; row1.sn = out_decode_pw.sn; row1.spectos_email = out_decode_pw.spectos_email; row1.preferredLanguage = out_decode_pw.preferredLanguage; row1.userPassword = out_decode_pw.userPassword; row1.zupId = out_decode_pw.zupId; row1.userEnabled = out_decode_pw.userEnabled; row1.debitorId = out_decode_pw.debitorId; nb_line_ok_tFilterRow_1++; } else { nb_line_reject_tFilterRow_1++; } nb_line_tFilterRow_1++; tos_count_tFilterRow_1++; /** * [tFilterRow_1 main ] stop */ // Start of branch "row1" if (row1 != null) { /** * [tFileOutputLDIF_1 main ] start */ currentComponent = "tFileOutputLDIF_1"; // row1 // row1 if (execStat) { runStat.updateStatOnConnection("row1" + iterateId, 1, 1); } // //////////////////////// boolean encodingBase64 = false; StringBuilder sb_tFileOutputLDIF_1 = new StringBuilder(); boolean needSeparator_tFileOutputLDIF_1 = false; boolean canOutput_tFileOutputLDIF_1 = false; boolean isPrintable_tFileOutputLDIF_1 = false; encodingBase64 = false; String value_dn_tFileOutputLDIF_1 = ""; if (row1.dn != null && !("").equals(row1.dn)) { value_dn_tFileOutputLDIF_1 = row1.dn; util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, dn_tFileOutputLDIF_1 + value_dn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } encodingBase64 = false; String value_objectClass_tFileOutputLDIF_1 = ""; if (row1.objectClass != null && !("").equals(row1.objectClass)) { value_objectClass_tFileOutputLDIF_1 = row1.objectClass; String[] values_objectClass_tFileOutputLDIF_1 = value_objectClass_tFileOutputLDIF_1 .split(","); for (String item_tFileOutputLDIF_1 : values_objectClass_tFileOutputLDIF_1) { // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(item_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, // it must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } else { encodingBase64 = false; } // Add ":" to comply with base64 ldif // syntax item_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, item_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "objectClass: " + item_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_uid_tFileOutputLDIF_1 = ""; if (row1.uid != null && !("").equals(row1.uid)) { value_uid_tFileOutputLDIF_1 = row1.uid; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_uid_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_uid_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_uid_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "uid: " + value_uid_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_spectos_loginName_tFileOutputLDIF_1 = ""; if (row1.spectos_loginName != null && !("").equals(row1.spectos_loginName)) { value_spectos_loginName_tFileOutputLDIF_1 = row1.spectos_loginName; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_spectos_loginName_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_spectos_loginName_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_spectos_loginName_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "spectos_loginName: " + value_spectos_loginName_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_cn_tFileOutputLDIF_1 = ""; if (row1.cn != null && !("").equals(row1.cn)) { value_cn_tFileOutputLDIF_1 = row1.cn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_cn_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_cn_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_cn_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "cn: " + value_cn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_sn_tFileOutputLDIF_1 = ""; if (row1.sn != null && !("").equals(row1.sn)) { value_sn_tFileOutputLDIF_1 = row1.sn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_sn_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_sn_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_sn_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "sn: " + value_sn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_spectos_email_tFileOutputLDIF_1 = ""; if (row1.spectos_email != null && !("").equals(row1.spectos_email)) { value_spectos_email_tFileOutputLDIF_1 = row1.spectos_email; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_spectos_email_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_spectos_email_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_spectos_email_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "spectos_email: " + value_spectos_email_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_preferredLanguage_tFileOutputLDIF_1 = ""; if (row1.preferredLanguage != null && !("").equals(row1.preferredLanguage)) { value_preferredLanguage_tFileOutputLDIF_1 = row1.preferredLanguage; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_preferredLanguage_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_preferredLanguage_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_preferredLanguage_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "preferredLanguage: " + value_preferredLanguage_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_userPassword_tFileOutputLDIF_1 = ""; if (row1.userPassword != null && !("").equals(row1.userPassword)) { value_userPassword_tFileOutputLDIF_1 = row1.userPassword; // Convert binary or Base64 value to Base64 // encoded string encodingBase64 = true; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_userPassword_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // Add ":" to comply with base64 ldif syntax value_userPassword_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_userPassword_tFileOutputLDIF_1, "ISO-8859-15"); if (!isPrintable_tFileOutputLDIF_1) { util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "userPassword:: " + value_userPassword_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } else { util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "userPassword: " + value_userPassword_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_zupId_tFileOutputLDIF_1 = ""; if (row1.zupId != null && !("").equals(row1.zupId)) { value_zupId_tFileOutputLDIF_1 = row1.zupId; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_zupId_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_zupId_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_zupId_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "zupId: " + value_zupId_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_userEnabled_tFileOutputLDIF_1 = ""; if (row1.userEnabled != null && !("").equals(row1.userEnabled)) { value_userEnabled_tFileOutputLDIF_1 = row1.userEnabled; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_userEnabled_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_userEnabled_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_userEnabled_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "userEnabled: " + value_userEnabled_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_debitorId_tFileOutputLDIF_1 = ""; if (row1.debitorId != null && !("").equals(row1.debitorId)) { value_debitorId_tFileOutputLDIF_1 = row1.debitorId; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_debitorId_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_debitorId_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_debitorId_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "debitorId: " + value_debitorId_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } sb_tFileOutputLDIF_1.append('\n'); if (canOutput_tFileOutputLDIF_1) { pw_tFileOutputLDIF_1.write(sb_tFileOutputLDIF_1.toString()); nb_line_tFileOutputLDIF_1++; } // //////////////////////// tos_count_tFileOutputLDIF_1++; /** * [tFileOutputLDIF_1 main ] stop */ } // End of branch "row1" } // End of branch "out_decode_pw" } // End of branch "decode_pw" /** * [tFileInputLDIF_2 end ] start */ currentComponent = "tFileInputLDIF_2"; } globalMap.put("tFileInputLDIF_2_NB_LINE", nb_line_tFileInputLDIF_2); ok_Hash.put("tFileInputLDIF_2", true); end_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); /** * [tFileInputLDIF_2 end ] stop */ /** * [tMap_1 end ] start */ currentComponent = "tMap_1"; // ############################### // # Lookup hashes releasing // ############################### if (execStat) { runStat.updateStatOnConnection("decode_pw" + iterateId, 2, 0); } ok_Hash.put("tMap_1", true); end_Hash.put("tMap_1", System.currentTimeMillis()); /** * [tMap_1 end ] stop */ /** * [tFilterRow_1 end ] start */ currentComponent = "tFilterRow_1"; globalMap.put("tFilterRow_1_NB_LINE", nb_line_tFilterRow_1); globalMap.put("tFilterRow_1_NB_LINE_OK", nb_line_ok_tFilterRow_1); globalMap.put("tFilterRow_1_NB_LINE_REJECT", nb_line_reject_tFilterRow_1); if (execStat) { runStat.updateStatOnConnection("out_decode_pw" + iterateId, 2, 0); } ok_Hash.put("tFilterRow_1", true); end_Hash.put("tFilterRow_1", System.currentTimeMillis()); /** * [tFilterRow_1 end ] stop */ /** * [tFileOutputLDIF_1 end ] start */ currentComponent = "tFileOutputLDIF_1"; pw_tFileOutputLDIF_1.flush(); pw_tFileOutputLDIF_1.close(); globalMap.put("tFileOutputLDIF_1_NB_LINE", nb_line_tFileOutputLDIF_1); if (execStat) { runStat.updateStatOnConnection("row1" + iterateId, 2, 0); } ok_Hash.put("tFileOutputLDIF_1", true); end_Hash.put("tFileOutputLDIF_1", System.currentTimeMillis()); /** * [tFileOutputLDIF_1 end ] stop */ } // end the resume } catch (java.lang.Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { runStat.stopThreadStat(); throw new java.lang.Error(error); } globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 1); }
From source file:sqs_dwh.get_origin_password_0_1.get_origin_password.java
public void tFileInputLDIF_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {/* www . ja v a 2 s .c om*/ String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; get_origin_pwStruct get_origin_pw = new get_origin_pwStruct(); output_origin_pwStruct output_origin_pw = new output_origin_pwStruct(); outputStruct output = new outputStruct(); /** * [tFileOutputLDIF_2 begin ] start */ ok_Hash.put("tFileOutputLDIF_2", false); start_Hash.put("tFileOutputLDIF_2", System.currentTimeMillis()); currentComponent = "tFileOutputLDIF_2"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_output = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_output.putIfAbsent("output" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_output = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_output .get("output" + iterateLoop); runStat.updateStatOnConnection("output" + iterateId, stats_output.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFileOutputLDIF_2 = 0; java.io.File file_tFileOutputLDIF_2 = new java.io.File( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/scout_after_get_original_pw.ldif"); // create directory only if not exists java.io.File parentFile_tFileOutputLDIF_2 = file_tFileOutputLDIF_2.getParentFile(); if (parentFile_tFileOutputLDIF_2 != null && !parentFile_tFileOutputLDIF_2.exists()) { parentFile_tFileOutputLDIF_2.mkdirs(); } class Util_tFileOutputLDIF_2 { public void breakString(StringBuilder pw, String value, int max) { int leftToGo = value.length(); int written = 0; int maxChars = max; while (leftToGo > 0) { int toWrite = Math.min(maxChars, leftToGo); String s = value.substring(written, written + toWrite); if (written != 0) { pw.append(" " + s); } else { pw.append(s); maxChars -= 1; } written += toWrite; leftToGo -= toWrite; pw.append('\n'); } } public String getBase64StringOrNot(boolean encodingBase64, String srcData, String encoding) { String returnValue = ""; try { if (encodingBase64 && !netscape.ldap.util.LDIF.isPrintable(srcData.getBytes(encoding))) { returnValue = org.apache.commons.codec.binary.Base64 .encodeBase64String(srcData.getBytes(encoding)); } else { returnValue = srcData; } } catch (java.lang.Exception e) { e.printStackTrace(); } return returnValue; } } Util_tFileOutputLDIF_2 util_tFileOutputLDIF_2 = new Util_tFileOutputLDIF_2(); int nb_line_tFileOutputLDIF_2 = 0; final String dn_tFileOutputLDIF_2 = "dn: "; final String changetype_tFileOutputLDIF_2 = "changetype: "; final int wrap_tFileOutputLDIF_2 = 78; java.io.PrintWriter pw_tFileOutputLDIF_2 = new java.io.PrintWriter(file_tFileOutputLDIF_2, "ISO-8859-15"); if (file_tFileOutputLDIF_2.length() == 0) { pw_tFileOutputLDIF_2.write("version: 1\n"); } /** * [tFileOutputLDIF_2 begin ] stop */ /** * [tMap_2 begin ] start */ ok_Hash.put("tMap_2", false); start_Hash.put("tMap_2", System.currentTimeMillis()); currentComponent = "tMap_2"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_output_origin_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_output_origin_pw.putIfAbsent("output_origin_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_output_origin_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_output_origin_pw .get("output_origin_pw" + iterateLoop); runStat.updateStatOnConnection("output_origin_pw" + iterateId, stats_output_origin_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tMap_2 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_2__Struct { } Var__tMap_2__Struct Var__tMap_2 = new Var__tMap_2__Struct(); // ############################### // ############################### // # Outputs initialization outputStruct output_tmp = new outputStruct(); // ############################### /** * [tMap_2 begin ] stop */ /** * [tJavaRow_1 begin ] start */ ok_Hash.put("tJavaRow_1", false); start_Hash.put("tJavaRow_1", System.currentTimeMillis()); currentComponent = "tJavaRow_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_get_origin_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_get_origin_pw.putIfAbsent("get_origin_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_get_origin_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_get_origin_pw .get("get_origin_pw" + iterateLoop); runStat.updateStatOnConnection("get_origin_pw" + iterateId, stats_get_origin_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tJavaRow_1 = 0; int nb_line_tJavaRow_1 = 0; /** * [tJavaRow_1 begin ] stop */ /** * [tFileInputLDIF_2 begin ] start */ ok_Hash.put("tFileInputLDIF_2", false); start_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); currentComponent = "tFileInputLDIF_2"; int tos_count_tFileInputLDIF_2 = 0; // ///////////////////////////////// netscape.ldap.util.LDIF ldif_tFileInputLDIF_2 = new netscape.ldap.util.LDIF( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/scout_after_decode.ldif"); String[] filters_tFileInputLDIF_2 = new String[] { "dn", "objectClass", "cn", "sn", "email", "givenName", "preferredLanguage", "userPassword", "zupId", "userEnabled", "debitorId", }; String[] filters_binary_tFileInputLDIF_2 = new String[] { "dn;binary", "objectClass;binary", "cn;binary", "sn;binary", "email;binary", "givenName;binary", "preferredLanguage;binary", "userPassword;binary", "zupId;binary", "userEnabled;binary", "debitorId;binary", }; String[] results_tFileInputLDIF_2 = null; List<List<byte[]>> resultsBinary_tFileInputLDIF_2 = null; int nb_line_tFileInputLDIF_2 = 0; // ///////////////////////////////// for (netscape.ldap.util.LDIFRecord record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord(); record_tFileInputLDIF_2 != null; record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord()) { results_tFileInputLDIF_2 = new String[11]; resultsBinary_tFileInputLDIF_2 = new java.util.ArrayList<List<byte[]>>(); netscape.ldap.util.LDIFContent content_tFileInputLDIF_2 = record_tFileInputLDIF_2.getContent(); netscape.ldap.LDAPAttribute[] attributes_tFileInputLDIF_2 = null; switch (content_tFileInputLDIF_2.getType()) { case netscape.ldap.util.LDIFContent.ATTRIBUTE_CONTENT: netscape.ldap.util.LDIFAttributeContent attrContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAttributeContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = attrContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.ADD_CONTENT: netscape.ldap.util.LDIFAddContent addContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAddContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = addContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "add"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.MODIFICATION_CONTENT: netscape.ldap.util.LDIFModifyContent modifyContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModifyContent) content_tFileInputLDIF_2; netscape.ldap.LDAPModification[] modifications_tFileInputLDIF_2 = modifyContent_tFileInputLDIF_2 .getModifications(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (netscape.ldap.LDAPModification modification_tFileInputLDIF_2 : modifications_tFileInputLDIF_2) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = modification_tFileInputLDIF_2 .getAttribute(); if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modify"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); boolean firstLoop_tFileInputLDIF_2 = true; for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); if (firstLoop_tFileInputLDIF_2) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + ":" + value_tFileInputLDIF_2; } else { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } firstLoop_tFileInputLDIF_2 = false; } } } } } break; case netscape.ldap.util.LDIFContent.DELETE_CONTENT: // netscape.ldap.util.LDIFDeleteContent // deleteContent_tFileInputLDIF_2 = // (netscape.ldap.util.LDIFDeleteContent) // content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "delete"; } } break; case netscape.ldap.util.LDIFContent.MODDN_CONTENT: netscape.ldap.util.LDIFModDNContent moddnContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModDNContent) content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modrdn"; } else if ("newrdn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getRDN(); } else if ("deleteoldrdn" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = Boolean .toString(moddnContent_tFileInputLDIF_2.getDeleteOldRDN()); } else if ("newsuperior" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getNewParent(); } } break; default: } nb_line_tFileInputLDIF_2++; // for output get_origin_pw = null; boolean whetherReject_tFileInputLDIF_2 = false; get_origin_pw = new get_origin_pwStruct(); try { if (0 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[0] != null) { get_origin_pw.dn = results_tFileInputLDIF_2[0]; } else { get_origin_pw.dn = null; } if (1 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[1] != null) { get_origin_pw.objectClass = results_tFileInputLDIF_2[1]; } else { get_origin_pw.objectClass = null; } if (2 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[2] != null) { get_origin_pw.cn = results_tFileInputLDIF_2[2]; } else { get_origin_pw.cn = null; } if (3 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[3] != null) { get_origin_pw.sn = results_tFileInputLDIF_2[3]; } else { get_origin_pw.sn = null; } if (4 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[4] != null) { get_origin_pw.email = results_tFileInputLDIF_2[4]; } else { get_origin_pw.email = null; } if (5 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[5] != null) { get_origin_pw.givenName = results_tFileInputLDIF_2[5]; } else { get_origin_pw.givenName = null; } if (6 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[6] != null) { get_origin_pw.preferredLanguage = results_tFileInputLDIF_2[6]; } else { get_origin_pw.preferredLanguage = null; } if (7 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[7] != null) { get_origin_pw.userPassword = results_tFileInputLDIF_2[7]; } else { get_origin_pw.userPassword = null; } if (8 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[8] != null) { get_origin_pw.zupId = results_tFileInputLDIF_2[8]; } else { get_origin_pw.zupId = null; } if (9 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[9] != null) { get_origin_pw.userEnabled = results_tFileInputLDIF_2[9]; } else { get_origin_pw.userEnabled = null; } if (10 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[10] != null) { get_origin_pw.debitorId = results_tFileInputLDIF_2[10]; } else { get_origin_pw.debitorId = null; } } catch (java.lang.Exception e) { whetherReject_tFileInputLDIF_2 = true; System.err.println(e.getMessage()); get_origin_pw = null; } // ///////////////////////////////// /** * [tFileInputLDIF_2 begin ] stop */ /** * [tFileInputLDIF_2 main ] start */ currentComponent = "tFileInputLDIF_2"; tos_count_tFileInputLDIF_2++; /** * [tFileInputLDIF_2 main ] stop */ // Start of branch "get_origin_pw" if (get_origin_pw != null) { /** * [tJavaRow_1 main ] start */ currentComponent = "tJavaRow_1"; // get_origin_pw // get_origin_pw if (execStat) { runStat.updateStatOnConnection("get_origin_pw" + iterateId, 1, 1); } routines.MD5Service tMD5Service = new routines.MD5Service(); // System.out.println("Store_id =" + // get_origin_pw.userPassword); // System.out.println("value =" + // tMD5Service.getStringfromMD5(get_origin_pw.userPassword)); String sValue = tMD5Service.getStringfromMD5(get_origin_pw.userPassword); String sValue1 = "tnt123456"; if (sValue.indexOf("<error>") > 0) { sValue1 = "tnt123456"; } else { sValue1 = sValue.substring(sValue.indexOf("<string><![CDATA[") + 17, sValue.indexOf("]]></string>")); } sValue = sValue.trim(); if (sValue1 == "") sValue1 = "tnt123456"; output_origin_pw.dn = get_origin_pw.dn; output_origin_pw.objectClass = get_origin_pw.objectClass; output_origin_pw.cn = get_origin_pw.cn; output_origin_pw.sn = get_origin_pw.sn; output_origin_pw.email = get_origin_pw.email; output_origin_pw.givenName = get_origin_pw.givenName; output_origin_pw.preferredLanguage = get_origin_pw.preferredLanguage; output_origin_pw.userPassword = sValue1; output_origin_pw.zupId = get_origin_pw.zupId; output_origin_pw.userEnabled = get_origin_pw.userEnabled; output_origin_pw.debitorId = get_origin_pw.debitorId; // System.out.println("sValue =" + // get_origin_pw.userPassword + " *** sValue1: " + // sValue1); /* * * String longtitude = * tDirectionService.getLongitude(row1.street + ", " + * row1.city + ", Germany"); * * row2.longtitude = longtitude; * * String latitude = * tDirectionService.getLatitude(row1.street + ", " + * row1.city + ", Germany"); * * row2.latitude = latitude; row2.store_id = * row1.store_id; */ nb_line_tJavaRow_1++; tos_count_tJavaRow_1++; /** * [tJavaRow_1 main ] stop */ /** * [tMap_2 main ] start */ currentComponent = "tMap_2"; // output_origin_pw // output_origin_pw if (execStat) { runStat.updateStatOnConnection("output_origin_pw" + iterateId, 1, 1); } boolean hasCasePrimitiveKeyWithNull_tMap_2 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_2 = false; boolean mainRowRejected_tMap_2 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_2__Struct Var = Var__tMap_2;// ############################### // ############################### // # Output tables output = null; // # Output table : 'output' output_tmp.dn = output_origin_pw.dn; output_tmp.objectClass = output_origin_pw.objectClass; output_tmp.cn = output_origin_pw.cn; output_tmp.sn = output_origin_pw.sn; output_tmp.email = output_origin_pw.email; output_tmp.givenName = output_origin_pw.givenName; output_tmp.preferredLanguage = output_origin_pw.preferredLanguage; output_tmp.userPassword = output_origin_pw.userPassword; output_tmp.zupId = output_origin_pw.zupId; output_tmp.userEnabled = output_origin_pw.userEnabled; output_tmp.debitorId = output_origin_pw.debitorId; output = output_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_2 = false; tos_count_tMap_2++; /** * [tMap_2 main ] stop */ // Start of branch "output" if (output != null) { /** * [tFileOutputLDIF_2 main ] start */ currentComponent = "tFileOutputLDIF_2"; // output // output if (execStat) { runStat.updateStatOnConnection("output" + iterateId, 1, 1); } // //////////////////////// boolean encodingBase64 = false; StringBuilder sb_tFileOutputLDIF_2 = new StringBuilder(); boolean needSeparator_tFileOutputLDIF_2 = false; boolean canOutput_tFileOutputLDIF_2 = false; boolean isPrintable_tFileOutputLDIF_2 = false; encodingBase64 = false; String value_dn_tFileOutputLDIF_2 = ""; if (output.dn != null && !("").equals(output.dn)) { value_dn_tFileOutputLDIF_2 = output.dn; util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, dn_tFileOutputLDIF_2 + value_dn_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); } encodingBase64 = false; String value_objectClass_tFileOutputLDIF_2 = ""; if (output.objectClass != null && !("").equals(output.objectClass)) { value_objectClass_tFileOutputLDIF_2 = output.objectClass; String[] values_objectClass_tFileOutputLDIF_2 = value_objectClass_tFileOutputLDIF_2 .split(","); for (String item_tFileOutputLDIF_2 : values_objectClass_tFileOutputLDIF_2) { // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(item_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } else { encodingBase64 = false; } // Add ":" to comply with base64 ldif syntax item_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, item_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "objectClass: " + item_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); } canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_cn_tFileOutputLDIF_2 = ""; if (output.cn != null && !("").equals(output.cn)) { value_cn_tFileOutputLDIF_2 = output.cn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_cn_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_cn_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_cn_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "cn: " + value_cn_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_sn_tFileOutputLDIF_2 = ""; if (output.sn != null && !("").equals(output.sn)) { value_sn_tFileOutputLDIF_2 = output.sn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_sn_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_sn_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_sn_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "sn: " + value_sn_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_email_tFileOutputLDIF_2 = ""; if (output.email != null && !("").equals(output.email)) { value_email_tFileOutputLDIF_2 = output.email; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_email_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_email_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_email_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "email: " + value_email_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_givenName_tFileOutputLDIF_2 = ""; if (output.givenName != null && !("").equals(output.givenName)) { value_givenName_tFileOutputLDIF_2 = output.givenName; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_givenName_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_givenName_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_givenName_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "givenName: " + value_givenName_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_preferredLanguage_tFileOutputLDIF_2 = ""; if (output.preferredLanguage != null && !("").equals(output.preferredLanguage)) { value_preferredLanguage_tFileOutputLDIF_2 = output.preferredLanguage; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF.isPrintable( value_preferredLanguage_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_preferredLanguage_tFileOutputLDIF_2 = util_tFileOutputLDIF_2 .getBase64StringOrNot(encodingBase64, value_preferredLanguage_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "preferredLanguage: " + value_preferredLanguage_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_userPassword_tFileOutputLDIF_2 = ""; if (output.userPassword != null && !("").equals(output.userPassword)) { value_userPassword_tFileOutputLDIF_2 = output.userPassword; // Convert binary or Base64 value to Base64 // encoded string encodingBase64 = true; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_userPassword_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // Add ":" to comply with base64 ldif syntax value_userPassword_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_userPassword_tFileOutputLDIF_2, "ISO-8859-15"); if (!isPrintable_tFileOutputLDIF_2) { util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "userPassword:: " + value_userPassword_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); } else { util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "userPassword: " + value_userPassword_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); } canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_zupId_tFileOutputLDIF_2 = ""; if (output.zupId != null && !("").equals(output.zupId)) { value_zupId_tFileOutputLDIF_2 = output.zupId; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_zupId_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_zupId_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_zupId_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "zupId: " + value_zupId_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_userEnabled_tFileOutputLDIF_2 = ""; if (output.userEnabled != null && !("").equals(output.userEnabled)) { value_userEnabled_tFileOutputLDIF_2 = output.userEnabled; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_userEnabled_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_userEnabled_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_userEnabled_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "userEnabled: " + value_userEnabled_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_debitorId_tFileOutputLDIF_2 = ""; if (output.debitorId != null && !("").equals(output.debitorId)) { value_debitorId_tFileOutputLDIF_2 = output.debitorId; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_debitorId_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_debitorId_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_debitorId_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "debitorId: " + value_debitorId_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } sb_tFileOutputLDIF_2.append('\n'); if (canOutput_tFileOutputLDIF_2) { pw_tFileOutputLDIF_2.write(sb_tFileOutputLDIF_2.toString()); nb_line_tFileOutputLDIF_2++; } // //////////////////////// tos_count_tFileOutputLDIF_2++; /** * [tFileOutputLDIF_2 main ] stop */ } // End of branch "output" } // End of branch "get_origin_pw" /** * [tFileInputLDIF_2 end ] start */ currentComponent = "tFileInputLDIF_2"; } globalMap.put("tFileInputLDIF_2_NB_LINE", nb_line_tFileInputLDIF_2); ok_Hash.put("tFileInputLDIF_2", true); end_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); /** * [tFileInputLDIF_2 end ] stop */ /** * [tJavaRow_1 end ] start */ currentComponent = "tJavaRow_1"; globalMap.put("tJavaRow_1_NB_LINE", nb_line_tJavaRow_1); if (execStat) { runStat.updateStatOnConnection("get_origin_pw" + iterateId, 2, 0); } ok_Hash.put("tJavaRow_1", true); end_Hash.put("tJavaRow_1", System.currentTimeMillis()); if (execStat) { runStat.updateStatOnConnection("OnComponentOk2", 0, "ok"); } tLibraryLoad_1Process(globalMap); if (execStat) { runStat.updateStatOnConnection("OnComponentOk3", 0, "ok"); } tLibraryLoad_2Process(globalMap); if (execStat) { runStat.updateStatOnConnection("OnComponentOk4", 0, "ok"); } tLibraryLoad_3Process(globalMap); if (execStat) { runStat.updateStatOnConnection("OnComponentOk5", 0, "ok"); } tLibraryLoad_4Process(globalMap); /** * [tJavaRow_1 end ] stop */ /** * [tMap_2 end ] start */ currentComponent = "tMap_2"; // ############################### // # Lookup hashes releasing // ############################### if (execStat) { runStat.updateStatOnConnection("output_origin_pw" + iterateId, 2, 0); } ok_Hash.put("tMap_2", true); end_Hash.put("tMap_2", System.currentTimeMillis()); /** * [tMap_2 end ] stop */ /** * [tFileOutputLDIF_2 end ] start */ currentComponent = "tFileOutputLDIF_2"; pw_tFileOutputLDIF_2.flush(); pw_tFileOutputLDIF_2.close(); globalMap.put("tFileOutputLDIF_2_NB_LINE", nb_line_tFileOutputLDIF_2); if (execStat) { runStat.updateStatOnConnection("output" + iterateId, 2, 0); } ok_Hash.put("tFileOutputLDIF_2", true); end_Hash.put("tFileOutputLDIF_2", System.currentTimeMillis()); /** * [tFileOutputLDIF_2 end ] stop */ } // end the resume } catch (java.lang.Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { runStat.stopThreadStat(); throw new java.lang.Error(error); } globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 1); }