It's all about the answers!

Ask a question

question about jazz ajax support for storage model items


Scott Patterson (4142) | asked Apr 21 '09, 6:18 p.m.
JAZZ DEVELOPER
I am developing a jazz component that has a storage model and a web extension. I also created rest services for fetching data from the repository. My web client is using the ajax transport, https://jazz.net/wiki/bin/view/Main/JazzAjaxTransportDesign, design to talk to my rest service.

So far my web client has been able to successfully get items using the ajax transport service. However, the item instances returned from the service request are not fully populated, they are missing members which are 0-many EReferences to a Helper class in my storage model. 1-1 EReferences to a Helper gets send back to the client fine.

Am I going about this the correct way? The only potential issue I can see is that my helper interface doesn't extend Helper as where the simple item interface does extend SimpleItem. Maybe that could be where the array transport is getting tripped up because there's no direct reflection to the EObject?

How do other projects create class hierarchies for a component with a storage model that needs to be accessed by an ajax UI?

Here's some code snippets:

My Storage model SimpleItem facade interface
public interface IPacket extends IPacketHandle, ISimpleItem {
...
public IReplicaSelector getSource();
public List<IReplicaSelector> getTargets();
public IReplicaSelector[] getRepTargets(); //wrapper for getTargets()
...
}

Storage model SimpleItem codegen classes:
public interface Packet extends SimpleItem, PacketHandle, IPacket {...
public class PacketImpl extends SimpleItemImpl implements Packet { ...

My Storage model Helper facade interface
public interface IReplicaSelector;

Storage model Helper codegen classes:
public interface ReplicaSelector extends Helper, IReplicaSelector { ... }
public class ReplicaSelectorImpl extends HelperImpl implements ReplicaSelector { ... }

My service interface:
public interface IGlobalAdminRestService extends ITeamModelledRestService {
...
public static final class CommonParms implements IParameterWrapper {
public String registry;
public String region;
public String hostname;
}
IPacket [] getPackets(CommonParms param) throws TeamRepositoryException;
...
}

client side json
displayPackets: function(kwArgs){
var self= this;
var serviceObject= {
success: function(resp) {
...
for(var i=0; i<resp.length; i++) {
var packet = resp; //okay
var src = packet; //okay
var targets = packet; //undefined
...
}
} error: function(error) {
...
};

var svcRequest = new ServiceRequest(
"com.ibm.clearcase.ga.common.internal.rest.IGlobalAdminRestService",
"getPackets", {"registry" : "", "region" : "", "hostname" : ""});


TeamServerClient.invokeService(
svcRequest,
new ServiceResponseHandler(serviceObject, "success", "error"));
},

One answer



permanent link
Balaji Krish (1.8k12) | answered Apr 27 '09, 12:57 p.m.
JAZZ DEVELOPER
You are right. You need to extend from Helper object. We use it as a hint to marshal the entire object.

You will also have other issues during save / migration if you don't extend Helper object

--- Balaji
Jazz Server Team

I am developing a jazz component that has a storage model and a web extension. I also created rest services for fetching data from the repository. My web client is using the ajax transport, https://jazz.net/wiki/bin/view/Main/JazzAjaxTransportDesign, design to talk to my rest service.

So far my web client has been able to successfully get items using the ajax transport service. However, the item instances returned from the service request are not fully populated, they are missing members which are 0-many EReferences to a Helper class in my storage model. 1-1 EReferences to a Helper gets send back to the client fine.

Am I going about this the correct way? The only potential issue I can see is that my helper interface doesn't extend Helper as where the simple item interface does extend SimpleItem. Maybe that could be where the array transport is getting tripped up because there's no direct reflection to the EObject?

How do other projects create class hierarchies for a component with a storage model that needs to be accessed by an ajax UI?

Here's some code snippets:

My Storage model SimpleItem facade interface
public interface IPacket extends IPacketHandle, ISimpleItem {
...
public IReplicaSelector getSource();
public List<IReplicaSelector> getTargets();
public IReplicaSelector[] getRepTargets(); //wrapper for getTargets()
...
}

Storage model SimpleItem codegen classes:
public interface Packet extends SimpleItem, PacketHandle, IPacket {...
public class PacketImpl extends SimpleItemImpl implements Packet { ...

My Storage model Helper facade interface
public interface IReplicaSelector;

Storage model Helper codegen classes:
public interface ReplicaSelector extends Helper, IReplicaSelector { ... }
public class ReplicaSelectorImpl extends HelperImpl implements ReplicaSelector { ... }

My service interface:
public interface IGlobalAdminRestService extends ITeamModelledRestService {
...
public static final class CommonParms implements IParameterWrapper {
public String registry;
public String region;
public String hostname;
}
IPacket [] getPackets(CommonParms param) throws TeamRepositoryException;
...
}

client side json
displayPackets: function(kwArgs){
var self= this;
var serviceObject= {
success: function(resp) {
...
for(var i=0; i<resp.length; i++) {
var packet = resp; //okay
var src = packet; //okay
var targets = packet; //undefined
...
}
} error: function(error) {
...
};

var svcRequest = new ServiceRequest(
"com.ibm.clearcase.ga.common.internal.rest.IGlobalAdminRestService",
"getPackets", {"registry" : "", "region" : "", "hostname" : ""});


TeamServerClient.invokeService(
svcRequest,
new ServiceResponseHandler(serviceObject, "success", "error"));
},

Your answer


Register or to post 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.