congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Contract.getId
Code IndexAdd Tabnine to your IDE (free)

How to use
getId
method
in
com.icodici.universa.contract.Contract

Best Java code snippets using com.icodici.universa.contract.Contract.getId (Showing top 20 results out of 315)

origin: UniversaBlockchain/universa

/**
 * Direct add the subItem. Not recommended as {@link #setContract(Contract)} already does it for all subItems.
 * Use it to add subItems not mentioned in the added contracts.
 *
 * @param subItem is {@link Contract} for adding
 */
public void addSubItem(Contract subItem) {
  if (!subItems.containsKey(subItem.getId())) {
    packedBinary = null;
    subItems.put(subItem.getId(), subItem);
  }
}
origin: UniversaBlockchain/universa

/**
 * Direct add the referenced items. Use it to add references not mentioned in the added contracts.
 *
 * @param referencedItem is {@link Contract} for adding
 */
public void addReferencedItem(Contract referencedItem) {
  if (!referencedItems.containsKey(referencedItem.getId())) {
    packedBinary = null;
    referencedItems.put(referencedItem.getId(), referencedItem);
  }
}
origin: UniversaBlockchain/universa

final void cleanUp() {
  // we should avoid creating an object for each check:
  Instant now = Instant.now();
  environmetsExpiration.keySet().forEach(envId -> {
    if(environmetsExpiration.get(envId).isBefore(now)) {
      environmetsExpiration.remove(envId);
      environemtsByContract.remove(environemtsById.remove(envId).getContract().getId());
    }
  });
}
origin: UniversaBlockchain/universa

/**
 * If {@link UnsName} references to origin contract, this contract should be placed into UnsContract with this method.
 * @param contract
 */
public void addOriginContract(Contract contract) {
  originContracts.put(contract.getOrigin() != null ? contract.getOrigin() : contract.getId(),contract);
}
origin: UniversaBlockchain/universa

private static void doShowId() throws Exception {
  String contractFile = (String) options.valueOf("id");
  Contract c = Contract.fromPackedTransaction(Files.readAllBytes(Paths.get(contractFile)));
  reporter.message(c.getId().toBase64String());
  finish();
}
origin: UniversaBlockchain/universa

public JSApiRevisionStorage getRevisionStorage() {
  if (scriptParameters.checkPermission(JSApiScriptParameters.ScriptPermissions.PERM_REVISION_STORAGE))
    return new JSApiRevisionStorage(this.currentContract.getId(), this.currentContract.getParent());
  throw new IllegalArgumentException("access denied: missing permission " + JSApiScriptParameters.ScriptPermissions.PERM_REVISION_STORAGE.toString());
}
origin: UniversaBlockchain/universa

  @Override
  public void run() {
    System.out.println("-----------nodes state--------------");
    for (Node n : nodesMap_s.values()) {
      ItemResult r = n.checkItem(contract.getId());
      System.out.println("Node: " + n.toString() + " state: " + r.state);
    }
  }
}, 0, 1000);
origin: UniversaBlockchain/universa

public void checkSimplePack(TransactionPack tp) {
  assertEquals(3, tp.getSubItems().size());
  assertEquals(c.getId(), tp.getContract().getId());
  Set<HashId> rids = c.getRevokingItems().stream().map(x->x.getId()).collect(Collectors.toSet());
  Set<HashId> nids = c.getNewItems().stream().map(x->x.getId()).collect(Collectors.toSet());
  assertTrue(rids.contains(r0.getId()));
  assertTrue(nids.contains(n0.getId()));
  assertTrue(nids.contains(n1.getId()));
}
origin: UniversaBlockchain/universa

  @Override
  public void run() {
    ItemResult r = node.checkItem(contract.getId());
    System.out.println("Complex contract state: " + r.state);
    if(r.state == ItemState.DECLINED) ae.fire();
  }
}, 0, 500);
origin: UniversaBlockchain/universa

  @Override
  public void run() {
    ItemResult r = node.checkItem(contract.getId());
    System.out.println("Complex contract state: " + r.state);
    if(r.state == ItemState.APPROVED) ae.fire();
  }
}, 0, 500);
origin: UniversaBlockchain/universa

  @Override
  public void run() {
    if( ItemState.UNDEFINED == node.checkItem(c.getId()).state)
      ae.fire();
  }
}, 100, 500);
origin: UniversaBlockchain/universa

  @Override
  public void run() {
    if( ItemState.UNDEFINED == node.checkItem(c.getId()).state)
      ae.fire();
  }
}, 100, 500);
origin: UniversaBlockchain/universa

protected synchronized void destroyCurrentFromAllNodesIfExists(Contract finalC) {
  for (Node nodeS : nodesMap.values()) {
    StateRecord r = nodeS.getLedger().getRecord(finalC.getId());
    if (r != null) {
      r.destroy();
    }
  }
}
origin: UniversaBlockchain/universa

  @Override
  public void run() {
    ItemResult r = node.checkItem(parcel.getPayloadContract().getId());
    System.out.println("Complex contract state: " + r.state);
    if(r.state == ItemState.DECLINED) ae.fire();
  }
}, 0, 500);
origin: UniversaBlockchain/universa

