示例#1
0
  public static void main(String[] args) {

    Properties props = new Properties();
    try {
      InputStream zcInpStream = new FileInputStream("zc.txt");
      props.load(zcInpStream);
      Set<?> keys = props.keySet();
      Iterator<?> keysIterator = keys.iterator();
      while (keysIterator.hasNext()) {
        String key = (String) keysIterator.next();
        String value = props.getProperty(key);
        if (key.equals("AccountsURL")) {
          ZOHOCreator.setAccountsURL(value);
        } else if (key.equals("CreatorURL")) {
          ZOHOCreator.setCreatorURL(value);
        } else if (key.equals("ServiceName")) {
          ZOHOCreator.setServiceName(value);
        }
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    ZOHOUser user = ZOHOCreator.getZohoUser();

    if (user == null) {
      String username = getInput("Enter Username"); // No I18N
      String password = getInput("Enter password", true); // No I18N
      user = ZOHOCreator.login(username, password);
    }

    // System.out.println(user.getAuthToken());
    // System.out.println("Fetching Application List....");

    ZOHOCreator.setCurrentNavigationListForApps(ZOHOCreator.getNavigationListForApps());

    ZOHOCreator.setCurrentAppList(ZOHOCreator.getPersonalApplicationList());
    printAppList();

    String inp =
        getInput(
            "Do you want to logut? Type 1 to quit without logout..... 2 to logout and quit"); // No
                                                                                              // I18N
    int inpValue = -1;
    try {
      inpValue = Integer.parseInt(inp);
    } catch (Exception ee) {
    }

    if (inpValue == 2) {
      ZOHOCreator.logout();
      System.out.println("************** Successfully logged out... **************");
    }

    // System.out.println("Fetching Section List....");
    // List<ZCSection> zcSections = ZOHOCreator.getSectionList(zcapps.get(2));
    //// System.out.println("Fetching Form....");
    // ZCForm zcForm = ZOHOCreator.getForm(zcSections.get(25).getComponents().get(0));

    // System.out.println("Fetching View....");
    // ZCView zcView = ZOHOCreator.getView(zcSections.get(22).getComponents().get(1));

    // System.out.println("Fetching View....");
    // ZCView zcView = ZOHOCreator.getView("all-fields", "All_fields_View", "charles");
    // System.out.println(zcView);

    // System.out.println("\n\n******************************\n\n");
    // System.out.println(zcSections);
    // System.out.println("\n\n******************************\n\n");
    //// System.out.println(zcForm);
    // System.out.println("\n\n******************************\n\n");

  }