Tabnine Logo
Contract.get
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: UniversaBlockchain/universa

/**
 * Check matching fields of two contracts.
 * @param changed contract to check
 * @param c contract to check
 * @return true if all fields are matching, else false
 */
public boolean validateMergeFields(Contract changed, Contract c) {
  // check matching fields
  for (String name : mergeFields) {
    Object v1 = changed.get(name);
    Object v2 = c.get(name);
    if (!v1.equals(v2))
      return false;
  }
  return true;
}
origin: UniversaBlockchain/universa

contract.getRevoking().forEach(c -> {
  Decimal x;
  if(c.get(fieldName) != null) {
    x = new Decimal(c.get(fieldName).toString());
    values.add(x);
    if (outcome.length() > 0)
news.forEach(c -> {
  Decimal x;
  if(c.get(fieldName) != null) {
    if( c != contract )
      outcome.append(" + ");
    x = new Decimal(c.get(fieldName).toString());
    outcome.append(x.toString());
    values.add(x.negate());
origin: UniversaBlockchain/universa

@Test
public void getPath() throws Exception {
  Contract c = Contract.fromDslFile(rootPath + "simple_root_contract.yml");
  c.seal();
  assertNull(c.get("state.data.hello.world"));
  assertAlmostSame(ZonedDateTime.now(), c.get("definition.created_at"));
  assertAlmostSame(ZonedDateTime.now(), c.get("state.created_at"));
  assertEquals(c.getId(), c.get("id"));
  assertEquals(c.getId(), c.get("state.origin"));
  assertEquals(c.getId(), c.get("definition.origin"));
  assertEquals("access certificate", c.get("definition.data.type"));
}
origin: UniversaBlockchain/universa

assertEquals(NSmartContract.SmartContractType.SLOT1.name(), smartContract.get("definition.extended_type"));
origin: UniversaBlockchain/universa

assertEquals(NSmartContract.SmartContractType.FOLLOWER1.name(), desContract.get("definition.extended_type"));
assertEquals(NSmartContract.SmartContractType.FOLLOWER1.name(), copiedContract.get("definition.extended_type"));
origin: UniversaBlockchain/universa

  @Test
  public void goodSmartContractFromDSL() throws Exception {
    Contract smartContract = NSmartContract.fromDslFile(ROOT_PATH + "NotarySmartDSLTemplate.yml");
    smartContract.addSignerKeyFromFile(ROOT_PATH + "_xer0yfe2nn1xthc.private.unikey");
    smartContract.seal();
    smartContract.check();
    smartContract.traceErrors();
    assertTrue(smartContract.isOk());

    assertTrue(smartContract instanceof NSmartContract);
    assertTrue(smartContract instanceof NContract);

    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.get("definition.extended_type"));

    registerAndCheckApproved(smartContract);

    ItemResult itemResult = node.waitItem(smartContract.getId(), 8000);
//        assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
//        assertEquals("ok", itemResult.extraDataBinder.getBinder("onUpdateResult").getString("status", null));
  }

origin: UniversaBlockchain/universa

@Test
public void goodNSmartContractFromDSL() throws Exception {
  Contract smartContract = NSmartContract.fromDslFile(rootPath + "NotaryNSmartDSLTemplate.yml");
  smartContract.addSignerKeyFromFile(rootPath + "_xer0yfe2nn1xthc.private.unikey");
  smartContract.seal();
  smartContract.check();
  smartContract.traceErrors();
  assertTrue(smartContract.isOk());
  assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.getDefinition().getExtendedType());
  assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.get("definition.extended_type"));
  assertTrue(smartContract instanceof NSmartContract);
  assertTrue(smartContract instanceof NContract);
}
origin: UniversaBlockchain/universa

Object followerRoles = contract.get(section + ".data." + FOLLOWER_ROLES_FIELD_NAME);
if (((followerRoles != null) && followerRoles instanceof Collection) &&
    (((Collection)followerRoles).stream().anyMatch(r -> {
origin: UniversaBlockchain/universa

assertEquals(NSmartContract.SmartContractType.SLOT1.name(), smartContract.get("definition.extended_type"));
origin: UniversaBlockchain/universa

assertEquals(NSmartContract.SmartContractType.FOLLOWER1.name(), smartContract.get("definition.extended_type"));
origin: UniversaBlockchain/universa

  @Test
  public void goodNSmartContractFromDSL() throws Exception {
    Contract smartContract = NSmartContract.fromDslFile(ROOT_PATH + "NotaryNSmartDSLTemplate.yml");
    smartContract.addSignerKeyFromFile(ROOT_PATH + "_xer0yfe2nn1xthc.private.unikey");
    smartContract.seal();
    smartContract.check();
    smartContract.traceErrors();
    assertTrue(smartContract.isOk());

    assertTrue(smartContract instanceof NSmartContract);
    assertTrue(smartContract instanceof NContract);

    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.get("definition.extended_type"));

    registerAndCheckApproved(smartContract);

    ItemResult itemResult = node.waitItem(smartContract.getId(), 8000);
//        assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
//        assertEquals("ok", itemResult.extraDataBinder.getBinder("onUpdateResult").getString("status", null));
  }

origin: UniversaBlockchain/universa

@Test
public void goodSmartContractFromDSL() throws Exception {
  Contract smartContract = NSmartContract.fromDslFile(rootPath + "NotarySmartDSLTemplate.yml");
  smartContract.addSignerKeyFromFile(rootPath + "_xer0yfe2nn1xthc.private.unikey");
  smartContract.seal();
  smartContract.check();
  smartContract.traceErrors();
  assertTrue(smartContract.isOk());
  assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.getDefinition().getExtendedType());
  assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.get("definition.extended_type"));
  assertTrue(smartContract instanceof NSmartContract);
  assertTrue(smartContract instanceof NContract);
}
origin: UniversaBlockchain/universa

right = rightOperandContract.get(rightOperand);
origin: UniversaBlockchain/universa

assertEquals(NSmartContract.SmartContractType.FOLLOWER1.name(), smartContract.get("definition.extended_type"));
origin: UniversaBlockchain/universa

  @Test
  public void goodNSmartContract() throws Exception {
    final PrivateKey key = new PrivateKey(Do.read(ROOT_PATH + "_xer0yfe2nn1xthc.private.unikey"));
    Contract smartContract = new NSmartContract(key);
    smartContract.seal();
    smartContract.check();
    smartContract.traceErrors();
    assertTrue(smartContract.isOk());

    assertTrue(smartContract instanceof NSmartContract);
    assertTrue(smartContract instanceof NContract);

    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.get("definition.extended_type"));

    registerAndCheckApproved(smartContract);

    ItemResult itemResult = node.waitItem(smartContract.getId(), 8000);
//        assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
//        assertEquals("ok", itemResult.extraDataBinder.getBinder("onUpdateResult").getString("status", null));
  }

origin: UniversaBlockchain/universa

@Test
public void goodSmartContract() throws Exception {
  final PrivateKey key = new PrivateKey(Do.read(rootPath + "_xer0yfe2nn1xthc.private.unikey"));
  Contract smartContract = new NSmartContract(key);
  smartContract.seal();
  smartContract.check();
  smartContract.traceErrors();
  assertTrue(smartContract.isOk());
  assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.getDefinition().getExtendedType());
  assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.get("definition.extended_type"));
  assertTrue(smartContract instanceof NSmartContract);
  assertTrue(smartContract instanceof NContract);
}
origin: UniversaBlockchain/universa

  @Test
  public void goodSmartContract() throws Exception {
    final PrivateKey key = new PrivateKey(Do.read(ROOT_PATH + "_xer0yfe2nn1xthc.private.unikey"));
    Contract smartContract = new NSmartContract(key);
    smartContract.seal();
    smartContract.check();
    smartContract.traceErrors();
    assertTrue(smartContract.isOk());

    assertTrue(smartContract instanceof NSmartContract);
    assertTrue(smartContract instanceof NContract);

    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.get("definition.extended_type"));

    registerAndCheckApproved(smartContract);

    ItemResult itemResult = node.waitItem(smartContract.getId(), 8000);
//        assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
//        assertEquals("ok", itemResult.extraDataBinder.getBinder("onUpdateResult").getString("status", null));
  }

