Hi Susinda,

I'm having some concern on your suggestion.

If you don't want to list the REJECTED/BLOCKED APIs under My Subscription
Page, In Current APIM, there are no way a subscriber get to know
the REJECTED/BLOCKED subscriptions. So the REJECTED/BLOCKED subscription
will be listed in the My Subscription Page with the state of Subscription
Notified on the top corner.


My Subscription Page is common place to show the status of API Subscription
where an API was REJECTED/BLOCKED by a workflow OR by the publisher of the
API.

As a alternate solution, when an API subscription was blocked by a workflow
at the moment of subscription, API Manager should not persist this
subscription entry and just notify user about the subscription was
REJECTED/BLOCKED.

And the subscriptions blocked by the publisher will be shown in My
Subscription Page as earlier with a notification on top corner.

Please provide feedback on this.





On Wed, Nov 19, 2014 at 10:15 AM, Abimaran Kugathasan <[email protected]>
wrote:

> Hi Susinda,
>
> We will check and add relavent code to products itself tomorrow. Please
> create a JIRA for this issue.
>
> On Tue, Nov 18, 2014 at 10:10 AM, Susinda Perera <[email protected]> wrote:
>
>> Hi Amila/Sanjewa
>>
>> I have attached my customized code, in api-info.js its starts with "if
>> (result.status == 'REJECTED')*" *and in template.jag its <%
>> if(api.subStatus != "REJECTED") { %>.
>>
>> Thanks
>>
>>
>> On Tue, Nov 18, 2014 at 9:13 AM, Susinda Perera <[email protected]> wrote:
>>
>>> Hi Amila
>>>
>>> Is is good thing do that in UI level, For me it seems like its better to
>>> handle in programme code, i.e not adding that api to app.subscriptions list.
>>>
>>> However i was able to do that in UI as you suggested. I filtered it as
>>> <% if(api.subStatus != "REJECTED") { %>
>>> and place this logic just above the
>>> <div class="thumbnail <% if(api.status == "DEPRECATED" || api.status ==
>>> "RETIRED" || api.status == "BLOCKED" ) { %>deprecated<% } %>"> line
>>>
>>> And it worked fine, but i have some alignment issue, when page refreshes
>>> sometimes it aligns in the middle. Please see the attached image. Can i get
>>> some help to make this alignment problem. And i also would like to get to
>>> know about non ui approach to remove the subscription rejected apis.
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>> On Tue, Nov 18, 2014 at 6:55 AM, Amila De Silva <[email protected]> wrote:
>>>
>>>> Then you have to edit template.jag [1]. You have to check the
>>>> Subscription state and show approved APIs only.
>>>>
>>>>
>>>>
>>>>
>>>> [1] 
>>>> <APIM>/repository/deployment/server/jaggeryapps/store/site/themes/fancy/templates/subscription/subscription-list-element/template.jag
>>>>
>>>> On Tue, Nov 18, 2014 at 6:28 AM, Susinda Perera <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Amila
>>>>>
>>>>> Sorry, what i meant was not that we are subscription page, Its about
>>>>> subscription failed api is listed in MySubscriptions, what i wanted is to
>>>>> not to have that api listed in MySubscription since it failed.
>>>>>
>>>>> On Tue, Nov 18, 2014 at 6:23 AM, Amila De Silva <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi Susinda,
>>>>>> For this you have to edit triggerSubscribe() in api-info.js. That
>>>>>> function redirects the user to Subscription list after creating the
>>>>>> subscription. You can disable that redirection if the Subscription is
>>>>>> rejected.
>>>>>>
>>>>>> On Tue, Nov 18, 2014 at 4:07 AM, Susinda Perera <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> I tried with following code
>>>>>>>
>>>>>>> if (result.error == false) {
>>>>>>>     if (result.status == 'REJECTED') {
>>>>>>>
>>>>>>> $('#messageModal').html($('#confirmation-data').html());
>>>>>>>     $('#messageModal
>>>>>>> h3.modal-title').html(i18n.t('info.subscriptionRejectTitle'));
>>>>>>>     $('#messageModal div.modal-body').html('\n\n' +
>>>>>>> i18n.t('info.subscriptionRejected'));
>>>>>>>     $('#messageModal a.btn-primary').html(i18n.t('info.OK'));
>>>>>>>     $('#messageModal a.btn-primary').click(function() {
>>>>>>>         window.location.reload();
>>>>>>>     });
>>>>>>>             } else {
>>>>>>>
>>>>>>> However when i goes to my subscription page i can see it in inactive
>>>>>>> state. Can we make it not to goto subscription-list if rejected.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Nov 18, 2014 at 3:54 AM, Susinda Perera <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Could have been found a solution with adding "*if (result.status
>>>>>>>> == 'REJECTED')*"
>>>>>>>> at 
>>>>>>>> repository/deployment/server/jaggeryapps/store/site/themes/fancy/templates/api/api-info/js/api-info.js
>>>>>>>> but i dont know weather thats the best place to handle.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Nov 17, 2014 at 9:04 PM, Susinda Perera <[email protected]>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi Amila
>>>>>>>>>
>>>>>>>>> I tried to reject the subscription but it still gives me following
>>>>>>>>> success message
>>>>>>>>> *Congratulations! You have successfully subscribed to the API.
>>>>>>>>> Please go to 'My Subscriptions' page to review your subscription and
>>>>>>>>> generate keys*
>>>>>>>>> This is the code i used, could you please have a look and see why
>>>>>>>>> it is giving above, Do i need to call the super.execute() and
>>>>>>>>> super.complete() methods after setiing the status, i tried that but 
>>>>>>>>> that
>>>>>>>>> does not worked either. Do i need to remove the super methods?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> @Override
>>>>>>>>>     public void execute(WorkflowDTO workflowDTO) throws
>>>>>>>>> WorkflowException{
>>>>>>>>>         SubscriptionWorkflowDTO subsCreationWFDTO =
>>>>>>>>> (SubscriptionWorkflowDTO)workflowDTO;
>>>>>>>>>
>>>>>>>>>         System.out.println("Inside execute method");
>>>>>>>>>         System.out.println("Subscription created for API " +
>>>>>>>>> subsCreationWFDTO.getApiName() +
>>>>>>>>>                 " using Application " +
>>>>>>>>> subsCreationWFDTO.getApplicationName() +
>>>>>>>>>                 " by user " + subsCreationWFDTO.getSubscriber());
>>>>>>>>>
>>>>>>>>>         try {
>>>>>>>>>
>>>>>>>>>             //Call the execute method of the parent class. This
>>>>>>>>> will create a reference for the
>>>>>>>>>             //workflow execution in the database.
>>>>>>>>>             super.execute(workflowDTO);
>>>>>>>>>
>>>>>>>>>             //Set the workflow Status to APPROVED and Immediately
>>>>>>>>> complete the workflow since we
>>>>>>>>>             //are not waiting for an external party to complete
>>>>>>>>> this.
>>>>>>>>>             workflowDTO.setStatus(WorkflowStatus.REJECTED);
>>>>>>>>>             complete(workflowDTO);
>>>>>>>>>
>>>>>>>>>         } catch (Exception e){
>>>>>>>>>             e.printStackTrace();
>>>>>>>>>             throw new WorkflowException(e.getMessage());
>>>>>>>>>         }
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>>     @Override
>>>>>>>>>     public void complete(WorkflowDTO workflowDTO) throws
>>>>>>>>> WorkflowException{
>>>>>>>>>
>>>>>>>>>     System.out.println("inside complete method");
>>>>>>>>>         workflowDTO.setUpdatedTime(System.currentTimeMillis());
>>>>>>>>>         super.complete(workflowDTO);
>>>>>>>>>
>>>>>>>>>         ApiMgtDAO apiMgtDAO = new ApiMgtDAO();
>>>>>>>>>         try {
>>>>>>>>>             apiMgtDAO.updateSubscriptionStatus(
>>>>>>>>>
>>>>>>>>> Integer.parseInt(workflowDTO.getWorkflowReference()),
>>>>>>>>>                     APIConstants.SubscriptionStatus.REJECTED);
>>>>>>>>>         } catch (APIManagementException e) {
>>>>>>>>>             throw new WorkflowException(
>>>>>>>>>                     "Could not complete subscription creation
>>>>>>>>> workflow", e);
>>>>>>>>>         }
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, Nov 16, 2014 at 9:10 AM, Amila De Silva <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Susinda,
>>>>>>>>>> This popup is rendered by the JS in [1]. If you are trying to
>>>>>>>>>> change the message, you have to edit the correct locale file (for en 
>>>>>>>>>> which
>>>>>>>>>> is [2]).
>>>>>>>>>> JS at [1] reads the variable subscriptionSuccess in [2] to get
>>>>>>>>>> the message content.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>> <APIM>/repository/deployment/server/jaggeryapps/store/site/themes/fancy/templates/api/api-info/js/api-info.js
>>>>>>>>>>
>>>>>>>>>> [2] 
>>>>>>>>>> <APIM>/repository/deployment/server/jaggeryapps/store//site/conf/locales/js/i18nResources.json
>>>>>>>>>>
>>>>>>>>>> On Sun, Nov 16, 2014 at 7:45 AM, Susinda Perera <[email protected]
>>>>>>>>>> > wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi Amila/Ruwan
>>>>>>>>>>>
>>>>>>>>>>> I followed above links and were able to do that. I have another
>>>>>>>>>>> thing to clarify. i.e How can we modify the content in popup 
>>>>>>>>>>> message comes
>>>>>>>>>>> after subscription. I want to change the default approve and 
>>>>>>>>>>> rejected
>>>>>>>>>>> messages and give my custom messages? Where should i look for this?
>>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>>
>>>>>>>>>>> On Sat, Nov 15, 2014 at 7:52 AM, Susinda Perera <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Amila
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks alot for the detailed reply and links.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Sat, Nov 15, 2014 at 7:39 AM, Amila De Silva <
>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Susinda,
>>>>>>>>>>>>> Yes, you can hook in a java code.
>>>>>>>>>>>>> You have to extend the WorkflowExecutor class and create your
>>>>>>>>>>>>> custom WorkflowExecutor. When a subscription is created, execute 
>>>>>>>>>>>>> method of
>>>>>>>>>>>>> the WorkflowExecutor will be called, and you can write your 
>>>>>>>>>>>>> custom logic
>>>>>>>>>>>>> inside that method. After running the custom code, you have to 
>>>>>>>>>>>>> set the
>>>>>>>>>>>>> status of the Workflow to Approved, and then update the status of 
>>>>>>>>>>>>> the
>>>>>>>>>>>>> subscription (whether it's allowed or not).
>>>>>>>>>>>>>
>>>>>>>>>>>>> SubscriptionCreationSimpleWorkflowExecutor
>>>>>>>>>>>>> <https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/apimgt/org.wso2.carbon.apimgt.impl/1.2.2/src/main/java/org/wso2/carbon/apimgt/impl/workflow/SubscriptionCreationSimpleWorkflowExecutor.java>,
>>>>>>>>>>>>>  the
>>>>>>>>>>>>> one that is enabled by default, is written in a similar way.
>>>>>>>>>>>>>
>>>>>>>>>>>>> The Workflow implementation to be used, is picked from
>>>>>>>>>>>>> workflow-extensions.xml (in 1.7.0 this is kept in
>>>>>>>>>>>>> gov:apimgt/applicationdata/workflow-extensions.xml) , and you 
>>>>>>>>>>>>> have to edit
>>>>>>>>>>>>> this file providing the correct class name.
>>>>>>>>>>>>>
>>>>>>>>>>>>> You may also find this post useful[1]
>>>>>>>>>>>>>
>>>>>>>>>>>>> [1]
>>>>>>>>>>>>> http://nuwanzone.blogspot.com/2014/01/how-to-write-custom-workflow-extension.html
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Sat, Nov 15, 2014 at 5:25 AM, Susinda Perera <
>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi All
>>>>>>>>>>>>>> Can we hook a java code in this place instead of
>>>>>>>>>>>>>> workflow/human task? Is that recomended
>>>>>>>>>>>>>> If so could someone brief the steps to do that.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> *Susinda Perera*
>>>>>>>>>>>>>> Software Engineer
>>>>>>>>>>>>>> Mobile:(+94)716049075
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>>>>>>>>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> *Amila De Silva*
>>>>>>>>>>>>>
>>>>>>>>>>>>> WSO2 Inc.
>>>>>>>>>>>>> mobile :(+94) 775119302
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> *Susinda Perera*
>>>>>>>>>>>> Software Engineer
>>>>>>>>>>>> Mobile:(+94)716049075
>>>>>>>>>>>>
>>>>>>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>>>>>>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> *Susinda Perera*
>>>>>>>>>>> Software Engineer
>>>>>>>>>>> Mobile:(+94)716049075
>>>>>>>>>>>
>>>>>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>>>>>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> *Amila De Silva*
>>>>>>>>>>
>>>>>>>>>> WSO2 Inc.
>>>>>>>>>> mobile :(+94) 775119302
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> *Susinda Perera*
>>>>>>>>> Software Engineer
>>>>>>>>> Mobile:(+94)716049075
>>>>>>>>>
>>>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>>>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *Susinda Perera*
>>>>>>>> Software Engineer
>>>>>>>> Mobile:(+94)716049075
>>>>>>>>
>>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> *Susinda Perera*
>>>>>>> Software Engineer
>>>>>>> Mobile:(+94)716049075
>>>>>>>
>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Amila De Silva*
>>>>>>
>>>>>> WSO2 Inc.
>>>>>> mobile :(+94) 775119302
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Susinda Perera*
>>>>> Software Engineer
>>>>> Mobile:(+94)716049075
>>>>>
>>>>> WSO2 Inc. http://wso2.com/
>>>>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *Amila De Silva*
>>>>
>>>> WSO2 Inc.
>>>> mobile :(+94) 775119302
>>>>
>>>>
>>>
>>>
>>> --
>>> *Susinda Perera*
>>> Software Engineer
>>> Mobile:(+94)716049075
>>>
>>> WSO2 Inc. http://wso2.com/
>>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>>
>>>
>>
>>
>> --
>> *Susinda Perera*
>> Software Engineer
>> Mobile:(+94)716049075
>>
>> WSO2 Inc. http://wso2.com/
>> Tel : 94 11 214 5345 Fax :94 11 2145300
>>
>>
>
>
> --
> Thanks
> Abimaran Kugathasan
>
> Software Engineer | WSO2 Inc
> Data & APIs Technologies Team
> Mobile : +94 773922820
>
> <http://stackoverflow.com/users/515034>
> <http://lk.linkedin.com/in/abimaran>
> <http://www.lkabimaran.blogspot.com/>  <https://github.com/abimaran>
> <https://twitter.com/abimaran>
>
>


-- 
Thanks
Abimaran Kugathasan

Software Engineer | WSO2 Inc
Data & APIs Technologies Team
Mobile : +94 773922820

<http://stackoverflow.com/users/515034>
<http://lk.linkedin.com/in/abimaran>  <http://www.lkabimaran.blogspot.com/>
<https://github.com/abimaran>  <https://twitter.com/abimaran>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to