Examples of PasswordRecord


Examples of com.knowgate.acl.PasswordRecord

  if (DebugFile.trace) {
    DebugFile.writeln("Begin GCalendarSynchronizer.connect([JDCConnection], "+sUser+","+sWorkArea+"[DistributedCachePeer])");
    DebugFile.incIdent();
  }
 
  PasswordRecord oPrec = null;
 
  sGuUser = sUser;
  sGuWorkArea = sWorkArea;

  boolean bCalendarFound = false;
 
  PreparedStatement oStmt;
  ResultSet oRSet;
 
  iIdDomain = oWrkA.get(sWorkArea);
  if (null==iIdDomain) {
    oStmt = oConn.prepareStatement("SELECT "+DB.id_domain+" FROM "+DB.k_workareas+" WHERE "+DB.gu_workarea+"=?");
    oStmt.setString(1, sWorkArea);
    oRSet = oStmt.executeQuery();
    if (oRSet.next()) {
      iIdDomain = new Integer(oRSet.getInt(1));
      oWrkA.put(sWorkArea, iIdDomain);
    }
    oRSet.close();
    oStmt.close();
  }
  if (null==iIdDomain) throw new SQLException("WorkArea "+sWorkArea+" not found");
 
  if (oCache!=null) {
    oPrec = (PasswordRecord) oCache.get(sUser+"[gmail]");
  }
 
  if (null==oPrec) {
    oPrec = new PasswordRecord();
    if (DebugFile.trace)
      DebugFile.writeln("JDCConnection.prepareStatement(SELECT "+DB.gu_pwd+" FROM "+DB.k_user_pwd+" WHERE "+DB.gu_user+"='"+sUser+"' AND "+DB.id_pwd+"='gmail'");
    oStmt = oConn.prepareStatement("SELECT "+DB.gu_pwd+" FROM "+DB.k_user_pwd+" WHERE "+DB.gu_user+"=? AND "+DB.id_pwd+"='gmail'",
                     ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    oStmt.setString(1, sUser);
    oRSet = oStmt.executeQuery();
    if (oRSet.next())
      oPrec.load(oConn, oRSet.getString(1));
    oRSet.close();
    oStmt.close();
    if (oPrec.getValueOf("cal")==null)
      oPrec = new PasswordRecord();
    else if (oPrec.getValueOf("cal").length()==0)
      oPrec = new PasswordRecord();
    if (oCache!=null) oCache.put(sUser+"[gmail]", oPrec);
  } else {
    if (DebugFile.trace)
      DebugFile.writeln("cache hit for GMail account of user "+sUser);
  }

  if (oPrec.lines().size()>0) {
    if (DebugFile.trace)
      DebugFile.writeln("CalendarService.setUserCredentials("+oPrec.getValueOf("user")+", ...)");
      oCalSrv.setUserCredentials(oPrec.getValueOf("user"), oPrec.getValueOf("pwd"));
    URL feedUrl = new URL("https://www.google.com/calendar/feeds/default/allcalendars/full");
    CalendarFeed oFeed = oCalSrv.getFeed(feedUrl, CalendarFeed.class);
    for (int i = 0; i < oFeed.getEntries().size() && !bCalendarFound; i++) {
        CalendarEntry oCalendar = oFeed.getEntries().get(i);
        bCalendarFound = oCalendar.getTitle().getPlainText().equals(oPrec.getValueOf("cal"));
    } // next
    if (bCalendarFound) {
      sEMail = oPrec.getValueOf("user");
    } else {
      if (oCache!=null) {
        oCache.expire(sUser+"[gmail]");
        oCache.put(sUser+"[gmail]", new PasswordRecord());     
      }
    }
  } // fi

  if (DebugFile.trace) {
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet s = wb.createSheet();
    s.protectSheet("abcdefghij");
    Sheet sheet = s.getSheet();
    ProtectRecord protect = sheet.getProtect();
    PasswordRecord pass = sheet.getPassword();
    assertTrue("protection should be on",protect.getProtect());
    assertTrue("object protection should be on",sheet.isProtected()[1]);
    assertTrue("scenario protection should be on",sheet.isProtected()[2]);
    assertEquals("well known value for top secret hash should be "+Integer.toHexString(expected).substring(4),expected,pass.getPassword());
  }
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

    /**
     * @return a new Password record with password set to 0x0000 (no password).
     */
    private static PasswordRecord createPassword() {
        return new PasswordRecord(0x0000); // no password by default!
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

    /**
     * @return a new Password record with password set to 0x0000 (no password).
     */
    private static PasswordRecord createPassword() {
        return new PasswordRecord(0x0000); // no password by default!
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

    /**
     * creates a Password record with password set to 0x0000.
     */
    private static PasswordRecord createPassword() {
        return new PasswordRecord(0x0000);
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

     * @param scenarios are protected
     */
    public void protectSheet( String password, boolean objects, boolean scenarios ) {
        int protIdx = -1;
        ProtectRecord prec = getProtect();
        PasswordRecord pass = getPassword();
        prec.setProtect(true);
        pass.setPassword(PasswordRecord.hashPassword(password));
        if((objprotect == null && objects) || (scenprotect != null && scenarios)) {
            protIdx = _records.indexOf( protect );
        }
        if(objprotect == null && objects) {
            ObjectProtectRecord rec = createObjectProtect();
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

    public void unprotectSheet( boolean sheet, boolean objects, boolean scenarios ) {

        if (!sheet) {
           ProtectRecord prec = getProtect();
           prec.setProtect(sheet);
           PasswordRecord pass = getPassword();
           pass.setPassword((short)00);
        }
        if(objprotect != null && !objects) {
            objprotect.setProtect(false);
        }
        if(scenprotect != null && !scenarios) {
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

    /**
     * @return a new Password record with password set to 0x0000 (no password).
     */
    private static PasswordRecord createPassword() {
        return new PasswordRecord(0x0000); // no password by default!
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

    /**
     * @return a new Password record with password set to 0x0000 (no password).
     */
    private static PasswordRecord createPassword() {
        return new PasswordRecord(0x0000); // no password by default!
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.PasswordRecord

  HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet s = wb.createSheet();
    s.protectSheet("abcdefghij");
    Sheet sheet = s.getSheet();
  ProtectRecord protect = sheet.getProtect();
  PasswordRecord pass = sheet.getPassword();
    assertTrue("protection should be on",protect.getProtect());
    assertTrue("object protection should be on",sheet.isProtected()[1]);
    assertTrue("scenario protection should be on",sheet.isProtected()[2]);
    assertEquals("well known value for top secret hash should be "+Integer.toHexString(expected).substring(4),expected,pass.getPassword());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.