Example #1
1
  private static Long latestVersion(Hashtable<String, String> config, dbutil db_util)
      throws Exception {
    if (!config.get("timestamp_stop").equals(Integer.toString(Integer.MAX_VALUE))) {
      return new Long(config.get("timestamp_stop"));
    }

    String rowName = config.get("file_id") + config.get("run_id") + "_";
    if (config.get("task_id") != "") {
      try {
        rowName = rowName + String.format("%04d", new Integer(config.get("task_id")));
      } catch (NumberFormatException E) {
        rowName = rowName + config.get("task_id");
      }
    }
    Get timestampGet = new Get(rowName.getBytes());
    timestampGet.addColumn("d".getBytes(), "update".getBytes());
    Result timestampResult = db_util.doGet(config.get("db_name_updates"), timestampGet);
    KeyValue tsKv = timestampResult.getColumnLatest("d".getBytes(), "update".getBytes());
    if (tsKv == null) {
      rowName = config.get("file_id") + "_";
      timestampGet = new Get(rowName.getBytes());
      timestampGet.addColumn("d".getBytes(), "update".getBytes());
      timestampResult = db_util.doGet(config.get("db_name_updates"), timestampGet);
      tsKv = timestampResult.getColumnLatest("d".getBytes(), "update".getBytes());
    }

    if (tsKv == null) {
      return new Long(Integer.MAX_VALUE);
    }
    Long latestVersion = new Long(tsKv.getTimestamp());
    return latestVersion;
  }
  @Test
  public void createTransactionFromTransparentRedirectSpecifyingLevel2Attributes() {
    TransactionRequest request =
        new TransactionRequest()
            .amount(TransactionAmount.AUTHORIZE.amount)
            .creditCard()
            .number(CreditCardNumber.VISA.number)
            .expirationDate("05/2009")
            .done();

    TransactionRequest trParams =
        new TransactionRequest()
            .type(Transaction.Type.SALE)
            .taxAmount(new BigDecimal("10.00"))
            .taxExempt(true)
            .purchaseOrderNumber("12345");

    String queryString =
        TestHelper.simulateFormPostForTR(
            gateway, trParams, request, gateway.transparentRedirect().url());
    Result<Transaction> result = gateway.transparentRedirect().confirmTransaction(queryString);

    assertTrue(result.isSuccess());
    Transaction transaction = result.getTarget();
    assertEquals(new BigDecimal("10.00"), transaction.getTaxAmount());
    assertTrue(transaction.isTaxExempt());
    assertEquals("12345", transaction.getPurchaseOrderNumber());
  }
  @Test
  public void updateCreditCardFromTransparentRedirect() {
    Customer customer = gateway.customer().create(new CustomerRequest()).getTarget();
    CreditCardRequest request =
        new CreditCardRequest()
            .customerId(customer.getId())
            .number("5105105105105100")
            .expirationDate("05/12");
    CreditCard card = gateway.creditCard().create(request).getTarget();

    CreditCardRequest updateRequest = new CreditCardRequest();
    CreditCardRequest trParams =
        new CreditCardRequest()
            .paymentMethodToken(card.getToken())
            .number("4111111111111111")
            .expirationDate("10/10");
    String queryString =
        TestHelper.simulateFormPostForTR(
            gateway, trParams, updateRequest, gateway.transparentRedirect().url());

    Result<CreditCard> result = gateway.transparentRedirect().confirmCreditCard(queryString);

    assertTrue(result.isSuccess());
    CreditCard updatedCreditCard = gateway.creditCard().find(card.getToken());
    assertEquals("411111", updatedCreditCard.getBin());
    assertEquals("1111", updatedCreditCard.getLast4());
    assertEquals("10/2010", updatedCreditCard.getExpirationDate());
  }
