http://codereview.appspot.com/1862048/show
On Tue, Jul 27, 2010 at 8:30 PM, Henry Saputra <[email protected]>wrote: > Hi Franck, > > If you dont mind, could you upload the patch to > http://codereview.appspot.com/ ? > > It will make easier for the community to review. > > - Henry > > On Tue, Jul 27, 2010 at 11:21 AM, franck tankoua <[email protected]> > wrote: > > > Hello, > > this is a java patch. > > > > > > Index: src/main/java/org/apache/shindig/social/core/model/GroupImpl.java > > =================================================================== > > --- src/main/java/org/apache/shindig/social/core/model/GroupImpl.java > > (revision 0) > > +++ src/main/java/org/apache/shindig/social/core/model/GroupImpl.java > > (revision 0) > > @@ -0,0 +1,33 @@ > > +package org.apache.shindig.social.core.model; > > + > > +import org.apache.shindig.social.opensocial.model.Group; > > +import org.apache.shindig.social.opensocial.spi.GroupId; > > + > > +public class GroupImpl implements Group{ > > + > > + private GroupId groupId; > > + private String title; > > + private String description; > > + > > + public String getTitle() { > > + return title; > > + } > > + public void setTitle(String title) { > > + this.title = title; > > + } > > + public String getDescription() { > > + return description; > > + } > > + public void setDescription(String description) { > > + this.description = description; > > + } > > + > > + public void setId(GroupId groupId) { > > + this.groupId = groupId; > > + } > > + public GroupId getId() { > > + return groupId; > > + } > > + > > + > > +} > > Index: > src/main/java/org/apache/shindig/social/opensocial/model/Group.java > > =================================================================== > > --- src/main/java/org/apache/shindig/social/opensocial/model/Group.java > > (revision 0) > > +++ src/main/java/org/apache/shindig/social/opensocial/model/Group.java > > (revision 0) > > @@ -0,0 +1,65 @@ > > +package org.apache.shindig.social.opensocial.model; > > + > > +import org.apache.shindig.protocol.model.Exportablebean; > > +import org.apache.shindig.social.core.model.GroupImpl; > > +import org.apache.shindig.social.opensocial.spi.GroupId; > > + > > +import com.google.inject.ImplementedBy; > > + > > +/** > > + * <p> > > + * OpenSocial Groups are owned by people, and are used to tag or > > categorize > > people and their relationships. > > + * Each group has a display name, an identifier which is unique within > the > > groups owned by that person, and a URI link. > > + * A group may be a private, invitation-only, public or a personal group > > used to organize friends. > > + * </p> > > + * <p> > > + * From > > > > > http://opensocial-resources.googlecode.com/svn/spec/1.0/Social-Data.xml#Group > > + * </p> > > + */ > > +...@implementedby(GroupImpl.class) > > +...@exportablebean > > +public interface Group { > > + > > + public static enum Field { > > + /** Unique ID for this group Required. */ > > + ID("Id"), > > + /** Title of group Required. */ > > + TITLE("title"), > > + /** Description of group Optional. */ > > + DESCRIPTION("description"); > > + > > + /** > > + * The json field that the instance represents. > > + */ > > + private final String jsonString; > > + > > + /** > > + * create a field base on the a json element. > > + * > > + * @param jsonString the name of the element > > + */ > > + private Field(String jsonString) { > > + this.jsonString = jsonString; > > + } > > + > > + /** > > + * emit the field as a json element. > > + * > > + * @return the field name > > + */ > > + @Override > > + public String toString() { > > + return jsonString; > > + } > > + } > > + > > + GroupId getId(); > > + void setId(GroupId id); > > + > > + String getTitle(); > > + void setTitle(String title); > > + > > + String getDescription(); > > + void setDescription(String description); > > + > > +} > > Index: > > > > > src/main/java/org/apache/shindig/social/opensocial/service/GroupHandler.java > > =================================================================== > > --- > > > > > src/main/java/org/apache/shindig/social/opensocial/service/GroupHandler.java > > (revision 0) > > +++ > > > > > src/main/java/org/apache/shindig/social/opensocial/service/GroupHandler.java > > (revision 0) > > @@ -0,0 +1,40 @@ > > +package org.apache.shindig.social.opensocial.service; > > + > > +import java.util.Set; > > +import java.util.concurrent.Future; > > + > > +import org.apache.shindig.protocol.HandlerPreconditions; > > +import org.apache.shindig.protocol.Operation; > > +import org.apache.shindig.protocol.ProtocolException; > > +import org.apache.shindig.protocol.Service; > > +import org.apache.shindig.social.opensocial.spi.CollectionOptions; > > +import org.apache.shindig.social.opensocial.spi.GroupService; > > +import org.apache.shindig.social.opensocial.spi.UserId; > > + > > +import com.google.inject.Inject; > > + > > + > > +...@service(name = "groups", path="/{userId}") > > +public class GroupHandler { > > + > > + private final GroupService service; > > + > > + @Inject > > + public GroupHandler(GroupService service){ > > + this.service = service; > > + } > > + > > + @Operation(httpMethods="GET") > > + public Future<?> get(SocialRequestItem request) throws > > ProtocolException { > > + Set<UserId> userIds = request.getUsers(); > > + CollectionOptions options = new CollectionOptions(request); > > + > > + // Preconditions > > + HandlerPreconditions.requireNotEmpty(userIds, "No userId > > specified"); > > + HandlerPreconditions.requireSingular(userIds, "Only one userId > > must be specified"); > > + > > + return service.getGroups(userIds.iterator().next(), options, > > request.getFields(), request.getToken()); > > + > > + } > > + > > +} > > Index: > > src/main/java/org/apache/shindig/social/opensocial/spi/GroupService.java > > =================================================================== > > --- > > src/main/java/org/apache/shindig/social/opensocial/spi/GroupService.java > > (revision 0) > > +++ > > src/main/java/org/apache/shindig/social/opensocial/spi/GroupService.java > > (revision 0) > > @@ -0,0 +1,14 @@ > > +package org.apache.shindig.social.opensocial.spi; > > + > > +import java.util.Set; > > +import java.util.concurrent.Future; > > + > > +import org.apache.shindig.auth.SecurityToken; > > +import org.apache.shindig.protocol.RestfulCollection; > > +import org.apache.shindig.social.opensocial.model.Group; > > + > > +public interface GroupService { > > + > > + public Future<RestfulCollection<Group>> getGroups(UserId userId, > > CollectionOptions options, Set<String> fields, SecurityToken token); > > + > > +} > > > > > > > > > > On Tue, Jul 27, 2010 at 8:17 PM, Christiaan Hees <[email protected]> > > wrote: > > > > > I don't think you can send attachments on this mailing list. I'm > > interested > > > in seeing the patch though. Is it for the Java or the PHP version of > > > Shindig? > > > > > > /Christiaan > > > > > > On Tue, Jul 27, 2010 at 6:49 PM, franck tankoua <[email protected]> > > > wrote: > > > > > > > Here is my patch. > > > > Feel free to comment. > > > > > > > > Thanks > > > > > > > > > > > > On Tue, Jul 27, 2010 at 2:30 PM, franck tankoua <[email protected] > > > >wrote: > > > > > > > >> Hello all, > > > >> > > > >> from the specification > > > >> https://docs.google.com/View?docid=dcc2jvzt_37hdzwkmf8#ssc:310, > there > > > >> should be a groups service. > > > >> > > > >> I have made one and I would like to know if you guys are interested. > > > >> > > > >> Regards > > > >> > > > >> -- > > > >> Franck > > > >> > > > > > > > > > > > > > > > > -- > > > > Franck > > > > > > > > > > > > > > > -- > > Franck > > > -- Franck
