Setting absences using the Server Side API
Hi all,
Is there a way to set an absence using the Server Side API? It is surely possible to achieve this using some internal client libraries but it seems that this cannot be done by the Server API .
I´ve already read this:
https://jazz.net/forum/questions/37634/accessing-the-time-zone-of-usercontributor-of-a-work-item
This:
https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/
And this:
https://jazz.net/forum/questions/103798/is-there-any-solutions-for-saving-or-getting-users-absence-information-using-api-of-server-side-rtc
And quite a lot more so I would really appreciate your help or guidance.
Thanks in advance,
Francisco R.
showing 5 of 6
show 1 more comments
|
Accepted answer
Ralph Schoon (63.6k●3●36●47)
| answered Jul 24 '14, 5:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I found a way from AbstractService, to at least get at the data.
You can get the handle for IContributorRecord which is a class that provides all the data, including the details, which include the absences. This might be another way through the server API. Francisco Rodriguez selected this answer as the correct answer
Comments
sam detweiler
commented Jul 24 '14, 9:04 a.m.
there is a service..
Interesting. I wasn't able to find it in the SDK.. Probably because I didnot have the dependent plugin? I dummy.
eh? sorry, didn't understand that.
Ralph Schoon
commented Jul 24 '14, 11:05 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
What I am saying is: once I create a new plug-in project, added all com.ibm. plugins as dependency and then did a JavaSearch for 'ResourcePlanning', Type, All Occurrences
Ralph Schoon
commented Jul 24 '14, 11:07 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Attached a screenshot
sam detweiler
commented Jul 24 '14, 11:13 a.m.
k.. my mind doesn't work that way, I can't try to search the catalog for something I 'think' might be there without any clue of the name construct..
Francisco Rodriguez
commented Jul 24 '14, 11:36 a.m.
That is right, Sam. That service provides some helpful methods.
Ralph Schoon
commented Jul 24 '14, 11:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
A general pattern is that client API is called com.ibm.......SomeNameClient and the server API is com.ibm.......SomeNameService
sam detweiler
commented Jul 24 '14, 11:59 a.m.
right.. but this only works, as you've noted, if you have all the right dependencies setup.. (if I KNEW what I needed, why was I searching?!).. sorry, again, my mind has some blockage here..
Francisco Rodriguez
commented Jul 24 '14, 1:22 p.m.
Ralph,
This service (IResourcePlanningService) and its methods will definitely help me to set absences somehow, but they are useless if the user does not have a JazzAdmins privilege. Do you think it is possible to save the absence with this privilege no matter the current user has JazzUsers role?
Thanks in advance,
Francisco R.
Francisco Rodriguez
commented Jul 24 '14, 2:40 p.m.
I think Sam's answer should be marked as the accepted one. The question above is now posted in the next link:
Thanks!
showing 5 of 11
show 6 more comments
|
2 other answers
Ralph Schoon (63.6k●3●36●47)
| answered Jul 24 '14, 3:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jul 24 '14, 3:53 a.m.
The only API I am aware of is described here: http://rsjazz.wordpress.com/2014/07/22/manage-scheduled-absences-using-the-plainjava-client-libraries/
If you look for references to any of the classes used or for "ResourcePlanning" you will notice that there are only references to com.ibm.apt.*.common and com.ibm.apt.*.client and that there is no service (at least I could find) for this. Common api is for client and server, however, all I was able to find are the resource model classes. No common service. If you find something, let me know. @Sam, as far as I know, the WebUI uses the client API. Comments
Jonas Studer
commented Jul 24 '14, 4:33 a.m.
Hy Ralph,
As I am not completely sure how this works, I could not be mad at you anyway. 8D
Jonas Studer
commented Jul 24 '14, 5:20 a.m.
Hey Ralph,
Jonas,
Jonas Studer
commented Jul 24 '14, 5:47 a.m.
Now it works again?!?!
Jonas Studer
commented Jul 24 '14, 10:58 a.m.
Hey Ralph,
Ralph Schoon
commented Jul 24 '14, 11:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Jonas,
showing 5 of 7
show 2 more comments
|
Hy Francisco,
I've found out how you can do it with the ServerSide API. Hopefully I didn't meant something different. But here's my solution: First you have to require the needed Class: dojo.require("com.ibm.team.apt.web.client.internal.ResourcePlanningClient"); If you wanna see the class watch it here: "installs\rtc-sdk\plugins\com.ibm.team.apt.web.client_3.0.800.v20131025_0417\resources\internal" In RTC 4.0.5 There you can see the different parameters you could use. So on... you have to set up a serviceResponseHandler. var serviceObjectSprints = { self: this, //This you don't really need. But in this way you could iteract with the viewlet [this.self.test()] success: function(page) { }, failure: function (error) { } } var srh = new ServiceResponseHandler(serviceObjectSprints, "success", "failure"); var args = { addedAbsences: { "description": "nameOfAbsence", "startDate": "ISO String", "endDate": "
2014-07-24T00:00:00+02:00" //This is an ISO-String
contributorId: //The ID of the user you wanna add the absence
}; ResourcePlanningClient.postAbsences(srh, args); To be honest, I didn't tryed it out.... but this is the key ;) If it won't work, I gonna try it for you if you want. Comments Good catch.
Jonas Studer
commented Jul 24 '14, 5:50 a.m.
Yeah,
Francisco Rodriguez
commented Jul 24 '14, 11:39 a.m.
Thank you, Ralph and Jonas. I'm going to try the different approaches posted here and I'll let you know my results.
Jonas Studer
commented Jul 25 '14, 3:59 a.m.
@Francisco,
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
I don't know.. as u can manage this from the Web UI there IS a server side api. but much of the server api is not yet published.
by looking thru the source in the SDK you can get close pretty quickly.
the packaging model here is
client
common
service
client & common go on the client
common and service go on the server.
the classes u want are in the com\ibm\team\apt\api\common\rm package in the com.ibm.team.apt.api.common.jar
com.ibm.team.apt.service.... far contains the com\ibm\team\apt\internal\service\resource\ResourcePlanningService class
which has a method
public IContributorResourceDetails saveResourceDetails(final IContributorResourceDetails workingCopy)
which seems close to the qst link.
I have another question. Let's see if you can help me. Currently, the absences can only be set by the users with JazzAdmins privileges, but we need users with JazzUsers privileges and specific roles can also set the absences through the Web UI or the Eclipse UI. Do you think this can be achieved with a plugin extension developed using the Server API?
Unlikely. I haven't found a way around the permissions system.
Do it with OSLC. Then permission isn't a problem anymore!
But this is also pretty dangerous to avoid the OAuth!
Hmmm, but as far as I know, each contributor should be able to manage it's own absences. Or you wanna have full access?
Yes, each contributor is able to manage its own absences. But we want the behavior that I commented before.
@Jonas, you have to authenticate to use OSLC too. so, no change
Today Sue's manager Bob cannot manage her absences unless he is JazzAdmin.
if she has an accident or falls ill, Bob must contact someone else (who doesn't need to know any of this) just to manage this data.