Example #4
0
 public void testConditional() throws Exception {
   addSnippetClassDecl("static class D {}");
   addSnippetClassDecl("static class C extends D {}");
   addSnippetClassDecl("static class B extends C {}");
   addSnippetClassDecl("static class A extends C {}");
   Result result =
       optimize(
           "void",
           "int x = 0;",
           "A a1 = new A();",
           "A a2 = new A();",
           "B b = new B();",
           "C c = new C();",
           "C c1 = (x > 0) ? a1 : b;",
           "C c2 = (x > 0) ? a1 : a2;",
           "D d = (x > 0) ? b : c;");
   result.intoString(
       "int x = 0;\n"
           + "EntryPoint$A a1 = new EntryPoint$A();\n"
           + "EntryPoint$A a2 = new EntryPoint$A();\n"
           + "EntryPoint$B b = new EntryPoint$B();\n"
           + "EntryPoint$C c = new EntryPoint$C();\n"
           + "EntryPoint$C c1 = x > 0 ? a1 : b;\n"
           + "EntryPoint$A c2 = x > 0 ? a1 : a2;\n"
           + "EntryPoint$C d = x > 0 ? b : c;");
 }
Example #5
0
 private void jButton21ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton21ActionPerformed
   // TODO add your handling code here:
   cal.a = Double.valueOf(Result.getText());
   Result.setText("");
   state = "/";
 } // GEN-LAST:event_jButton21ActionPerformed
 public Result<ActionPlan> createActionPlan(Map<String, String> parameters) {
   Result<ActionPlan> result = createActionPlanResult(parameters);
   if (result.ok()) {
     result.set(actionPlanService.create(result.get(), UserSession.get()));
   }
   return result;
 }
Example #7
0
 public Result decode(BinaryBitmap image, Hashtable hints)
     throws NotFoundException, ChecksumException, FormatException {
   DecoderResult decoderResult;
   ResultPoint[] points;
   if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
     BitMatrix bits = extractPureBits(image.getBlackMatrix());
     decoderResult = decoder.decode(bits);
     points = NO_POINTS;
   } else {
     DetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect();
     decoderResult = decoder.decode(detectorResult.getBits());
     points = detectorResult.getPoints();
   }
   Result result =
       new Result(
           decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.DATAMATRIX);
   if (decoderResult.getByteSegments() != null) {
     result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments());
   }
   if (decoderResult.getECLevel() != null) {
     result.putMetadata(
         ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel().toString());
   }
   return result;
 }
  @Test(timeout = 30000)
  public void testCreateDeleteTable() throws IOException {
    // Create table then get the single region for our new table.
    HTableDescriptor hdt = HTU.createTableDescriptor("testCreateDeleteTable");
    hdt.setRegionReplication(NB_SERVERS);
    hdt.addCoprocessor(SlowMeCopro.class.getName());
    Table table = HTU.createTable(hdt, new byte[][] {f}, HTU.getConfiguration());

    Put p = new Put(row);
    p.add(f, row, row);
    table.put(p);

    Get g = new Get(row);
    Result r = table.get(g);
    Assert.assertFalse(r.isStale());

    try {
      // But if we ask for stale we will get it
      SlowMeCopro.cdl.set(new CountDownLatch(1));
      g = new Get(row);
      g.setConsistency(Consistency.TIMELINE);
      r = table.get(g);
      Assert.assertTrue(r.isStale());
      SlowMeCopro.cdl.get().countDown();
    } finally {
      SlowMeCopro.cdl.get().countDown();
      SlowMeCopro.sleepTime.set(0);
    }

    HTU.getHBaseAdmin().disableTable(hdt.getTableName());
    HTU.deleteTable(hdt.getTableName());
  }
