syncbase/src/main/java/io/v/syncbase/Database.java
/**
     * FOR ADVANCED USERS. Creates syncgroup and adds it to the user's "userdata" collection, as
     * needed. Idempotent. The id of the new syncgroup will include the creator's user id and the
     * given syncgroup name. Requires that all collections were created by the current user.
     *
     * @param name        name of the syncgroup
     * @param collections collections in the syncgroup
     * @param opts        options for syncgroup creation
     * @throws IllegalArgumentException if no collections or collections don't all have same creator
     * @return the syncgroup
     */
FOR ADVANCED USERS. Creates syncgroup and adds it to the user's "userdata" collection, as
needed. Idempotent. The id of the new syncgroup will include the creator's user id and the
given syncgroup name. Requires that all collections were created by the current user.


FOR ADVANCED USERS . Creates syncgroup and adds it to the user ' s " userdata " collection as needed . Idempotent . The id of the new syncgroup will include the creator ' s user id and the given syncgroup name . Requires that all collections were created by the current user .
public Syncgroup syncgroup(String name, List<Collection> collections, SyncgroupOptions opts)
            throws SyncbaseException {
        if (collections.isEmpty()) {
            throw new IllegalArgumentException("No collections specified");
        }
        Id id = new Id(collections.get(0).getId().getBlessing(), name);
        for (Collection collection : collections) {
            if (!collection.getId().getBlessing().equals(id.getBlessing())) {
                throw new IllegalArgumentException("Collections must all have the same creator");
            }
        }
        Syncgroup syncgroup = new Syncgroup(mCoreDatabase.syncgroup(id.toCoreId()), this);
        syncgroup.createIfMissing(collections);
        Syncbase.addToUserdata(id);
        return syncgroup;
    }
public Syncgroup syncgroup ( String name , List < Collection > collections , SyncgroupOptions opts ) throws SyncbaseException { if ( collections . isEmpty ( ) ) { throw new IllegalArgumentException ( "No collections specified" ) ; } Id id = new Id ( collections . get ( 0 ) . getId ( ) . getBlessing ( ) , name ) ; for ( Collection collection : collections ) { if ( ! collection . getId ( ) . getBlessing ( ) . equals ( id . getBlessing ( ) ) ) { throw new IllegalArgumentException ( "Collections must all have the same creator" ) ; } } Syncgroup syncgroup = new Syncgroup ( mCoreDatabase . syncgroup ( id . toCoreId ( ) ) , this ) ; syncgroup . createIfMissing ( collections ) ; Syncbase . addToUserdata ( id ) ; return syncgroup ; }
FOR ADVANCED USERS.
FOR ADVANCED USERS .
// Remember this syncgroup in the userdata collection. The value doesn't matter, but since // VOM won't accept null, use a boolean. // Note: We may eventually want to use the value to deal with rejected invitations.