Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
RequestFactory Proxies and Generics - Compile problem
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
otth2oskier  
View profile  
 More options Nov 14 2012, 3:52 pm
From: otth2oskier <wippel.rol...@gmail.com>
Date: Wed, 14 Nov 2012 12:52:07 -0800 (PST)
Local: Wed, Nov 14 2012 3:52 pm
Subject: RequestFactory Proxies and Generics - Compile problem

I am writing a bunch of screens using CellTable and the AsyncDataProvider
along with RequestFactory calls. I would like to get away from the pattern
of making a server call for data and a second call for row count to update
the AsyncDataProvider's data and row count. I would like create a generic
return object that contains both data and count and make only one cal to
the server.

My code looks like:

public class Result<T extends EntityBase> {
private final List<T> data;
private final long count;

public Result(List<T> data, long count) {
this.data = data;
this.count = count;

}

public List<T> getData() {
return data;

}

public long getCount() {
return count;

}
}

@ProxyFor(value = Result.class, locator = EntityLocator.class)
public interface ResultProxy<T extends EntityProxy> extends ValueProxy {
List<T> getData();

public long getCount();

}

@Service(value=UserDao.class,locator=BaseServiceLocator.class)
@ExtraTypes({ResultProxy.class})
public interface UserRequest extends RequestContext {
Request<Long> count();

Request<UserProxy> find(Long id);

Request<ResultProxy<UserProxy>> findAll(int firstResult, int maxResults);

Request<Void> persist(UserProxy instance);

Request<Void> remove(UserProxy instance);

}

@Stateless
public class UserDao {

@PersistenceContext(unitName = "acdb")
private EntityManager entityManager;

private static Logger LOGGER = Logger.getLogger(UserDao.class.getName());

public long count() {
...

}

public User find(Long id) {
return entityManager.find(User.class, id);

}

public Result<User> findAll(int firstResult, int maxResults) {
...

}

public void persist(User instance) {
LOGGER.info("Persisting instance:" + instance);
entityManager.merge(instance);
LOGGER.info("Persisted instance:" + instance);

}

public void remove(User instance) {
...

}
}

@ProxyFor(value = User.class, locator = EntityLocator.class)
public interface UserProxy extends EntityProxy {
Long getId();

String getFirstName();

void setFirstName(String firstName);

String getLastName();

void setLastName(String lastName);

}

When I compile, I am getting:

ResultProxy.java:13: warning: Cannot validate this method because the
domain mapping for  the return type (java.util.List) could not be resolved
to a domain type
UserRequest.java:19: Could not find domain method similar to
com.avaya.gwtproto.shared.model.Result<T> findAll(intint)

Lines are highlighted in red above.

I cannot figure out what I am doing wrong. I am guessing that the compiler
is not handling the generics as I would expect it to. I don't want to write
a separate return value for each EntityProxy and I don't want to make 2
server calls to get data and count to refresh my CellTable.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrea Boscolo  
View profile  
 More options Nov 14 2012, 4:42 pm
From: Andrea Boscolo <andrew...@gmail.com>
Date: Wed, 14 Nov 2012 13:42:06 -0800 (PST)
Local: Wed, Nov 14 2012 4:42 pm
Subject: Re: RequestFactory Proxies and Generics - Compile problem

I guess, you can't. See
http://code.google.com/p/google-web-toolkit/issues/detail?id=6967 and
http://code.google.com/p/google-web-toolkit/issues/detail?id=5974

For the 2 server calls you can simply (and probabily better) call two
different service methods with two different receivers in the same request
context, before firing it (that will end up in a single http request, if I
remember right).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic