示例#1
0
  public static void getBackupSummary(String id, String bkpId) throws Exception {

    SalesforceOrg org = dbUtils.findOrganizationById(id);
    for (Backup bkp : dbUtils.backupsForOrg(org.getOrgId())) {
      if (bkpId.equalsIgnoreCase((bkp.getId()))) {
        JedisPool pool = null;
        Jedis jedis = null;
        try {

          pool = poolFactory.getPool();
          jedis = pool.getResource();

          response.setContentTypeIfNotSet("application/json");
          ObjectMapper objectMapper = new ObjectMapper();
          objectMapper.setSerializationInclusion(Inclusion.NON_NULL);
          renderJSON(
              objectMapper.writeValueAsString(
                  DifferenceUtils.summarizeDifferences(
                      jedis.hget(bkp.getGitVersion(), "changes"))));
        } finally {
          if (pool != null && jedis != null) {
            pool.returnResource(jedis);
          }
        }
        break;
      }
    }
    renderJSON("{}");
  }
示例#2
0
 public static void scheduleBackupNow(String id) throws Exception {
   SalesforceOrg org = dbUtils.findOrganizationById(id);
   org.setLastBackupStatus("Scheduled");
   dbUtils.upsert(org);
   JedisPool pool = null;
   Jedis jedis = null;
   try {
     pool = poolFactory.getPool();
     jedis = pool.getResource();
     ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
     mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
     String msgJson = mapper.writeValueAsString(org);
     jedis.rpush(DotVersionConstants.BACKUP_QUEUE_NAME, msgJson);
   } finally {
     if (pool != null && jedis != null) {
       pool.returnResource(jedis);
     }
   }
   backups();
 }