congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Contract.getRevision
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: UniversaBlockchain/universa

public void checkAllContracts() {
  //final AtomicBoolean needToReload = new AtomicBoolean(false);
  endpoints.forEach((endpoint, env) -> {
    HashId slotId = env.getSlotId();
    HashId originId = env.getCurrentContract().getOrigin();
    byte[] contractBinFromSlot1 = slot1Requestor.queryContract(slotId, originId);
    if (contractBinFromSlot1 != null) {
      try {
        Contract contractFromSlot1 = Contract.fromPackedTransaction(contractBinFromSlot1);
        if (contractFromSlot1.getRevision() > env.getCurrentContract().getRevision()) {
          System.err.println("JSApiHttpServer warning: contract origin="+originId+" changed in slot1, endpoint: " + endpoint);
          env.updateThisEnvironmentByName(contractFromSlot1, execOptions);
        }
      } catch (IOException e) {
        System.err.println("JSApiHttpServer error: unable to unpack latest contract origin=" + originId + " from slot1, update it, endpoint: " + endpoint + ", err: " + e);
      } catch (Exception e) {
        System.err.println("JSApiHttpServer error while update JSApiEnvironment: " + e);
        e.printStackTrace();
      }
    }
    HashId id = env.getCurrentContract().getId();
    if (!contractChecker.isApproved(id)) {
      System.err.println("JSApiHttpServer warning: contract id="+id+" is not approved, disabled " + endpoint);
      endpoints.remove(endpoint);
    }
  });
}
origin: UniversaBlockchain/universa

  return (T) getRole("creator");
case "revision":
  return (T) ((Integer) getRevision());
case "parent":
  return (T) getParent();
origin: UniversaBlockchain/universa

contract.getState().setParent(parent.getId());
contract.getState().setOrigin(parent.getOrigin());
contract.getState().setRevision(parent.getRevision()+1);
contract.getDefinition().setExpiresAt(parent.getDefinition().getExpiresAt());
contract.getDefinition().setCreatedAt(parent.getDefinition().getCreatedAt());
origin: UniversaBlockchain/universa

