Setting absences using the Server Side API
Accepted answer
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.
Comments
there is a service..
from com.ibm.team.apt.service.????.jar
<serviceProvider
componentId="com.ibm.team.apt.resource"
implementationClass="com.ibm.team.apt.internal.service.resource.ResourcePlanningService">
<provides>
<providedService
interface="com.ibm.team.apt.common.resource.IResourcePlanningService">
</providedService></provides>
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.
what I did from yesterday,
the client class is com.ibm.team.apt.internal.client.resource.ResourcePlanningClient:
ths took me to the source in the sdk, where I found the matching service method I listed.
lack of clarity lead to the stream of notes overnight.
so I looked in the sdk/plugins folder for a similar 'service' jar. and found one.
then I looked in the plugin.xml in that jar, and found a service which pre-reqs a similarly named service.
<requiredService interface="com.ibm.team.apt.common.resource.IResourcePlanningService"/>
then I looked for the definition of said service. and found the info on my prior post.
which took me back to the same class I had previously found. (service defines class and interface)
(and as it is USED by other services, its pretty sticky, and unlikely to go away)
which when properly connected in my plugin, provides these methods via eclipse
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
It found the service class right away. I did not have to dig into any plugin.XML.
When I did that in a project that did NOT have all dependencies, somehow, the class was not found searching the SDK, which led me to believe it would not exist.
Attached a screenshot
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..
That is right, Sam. That service provides some helpful methods.
A general pattern is that client API is called com.ibm.......SomeNameClient and the server API is com.ibm.......SomeNameService
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..
I think Sam's answer should be marked as the accepted one. The question above is now posted in the next link:
2 other answers
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
Hy Ralph,
As I guess from my experience I don't think that the WebUI uses the client API.
Just compare the "ProcessClient" of them to see there's a difference.
Maybe I'm mixing something so don't be mad at me ;)
As I am not completely sure how this works, I could not be mad at you anyway. 8D
However, I am unable to find a service for the scheduled absences - at least in the SDK. All I can see is the client library and the common API. This could well be just a left over from the times this was done in the Eclipse UI. Not sure how the WebUI accesses it. There could be a rest service. This might be a case where someone would have to trace the communication from the browser.
Hey Ralph,
Why don't I get notifications when you comment?
Can I change that?
Jonas,
you should. I am not sure what is going on. I get notifications, but it takes some time.
Now it works again?!?!
Problem solved :D
Hey Ralph,
I've got a plain Widget Class where I described the Methods which fires automatically.
So if you wanna have it (or better improve it), give me your mail.
Then you can upload it to your blog.
Greetings
Jonas,
mail is ralph.schoon@de.ibm.com. Feel free to send it. But I never blog about stuff I don't understand. So I would likely need to look into it first and maybe ask back. I am a HTML/JavaScript dummy.
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.
This is however a client interface that you are using.
Yeah,
Due to my reverse engineering I just get client interfaces.
I just went to the absences and watched the NET Panel.
This is how I got to my solution ;)
Thank you, Ralph and Jonas. I'm going to try the different approaches posted here and I'll let you know my results.
@Francisco,
Ou.. . I forgot to mention that I work with.
Javascript and Dojo. So please don't get baffled
Comments
sam detweiler
Jul 23 '14, 7:27 p.m.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.
Francisco Rodriguez
Jul 23 '14, 8:38 p.m.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?
sam detweiler
Jul 23 '14, 8:45 p.m.Unlikely. I haven't found a way around the permissions system.
Jonas Studer
Jul 24 '14, 5:35 a.m.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?
Francisco Rodriguez
Jul 24 '14, 12:08 p.m.Yes, each contributor is able to manage its own absences. But we want the behavior that I commented before.
sam detweiler
Jul 24 '14, 12:30 p.m.@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.