Codota Logo
Contract.getReferences
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain Contract
private void myMethod () {
Contract c =
  • Codota Iconnew Contract()
  • Codota IconString fileName;Contract.fromDslFile(fileName)
  • Codota IconParcel parcel;parcel.getPaymentContract()
  • Smart code suggestions by Codota
}
origin: UniversaBlockchain/universa

/**
 * Get contract reference with given name
 * @param name name of the reference
 * @return found reference or null
 */
public Reference findReferenceByName(String name) {
  if (getReferences() == null)
    return null;
  return getReferences().get(name);
}
origin: UniversaBlockchain/universa

public void removeReferencedItem(Contract removed) {
  for (Reference ref: getReferences().values())
    ref.matchingItems.remove(removed);
  if (transactional != null && transactional.references != null)
    for (Reference ref: transactional.references)
      ref.matchingItems.remove(removed);
  if (definition != null && definition.references != null)
    for(Reference ref : definition.references)
      ref.matchingItems.remove(removed);
  if (state != null && state.references != null)
    for(Reference ref : state.references)
      ref.matchingItems.remove(removed);
  newItems.remove(removed);
  revokingItems.remove(removed);
}
origin: UniversaBlockchain/universa

/**
 * Transfers payment contract to new owner on the result of escrow.
 * Use payment contract that was added to external escrow contract by
 * {@link ContractsService#addPaymentToEscrowContract(Contract, Contract, Collection, Collection, Collection)} or
 * was modified by {@link ContractsService#modifyPaymentForEscrowContract(Contract, Contract, Collection, Collection, Collection)}.
 * Executor can take the payment contract, if internal escrow contract are completed.
 * Customer can take the payment contract, if internal escrow contract are canceled.
 * For registration payment contract (returned by this method) need to add result internal escrow contract by
 * {@link TransactionPack#addReferencedItem(Contract)}.
 *
 * @param newOwnerKeys are private keys of new owner of payment
 * @param payment contract to take by new owner. Must be registered for creation new revision
 *
 * @return new revision of payment contract with new owner
 */
public static Contract takeEscrowPayment(Collection<PrivateKey> newOwnerKeys, Contract payment) {
  Contract revisionPayment = payment.createRevision(newOwnerKeys);
  // set new owner
  revisionPayment.setOwnerKeys(newOwnerKeys);
  // remove escrow references from Contract.references (from transactional section references removed automatically)
  revisionPayment.getReferences().remove("return_payment_to_customer");
  revisionPayment.getReferences().remove("send_payment_to_executor");
  revisionPayment.seal();
  return revisionPayment;
}
origin: UniversaBlockchain/universa

