Hi Samisa,

On Thu, Oct 11, 2012 at 3:16 PM, Samisa Abeysinghe <sam...@wso2.com> wrote:

> This is kind of what I was looking for. However I need something more on
> top of this.
>
> I need to be able to pop us a dialog (JS), get a value and use that as a
> parameter to this service call.
>
We do not have this capability for check-item clicks. Only static
parameters(that are configured from the lifecycle configuration) can be
passed to validations classes.

>
> 1. Can I use transitionScripts to do the dialog po-up part?
>
Yes. But this UI will be showed when you try to do a transition and not a
check-item click.

2. How do I pass the captured param to service call?
>

>From the JS, you can send a request to the invoke_aspect_ajaxprocessor.jsp
with the following parameters. Example code can be found in [1](function
invokeAspect).

new Ajax.Request('../lifecycles/invoke_aspect_ajaxprocessor.jsp',
        {
            method : 'post',
            parameters : {
                path : path,
                aspect : aspect,
                action : action,
                items : itemsGlobal,
                parameterString : parameterString

})

The parameter string is constructed in the following manner .

obj.name + "^^" + obj.value + "^|^" + obj.name + "^^" + obj.value + "^|^";


In the BE class(executor implementation) these parameters are sent in the
requestContext, as properties. You can read these properties and get the
required parameters. We have such method in [2].

    public static boolean populateParameterMap(RequestContext
requestContext, Map<String, String> currentParameterMap) {
        Set parameterMapKeySet = (Set)
requestContext.getProperty("parameterNames");
        if (parameterMapKeySet == null) {
            log.warn("No parameters where found");
            return true;
        }
        for (Object entry : parameterMapKeySet) {
            String key = (String) entry;
            if (!key.equals("preserveOriginal")) {
                currentParameterMap.put(key, (String)
requestContext.getProperty(key));
            }
        }
        return true;

}

> 3. Do we have a sample?
>

[3] refer to the default transition UI that we ship with G-Reg.
[4] refer to one of the executors(CopyExecutor) we ship with G-Reg.


Eranda,

Did we add any samples related to these use cases?

Thanks,
Janaka

[1]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/governance/org.wso2.carbon.governance.custom.lifecycles.checklist.ui/4.0.1/src/main/resources/web/lifecycles/js/lifecycles.js

[2]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/governance/org.wso2.carbon.governance.registry.extensions/4.0.2/src/org/wso2/carbon/governance/registry/extensions/executors/utils/Utils.java

[3]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/governance/org.wso2.carbon.governance.custom.lifecycles.checklist.ui/4.0.1/src/main/resources/web/lifecycles/pre_invoke_aspect_ajaxprocessor.jsp

[4]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/governance/org.wso2.carbon.governance.registry.extensions/4.0.2/src/org/wso2/carbon/governance/registry/extensions/executors/CopyExecutor.java


> On Thu, Oct 11, 2012 at 10:15 AM, Janaka Ranabahu <jan...@wso2.com> wrote:
>
>> Hi Samisa,
>>
>> On Thu, Oct 11, 2012 at 9:49 AM, Samisa Abeysinghe <sam...@wso2.com>wrote:
>>
>>> I want to do, say, some service calls, when someone ticks a ckecklist
>>> item on an LC state.
>>
>> Does this call should happen as a post check-item click action or a pre
>> check-item click action.
>>
>>>
>>> Is that possible? If so how?
>>>
>> This is possible as a pre check-item click action. We can define a
>> validation class for check-item clicks and these classes are pluggable.
>> Validation classes can be configured from the lifecycle configuration.
>>
>> <item name="" forEvent="">*<!-- the check item element -->*
>>     <validations>
>>         <validation forEvent="" class="">
>>             *<!--forEvent - defines the event that the custom validation
>> should be done*
>> *class - defines the full qualified name of the custom validations class
>> -->*
>>             <parameter name="" value=""/>
>>             *<!--name - defines the custom parameter name*
>> *      value - defines the custom parameter value-->*
>>         </validation>
>>     </validations>
>> </item>
>>
>> And as a validation, we can do a service call or some other
>> functionality. Validations are similar to transition executors and there is
>> an interface that you need to implement. More information about validations
>> can be found in our docs[1]. Also there are a set of standard validators
>> that we ship with the distribution[2].
>>
>> If it is not possible, can we add that functionality?
>>>
>>> The use case is, it is required to make the tick real, for e.g. if the
>>> tick is about - did you report time, if reporting time itself is attached
>>> to the tick, it is more practical. If not, people will pre-tic with the
>>> post action intent, and in reality the action associated with the tick
>>> would not really happen.
>>>
>>
>> I believe validations are the solution for this problem. If the
>> validation fails, the check-item click will not happen.
>>
>> Thanks,
>> Janaka
>>
>> [1]
>> http://docs.wso2.org/wiki/display/Governance450/Configuring+Lifecycles
>> [2]
>> http://docs.wso2.org/wiki/display/Governance450/Supported+Standard+Validators
>>
>>>  Thanks,
>>> Samisa...
>>>
>>> Samisa Abeysinghe
>>> VP Engineering
>>> WSO2 Inc.
>>> http://wso2.com
>>> http://wso2.org
>>>
>>>
>>
>>
>> --
>> Janaka Ranabahu
>> Software Engineer
>> WSO2 Inc.
>>
>> Mobile +94 718370861
>> Email : jan...@wso2.com
>> Blog : janakaranabahu.blogspot.com
>>
>>  Thanks,
> Samisa...
>
> Samisa Abeysinghe
> VP Engineering
> WSO2 Inc.
> http://wso2.com
> http://wso2.org
>
>
>


-- 
Janaka Ranabahu
Software Engineer
WSO2 Inc.

Mobile +94 718370861
Email : jan...@wso2.com
Blog : janakaranabahu.blogspot.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to