Skip to content

Instantly share code, notes, and snippets.

View chumpa's full-sized avatar
🌨️
всем привет

Iliya Kuznetsov chumpa

🌨️
всем привет
View GitHub Profile
@chumpa
chumpa / rsugio-cpi-001-showVersion.groovy
Last active January 31, 2018 18:16
rsugio-cpi-001-showVersion
import com.sap.gateway.ip.core.customdev.util.Message as CpiMsg
import groovy.transform.TypeChecked
import groovy.transform.TypeCheckingMode
/**
* When your IFlow gets running in CPI environment, you are in need of detecting some parameters.
* Here below is the code for system environment reporting.
*
* @author Iliya Kuznetsov <iliya.kuznetsov@gmail.com>
* @version 1.0.1
@chumpa
chumpa / rsugio-cpi-003-scriptApi.groovy
Created January 31, 2018 17:51
rsugio-cpi-003-scriptApi
/**
* Some scriptApi
*
* @author Iliya Kuznetsov <iliya.kuznetsov@gmail.com>
* @version 1.0.1
* @date 2018-01-31
* @see https://github.com/rsugio/cpi/tree/master/rsugio-cpi-003-scriptApi
*/
import com.sap.gateway.ip.core.customdev.util.Message as CpiMsg
@chumpa
chumpa / Rsug002script.groovy
Created February 16, 2018 04:54
SAP CPI SFTP logging
package io.rsug.cpi
/**
* Some logging technics for CPI IFlow
*
* @author Iliya Kuznetsov <iliya.kuznetsov@gmail.com>
* @version 1.0.2
* @date 2018-02-15
* @see https://github.com/rsugio/cpi/tree/master/rsugio-cpi-002-log
*/
@chumpa
chumpa / log.groovy
Last active April 25, 2018 15:45
cpi message processing log attachment conditional output
// More clear version. Note for CpiMsg import alias
import com.sap.gateway.ip.core.customdev.util.Message as CpiMsg
CpiMsg log2(CpiMsg msg) {
def mlog = messageLogFactory.getMessageLog(msg)
String body = msg.getBody(String.class)
String ll = msg.properties.SAP_MessageProcessingLogConfiguration.logLevel.toString() //NONE, INFO, DEBUG, Trace
if (ll in ['DEBUG', 'Trace'])
mlog.addAttachmentAsString(ll, body, 'application/binary')
mlog.addAttachmentAsString('const', body, 'application/binary')
@chumpa
chumpa / urls.groovy
Created July 19, 2018 15:52
java.net.URL compendium
import java.net.URL
@chumpa
chumpa / regex01.groovy
Created August 21, 2018 05:21
groovy regex
String x = "SFOData.FormHeader"
String y = "FormHeader"
List a(String w) {
String namespace="", local=""
(w=~/((?<namespace>\S*)\.)?(?<local>\S+)/).each {
(namespace,local)=it[2..3]
}
namespace ?= ""
[namespace, local]
package io.rsug.sf.sow
import groovy.json.StringEscapeUtils
import com.ibm.icu.text.Transliterator
class Main {
static String createGroovyDecl(String unicode) {
String x = StringEscapeUtils.escapeJava(unicode)
Transliterator toEn = Transliterator.getInstance("Russian-Latin/BGN")
String varname = "c" + toEn.transliterate(unicode)
@chumpa
chumpa / cpi-ds-notes.md
Last active September 18, 2018 16:01
CPI-DS useful functions and tips
@chumpa
chumpa / rsugio-cpi-001-showVersion-tenantInfo.groovy
Created September 20, 2018 12:03
rsugio-cpi-001-showVersion-tenantInfo
import com.sap.gateway.ip.core.customdev.util.Message as CpiMsg
// tenant information
// ilya.kuznetsov@sap.com
CpiMsg r001showVersion_tenantInfo(CpiMsg msg) {
String hn = msg.headers.host
String tenantName = System.properties['com.sap.it.node.tenant.name']
msg.setBody("tenant $tenantName, host $hn" as String)
msg
@chumpa
chumpa / sqlite.md
Created November 9, 2018 12:43
sqlite

Афинность

Есть только: TEXT, NUMERIC, INTEGER, REAL, BLOB