for (byte[] bin : storedRevisions) {
  Contract c = Contract.fromPackedTransaction(bin);
  if (latestRevision < c.getRevision()) {
    latestRevision = c.getRevision();
    latestContract = bin;
origin: UniversaBlockchain/universa

    StandardCopyOption.ATOMIC_MOVE
};
String uDest = new FilenameTool(uSource).addSuffixToBase("_rev" + u.getRevision()).toString();
uDest = FileTool.writeFileContentsWithRenaming(uDest, new byte[0]);
if (uDest != null) {
origin: UniversaBlockchain/universa

};
String utnDest = new FilenameTool(utnPath).addSuffixToBase("_rev" + utnContract.getRevision()).toString();
utnDest = FileTool.writeFileContentsWithRenaming(utnDest, new byte[0]);
if (utnDest != null) {
origin: UniversaBlockchain/universa

    StandardCopyOption.ATOMIC_MOVE
};
String uDest = new FilenameTool(uSource).addSuffixToBase("_rev" + u.getRevision()).toString();
uDest = FileTool.writeFileContentsWithRenaming(uDest, new byte[0]);
if (uDest != null) {
origin: UniversaBlockchain/universa

    StandardCopyOption.ATOMIC_MOVE
};
String uDest = new FilenameTool(uSource).addSuffixToBase("_rev" + u.getRevision()).toString();
uDest = FileTool.writeFileContentsWithRenaming(uDest, new byte[0]);
if (uDest != null) {
origin: UniversaBlockchain/universa

System.out.println("DeLorean revoked ownership contract revision " + delorean.getRevision() + " is " + deloreanResult + " by Network");
System.out.println("DeLorean revoked ownership was belongs to Marty: " + delorean.getOwner().isAllowedForKeys(martyPublicKeys));
assertEquals(ItemState.REVOKED, deloreanResult.state);
System.out.println("Lamborghini revoked ownership contract revision " + lamborghini.getRevision() + " is " + lamborghiniResult + " by Network");
System.out.println("Lamborghini revoked ownership was belongs to Stepa: " + lamborghini.getOwner().isAllowedForKeys(stepaPublicKeys));
assertEquals(ItemState.REVOKED, lamborghiniResult.state);
System.out.println("DeLorean ownership contract revision " + newDelorean.getRevision() + " is " + deloreanResult + " by Network");
System.out.println("DeLorean ownership is now belongs to Stepa: " + newDelorean.getOwner().isAllowedForKeys(stepaPublicKeys));
assertEquals(ItemState.APPROVED, deloreanResult.state);
System.out.println("Lamborghini ownership contract revision " + newLamborghini.getRevision() + " is " + lamborghiniResult + " by Network");
System.out.println("Lamborghini ownership is now belongs to Marty: " + newLamborghini.getOwner().isAllowedForKeys(martyPublicKeys));
assertEquals(ItemState.APPROVED, lamborghiniResult.state);
origin: UniversaBlockchain/universa

System.out.println("DeLorean revoked ownership contract revision " + delorean.getRevision() + " is " + deloreanResult + " by Network");
System.out.println("DeLorean revoked ownership still belongs to Marty: " + delorean.getOwner().isAllowedForKeys(martyPublicKeys));
assertEquals(ItemState.APPROVED, deloreanResult.state);
System.out.println("Lamborghini revoked ownership contract revision " + lamborghini.getRevision() + " is " + lamborghiniResult + " by Network");
System.out.println("Lamborghini revoked ownership still belongs to Stepa: " + lamborghini.getOwner().isAllowedForKeys(stepaPublicKeys));
assertEquals(ItemState.APPROVED, lamborghiniResult.state);
System.out.println("DeLorean ownership contract revision " + newDelorean.getRevision() + " is " + deloreanResult + " by Network");
System.out.println("DeLorean ownership should belongs to Stepa: " + newDelorean.getOwner().isAllowedForKeys(stepaPublicKeys));
assertEquals(ItemState.UNDEFINED, deloreanResult.state);
System.out.println("Lamborghini ownership contract revision " + newLamborghini.getRevision() + " is " + lamborghiniResult + " by Network");
System.out.println("Lamborghini ownership should belongs to Marty: " + newLamborghini.getOwner().isAllowedForKeys(martyPublicKeys));
assertEquals(ItemState.UNDEFINED, lamborghiniResult.state);
origin: UniversaBlockchain/universa

ime.setNameCache(nameCache);
if (((Contract) newItem).getRevision() == 1) {
  if (!((NSmartContract) newItem).beforeCreate(ime))
    newItem.addError(Errors.BAD_NEW_ITEM, item.getId().toString(), "newItem.beforeCreate fails");
origin: UniversaBlockchain/universa

report("contract id: " + contract.getId().toBase64String());
report("issued:      " + contract.getIssuedAt());
report("revision:    " + contract.getRevision());
report("created:     " + contract.getCreatedAt());
report("expires:     " + contract.getExpiresAt());
origin: UniversaBlockchain/universa

if ((getRevision() != 1) || (getParent()!=null)) {
  if (getOrigin().equals(getId())) {
    res = false;
    addError(Errors.BAD_VALUE, "can't origin itself");
  if (getRevision() <= 1) {
    res = false;
    addError(Errors.BAD_VALUE, "revision must be greater than 1");
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

System.out.println("DeLorean revoked ownership contract revision " + delorean.getRevision() + " is " + deloreanResult + " by Network");
System.out.println("DeLorean revoked ownership was belongs to Marty: " + delorean.getOwner().isAllowedForKeys(martyPublicKeys));
assertEquals(ItemState.REVOKED, deloreanResult.state);
System.out.println("Lamborghini revoked ownership contract revision " + lamborghini.getRevision() + " is " + lamborghiniResult + " by Network");
System.out.println("Lamborghini revoked ownership was belongs to Stepa: " + lamborghini.getOwner().isAllowedForKeys(stepaPublicKeys));
assertEquals(ItemState.REVOKED, lamborghiniResult.state);
System.out.println("DeLorean ownership contract revision " + newDelorean.getRevision() + " is " + deloreanResult + " by Network");
System.out.println("DeLorean ownership is now belongs to Stepa: " + newDelorean.getOwner().isAllowedForKeys(stepaPublicKeys));
assertEquals(ItemState.APPROVED, deloreanResult.state);
System.out.println("Lamborghini ownership contract revision " + newLamborghini.getRevision() + " is " + lamborghiniResult + " by Network");
System.out.println("Lamborghini ownership is now belongs to Marty: " + newLamborghini.getOwner().isAllowedForKeys(martyPublicKeys));
assertEquals(ItemState.APPROVED, lamborghiniResult.state);
com.icodici.universa.contractContractgetRevision

Javadoc

Get current revision number 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
  • 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
  • setRequestProperty (URLConnection)
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Kernel (java.awt.image)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • 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 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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