Skip to content

Instantly share code, notes, and snippets.

Avatar

Donato dmarrazzo

  • Red Hat
  • Roma, Italia
View GitHub Profile
@dmarrazzo
dmarrazzo / lsspecial.sh
Created Oct 14, 2015
bash regex example
View lsspecial.sh
for i in *; do if [[ $i =~ ^[0-9]{1,2}$ ]]; then echo $i; fi ; done
@dmarrazzo
dmarrazzo / cf.py
Created Mar 16, 2016
estrae data da codice fiscale
View cf.py
# Open a file
fi = open("/home/donato/cf.txt", "r+")
fo = open("/home/donato/date.txt", "w+")
meseCod = "ABCDEHLMPRST"
for cf in fi:
try:
anno = int(cf[6:8])
mese = meseCod.index(cf[8:9]) + 1
giorno = int(cf[9:11])
@dmarrazzo
dmarrazzo / jaxrs-client.java
Created Jul 7, 2016
JAX-RS client get collections
View jaxrs-client.java
Client client = ClientBuilder.newClient();
Response res = client.target("http://localhost:8888/Rest/ok").request().get();
Simple[] entity = res.readEntity(Simple[].class);
@dmarrazzo
dmarrazzo / pom.xml
Created Jul 7, 2016
jax-rs 2.0 pom
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.a2a.poc.bpm</groupId>
<artifactId>RestDataProvider</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>RestDataProvider</name>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
@dmarrazzo
dmarrazzo / Remediation.java
Created Oct 6, 2016
Remediation - launch a dynamic service task
View Remediation.java
testVar = "remed";
kcontext.setVariable("testVar",testVar);
org.jbpm.casemgmt.CaseMgmtService cmService = new org.jbpm.casemgmt.CaseMgmtUtil(kcontext);
java.util.Map<String, Object> workParams = new java.util.HashMap<String, Object>();
workParams.put("Message", testVar);
@dmarrazzo
dmarrazzo / loose-rules.wid
Created Jul 8, 2017
Work Item Handler definition
View loose-rules.wid
import org.drools.core.process.core.datatype.impl.type.StringDataType;
import org.drools.core.process.core.datatype.impl.type.ObjectDataType;
[
[
"name" : "loose-rules",
"description" : "invoke rules from an independent rule project",
"parameters" : [
"kbaseName" : new StringDataType(),
"fact" : new ObjectDataType()
],
@dmarrazzo
dmarrazzo / dmn pom.xml
Created Aug 17, 2017
libraries for DMN execution in Drools
View dmn pom.xml
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
<version>7.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-dmn-core</artifactId>
<version>7.1.0.Final</version>
</dependency>
@dmarrazzo
dmarrazzo / dmn.java
Last active Aug 18, 2017
drools dmn execution
View dmn.java
KieServices kieServices = KieServices.Factory.get();
KieContainer kieContainer = kieServices.getKieClasspathContainer();
DMNRuntime dmnRuntime = kieContainer.newKieSession().getKieRuntime( DMNRuntime.class );
DMNModel dmnModel = dmnRuntime.getModel("http://www.trisotech.com/definitions/_90a17b17-c884-4fa9-ba59-7a47899d89b2", "driving-eligibility");
DMNContext dmnContext = dmnRuntime.newContext();
Map<String, Object> person = new HashMap<>();
person.put("name", "Donato");
person.put("age", 17);
@dmarrazzo
dmarrazzo / kmodule.xml
Last active Aug 18, 2017
Knowledge Deplyment Descriptor
View kmodule.xml
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<kbase name="kbase">
<ksession name="ksession" default="true" />
</kbase>
</kmodule>
@dmarrazzo
dmarrazzo / EnvInfo.java
Created Aug 25, 2017
utility class to load endpoint and wsdl URL from system props
View EnvInfo.java
package utils;
public class EnvInfo {
private static String MOCK = "http://mas460:8088/mockPecManagerWsPortBinding";
public static String wsdl(String name){
return System.getProperty(name+"-wsdl", endpoint(name)+"?WSDL");
}
public static String endpoint(String name){
You can’t perform that action at this time.