This file contains 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
class InventorySystem { | |
boolean open(String token) { | |
// open a socket connection to some back-end mainframe system | |
println "opening connection to mainframe, token: ${token}" | |
true | |
} | |
BigDecimal pricingLookup(String clientId, String itemUuid) | |
{ |
This file contains 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
class InventorySystem { | |
boolean open(String token) { | |
// open a socket connection to some back-end mainframe system | |
println "opening connection to mainframe, token: ${token}" | |
true | |
} | |
BigDecimal pricingLookup(String clientId, String itemUuid) | |
{ |
This file contains 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
class AuthenticationProvider { | |
String authenticateUser(String username, String password) { | |
"validToken" | |
} | |
} |
This file contains 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
class InventoryApiConnectionFactory { | |
// these properties would ordinarily be injected | |
def authenticationProvider = new AuthenticationProvider() | |
String username = "username" | |
String password = "password" | |
def logError(String msg) { println msg } // simulated logger | |
def withInventoryConnection(Closure c) { |
This file contains 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
class PricingService { | |
// would be injected | |
InventoryApiConnectionFactory fac = new InventoryApiConnectionFactory() | |
def priceLookup(String clientId, String itemUUID) { | |
fac.withInventoryConnection { connection -> | |
connection.pricingLookup(clientId, itemUUID) | |
} |
This file contains 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
PricingService ps = new PricingService() // probably injected into a controller if this isn't a batch app | |
println ps.priceLookup("client1", "item-11-22-33") |
This file contains 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
class PricingServiceFirstTry { | |
// these dependencies would normally be injected | |
AuthenticationProvider auth = new AuthenticationProvider() | |
InventorySystem inv = new InventorySystem() | |
String username = 'test' | |
String password = 'test' | |
def logError(String msg) { println msg } // simulated logger | |
This file contains 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
INSERT INTO myclobs (data, date_created) VALUES('<attrs><attr name="name"><string>Barney</string></attr></attrs>', | |
SYSDATE); | |
UPDATE myclobs m SET data=UPDATEXML( | |
XMLTYPE.createXML(data),'/attrs/attr[@name="name"]/string /text()','Gumble').getClobVal() | |
WHERE m.id=26; |
This file contains 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
update myclobs set data = '{ "changingTheJSON": "Test" }' where id=2 |
This file contains 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
DELETE FROM myclobs where id=21 |
OlderNewer