This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected RouteBuilder createRouteBuilder() | |
{ | |
return new SpringRouteBuilder() | |
{ | |
public void configure() | |
{ | |
from("direct:input").to("bean:inputSql").to("jdbc:sourceDataSource").process(new ResultSetProcessor()).split(body()).to( | |
"jpa:com.abc.entity.MyJPAEntity"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class CamelProcessor<T> implements Processor | |
{ | |
protected void process(Exchange exchange, ResultMapper<T> mapper) throws Exception | |
{ | |
try | |
{ | |
ArrayList<T> payloads = new ArrayList<T>(); | |
ArrayList<HashMap<String, Object>> data = exchange.getIn().getBody(ArrayList.class); | |
if (data != null) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ResultSeProcessor extends CamelProcessor<MyJPAEntity> | |
{ | |
public void process(Exchange exchange) throws Exception | |
{ | |
process(exchange, getRowMapper()); | |
} | |
private static ResultMapper<MyJPAEntity> getRowMapper() | |
{ | |
ResultMapper<MyJPAEntity> mapper = new ResultMapper<MyJPAEntity>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chapter 4: Expressions and Simple functions | |
=========================================================================================================================== | |
There are 2 types of expressions. | |
1. def x = 5 | |
2. val x = 5 | |
Here # 1 represens definition and expression is at the right hand side of the = sign. It is not evaluated immediately. | |
Here # 2 represents value expression and its value is evaluated immediately and whenver val is being used; it replaces | |
it with pre-computed value of expression. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"address":{"street":"Oude Ebbingestraat","housenumber":"12","postalcode":"9712 HJ","city":"Groningen","geoLocation":{"lat":"53.219319","lng":"6.56671"}},"distance":0,"type":"ING"},{"address":{"street":"Amsterdamsestraat","housenumber":"9","postalcode":"2587 CN","city":"Den Haag","geoLocation":{"lat":"52.111805","lng":"4.287714"}},"distance":0,"type":"ING"},{"address":{"street":"Oudenoord","housenumber":"1","postalcode":"3513 EG","city":"Utrecht","geoLocation":{"lat":"52.0970886","lng":"5.1133961"}},"distance":0,"type":"ING"},{"address":{"street":"Bloemenoordplein","housenumber":"50","postalcode":"5143 TC","city":"Waalwijk","geoLocation":{"lat":"51.6823433","lng":"5.0782567"}},"distance":0,"type":"ING"},{"address":{"street":"Dorpsstraat","housenumber":"2","postalcode":"2361 BB","city":"Warmond","geoLocation":{"lat":"52.195528","lng":"4.502244"}},"distance":0,"type":"ING"},{"address":{"street":"Waalderstraat","housenumber":"48","postalcode":"1791 EC","city":"Den Burg","geoLocation":{"lat":"53.056402","lng":"4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<speak> All good except 2 escalations. <break time=“1s”/> We had 5 new deployments and have new release coming this Friday</speak> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Set; | |
public class GridQuestion { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package co.in.shoonya.abc.prep.ds.classic.strings; | |
// Given a string of characters (a, b, c,....z), we want to break the string into a maximum number of substrings | |
// in which every character comes in only one substring. We have to return length of all substrings. | |
// Ex 1: Input string = "abcdefgahijklhopqrsot" | |
// Output = [8, 5, 6, 1] | |
// Ex 2: Input string = "abcd" | |
// Output = [1, 1, 1, 1] | |
import java.util.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package co.in.shoonya.abc.kata; | |
public class CdkShoppingCart { | |
public static void main(String[] args) { | |
System.out.println(billAmount(CustomerType.Regular, 15000d)); | |
System.out.println(billAmount(CustomerType.Premium, 20000d)); | |
} | |
private static double billAmount(CustomerType type, double input) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package co.in.shoonya.abc.prep.ds.lists; | |
import co.in.shoonya.abc.prep.ds.lists.ds.ListNode; | |
public class AggregateAtZeroNode { | |
public static void main(String[] args) { | |
ListNode<Integer> l1 = new ListNode<Integer>(1); | |
l1.setNext(new ListNode<Integer>(4)); | |
l1.getNext().setNext(new ListNode<Integer>(0)); |