@PostConstruct
 public void setup() {
   final String queryString = "SELECT * " + "FROM CATCHMENT c ";
   Query query = em.createNativeQuery(queryString, CatchmentEntity.class);
   List<CatchmentEntity> list = query.getResultList();
   System.out.println(hubs);
   System.out.println(destinations);
   for (CatchmentEntity area : list) {
     System.out.println(area);
     destinations.get(State.valueOf(area.getDestination())).add(State.valueOf(area.getHub()));
     hubs.get(State.valueOf(area.getHub())).add(State.valueOf(area.getDestination()));
   }
 }
 public Shard(Map<String, Object> data) {
   state = State.valueOf((String) data.get("state"));
   id = (Integer) data.get("shard");
   index = (String) data.get("index");
   relocatingNode = (String) data.get("relocating_node");
   node = (String) data.get("node");
   primary = Boolean.TRUE.equals(data.get("primary"));
 }
示例#3
0
  /**
   * Returns the state of the file transfer
   *
   * @return State
   * @see FileTransfer.State
   * @throws RcsPersistentStorageException
   * @throws RcsGenericException
   */
  public State getState() throws RcsPersistentStorageException, RcsGenericException {
    try {
      return State.valueOf(mTransferInf.getState());

    } catch (Exception e) {
      RcsPersistentStorageException.assertException(e);
      throw new RcsGenericException(e);
    }
  }
示例#4
0
  public void restore(BufferedReader reader) throws IOException {
    master = restoreResourceList(reader);

    for (String line = reader.readLine(); !line.isEmpty(); line = reader.readLine()) {
      String[] el = line.split(" ");
      transactions.put(
          Integer.parseInt(el[0]), new Instance(State.valueOf(el[1]), restoreResourceList(reader)));
    }
  }
示例#5
0
    @SuppressWarnings("unchecked")
    @Override
    public void run() throws AuraExecutionException {
      try {
        HttpPost post = getPostMethod();
        HttpResponse response = getHttpClient().execute(post);
        assertEquals(HttpStatus.SC_OK, getStatusCode(response));
        rawResponse = getResponseBody(response);
        assertEquals(
            AuraBaseServlet.CSRF_PROTECT,
            rawResponse.substring(0, AuraBaseServlet.CSRF_PROTECT.length()));
        if (rawResponse.endsWith("/*ERROR*/")) {
          fail("Error response:" + rawResponse);
        }
        Map<String, Object> json =
            (Map<String, Object>)
                new JsonReader().read(rawResponse.substring(AuraBaseServlet.CSRF_PROTECT.length()));
        ArrayList<Map<String, Object>> actions =
            (ArrayList<Map<String, Object>>) json.get("actions");
        for (Map<String, Object> action : actions) {

          this.stateList.add(State.valueOf(action.get("state").toString()));
          this.returnValueList.add(action.get("returnValue"));
          this.errorsList.add((List<Object>) action.get("error"));
        }
        // for legacy uses
        Map<String, Object> action =
            (Map<String, Object>) ((List<Object>) json.get("actions")).get(0);
        this.state = State.valueOf(action.get("state").toString());
        this.returnValue = action.get("returnValue");
        this.errors = (List<Object>) action.get("error");

      } catch (Exception e) {
        throw new AuraExecutionException(e, null);
      }
    }
示例#6
0
 @Override
 protected void initFromCursorHelper(CursorHelper cursorHelper) {
   setId(cursorHelper.getInt(ID));
   try {
     setState(State.valueOf(cursorHelper.getString(STATE)));
   } catch (Exception e) {
     setState(State.UNKNOWN);
   }
   try {
     setLastAttempt(cursorHelper.getLong(ATTEMPT));
   } catch (Exception e) {
     setLastAttempt(UNKNOWN_TIME);
   }
   try {
     setLastSuccessful(cursorHelper.getLong(SUCCESSFUL));
   } catch (Exception e) {
     setLastSuccessful(UNKNOWN_TIME);
   }
   setDescription(cursorHelper.getString(DESCRIPTION));
 }
示例#7
0
 public final State getState() {
   return State.valueOf(this.getStateAsInt());
 }
示例#8
0
 public void setState(String argState) {
   state = State.valueOf(argState);
 }
 private void continueResume(Bundle bundle) {
   if (this.mState != State.INIT) {
     throw new IllegalStateException();
   }
   this.mState = State.valueOf(bundle.getString("state"));
   this.mAddFragmentShown = bundle.getBoolean("add_fragment_shown");
   this.mUserProvidedAddress = (SubscriberInfo) bundle.getParcelable("user_provided_address");
   this.mSavingScreenShown = bundle.getBoolean("saving_dialog_fragment");
   if (this.mSavingScreenShown) {
     finish();
     return;
   }
   setAddressAvailability();
   if (bundle.containsKey("error_dialog")) {
     this.mErrorFragment =
         (CarrierBillingErrorDialog) this.mContext.restoreFragment(bundle, "error_dialog");
     this.mErrorFragment.setOnResultListener(this);
   }
   switch (AnonymousClass5
       .$SwitchMap$com$google$android$finsky$billing$carrierbilling$flow$CreateCarrierBillingFlow$State[
       this.mState.ordinal()]) {
     case com.google
         .android
         .wallet
         .instrumentmanager
         .R
         .styleable
         .WalletImFormEditText_validatorErrorString /*1*/:
     case com.google
         .android
         .wallet
         .instrumentmanager
         .R
         .styleable
         .WalletImFormEditText_validatorRegexp /*2*/:
       if (bundle.containsKey("add_fragment")) {
         this.mAddFragment =
             (AddCarrierBillingFragment) this.mContext.restoreFragment(bundle, "add_fragment");
         this.mAddFragment.setOnResultListener(this);
         return;
       }
       return;
     case com.google
         .android
         .wallet
         .instrumentmanager
         .R
         .styleable
         .WalletImFormEditText_requiredErrorString /*3*/:
       if (bundle.containsKey("edit_fragment")) {
         this.mEditFragment =
             (EditCarrierBillingFragment) this.mContext.restoreFragment(bundle, "edit_fragment");
         this.mEditFragment.setOnResultListener(this);
         return;
       }
       return;
     default:
       if (this.mErrorFragment != null) {
         cancel();
         return;
       } else {
         finish();
         return;
       }
   }
 }