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

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

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

origin: UniversaBlockchain/universa

public String getParent() {
  return this.currentContract.getParent() == null ? null : this.currentContract.getParent().toBase64String();
}
origin: UniversaBlockchain/universa

protected Context getContext() {
  if (context == null) {
    context = new Context(getRevokingItem(getParent()));
    context.siblings.add(this);
    newItems.forEach(i -> {
      if (i.getParent() != null && i.getParent().equals(getParent()))
        context.siblings.add(i);
    });
  }
  return context;
}
origin: UniversaBlockchain/universa

/**
 * Gets complex "id" of current revision
 * @return revision "id" in format ORIGIN/PARENT/REVISION/BRANCH
 */
public String getRevisionId() {
  String parentId = getParent() == null ? "" : (getParent().toBase64String() + "/");
  StringBuilder sb = new StringBuilder(getOrigin().toBase64String() + "/" + parentId + state.revision);
  if (state.branchId != null)
    sb.append("/" + state.branchId.toString());
  return sb.toString();
}
origin: UniversaBlockchain/universa

private boolean searchNewItemWithParent(Approvable item, HashId id) {
  if(item instanceof Contract && ((Contract) item).getParent() != null && ((Contract) item).getParent().equals(id)) {
    return true;
  }
  for(Approvable newItem : item.getNewItems()) {
    if(searchNewItemWithParent(newItem,id)) {
      return true;
    }
  }
  return false;
}
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

private void checkRevokePermissions(Set<Contract> revokes) throws Quantiser.QuantiserException {
  for (Contract rc : revokes) {
    //check if revoking parent => no permission is needed
    if(getParent() != null && rc.getId().equals(getParent()))
      continue;
    if (!rc.isPermitted("revoke", getEffectiveKeys()))
      addError(FORBIDDEN, "revokingItem", "revocation not permitted for item " + rc.getId());
  }
}
origin: UniversaBlockchain/universa

@SuppressWarnings("deprecation") //outdated method. will be replaced with new one soon
private void checkForNetConfig(Contract contract) {
  if (contract.getIssuer().getKeys().stream().anyMatch(key -> config.getNetworkReconfigKeyAddress().isMatchingKey(key))) {
    if(contract.getParent() == null)
      return;
    if(contract.getRevoking().size() == 0 || !contract.getRevoking().get(0).getId().equals(contract.getParent()))
      return;
    Contract parent = contract.getRevoking().get(0);
    if(!checkContractCorrespondsToConfig(parent,network.allNodes())) {
      return;
    }
    if(!checkIfContractContainsNetConfig(contract)) {
      return;
    }
    List<NodeInfo> networkNodes = network.allNodes();
    List contractNodes = (List)DefaultBiMapper.getInstance().deserializeObject(contract.getStateData().get("net_config"));
    contractNodes.stream().forEach(nodeInfo -> {
      if(!networkNodes.contains(nodeInfo)) {
        addNode((NodeInfo) nodeInfo);
      }
      networkNodes.remove(nodeInfo);
    });
    networkNodes.stream().forEach( nodeInfo -> removeNode(nodeInfo));
  }
}
origin: UniversaBlockchain/universa

private void checkChangedContract() throws Quantiser.QuantiserException {
  // get context if not got yet
  getContext();
  Contract parent;
  // if exist siblings for contract (more then itself)
  if(getSiblings().size() > 1) {
    parent = getContext().base;
  } else {
    parent = getRevokingItem(getParent());
  }
  if (parent == null) {
    addError(BAD_REF, "parent", "parent contract must be included");
  } else {
    // checking parent:
    // proper origin
    HashId rootId = parent.getRootId();
    if (!rootId.equals(getRawOrigin())) {
      addError(BAD_VALUE, "state.origin", "wrong origin, should be root");
    }
    if (!getParent().equals(parent.getId()))
      addError(BAD_VALUE, "state.parent", "illegal parent references");
    ContractDelta delta = new ContractDelta(parent, this);
    delta.check();
    checkRevokePermissions(delta.getRevokingItems());
  }
}
origin: UniversaBlockchain/universa

Contract newLamborghini = null;
for (Contract c : swapContract.getNew()) {
  if(c.getParent().equals(delorean.getId())) {
    newDelorean = c;
  if(c.getParent().equals(lamborghini.getId())) {
    newLamborghini = c;
origin: UniversaBlockchain/universa

Contract newLamborghini = null;
for (Contract c : swapContract.getNew()) {
  if(c.getParent().equals(delorean.getId())) {
    newDelorean = c;
  if(c.getParent().equals(lamborghini.getId())) {
    newLamborghini = c;
origin: UniversaBlockchain/universa

if(c.getParent().equals(delorean.getId())) {
  newDelorean = c;
origin: UniversaBlockchain/universa

if(c.getParent().equals(delorean.getId())) {
  newDelorean = c;
origin: UniversaBlockchain/universa

if(c.getParent().equals(lamborghini.getId())) {
  newLamborghini = c;
origin: UniversaBlockchain/universa

  @Test
  public void newRevision() throws Exception {
    Contract c = Contract.fromDslFile(ROOT_CONTRACT);
    c.addSignerKeyFromFile(PRIVATE_KEY_PATH);
    byte[] sealed = c.seal();
    assertTrue(c.check());

    Contract c2 = c.createRevision(TestKeys.privateKey(0), TestKeys.privateKey(3));
    assertEquals(1, c2.getRevokingItems().size());
    assertEquals(c, c2.getRevokingItems().iterator().next());
    assertEquals(2, c2.getKeysToSignWith().size());
    assertEquals(2, c2.getRevision());
    assertEquals(c.getId(), c2.getParent());
    assertEquals(c.getId(), c2.getRawOrigin());

    c2.seal();

    Contract c3 = c2.createRevision(TestKeys.privateKey(0), TestKeys.privateKey(3));
    assertEquals(1, c3.getRevokingItems().size());
    assertEquals(c2, c3.getRevokingItems().iterator().next());
    assertEquals(2, c3.getKeysToSignWith().size());
    assertEquals(3, c3.getRevision());
    assertEquals(c2.getId(), c3.getParent());
    assertEquals(c.getId(), c3.getRawOrigin());


//        c2.check();
//        c2.traceErrors();
  }

origin: UniversaBlockchain/universa

Contract newLamborghini = null;
for (Contract c : swapContract.getNew()) {
  if(c.getParent().equals(delorean.getId())) {
    newDelorean = c;
  if(c.getParent().equals(lamborghini.getId())) {
    newLamborghini = c;
origin: UniversaBlockchain/universa

Contract newLamborghini = null;
for (Contract c : swapContract.getNew()) {
  if(c.getParent().equals(delorean.getId())) {
    newDelorean = c;
  if(c.getParent().equals(lamborghini.getId())) {
    newLamborghini = c;
origin: UniversaBlockchain/universa

Contract newDelorean = null;
for (Contract c : swapContract.getNew()) {
  if(c.getParent().equals(delorean.getId())) {
    newDelorean = c;
origin: UniversaBlockchain/universa

if(c.getParent().equals(lamborghini.getId())) {
  newLamborghini = c;
origin: UniversaBlockchain/universa

Contract parent = null;
for (Contract nrc : nc.getRevoking()) {
  if (nrc.getId().equals(nc.getParent())) {
    parent = nrc;
    break;
origin: UniversaBlockchain/universa

if(c.getId().equals(payment.getContract().getParent())) {
  parent = c;
  break;
com.icodici.universa.contractContractgetParent

Javadoc

Get the id of the parent 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
  • 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

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Menu (java.awt)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best IntelliJ 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