package com.prasanta.sample; import java.util.ArrayList; import com.pras.Collaborator; import com.pras.SpreadSheet; import com.pras.SpreadSheetFactory; /** * Demonstrates how to use SpreadSheet Share feature * @author Prasanta Paul * */ public class ShareSample { public static void main(String[] args){ SpreadSheetFactory spf = SpreadSheetFactory.getInstance(args[0], args[1]); // Get all SpreadSheets ArrayList spreadSheets = spf.getAllSpreadSheets(); if(spreadSheets == null || spreadSheets.size() == 0){ System.out.println("No SpreadSheet exists"); } SpreadSheet firstSP = spreadSheets.get(0); System.out.println("Read Collaborators of SpreadSheet: "+ firstSP.getEntry().getTitle()); // Get the list of all people to whom this SpreadSheet is shared ArrayList collaborators = spf.getAllCollaborators(firstSP); if(collaborators == null || collaborators.size() == 0){ System.out.println("No Collaborators"); } Collaborator c = null; for(int i=0; i"+ c.getScopeValue()); spf.changeSharePermission(c, Collaborator.ROLE_READER); } }