origin: UniversaBlockchain/universa

@Test
public void goodNSmartContract() throws Exception {
  final PrivateKey key = new PrivateKey(Do.read(rootPath + "_xer0yfe2nn1xthc.private.unikey"));
  Contract smartContract = new NSmartContract(key);
  smartContract.seal();
  smartContract.check();
  smartContract.traceErrors();
  assertTrue(smartContract.isOk());
  assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.getDefinition().getExtendedType());
  assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), smartContract.get("definition.extended_type"));
  assertTrue(smartContract instanceof NSmartContract);
  assertTrue(smartContract instanceof NContract);
}
origin: UniversaBlockchain/universa

  @Test
  public void serializeNSmartContract() throws Exception {
    final PrivateKey key = new PrivateKey(Do.read(rootPath + "_xer0yfe2nn1xthc.private.unikey"));
    Contract smartContract = new NSmartContract(key);
    smartContract.seal();
    smartContract.check();
    smartContract.traceErrors();
    assertTrue(smartContract.isOk());

    Binder b = BossBiMapper.serialize(smartContract);
    Contract desContract = DefaultBiMapper.deserialize(b);
    assertSameContracts(smartContract, desContract);
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), desContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), desContract.get("definition.extended_type"));
    assertTrue(desContract instanceof NSmartContract);
    assertTrue(smartContract instanceof NContract);

    Contract copiedContract = smartContract.copy();
    assertSameContracts(smartContract, copiedContract);
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), copiedContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), copiedContract.get("definition.extended_type"));
    assertTrue(copiedContract instanceof NSmartContract);
    assertTrue(smartContract instanceof NContract);
  }
}
origin: UniversaBlockchain/universa

  @Test
  public void serializeSmartContract() throws Exception {
    final PrivateKey key = new PrivateKey(Do.read(rootPath + "_xer0yfe2nn1xthc.private.unikey"));
    Contract smartContract = new NSmartContract(key);
    smartContract.seal();
    smartContract.check();
    smartContract.traceErrors();
    assertTrue(smartContract.isOk());

    Binder b = BossBiMapper.serialize(smartContract);
    Contract desContract = DefaultBiMapper.deserialize(b);
    assertSameContracts(smartContract, desContract);
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), desContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), desContract.get("definition.extended_type"));
    assertTrue(desContract instanceof NSmartContract);
    assertTrue(desContract instanceof NContract);

    Contract copiedContract = smartContract.copy();
    assertSameContracts(smartContract, copiedContract);
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), copiedContract.getDefinition().getExtendedType());
    assertEquals(NSmartContract.SmartContractType.N_SMART_CONTRACT.name(), copiedContract.get("definition.extended_type"));
    assertTrue(copiedContract instanceof NSmartContract);
    assertTrue(copiedContract instanceof NContract);
  }
}
com.icodici.universa.contractContractget

Javadoc

Get the named field in 'dotted' notation, e.g. 'state.data.name', or 'state.origin', 'definition.issuer' and so on.

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
  • getId
    Get the id sealing self if need
  • 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
  • createRevision,
  • fromDslFile,
  • fromPackedTransaction,
  • getCreatedAt,
  • getDefinition,
  • getErrors,
  • getKeysToSignWith,
  • getLastSealedBinary,
  • getNew,
  • getNewItems

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • getContentResolver (Context)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • String (java.lang)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Permission (java.security)
    Legacy security code; do not use.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • CodeWhisperer alternatives
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