protected synchronized Parcel registerWithNewParcel(Contract c) throws Exception {
  Set<PrivateKey> stepaPrivateKeys = new HashSet<>();
  stepaPrivateKeys.add(new PrivateKey(Do.read(ROOT_PATH + "keys/stepan_mamontov.private.unikey")));
  Parcel parcel = createParcelWithClassU(c, stepaPrivateKeys);
  System.out.println("register  parcel: " + parcel.getId() + " " + parcel.getPaymentContract().getId() + " " + parcel.getPayloadContract().getId());
  node.registerParcel(parcel);
  synchronized (uContractLock) {
    uContract = parcel.getPaymentContract();
  }
  return parcel;
}
origin: UniversaBlockchain/universa

@Test(timeout = 15000)
public void resyncOther() throws Exception {
  Contract c = new Contract(TestKeys.privateKey(0));
  c.seal();
  addToAllLedgers(c, ItemState.PENDING_POSITIVE);
  node.getLedger().getRecord(c.getId()).destroy();
  assertEquals(ItemState.UNDEFINED, node.checkItem(c.getId()).state);
  node.resync(c.getId());
  assertEquals(ItemState.PENDING, node.checkItem(c.getId()).state);
  assertEquals(ItemState.UNDEFINED, node.waitItem(c.getId(), 12000).state);
}
origin: UniversaBlockchain/universa

@Test(timeout = 15000)
public void resyncApproved() throws Exception {
  Contract c = new Contract(TestKeys.privateKey(0));
  c.seal();
  addToAllLedgers(c, ItemState.APPROVED);
  node.getLedger().getRecord(c.getId()).destroy();
  assertEquals(ItemState.UNDEFINED, node.checkItem(c.getId()).state);
  node.resync(c.getId());
  assertEquals(ItemState.APPROVED, node.waitItem(c.getId(), 15000).state);
}
origin: UniversaBlockchain/universa

@Test(timeout = 15000)
public void resyncDeclined() throws Exception {
  Contract c = new Contract(TestKeys.privateKey(0));
  c.seal();
  addToAllLedgers(c, ItemState.DECLINED);
  node.getLedger().getRecord(c.getId()).destroy();
  assertEquals(ItemState.UNDEFINED, node.checkItem(c.getId()).state);
  node.resync(c.getId());
  assertEquals(ItemState.DECLINED, node.waitItem(c.getId(), 12000).state);
}
origin: UniversaBlockchain/universa

public synchronized Parcel createParcelWithFreshU(Contract c, Set<PrivateKey> keys) throws Exception {
  Set<PublicKey> ownerKeys = new HashSet();
  keys.stream().forEach(key -> ownerKeys.add(key.getPublicKey()));
  Contract stepaU = InnerContractsService.createFreshU(100000000, ownerKeys);
  stepaU.check();
  //stepaU.setIsU(true);
  stepaU.traceErrors();
  node.registerItem(stepaU);
  ItemResult itemResult = node.waitItem(stepaU.getId(), 18000);
  assertEquals(ItemState.APPROVED, itemResult.state);
  return ContractsService.createParcel(c, stepaU, 150, keys);
}
origin: UniversaBlockchain/universa

@Test(timeout = 90000)
public void checkPayment_originMismatch() throws Exception {
  Contract payment = checkPayment_preparePaymentContract(checkPayment_preparePrivateKeys());
  final Field field2 = payment.getRevoking().get(0).getState().getClass().getDeclaredField("origin");
  field2.setAccessible(true);
  field2.set(payment.getRevoking().get(0).getState(), payment.getId());
  boolean res = payment.paymentCheck(config.getUIssuerKeys());
  payment.traceErrors();
  assertFalse(res);
}
com.icodici.universa.contractContractgetId

Javadoc

Get the id of the contract

Popular methods of Contract

  • <init>
    Extract old, deprecated v2 self-contained binary partially unpacked by the TransactionPack, and fill
  • addNewItems
    Add one or more siblings to the contract. Note that those must be sealed before calling #seal() or #
  • addSignerKey
    Add private key to keys contract binary to be signed with when sealed next time. It is called before
  • getExpiresAt
    Get contract expiration time
  • getPackedTransaction
    Pack the contract to the most modern .unicon format, same as TransactionPack#pack(). Uses bounded Tr
  • registerRole
    Register new role. Name must be unique otherwise existing role will be overwritten
  • seal
    Seal contract to binary. This call adds signatures from #getKeysToSignWith()
  • addSignatureToSeal
    Add signature to sealed (before) contract. Do not deserializing or changing contract bytes, but will
  • check
  • createRevision
    Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contr
  • fromDslFile
    Create contract importing its parameters with passed .yaml file. No signatures are added automatical
  • fromPackedTransaction
    Main .unicon read routine. Load any .unicon version and construct a linked Contract with counterpart
  • fromDslFile,
  • fromPackedTransaction,
  • getCreatedAt,
  • getDefinition,
  • getErrors,
  • getKeysToSignWith,
  • getLastSealedBinary,
  • getNew,
  • getNewItems

Popular in Java

  • Reactive rest calls using spring rest template
  • getContentResolver (Context)
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now