You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Bilu <al...@gmail.com> on 2020/07/06 07:37:05 UTC

Re: [Bugtracking API] Create new task in LocalTasks Repository programmatically ?

Is this possible ?

Le 29/06/2020 à 10:59, Bilu a écrit :
>
> Hello,
>
> Is there a way to add new task to the local repository programmatically ?
>
> Bugtracking API provides Util.createIssue(Repository repository, 
> String summary,  String description) but this method throw  an
> java.lang.UnsupportedOperationException: Not supported yet.
>     at
> org.netbeans.modules.localtasks.RepositoryProviderImpl.createIssue(RepositoryProviderImpl.java:94)
>     at
> org.netbeans.modules.localtasks.RepositoryProviderImpl.createIssue(RepositoryProviderImpl.java:35)
>     at
> org.netbeans.modules.bugtracking.RepositoryImpl.createNewIssue(RepositoryImpl.java:248)
>     at
> org.netbeans.modules.bugtracking.api.Util.createIssue(Util.java:150)
>
> and indeed seems not supported yet by the API:
> https://github.com/apache/netbeans/blob/0f2e98d513deaedccef831ee9cfc08d09f3650b6/ide/localtasks/src/org/netbeans/modules/localtasks/RepositoryProviderImpl.java#L94
>
> So is there another way to achieve this and create new local tasks
> programmatically? 
>

Re: [Bugtracking API] Create new task in LocalTasks Repository programmatically ?

Posted by Emilian Bold <em...@gmail.com>.
I wonder if there's statistics on how many people are using this feature.
It sometimes feels like more of a demo on how NetBeans Module System
supports OSGi bundles than an user-facing solution...

--emi


On Thu, Jul 9, 2020 at 1:18 PM Bilu <al...@gmail.com> wrote:

> Indeed there is some setters(TaskDueDate, TaskEstimateDate, ScheduleDate)
> but it is not enough
>
> The thing is, that method creates a new Task with a default Summary: "New
> Local Task" and automatically open it in the IDE, that's not what i want
>
> What i want is to create the task in background with minimal parameters
> like the Summary and the description...
>
> I think that's was the initial purpose of the Util.createIssue method as
> it takes these parameters unfortunately it is not implemented
>
>
> So what i did finally is to build new Version of Issue Tracking and Local
> Tasks modules to support it and distribute them with my module.
>
> First i create a new method in the Util class same as the legacy but
> without issue.open()
>
> public static void createIssueAndStore(Repository repository, String
> summary, String description) {
>         repository.getImpl().createNewIssue(summary, description);
> //        issue.open();
>     }
>
> and in LocalRepository class i create new createTask method that takes
> parameters:  LocalTask createTask(String summary, String description) and
> return it
>
> from RepositoryProviderImpl.createIssue:
>
> public LocalTask createIssue(LocalRepository r, String summary, String
> description) {
>         return r.createTask(summary, description);
> //        throw new UnsupportedOperationException("Not supported yet.");
> //To change body of generated methods, choose Tools | Templates.
>     }
>
> That's it:)
>
> I also think this is something other users might want, i will propose it
> as feature request
>
>
>
> Le 08/07/2020 à 09:48, Emilian Bold a écrit :
>
> That other method returns a Local task which has some setters. Is that not
> enough?
>
> --emi
>
> lun., 6 iul. 2020, 10:37 Bilu <al...@gmail.com> a scris:
>
>> Is this possible ?
>> Le 29/06/2020 à 10:59, Bilu a écrit :
>>
>> Hello,
>>
>> Is there a way to add new task to the local repository programmatically ?
>>
>> Bugtracking API provides Util.createIssue(Repository repository,  String
>> summary,  String description) but this method throw  an
>> java.lang.UnsupportedOperationException: Not supported yet.
>>     at
>> org.netbeans.modules.localtasks.RepositoryProviderImpl.createIssue(RepositoryProviderImpl.java:94)
>>     at
>> org.netbeans.modules.localtasks.RepositoryProviderImpl.createIssue(RepositoryProviderImpl.java:35)
>>     at
>> org.netbeans.modules.bugtracking.RepositoryImpl.createNewIssue(RepositoryImpl.java:248)
>>     at
>> org.netbeans.modules.bugtracking.api.Util.createIssue(Util.java:150)
>>
>> and indeed seems not supported yet by the API:
>> https://github.com/apache/netbeans/blob/0f2e98d513deaedccef831ee9cfc08d09f3650b6/ide/localtasks/src/org/netbeans/modules/localtasks/RepositoryProviderImpl.java#L94
>>
>> So is there another way to achieve this and create new local tasks
>> programmatically?
>>
>>

