For both 1. and 2. the spec defines association transformation. For example you want to associate process variable x.someParameter to your task data input xIn:
<bpmn2:dataInputAssociation id="_ta2cskLFEeGV7InrpvHmpg">
<bpmn2:sourceRef>x</bpmn2:sourceRef>
<bpmn2:targetRef>_815293A1-6C79-403F-A469-55DD5991F788_xInInput</bpmn2:targetRef>
<bpmn2:transformation xsi:type="bpmn2:tFormalExpression" id="_ta2cs0LFEeGV7InrpvHmpg">x.someParameter</bpmn2:transformation>
</bpmn2:dataInputAssociation>
Even tho you can specify these type of transformations in the jBPM Web Designer easily (in the assignment portion for example you would do "x.someParameter->xIn", you would have to test this in the runtime. Alternatives would be for example to use on-Entry/Exit scripts, script tasks, or if you are using domain-specific nodes you can do any transformation in your executeWorkitem method with plain Java.