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

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

Best Java code snippets using com.icodici.universa.contract.Contract.getValidRoleReferences (Showing top 6 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

/**
 * Check role is allowed to keys
 *
 * @param keys is set of keys
 * @return true if role is allowed to keys
 */
public  boolean isAllowedForKeys(Set<? extends AbstractKey> keys) {
  return isAllowedForReferences(contract == null ? new HashSet<>() : contract.getValidRoleReferences());
}
origin: UniversaBlockchain/universa

  @Test
  public void  isAllowed()  throws Exception {

    PublicKey key = keys.get(0).getPublicKey();
    Set<PublicKey> keySet = new HashSet<>();
    keySet.add(key);
    Contract contract = new Contract();

    SimpleRole sr = new SimpleRole("tr1");
    sr.addKeyRecord(new KeyRecord(key));
    contract.registerRole(sr);

    assertTrue(!sr.isAllowedForKeys(new HashSet<>()));
    assertTrue(sr.isAllowedForKeys(keySet));
    sr.addRequiredReference("ref1", Role.RequiredMode.ALL_OF);
    sr.addRequiredReference("ref2", Role.RequiredMode.ALL_OF);

    contract.getValidRoleReferences().add("ref1");
    assertFalse(sr.isAllowedForKeys(keySet));
    contract.getValidRoleReferences().add("ref2");
    assertTrue(sr.isAllowedForKeys(keySet));
    sr.addRequiredReference("ref3", Role.RequiredMode.ANY_OF);
    assertFalse(sr.isAllowedForKeys(keySet));
    sr.addRequiredReference("ref4", Role.RequiredMode.ANY_OF);
    sr.addRequiredReference("ref5", Role.RequiredMode.ANY_OF);
    contract.getValidRoleReferences().add("ref4");
    assertTrue(sr.isAllowedForKeys(keySet));
  }
}
origin: UniversaBlockchain/universa

assertThat(r, is(instanceOf(ListRole.class)));
assertFalse(r.isAllowedForKeys(stepaPublicKeys));
c.getValidRoleReferences().addAll(references);
assertTrue(r.isAllowedForKeys(stepaPublicKeys));
origin: UniversaBlockchain/universa

assertThat(r, is(instanceOf(ListRole.class)));
assertFalse(r.isAllowedForKeys(stepaPublicKeys));
c.getValidRoleReferences().addAll(references);
assertTrue(r.isAllowedForKeys(stepaPublicKeys));
origin: UniversaBlockchain/universa

assertThat(r, is(instanceOf(ListRole.class)));
assertFalse(r.isAllowedForKeys(stepaPublicKeys));
c.getValidRoleReferences().addAll(references);
assertTrue(r.isAllowedForKeys(stepaPublicKeys));
origin: UniversaBlockchain/universa

assertThat(r, is(instanceOf(ListRole.class)));
assertFalse(r.isAllowedForKeys(stepaPublicKeys));
c.getValidRoleReferences().addAll(references);
assertTrue(r.isAllowedForKeys(stepaPublicKeys));
com.icodici.universa.contractContractgetValidRoleReferences

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

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
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