Example #9
0
 public Optional<Response> get(Optional<Request> request) {
   if (!valid) {
     Logger.error("CANNOT GET! NO VALID CONNECTION");
     return Optional.empty();
   }
   Response response = new Response();
   if (request.isPresent()) {
     Request r = request.get();
     response.key = r.key;
     response.table = r.table;
     try {
       final Table htable = connection.getTable(TableName.valueOf(r.table));
       Result result = htable.get(new Get(r.key));
       if (result == null || result.isEmpty()) {
         return Optional.empty();
       }
       r.columns.forEach(
           c ->
               response.columns.add(
                   new Request.Column(
                       c.family,
                       c.qualifier,
                       result.getValue(c.family.getBytes(), c.qualifier.getBytes()))));
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   return Optional.of(response);
 }
 private void updateResult(Result result, Machine machine) {
   int completed = 0, failed = 0, notExecuted = 0, incomplete = 0;
   for (Context context : machine.getContexts()) {
     switch (context.getExecutionStatus()) {
       case COMPLETED:
         {
           completed++;
         }
         break;
       case FAILED:
         {
           failed++;
         }
         break;
       case NOT_EXECUTED:
         {
           notExecuted++;
         }
         break;
       case EXECUTING:
         {
           incomplete++;
         }
     }
   }
   result.setCompletedCount(completed);
   result.setFailedCount(failed);
   result.setNotExecutedCount(notExecuted);
   result.setIncompleteCount(incomplete);
   for (MachineException exception : getFailures()) {
     result.addError(getStackTrace(exception.getCause()));
   }
 }
Example #11
0
  /**
   * @param candidate
   * @param digitToFind
   * @return an integer which is 0 if digitToFind is not in candidate and a positive number if it
   *     is.
   */
  protected Result containsX(Integer candidate, Integer digitToFind) {

    int feedback = 0;
    Result r = new Result();

    int thisNumber = candidate >= 0 ? candidate : -candidate; // ?: => Conditional
    // Operator
    int thisDigit;

    int counter = 0;

    while (thisNumber != 0) {
      counter++;
      thisDigit = thisNumber % 10; // Always equal to the last digit of
      // thisNumber
      thisNumber = thisNumber / 10; // Always equal to thisNumber with the
      // last digit chopped off, or 0 if
      // thisNumber is less than 10
      if (thisDigit == digitToFind) {
        feedback = counter;
        r.addFeedback(feedback);
      }
    }

    return r;
  }
Example #12
0
  private void callMethod(Method m, HttpServletRequest request, HttpServletResponse response) {
    try {
      if (m != null) {

        Class<?>[] types = m.getParameterTypes();

        if (m.getReturnType().equals(Result.class)
            && types.length == 1
            && types[0].isAssignableFrom(Request.class)) {
          try {
            Result result = (Result) m.invoke(this, new Request(request));
            result.resultLogic(new Response(response));
          } catch (Exception ex) {
            ex.printStackTrace();
          }
        }

        if (types.length == 2) {
          if (types[0].isAssignableFrom(HttpServletRequest.class)
              && types[1].isAssignableFrom(HttpServletResponse.class)) {
            m.invoke(this, request, response);
          } else if (types[0].isAssignableFrom(Request.class)
              && types[1].isAssignableFrom(Response.class)) {
            m.invoke(this, new Request(request), new Response(response));
          }
        }
      }
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    }
  }
Example #13
0
  private static boolean hasFile(
      dbutil db_util, FileSystem fs, String db_name, String file_id, String file_path)
      throws Exception {
    Get file_id_get = new Get(file_id.getBytes());
    Result file_result = db_util.doGet(db_name, file_id_get);

    KeyValue file_names = file_result.getColumnLatest("d".getBytes(), "filenames".getBytes());
    if (file_names == null) {
      return false;
    }
    String all_files = new String(file_names.getValue());
    String[] files = all_files.split("\n");
    for (String line : files) {
      if (line.equals(file_path)) {
        if (fs.globStatus(new Path(line + "*")).length == 0) {
          Put new_put = new Put(file_id.getBytes());
          new_put.add(
              "d".getBytes(),
              "filenames".getBytes(),
              all_files.replace(file_path + "\n", "").getBytes());
          db_util.doPut(db_name, new_put);
          return false;
        }
        return true;
      }
    }
    return false;
  }
Example #14
0
 private static boolean putFileEntry(
     dbutil db_util,
     FileSystem fs,
     String db_name,
     String file_id,
     String file_path,
     String source)
     throws Exception {
   String all_paths = file_path;
   if (hasFile(db_util, fs, db_name, file_id, file_path)) {
     logger.debug("File already found, putFileEntry aborting");
     return false;
   } else {
     Get file_id_get = new Get(file_id.getBytes());
     Result file_result = db_util.doGet(db_name, file_id_get);
     KeyValue file_names = file_result.getColumnLatest("d".getBytes(), "filenames".getBytes());
     if (file_names != null) {
       String paths = new String(file_names.getValue());
       all_paths = paths + "\n" + file_path;
     }
   }
   Put file_id_put = new Put(file_id.getBytes());
   file_id_put.add("d".getBytes(), "source".getBytes(), source.getBytes());
   if (!source.equals("fullfile")) {
     file_id_put.add("d".getBytes(), "filenames".getBytes(), all_paths.getBytes());
   }
   db_util.doPut(db_name, file_id_put);
   return true;
 }
Example #15
0
 /* (non-Javadoc)
  * @see com.hazelcast.core.MapLoader#loadAllKeys()
  */
 @Override
 public Set<String> loadAllKeys() {
   Set<String> keySet = null;
   if (allowLoadAll) {
     keySet = new HashSet<String>();
     HTableInterface hti = null;
     try {
       hti = pool.getTable(tableName);
       Scan s = new Scan();
       s.addColumn(family, qualifier);
       ResultScanner rs = hti.getScanner(s);
       Result r = null;
       while ((r = rs.next()) != null) {
         String k = new String(r.getRow());
         keySet.add(k);
       }
     } catch (IOException e) {
       LOG.error("IOException while loading all keys", e);
     } finally {
       if (hti != null) {
         pool.putTable(hti);
       }
     }
   }
   return keySet;
 }
Example #16
0
 public Optional<byte[]> get(
     Optional<String> table,
     Optional<String> family,
     Optional<String> qualifier,
     Optional<String> key) {
   if (!valid) {
     Logger.error("CANNOT GET! NO VALID CONNECTION");
     return Optional.empty();
   }
   if (table.isPresent()
       && family.isPresent()
       && qualifier.isPresent()
       && key.isPresent()
       && !key.get().isEmpty()) {
     try {
       final Table htable = connection.getTable(TableName.valueOf(table.get()));
       Result result = htable.get(new Get(key.get().getBytes("UTF8")));
       return Optional.ofNullable(
           result.getValue(family.get().getBytes("UTF8"), qualifier.get().getBytes("UTF8")));
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   return Optional.empty();
 }
Example #17
0
 @Override
 public BaseResult shallowClone() {
   Result newResult = new Result();
   newResult.isSuc = isSuc;
   newResult.recommandProducts = recommandProducts;
   return newResult;
 }
Example #18
0
  /**
   * @param sb the StringBuilder to which to append the XML common to all Assignments
   * @return XML including the mapping of possible Results to hints and fractions
   */
  protected StringBuilder getAssignmentXML(StringBuilder sb) {

    if (hasHint() || hasFraction()) {
      for (Result res1 : Result.values()) {
        String hint = hintForResult.get(res1);
        Float fraction = fractionForResult.get(res1);
        if (hint != null && !hint.isEmpty() || fraction != null) {
          sb.append("\t\t<result name=\"");
          StringUtil.encodeXML(sb, res1.toString());
          sb.append("\" ");
          if (hint != null && !hint.isEmpty()) {
            sb.append("hint=\"");
            StringUtil.encodeXML(sb, hint);
            sb.append("\" ");
          }
          if (fraction != null) {
            sb.append("fraction=\"");
            sb.append(fraction.floatValue());
            sb.append("\" ");
          }
          sb.append("/>\n");
        }
      }
    }
    sb.append("\t</assignment>\n");
    return sb;
  }
 public Result<ActionPlan> deleteActionPlan(String actionPlanKey) {
   Result<ActionPlan> result = createResultForExistingActionPlan(actionPlanKey);
   if (result.ok()) {
     actionPlanService.delete(actionPlanKey, UserSession.get());
   }
   return result;
 }
Example #20
0
 @Override
 protected Result check() throws Exception {
   if (gaia.ping()) {
     return Result.healthy();
   }
   return Result.unhealthy("gaia ping returned something else than 200 OK");
 }
Example #21
0
  public void testTightenDependsOnTightenedMethods() throws Exception {
    addSnippetClassDecl("abstract static class A {}");
    addSnippetClassDecl("static class B extends A {}");
    addSnippetClassDecl("static A test() { return new B(); }");
    // test should be tightened to be static EntryPoint$B test();

    addSnippetClassDecl("static class C {A a;}");
    addSnippetClassDecl("static void fun1(A a) {if (a == null) return;}");
    addSnippetClassDecl("static A fun2() { return test(); }"); // tighten method return type
    Result result =
        optimize(
            "void",
            "A a = test();" // tighten local varialbe.
                + "C c = new C(); c.a = test();" // tighten field
                + "fun1(test());" // tighten parameter
            );
    assertEquals("static EntryPoint$B fun2();\n", result.findMethod("fun2").toString());
    assertEquals(
        "EntryPoint$B a",
        OptimizerTestBase.findLocal(result.findMethod(MAIN_METHOD_NAME), "a").toString());
    assertEquals(
        "EntryPoint$B a",
        OptimizerTestBase.findField(result.findClass("EntryPoint$C"), "a").toString());
    assertEquals("static void fun1(EntryPoint$B a);\n", result.findMethod("fun1").toString());
  }
Example #22
0
  @Override
  public Set<Element> get(Object key) {
    Get get = new Get(ByteArraySerializer.fromObject(key));
    Result result;
    try {
      result = backingTable.get(get);
    } catch (IOException e) {
      LOG.severe("Cannot get from backing table");
      e.printStackTrace();
      return null;
    }

    NavigableMap<byte[], byte[]> map = result.getFamilyMap(Bytes.toBytes(VALUES));
    if (null == map) return null;

    HashSet<Element> elementHashSet = new HashSet<Element>();

    for (byte[] byteArray : map.keySet()) {

      if (indexClass.equals(HVertex.class) || indexClass.equals(Vertex.class)) {
        HVertex hVertex = new HVertex(hGraph);
        hVertex.setId(byteArray);
        elementHashSet.add(hVertex);
      } else {
        final HEdge hEdge = new HEdge(hGraph);
        hEdge.setId(byteArray);
        elementHashSet.add(hEdge);
      }
    }

    return elementHashSet;
  }
Example #23
0
  @Override
  @SuppressWarnings("unchecked")
  public <U extends IValue, V extends IValue> Result<U> subscript(Result<?>[] subscripts) {
    if (subscripts.length > 1) {
      throw new UnsupportedSubscriptArityError(getType(), subscripts.length, ctx.getCurrentAST());
    }
    Result<IValue> subsBase = (Result<IValue>) subscripts[0];
    if (subsBase == null)
      /*
       * Wild card not allowed as tuple subscript
       */
      throw new UnsupportedSubscriptError(type, null, ctx.getCurrentAST());
    if (!subsBase.getType().isIntegerType()) {
      throw new UnsupportedSubscriptError(
          getTypeFactory().integerType(), subsBase.getType(), ctx.getCurrentAST());
    }
    IInteger index = (IInteger) subsBase.getValue();
    if (index.intValue() >= getValue().arity()) {
      throw RuntimeExceptionFactory.indexOutOfBounds(
          index, ctx.getCurrentAST(), ctx.getStackTrace());
    }

    Type elementType = getType().getFieldType(index.intValue());
    IValue element = getValue().get(index.intValue());
    return makeResult(elementType, element, ctx);
  }
Example #24
0
 @Override
 public Result performTest() {
   final String value = input.getText().toString();
   // 当输入内容为空时,如果第一个校验模式不是“Required”,则跳过后面的配置。
   final ValuePatternMeta first = patterns.get(0);
   if (TextUtils.isEmpty(value) && !ValuePattern.Required.equals(first.pattern)) {
     return Result.passed(null);
   }
   final String inputKey = input.getClass().getSimpleName() + "@{" + input.getHint() + "}";
   for (ValuePatternMeta meta : patterns) {
     meta.performLazyLoader();
     final AbstractValuesTester tester = findTester(meta);
     final boolean passed = tester.performTest(value);
     if (!passed) {
       FireEyeEnv.log(
           TAG,
           tester.getName()
               + " :: "
               + inputKey
               + " -> passed: NO, value: "
               + value
               + ", message: "
               + meta.getMessage());
       // 如果校验器发生异常,取异常消息返回
       String message = tester.getExceptionMessage();
       if (message == null) message = meta.getMessage();
       return Result.reject(message, value);
     } else {
       FireEyeEnv.log(
           TAG, tester.getName() + " :: " + inputKey + " -> passed: YES, value: " + value);
     }
   }
   FireEyeEnv.log(TAG, inputKey + " -> passed: YES, value: " + value);
   return Result.passed(value);
 }
  /**
   * Saves the highscores. Deletes all highscores that are not in TOP 10 highscores.
   *
   * @param highscores The highscores.
   */
  public void addHighscores(List<Result> highscores) {
    SQLiteDatabase database = dataOpenHelper.getWritableDatabase();

    try {
      for (Result result : highscores) {
        ContentValues values = new ContentValues();
        values.put(HIGHSCORES_COLUMN_NAME, result.getName());
        values.put(HIGHSCORES_COLUMN_SCORE, result.getScore());
        database.insert(HIGHSCORES_TABLE_NAME, null, values);

        database.delete(
            HIGHSCORES_TABLE_NAME,
            "((SELECT COUNT(*) FROM "
                + HIGHSCORES_TABLE_NAME
                + ") > 10 AND "
                + HIGHSCORES_COLUMN_SCORE
                + " < (SELECT "
                + HIGHSCORES_COLUMN_SCORE
                + " FROM "
                + HIGHSCORES_TABLE_NAME
                + " ORDER BY "
                + HIGHSCORES_COLUMN_SCORE
                + " DESC LIMIT 1 OFFSET 9))",
            null);
      }
    } finally {
      database.close();
    }
  }
 /** @return create dialog result object basing on the dialog state */
 private Result createResult() {
   Result rc = new Result();
   String name = myNameTextField.getText().trim();
   if (myTarget == null) {
     rc.target = myConfig.createConfiguration(name);
   } else {
     rc.target = myTarget;
     rc.target.setName(name);
   }
   rc.changes = new ArrayList<Change>(myChangesTree.getIncludedChanges());
   for (BranchDescriptor d : myBranches) {
     if (d.root != null) {
       if (!StringUtil.isEmpty(d.newBranchName)) {
         final String ref = d.referenceToCheckout.trim();
         rc.referencesToUse.put(d.root, Pair.create(ref, d.referencesToSelect.contains(ref)));
         rc.target.setReference(d.root.getPath(), d.newBranchName.trim());
         rc.checkoutNeeded.add(d.root);
       } else {
         String ref = d.referenceToCheckout.trim();
         if (!d.referencesToSelect.contains(ref)) {
           ref = myConfig.detectTag(d.root, ref);
         }
         rc.target.setReference(d.root.getPath(), ref);
         if (!d.referenceToCheckout.equals(d.currentReference)) {
           rc.checkoutNeeded.add(d.root);
         }
       }
     }
   }
   return rc;
 }
  @Test
  public void createTransactionFromTransparentRedirectSpecifyingDescriptor() {
    TransactionRequest request =
        new TransactionRequest()
            .amount(TransactionAmount.AUTHORIZE.amount)
            .creditCard()
            .number(CreditCardNumber.VISA.number)
            .expirationDate("05/2009")
            .done();

    TransactionRequest trParams =
        new TransactionRequest()
            .type(Transaction.Type.SALE)
            .descriptor()
            .name("123*123456789012345678")
            .phone("3334445555")
            .done();

    String queryString =
        TestHelper.simulateFormPostForTR(
            gateway, trParams, request, gateway.transparentRedirect().url());
    Result<Transaction> result = gateway.transparentRedirect().confirmTransaction(queryString);

    assertTrue(result.isSuccess());
    Transaction transaction = result.getTarget();
    assertEquals("123*123456789012345678", transaction.getDescriptor().getName());
    assertEquals("3334445555", transaction.getDescriptor().getPhone());
  }
Example #28
0
  /*
   * (non-Javadoc)
   *
   * @see com.hazelcast.core.MapLoader#load(java.lang.Object)
   */
  @Override
  public String load(String key) {
    String retval = null;
    if (allowLoad) {
      HTableInterface table = null;
      try {
        Get g = new Get(Bytes.toBytes(key));
        table = pool.getTable(tableName);
        Result r = table.get(g);
        byte[] value = r.getValue(family, qualifier);
        if (value != null) {
          if (outputFormatType == StoreFormatType.SMILE) {
            retval = jsonSmileConverter.convertFromSmile(value);
          } else {
            retval = new String(value);
          }
        }
      } catch (IOException e) {
        LOG.error("Value did not exist for row: " + key, e);
      } finally {
        if (pool != null && table != null) {
          pool.putTable(table);
        }
      }
    }

    return retval;
  }
  @Override
  public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener)
      throws InterruptedException, IOException {

    Result result = build.getResult();
    if (result == null) {
      result = Result.SUCCESS;
    }

    String packIdString = getPackageId(build, listener);
    PackId packId = PackId.parsePid(packIdString);
    if (packId == null) {
      listener.fatalError("Failed to parse Package ID: %s%n", packIdString);
      return false;
    }

    String wspFilterString = getWspFilter(build, listener);
    WspFilter filter = WspFilter.parseSimpleSpec(wspFilterString);

    GraniteClientConfig clientConfig =
        new GraniteClientConfig(
            getBaseUrl(build, listener), credentialsId, requestTimeout, serviceTimeout, waitDelay);

    BuildPackageCallable callable =
        new BuildPackageCallable(clientConfig, listener, packId, filter, download);

    final String fLocalDirectory = getLocalDirectory(build, listener);
    result = result.combine(build.getWorkspace().child(fLocalDirectory).act(callable));

    return result.isBetterOrEqualTo(Result.UNSTABLE);
  }
  /**
   * Get Journal Entries.
   *
   * @param userId The ID of the user whose e-journal entries are being retrieved.
   * @return all of the user's notary e-journal entries.
   */
  public List<com.silanis.esl.sdk.NotaryJournalEntry> getJournalEntries(String userId) {
    List<com.silanis.esl.sdk.NotaryJournalEntry> result =
        new ArrayList<com.silanis.esl.sdk.NotaryJournalEntry>();
    String path =
        template.urlFor(UrlTemplate.NOTARY_JOURNAL_PATH).replace("{userId}", userId).build();

    try {
      String stringResponse = client.get(path);
      Result<com.silanis.esl.api.model.NotaryJournalEntry> apiResponse =
          JacksonUtil.deserialize(
              stringResponse,
              new TypeReference<Result<com.silanis.esl.api.model.NotaryJournalEntry>>() {});
      for (com.silanis.esl.api.model.NotaryJournalEntry apiNotaryJournalEntry :
          apiResponse.getResults()) {
        result.add(
            new NotaryJournalEntryConverter(apiNotaryJournalEntry).toSDKNotaryJournalEntry());
      }
      return result;

    } catch (RequestException e) {
      throw new EslException("Could not get Journal Entries.", e);
    } catch (Exception e) {
      throw new EslException("Could not get Journal Entries." + " Exception: " + e.getMessage());
    }
  }