private boolean checkReferencedItems(Map<HashId, Contract> neighbourContracts, boolean roleRefsOnly) throws Quantiser.QuantiserException {
  validRoleReferences.clear();
  if (getReferences().size() == 0) {
  for (final Reference rm : getReferences().values()) {
origin: UniversaBlockchain/universa

refContract2.check();
assertTrue(refContract1.getReferences().get("ref_cont").matchingItems.contains(refContract1));
assertTrue(refContract1.getReferences().get("ref_cont").matchingItems.contains(contract2));
assertFalse(refContract1.getReferences().get("ref_cont").matchingItems.contains(contract3));
assertFalse(refContract1.getReferences().get("ref_cont2").matchingItems.contains(refContract1));
assertFalse(refContract1.getReferences().get("ref_cont2").matchingItems.contains(contract2));
assertTrue(refContract1.getReferences().get("ref_cont2").matchingItems.contains(contract3));
assertTrue(refContract1.getReferences().get("ref_cont_inherit").matchingItems.contains(refContract1));
assertFalse(refContract1.getReferences().get("ref_cont_inherit").matchingItems.contains(contract2));
assertFalse(refContract1.getReferences().get("ref_cont_inherit").matchingItems.contains(contract3));
assertTrue(refContract2.getReferences().get("ref_cont3").matchingItems.contains(contract1));
assertTrue(refContract2.getReferences().get("ref_cont3").matchingItems.contains(contract2));
assertTrue(refContract2.getReferences().get("ref_cont3").matchingItems.contains(refContract2));
assertTrue(refContract2.getReferences().get("ref_cont4").matchingItems.contains(contract1));
assertFalse(refContract2.getReferences().get("ref_cont4").matchingItems.contains(contract2));
assertTrue(refContract2.getReferences().get("ref_cont4").matchingItems.contains(refContract2));
origin: UniversaBlockchain/universa

for (int i = 0; i < getReferences().size(); i++) {
  quantiser.addWorkCost(Quantiser.QuantiserProcesses.PRICE_CHECK_REFERENCED_VERSION);
origin: UniversaBlockchain/universa

Binder conditions = contract1.getReferences().get("ref_string").getConditions();
List<Object> condList = conditions.getList(all_of.name(), null);
    "           MexOc3/kPEEdfjH/GcJU0Mw6DgoY8QgfaNwXcFbBUvf3TwZ5Mysf21OLHH13g8gzREm+h8c=\"==ref.definition.issuer");
condList.add("\"1:25\"==this.state.branchId");
contract1.getReferences().get("ref_string").setConditions(conditions);
conditions = contract1.getReferences().get("ref_time").getConditions();
condList = conditions.getList(all_of.name(), null);
contract1.getReferences().get("ref_time").setConditions(conditions);
assertTrue(refContract.getReferences().get("ref_roles").matchingItems.contains(contract2));
System.out.println("Check integer conditions");
assertTrue(refContract.getReferences().get("ref_integer").matchingItems.contains(contract2));
System.out.println("Check float conditions");
assertTrue(refContract.getReferences().get("ref_float").matchingItems.contains(contract2));
System.out.println("Check string conditions");
assertTrue(refContract.getReferences().get("ref_string").matchingItems.contains(contract2));
System.out.println("Check boolean conditions");
assertTrue(refContract.getReferences().get("ref_boolean").matchingItems.contains(contract2));
System.out.println("Check inherited conditions");
assertTrue(refContract.getReferences().get("ref_inherited").matchingItems.contains(contract2));
System.out.println("Check time conditions");
assertTrue(refContract.getReferences().get("ref_time").matchingItems.contains(contract2));
System.out.println("Check ref_hashes conditions");
assertTrue(refContract.getReferences().get("ref_hashes").matchingItems.contains(contract2));
System.out.println("Check ref_bigdecimal conditions");
assertTrue(refContract.getReferences().get("ref_bigdecimal").matchingItems.contains(contract2));
origin: UniversaBlockchain/universa

c.traceErrors();
System.out.println("c " + " isok=" + c.isOk() + " new: " + c.getNew().size() + " rev: " + c.getRevoking().size() + " ref: " + c.getReferences().size() + " signs:" + c.getSealedByKeys().size() + " data:" + c.getStateData() + " id:" + c.getId());
Contract cNew1 = c.getNew().get(0);
Contract cNew2 = c.getNew().get(1);
System.out.println("cNew1 new: " + cNew1.getNew().size() + " rev: " + cNew1.getRevoking().size() + " ref: " + cNew1.getReferences().size() + " signs:" + cNew1.getSealedByKeys().size() + " data:" + cNew1.getStateData() + " id:" + cNew1.getId());
System.out.println("cNew2 new: " + cNew2.getNew().size() + " rev: " + cNew2.getRevoking().size() + " ref: " + cNew2.getReferences().size() + " signs:" + cNew2.getSealedByKeys().size() + " data:" + cNew2.getStateData() + " id:" + cNew2.getId());
Contract cRevoke1 = cNew1.getRevoking().get(0);
Contract cRevoke2 = cNew2.getRevoking().get(0);
System.out.println("cRevoke1 new: " + cRevoke1.getNew().size() + " rev: " + cRevoke1.getRevoking().size() + " ref: " + cRevoke1.getReferences().size() + " signs:" + cRevoke1.getSealedByKeys().size() + " data:" + cRevoke1.getStateData() + " id:" + cRevoke1.getId());
System.out.println("cRevoke2 new: " + cRevoke2.getNew().size() + " rev: " + cRevoke2.getRevoking().size() + " ref: " + cRevoke2.getReferences().size() + " signs:" + cRevoke2.getSealedByKeys().size() + " data:" + cRevoke2.getStateData() + " id:" + cRevoke2.getId());
System.out.println("cNew1_1 new: " + cNew1_1.getNew().size() + " rev: " + cNew1_1.getRevoking().size() + " ref: " + cNew1_1.getReferences().size() + " signs:" + cNew1_1.getSealedByKeys().size() + " data:" + cNew1_1.getStateData() + " id:" + cNew1_1.getId());
origin: UniversaBlockchain/universa

System.out.println(newDelorean.getReferences().values().iterator().next().transactional_id);
System.out.println(newLamborghini.getReferences().values().iterator().next().transactional_id);
origin: UniversaBlockchain/universa

remRefContract2.check();
assertTrue(remRefContract1.getReferences().get("certification_contract_def").matchingItems.contains(contractCertificate));
assertTrue(remRefContract1.getReferences().get("certification_contract_state").matchingItems.contains(contractCertificate));
assertFalse(remRefContract1.getReferences().get("certification_contract_def").matchingItems.contains(contractCertificate));
assertFalse(remRefContract1.getReferences().get("certification_contract_state").matchingItems.contains(contractCertificate));
assertTrue(remRefContract2.getReferences().get("certification_contract_def").matchingItems.contains(contractCertificate));
assertTrue(remRefContract2.getReferences().get("certification_contract_state").matchingItems.contains(contractCertificate));
assertFalse(remRefContract2.getReferences().get("certification_contract_def").matchingItems.contains(contractCertificate));
assertFalse(remRefContract2.getReferences().get("certification_contract_state").matchingItems.contains(contractCertificate));
origin: UniversaBlockchain/universa

Binder conditions = refContract.getReferences().get("test_ref4").getConditions();
List<Object> condList = conditions.getList(all_of.name(), null);
condList.add("\"string\"==this.state.data.string4");
refContract.getReferences().get("test_ref4").setConditions(conditions);
conditions = refContract.getReferences().get("test_ref3").getConditions();
condList = conditions.getList(all_of.name(), null);
assertEquals(parsed.getIntOrThrow("operator"), 3);
conditions = refContract.getReferences().get("test_ref4").getConditions();
condList = conditions.getList(all_of.name(), null);
origin: UniversaBlockchain/universa

newListConditions.add("inherits this.definition.references.bank_certificate");
llcProperty2.getState().getReferences().remove(llcProperty2.getReferences().get("account_in_bank_certificate"));
llcProperty2.getReferences().remove("account_in_bank_certificate");
origin: UniversaBlockchain/universa

llcProperty.getReferences().get("bank_certificate").matchingItems.clear();
llcProperty.getDefinition().getReferences().get(0).matchingItems.clear();
origin: UniversaBlockchain/universa

ref.type = Reference.TYPE_EXISTING_DEFINITION;
ref.addMatchingItem(new Contract());
c3.getRevoking().get(0).getReferences().put(ref.name, ref);
origin: UniversaBlockchain/universa

llcProperty3.getState().getReferences().remove(llcProperty3.getReferences().get("temp_certification_contract"));
llcProperty3.getReferences().remove("temp_certification_contract");
origin: UniversaBlockchain/universa

/**
 * Check serialization and deserialization contract with references
 * @throws Exception
 */
@Test
public void checkReferenceSerialization() throws Exception {
  Contract contract = Contract.fromDslFile(rootPath + "simple_root_contract_with_references.yml");
  assertEquals(contract.findReferenceByName("ref_cont").getComment(), "ref_comment");
  contract.findReferenceByName("ref_cont3").setComment("ref_comment3");
  contract.seal();
  Binder b = BossBiMapper.serialize(contract);
  Contract desContract = DefaultBiMapper.deserialize(b);
  assertEquals(desContract.findReferenceByName("ref_cont").getComment(), "ref_comment");
  assertEquals(desContract.findReferenceByName("ref_cont3").getComment(), "ref_comment3");
  assertNull(desContract.findReferenceByName("ref_cont2").getComment());
  for (Reference ref: contract.getReferences().values()) {
    Reference desRef = desContract.findReferenceByName(ref.getName());
    assertTrue(desRef != null);
    assertEquals(ref.getConditions(), desRef.getConditions());
  }
}
origin: UniversaBlockchain/universa

for (Reference ref: originContract.getReferences().values()) {
  Reference desRef = checkingContract.findReferenceByName(ref.getName());
  assertTrue(desRef != null);
com.icodici.universa.contractContractgetReferences

Javadoc

Get map contract's references

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

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now