Re: [Bugtracking API] Create new task in LocalTasks Repository programmatically ?

Posted by Bilu <al...@gmail.com>.
Indeed there is some setters(TaskDueDate, TaskEstimateDate,
ScheduleDate) but it is not enough

The thing is, that method creates a new Task with a default Summary:
"New Local Task" and automatically open it in the IDE, that's not what i
want

What i want is to create the task in background with minimal parameters
like the Summary and the description...

I think that's was the initial purpose of the Util.createIssue method as
it takes these parameters unfortunately it is not implemented


So what i did finally is to build new Version of Issue Tracking and
Local Tasks modules to support it and distribute them with my module.

First i create a new method in the Util class same as the legacy but
without issue.open()

public static void createIssueAndStore(Repository repository, String
summary, String description) {
        repository.getImpl().createNewIssue(summary, description);
//        issue.open();
    }

and in LocalRepository class i create new createTask method that takes
parameters:  LocalTask createTask(String summary, String description)
and return it

from RepositoryProviderImpl.createIssue:

public LocalTask createIssue(LocalRepository r, String summary, String
description) {
        return r.createTask(summary, description);
//        throw new UnsupportedOperationException("Not supported yet.");
//To change body of generated methods, choose Tools | Templates.
    }

That's it:)

I also think this is something other users might want, i will propose it
as feature request



Le 08/07/2020 à 09:48, Emilian Bold a écrit :
> That other method returns a Local task which has some setters. Is that
> not enough?
>
> --emi
>
> lun., 6 iul. 2020, 10:37 Bilu <albilu4@gmail.com
> <ma...@gmail.com>> a scris:
>
>     Is this possible ?
>
>     Le 29/06/2020 à 10:59, Bilu a écrit :
>>
>>     Hello,
>>
>>     Is there a way to add new task to the local repository
>>     programmatically ?
>>
>>     Bugtracking API provides Util.createIssue(Repository repository, 
>>     String summary,  String description) but this method throw  an
>>     java.lang.UnsupportedOperationException: Not supported yet.
>>         at
>>     org.netbeans.modules.localtasks.RepositoryProviderImpl.createIssue(RepositoryProviderImpl.java:94)
>>         at
>>     org.netbeans.modules.localtasks.RepositoryProviderImpl.createIssue(RepositoryProviderImpl.java:35)
>>         at
>>     org.netbeans.modules.bugtracking.RepositoryImpl.createNewIssue(RepositoryImpl.java:248)
>>         at
>>     org.netbeans.modules.bugtracking.api.Util.createIssue(Util.java:150)
>>
>>     and indeed seems not supported yet by the API:
>>     https://github.com/apache/netbeans/blob/0f2e98d513deaedccef831ee9cfc08d09f3650b6/ide/localtasks/src/org/netbeans/modules/localtasks/RepositoryProviderImpl.java#L94
>>
>>     So is there another way to achieve this and create new local
>>     tasks programmatically? 
>>

Re: [Bugtracking API] Create new task in LocalTasks Repository programmatically ?

Posted by Emilian Bold <em...@gmail.com>.
That other method returns a Local task which has some setters. Is that not
enough?

--emi

lun., 6 iul. 2020, 10:37 Bilu <al...@gmail.com> a scris:

> Is this possible ?
> Le 29/06/2020 à 10:59, Bilu a écrit :
>
> Hello,
>
> Is there a way to add new task to the local repository programmatically ?
>
> Bugtracking API provides Util.createIssue(Repository repository,  String
> summary,  String description) but this method throw  an
> java.lang.UnsupportedOperationException: Not supported yet.
>     at
> org.netbeans.modules.localtasks.RepositoryProviderImpl.createIssue(RepositoryProviderImpl.java:94)
>     at
> org.netbeans.modules.localtasks.RepositoryProviderImpl.createIssue(RepositoryProviderImpl.java:35)
>     at
> org.netbeans.modules.bugtracking.RepositoryImpl.createNewIssue(RepositoryImpl.java:248)
>     at org.netbeans.modules.bugtracking.api.Util.createIssue(Util.java:150)
>
> and indeed seems not supported yet by the API:
> https://github.com/apache/netbeans/blob/0f2e98d513deaedccef831ee9cfc08d09f3650b6/ide/localtasks/src/org/netbeans/modules/localtasks/RepositoryProviderImpl.java#L94
>
> So is there another way to achieve this and create new local tasks
> programmatically?
>
>