repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java | HashTreeBuilder.add | public void add(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException {
addToHeads(heads, aggregate(node, metadata));
} | java | public void add(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException {
addToHeads(heads, aggregate(node, metadata));
} | [
"public",
"void",
"add",
"(",
"ImprintNode",
"node",
",",
"IdentityMetadata",
"metadata",
")",
"throws",
"HashException",
",",
"KSIException",
"{",
"addToHeads",
"(",
"heads",
",",
"aggregate",
"(",
"node",
",",
"metadata",
")",
")",
";",
"}"
] | Adds a new leaf with its metadata to the hash tree.
@param node leaf node to be added, must not be null.
@param metadata node's metadata, must not be null
@throws HashException
@throws KSIException | [
"Adds",
"a",
"new",
"leaf",
"with",
"its",
"metadata",
"to",
"the",
"hash",
"tree",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L100-L102 | train |
guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java | HashTreeBuilder.calculateHeight | public long calculateHeight(ImprintNode node) throws HashException {
LinkedList<ImprintNode> tmpHeads = new LinkedList<>();
for (ImprintNode in : heads) {
tmpHeads.add(new ImprintNode(in));
}
addToHeads(tmpHeads, new ImprintNode(node));
ImprintNode root = getRootNod... | java | public long calculateHeight(ImprintNode node) throws HashException {
LinkedList<ImprintNode> tmpHeads = new LinkedList<>();
for (ImprintNode in : heads) {
tmpHeads.add(new ImprintNode(in));
}
addToHeads(tmpHeads, new ImprintNode(node));
ImprintNode root = getRootNod... | [
"public",
"long",
"calculateHeight",
"(",
"ImprintNode",
"node",
")",
"throws",
"HashException",
"{",
"LinkedList",
"<",
"ImprintNode",
">",
"tmpHeads",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"ImprintNode",
"in",
":",
"heads",
")",
"{",
... | Calculates the height of the hash tree in case a new node would be added.
@param node
a leaf to be added to the tree, must not be null.
@return Height of the hash tree.
@throws HashException | [
"Calculates",
"the",
"height",
"of",
"the",
"hash",
"tree",
"in",
"case",
"a",
"new",
"node",
"would",
"be",
"added",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L114-L126 | train |
guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java | HashTreeBuilder.calculateHeight | public long calculateHeight(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException {
return calculateHeight(aggregate(node, metadata));
} | java | public long calculateHeight(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException {
return calculateHeight(aggregate(node, metadata));
} | [
"public",
"long",
"calculateHeight",
"(",
"ImprintNode",
"node",
",",
"IdentityMetadata",
"metadata",
")",
"throws",
"HashException",
",",
"KSIException",
"{",
"return",
"calculateHeight",
"(",
"aggregate",
"(",
"node",
",",
"metadata",
")",
")",
";",
"}"
] | Calculates the height of the hash tree in case a new node with metadata would be added.
@param node a leaf to be added to the tree, must not be null.
@param metadata metadata associated with the node.
@return Height of the hash tree.
@throws HashException
@throws KSIException | [
"Calculates",
"the",
"height",
"of",
"the",
"hash",
"tree",
"in",
"case",
"a",
"new",
"node",
"with",
"metadata",
"would",
"be",
"added",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L137-L139 | train |
guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java | HashTreeBuilder.add | public void add(ImprintNode... nodes) throws HashException {
notNull(nodes, "Nodes");
for (ImprintNode node : nodes) {
add(node);
}
} | java | public void add(ImprintNode... nodes) throws HashException {
notNull(nodes, "Nodes");
for (ImprintNode node : nodes) {
add(node);
}
} | [
"public",
"void",
"add",
"(",
"ImprintNode",
"...",
"nodes",
")",
"throws",
"HashException",
"{",
"notNull",
"(",
"nodes",
",",
"\"Nodes\"",
")",
";",
"for",
"(",
"ImprintNode",
"node",
":",
"nodes",
")",
"{",
"add",
"(",
"node",
")",
";",
"}",
"}"
] | Adds a new array of child nodes to the hash tree.
@param nodes array of nodes to be added.
@throws HashException | [
"Adds",
"a",
"new",
"array",
"of",
"child",
"nodes",
"to",
"the",
"hash",
"tree",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L148-L153 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java | KSIBuilder.setKsiProtocolSignerClient | public KSIBuilder setKsiProtocolSignerClient(KSISigningClient signingClient) {
Util.notNull(signingClient, "KSI Signing Client");
return setKsiProtocolSigningService(new KSISigningClientServiceAdapter(signingClient));
} | java | public KSIBuilder setKsiProtocolSignerClient(KSISigningClient signingClient) {
Util.notNull(signingClient, "KSI Signing Client");
return setKsiProtocolSigningService(new KSISigningClientServiceAdapter(signingClient));
} | [
"public",
"KSIBuilder",
"setKsiProtocolSignerClient",
"(",
"KSISigningClient",
"signingClient",
")",
"{",
"Util",
".",
"notNull",
"(",
"signingClient",
",",
"\"KSI Signing Client\"",
")",
";",
"return",
"setKsiProtocolSigningService",
"(",
"new",
"KSISigningClientServiceAda... | Sets the signer client to be used in signing process.
@param signingClient
instance of {@link KSISigningClient}.
@return Instance of {@link KSIBuilder}. | [
"Sets",
"the",
"signer",
"client",
"to",
"be",
"used",
"in",
"signing",
"process",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java#L135-L138 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java | KSIBuilder.setKsiProtocolExtenderClient | public KSIBuilder setKsiProtocolExtenderClient(KSIExtenderClient extenderClient) {
Util.notNull(extenderClient, "KSI Extender Client");
return setKsiProtocolExtendingService(new KSIExtendingClientServiceAdapter(extenderClient));
} | java | public KSIBuilder setKsiProtocolExtenderClient(KSIExtenderClient extenderClient) {
Util.notNull(extenderClient, "KSI Extender Client");
return setKsiProtocolExtendingService(new KSIExtendingClientServiceAdapter(extenderClient));
} | [
"public",
"KSIBuilder",
"setKsiProtocolExtenderClient",
"(",
"KSIExtenderClient",
"extenderClient",
")",
"{",
"Util",
".",
"notNull",
"(",
"extenderClient",
",",
"\"KSI Extender Client\"",
")",
";",
"return",
"setKsiProtocolExtendingService",
"(",
"new",
"KSIExtendingClient... | Sets the extender client to be used in verification and extending process.
@param extenderClient
instance of {@link KSIExtenderClient}.
@return Instance of {@link KSIBuilder}. | [
"Sets",
"the",
"extender",
"client",
"to",
"be",
"used",
"in",
"verification",
"and",
"extending",
"process",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java#L147-L150 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/trust/JKSTrustStore.java | JKSTrustStore.isTrusted | public boolean isTrusted(X509Certificate certificate, Store certStore) throws CryptoException {
try {
if (certificate == null) {
throw new CryptoException("Invalid input parameter. Certificate can not be null");
}
LOGGER.info("Checking if certificate with subj... | java | public boolean isTrusted(X509Certificate certificate, Store certStore) throws CryptoException {
try {
if (certificate == null) {
throw new CryptoException("Invalid input parameter. Certificate can not be null");
}
LOGGER.info("Checking if certificate with subj... | [
"public",
"boolean",
"isTrusted",
"(",
"X509Certificate",
"certificate",
",",
"Store",
"certStore",
")",
"throws",
"CryptoException",
"{",
"try",
"{",
"if",
"(",
"certificate",
"==",
"null",
")",
"{",
"throw",
"new",
"CryptoException",
"(",
"\"Invalid input parame... | This method is used to check if certificate is trusted or not.
@param certificate
instance of PKI X.509 certificate. not null.
@param certStore
additional certificates to be used to check if certificate chain is trusted or not.
@return true if certificate is trusted, false otherwise
@throws CryptoException
will be thr... | [
"This",
"method",
"is",
"used",
"to",
"check",
"if",
"certificate",
"is",
"trusted",
"or",
"not",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/trust/JKSTrustStore.java#L138-L182 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/trust/JKSTrustStore.java | JKSTrustStore.loadFile | @SuppressWarnings("resource")
private InputStream loadFile(String trustStorePath) throws FileNotFoundException {
InputStream input;
try {
input = new FileInputStream(trustStorePath);
} catch (FileNotFoundException e) {
LOGGER.warn("File {} not found. Fallback to class... | java | @SuppressWarnings("resource")
private InputStream loadFile(String trustStorePath) throws FileNotFoundException {
InputStream input;
try {
input = new FileInputStream(trustStorePath);
} catch (FileNotFoundException e) {
LOGGER.warn("File {} not found. Fallback to class... | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"private",
"InputStream",
"loadFile",
"(",
"String",
"trustStorePath",
")",
"throws",
"FileNotFoundException",
"{",
"InputStream",
"input",
";",
"try",
"{",
"input",
"=",
"new",
"FileInputStream",
"(",
"trustStorePa... | This method is used to find file from disk or classpath.
@param trustStorePath
file to load
@return instance of {@link InputStream} containing content of the file
@throws FileNotFoundException
if file does not exist | [
"This",
"method",
"is",
"used",
"to",
"find",
"file",
"from",
"disk",
"or",
"classpath",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/trust/JKSTrustStore.java#L194-L207 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/PublicationData.java | PublicationData.getPublicationString | public String getPublicationString() {
byte[] imprint = publicationHash.getImprint();
byte[] data = new byte[imprint.length + 8];
System.arraycopy(Util.toByteArray(publicationTime.getTime() / 1000), 0, data, 0, 8);
System.arraycopy(imprint, 0, data, 8, imprint.length);
return Ba... | java | public String getPublicationString() {
byte[] imprint = publicationHash.getImprint();
byte[] data = new byte[imprint.length + 8];
System.arraycopy(Util.toByteArray(publicationTime.getTime() / 1000), 0, data, 0, 8);
System.arraycopy(imprint, 0, data, 8, imprint.length);
return Ba... | [
"public",
"String",
"getPublicationString",
"(",
")",
"{",
"byte",
"[",
"]",
"imprint",
"=",
"publicationHash",
".",
"getImprint",
"(",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"imprint",
".",
"length",
"+",
"8",
"]",
";",
"System",... | Returns a publication string that is a base-32 encoded value that is meant published to print media as human
readable text
@return returns a base-32 encoded publication string | [
"Returns",
"a",
"publication",
"string",
"that",
"is",
"a",
"base",
"-",
"32",
"encoded",
"value",
"that",
"is",
"meant",
"published",
"to",
"print",
"media",
"as",
"human",
"readable",
"text"
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/PublicationData.java#L160-L167 | train |
guardtime/ksi-java-sdk | ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIRequest.java | AbstractKSIRequest.calculateMac | protected DataHash calculateMac() throws KSIException {
try {
HashAlgorithm algorithm = HashAlgorithm.getByName("DEFAULT");
algorithm.checkExpiration();
return new DataHash(algorithm, Util.calculateHMAC(getContent(), this.loginKey, algorithm.getName()));
} catch (IOEx... | java | protected DataHash calculateMac() throws KSIException {
try {
HashAlgorithm algorithm = HashAlgorithm.getByName("DEFAULT");
algorithm.checkExpiration();
return new DataHash(algorithm, Util.calculateHMAC(getContent(), this.loginKey, algorithm.getName()));
} catch (IOEx... | [
"protected",
"DataHash",
"calculateMac",
"(",
")",
"throws",
"KSIException",
"{",
"try",
"{",
"HashAlgorithm",
"algorithm",
"=",
"HashAlgorithm",
".",
"getByName",
"(",
"\"DEFAULT\"",
")",
";",
"algorithm",
".",
"checkExpiration",
"(",
")",
";",
"return",
"new",... | Calculates the MAC based on header and payload TLVs.
@return Calculated data hash.
@throws KSIException
if HMAC generation fails. | [
"Calculates",
"the",
"MAC",
"based",
"on",
"header",
"and",
"payload",
"TLVs",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIRequest.java#L132-L148 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java | VerificationContextBuilder.setDocumentHash | public VerificationContextBuilder setDocumentHash(DataHash documentHash, Long level) {
this.documentHash = documentHash;
this.inputHashLevel = level;
return this;
} | java | public VerificationContextBuilder setDocumentHash(DataHash documentHash, Long level) {
this.documentHash = documentHash;
this.inputHashLevel = level;
return this;
} | [
"public",
"VerificationContextBuilder",
"setDocumentHash",
"(",
"DataHash",
"documentHash",
",",
"Long",
"level",
")",
"{",
"this",
".",
"documentHash",
"=",
"documentHash",
";",
"this",
".",
"inputHashLevel",
"=",
"level",
";",
"return",
"this",
";",
"}"
] | Used to set the hash and local aggregation tree height.
If present then this hash must equal to signature input hash.
@param documentHash document hash
@return instance of {@link VerificationContextBuilder} | [
"Used",
"to",
"set",
"the",
"hash",
"and",
"local",
"aggregation",
"tree",
"height",
".",
"If",
"present",
"then",
"this",
"hash",
"must",
"equal",
"to",
"signature",
"input",
"hash",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java#L121-L125 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java | VerificationContextBuilder.createVerificationContext | @Deprecated
public final VerificationContext createVerificationContext() throws KSIException {
if (signature == null) {
throw new KSIException("Failed to createSignature verification context. Signature must be present.");
}
if (extendingService == null) {
throw new KS... | java | @Deprecated
public final VerificationContext createVerificationContext() throws KSIException {
if (signature == null) {
throw new KSIException("Failed to createSignature verification context. Signature must be present.");
}
if (extendingService == null) {
throw new KS... | [
"@",
"Deprecated",
"public",
"final",
"VerificationContext",
"createVerificationContext",
"(",
")",
"throws",
"KSIException",
"{",
"if",
"(",
"signature",
"==",
"null",
")",
"{",
"throw",
"new",
"KSIException",
"(",
"\"Failed to createSignature verification context. Signa... | Builds the verification context.
@return instance of verification context
@throws KSIException when error occurs (e.g mandatory parameters aren't present) | [
"Builds",
"the",
"verification",
"context",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java#L149-L161 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationChainLink.java | InMemoryAggregationChainLink.getIdentityFromLegacyId | private String getIdentityFromLegacyId() throws CharacterCodingException {
byte[] data = legacyId;
int len = Util.toShort(data, 1);
return Util.decodeString(data, 3, len);
} | java | private String getIdentityFromLegacyId() throws CharacterCodingException {
byte[] data = legacyId;
int len = Util.toShort(data, 1);
return Util.decodeString(data, 3, len);
} | [
"private",
"String",
"getIdentityFromLegacyId",
"(",
")",
"throws",
"CharacterCodingException",
"{",
"byte",
"[",
"]",
"data",
"=",
"legacyId",
";",
"int",
"len",
"=",
"Util",
".",
"toShort",
"(",
"data",
",",
"1",
")",
";",
"return",
"Util",
".",
"decodeS... | Decodes link identity from legacy id.
@return decoded link identity decoded from legacy id. | [
"Decodes",
"link",
"identity",
"from",
"legacy",
"id",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationChainLink.java#L188-L192 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationChainLink.java | InMemoryAggregationChainLink.hash | protected final DataHash hash(byte[] hash1, byte[] hash2, long level, HashAlgorithm algorithm) throws InvalidAggregationHashChainException {
if (!algorithm.isImplemented()) {
throw new InvalidAggregationHashChainException("Invalid aggregation hash chain. Hash algorithm " + algorithm.getName() + " is... | java | protected final DataHash hash(byte[] hash1, byte[] hash2, long level, HashAlgorithm algorithm) throws InvalidAggregationHashChainException {
if (!algorithm.isImplemented()) {
throw new InvalidAggregationHashChainException("Invalid aggregation hash chain. Hash algorithm " + algorithm.getName() + " is... | [
"protected",
"final",
"DataHash",
"hash",
"(",
"byte",
"[",
"]",
"hash1",
",",
"byte",
"[",
"]",
"hash2",
",",
"long",
"level",
",",
"HashAlgorithm",
"algorithm",
")",
"throws",
"InvalidAggregationHashChainException",
"{",
"if",
"(",
"!",
"algorithm",
".",
"... | Hash two hashes together.
@param hash1 first hash
@param hash2 second hash
@param level level
@param algorithm hash algorithm to use
@return instance of {@link DataHash} | [
"Hash",
"two",
"hashes",
"together",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationChainLink.java#L214-L223 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVInputStream.java | TLVInputStream.readElement | public TLVElement readElement() throws IOException, TLVParserException {
TlvHeader header = readHeader();
TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type);
int count = countNestedTlvElements(header);
if (count > 0) {
readNes... | java | public TLVElement readElement() throws IOException, TLVParserException {
TlvHeader header = readHeader();
TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type);
int count = countNestedTlvElements(header);
if (count > 0) {
readNes... | [
"public",
"TLVElement",
"readElement",
"(",
")",
"throws",
"IOException",
",",
"TLVParserException",
"{",
"TlvHeader",
"header",
"=",
"readHeader",
"(",
")",
";",
"TLVElement",
"element",
"=",
"new",
"TLVElement",
"(",
"header",
".",
"tlv16",
",",
"header",
".... | Reads the next TLV element from the stream.
@return Instance of {@link TLVElement}.
@throws IOException
when reading from underlying stream fails.
@throws TLVParserException
when input stream is null. | [
"Reads",
"the",
"next",
"TLV",
"element",
"from",
"the",
"stream",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVInputStream.java#L81-L91 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVInputStream.java | TLVInputStream.readTlvContent | private byte[] readTlvContent(TlvHeader header) throws IOException {
byte[] data = new byte[header.getDataLength()];
in.readFully(data);
return data;
} | java | private byte[] readTlvContent(TlvHeader header) throws IOException {
byte[] data = new byte[header.getDataLength()];
in.readFully(data);
return data;
} | [
"private",
"byte",
"[",
"]",
"readTlvContent",
"(",
"TlvHeader",
"header",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"header",
".",
"getDataLength",
"(",
")",
"]",
";",
"in",
".",
"readFully",
"(",
"data",
")... | Reads the TLV content bytes from the underlying stream.
@param header
instance of {@link TlvHeader}, not null.
@return TLV content bytes.
@throws IOException
if an I/O error occurs. | [
"Reads",
"the",
"TLV",
"content",
"bytes",
"from",
"the",
"underlying",
"stream",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVInputStream.java#L217-L221 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java | ContextAwarePolicyAdapter.createPolicy | public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) {
if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){
throw new IllegalArgumentException("Unsupported verification policy.");
}
Util.notNu... | java | public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) {
if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){
throw new IllegalArgumentException("Unsupported verification policy.");
}
Util.notNu... | [
"public",
"static",
"ContextAwarePolicy",
"createPolicy",
"(",
"Policy",
"policy",
",",
"PublicationsHandler",
"handler",
",",
"KSIExtendingService",
"extendingService",
")",
"{",
"if",
"(",
"policy",
"instanceof",
"UserProvidedPublicationBasedVerificationPolicy",
")",
"{",... | Method creating context aware policy using user provided policy with needed components.
@param policy
Policy.
@param handler
Publications handler.
@param extendingService
Extender client.
@return Policy with suitable context. | [
"Method",
"creating",
"context",
"aware",
"policy",
"using",
"user",
"provided",
"policy",
"with",
"needed",
"components",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L161-L168 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java | ContextAwarePolicyAdapter.setFallbackPolicy | public void setFallbackPolicy(Policy fallbackPolicy) {
Policy p = fallbackPolicy;
while (p != null) {
if (!(p instanceof ContextAwarePolicy)) {
throw new IllegalArgumentException("Fallback policy must be instance of ContextAwarePolicy");
}
p = p.getFal... | java | public void setFallbackPolicy(Policy fallbackPolicy) {
Policy p = fallbackPolicy;
while (p != null) {
if (!(p instanceof ContextAwarePolicy)) {
throw new IllegalArgumentException("Fallback policy must be instance of ContextAwarePolicy");
}
p = p.getFal... | [
"public",
"void",
"setFallbackPolicy",
"(",
"Policy",
"fallbackPolicy",
")",
"{",
"Policy",
"p",
"=",
"fallbackPolicy",
";",
"while",
"(",
"p",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"p",
"instanceof",
"ContextAwarePolicy",
")",
")",
"{",
"throw",
... | Sets a fallback policy to be used when signature does not verify with given policy.
@param fallbackPolicy the fallback policy used when signature does not verify with given policy. All fallback
policies in he chain must be instances of {@link ContextAwarePolicy}. | [
"Sets",
"a",
"fallback",
"policy",
"to",
"be",
"used",
"when",
"signature",
"does",
"not",
"verify",
"with",
"given",
"policy",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L195-L204 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.decodeString | public static String decodeString(byte[] buf, int ofs, int len) throws CharacterCodingException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder().onMalformedI... | java | public static String decodeString(byte[] buf, int ofs, int len) throws CharacterCodingException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder().onMalformedI... | [
"public",
"static",
"String",
"decodeString",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"ofs",
",",
"int",
"len",
")",
"throws",
"CharacterCodingException",
"{",
"if",
"(",
"ofs",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"ofs",
"+",
"len",
"<",
"0",
... | Decodes UTF-8 string from the given buffer.
@param buf
the buffer.
@param ofs
offset of the UTF-8 data in the buffer.
@param len
length of the UTF-8 data to decode.
@return The decoded string.
@throws CharacterCodingException
when the specified data is not in valid UTF-8 format. | [
"Decodes",
"UTF",
"-",
"8",
"string",
"from",
"the",
"given",
"buffer",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L146-L154 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.toByteArray | public static byte[] toByteArray(String value) {
if (value == null) {
return null;
}
try {
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder().onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
... | java | public static byte[] toByteArray(String value) {
if (value == null) {
return null;
}
try {
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder().onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
... | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"CharsetEncoder",
"encoder",
"=",
"Charset",
".",
"forName",
"(",
"\"UTF-8\"",
")... | Encodes the given string in UTF-8.
@param value
the string to encode.
@return A newly allocated array containing the encoding result. | [
"Encodes",
"the",
"given",
"string",
"in",
"UTF",
"-",
"8",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L164-L180 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.copyOf | public static byte[] copyOf(byte[] b, int off, int len) throws NullPointerException, ArrayIndexOutOfBoundsException {
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
... | java | public static byte[] copyOf(byte[] b, int off, int len) throws NullPointerException, ArrayIndexOutOfBoundsException {
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
... | [
"public",
"static",
"byte",
"[",
"]",
"copyOf",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"NullPointerException",
",",
"ArrayIndexOutOfBoundsException",
"{",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"throw",
"new",
... | Creates a copy of a section of the given byte array.
@param b
the array to copy.
@param off
the start offset of the data within {@code b}.
@param len
the number of bytes to copy.
@return The copy of the requested section of {@code b}.
@throws NullPointerException
if {@code b} is null.
@throws ArrayIndexOutOfBoundsEx... | [
"Creates",
"a",
"copy",
"of",
"a",
"section",
"of",
"the",
"given",
"byte",
"array",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L248-L259 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.join | public static byte[] join(byte[] a, byte[] b) {
byte[] result = new byte[a.length + b.length];
System.arraycopy(a, 0, result, 0, a.length);
System.arraycopy(b, 0, result, a.length, b.length);
return result;
} | java | public static byte[] join(byte[] a, byte[] b) {
byte[] result = new byte[a.length + b.length];
System.arraycopy(a, 0, result, 0, a.length);
System.arraycopy(b, 0, result, a.length, b.length);
return result;
} | [
"public",
"static",
"byte",
"[",
"]",
"join",
"(",
"byte",
"[",
"]",
"a",
",",
"byte",
"[",
"]",
"b",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"a",
".",
"length",
"+",
"b",
".",
"length",
"]",
";",
"System",
".",
"arrayc... | Joins two byte arrays into one.
@param a
first byte array to join, not null.
@param b
second byte array to join, not null.
@return Joined byte array. | [
"Joins",
"two",
"byte",
"arrays",
"into",
"one",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L271-L276 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.decodeUnsignedLong | public static long decodeUnsignedLong(byte[] buf, int ofs, int len) throws IllegalArgumentException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
if (len > 8 || len == 8 && buf[ofs] < 0) {
throw new Illegal... | java | public static long decodeUnsignedLong(byte[] buf, int ofs, int len) throws IllegalArgumentException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
if (len > 8 || len == 8 && buf[ofs] < 0) {
throw new Illegal... | [
"public",
"static",
"long",
"decodeUnsignedLong",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"ofs",
",",
"int",
"len",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"ofs",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"ofs",
"+",
"len",
"<",
"0"... | Decodes an unsigned integer from the given buffer.
@param buf
the buffer.
@param ofs
offset of the data in the buffer.
@param len
length of the data to decode.
@return The decoded value.
@throws IllegalArgumentException
when result does not fit into 63-bit unsigned integer. | [
"Decodes",
"an",
"unsigned",
"integer",
"from",
"the",
"given",
"buffer",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L489-L501 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.calculateHMAC | public static byte[] calculateHMAC(byte[] message, byte[] keyBytes, String algorithm) throws NoSuchAlgorithmException, InvalidKeyException {
if (keyBytes == null) {
throw new IllegalArgumentException("Invalid HMAC key: null");
}
String hmacAlgorithmName = "Hmac" + algorithm.toUpperCa... | java | public static byte[] calculateHMAC(byte[] message, byte[] keyBytes, String algorithm) throws NoSuchAlgorithmException, InvalidKeyException {
if (keyBytes == null) {
throw new IllegalArgumentException("Invalid HMAC key: null");
}
String hmacAlgorithmName = "Hmac" + algorithm.toUpperCa... | [
"public",
"static",
"byte",
"[",
"]",
"calculateHMAC",
"(",
"byte",
"[",
"]",
"message",
",",
"byte",
"[",
"]",
"keyBytes",
",",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
"{",
"if",
"(",
"keyBytes",
"==",
"... | Calculates the RFC 2104 compatible HMAC for the given message, key, and algorithm.
@param message
message for which the MAC is to be calculated.
@param keyBytes
key for calculation.
@param algorithm
algorithm to be used (MD5, SHA1, SHA256).
@return HMAC as byte array.
@throws NoSuchAlgorithmException
if invalid algo... | [
"Calculates",
"the",
"RFC",
"2104",
"compatible",
"HMAC",
"for",
"the",
"given",
"message",
"key",
"and",
"algorithm",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L545-L555 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.equalsIgnoreOrder | public static boolean equalsIgnoreOrder(Collection<?> c1, Collection<?> c2) {
return (c1 == null && c2 == null) || (c1 != null && c2 != null && c1.size() == c2.size() && c1.containsAll(c2) && c2.containsAll(c1));
} | java | public static boolean equalsIgnoreOrder(Collection<?> c1, Collection<?> c2) {
return (c1 == null && c2 == null) || (c1 != null && c2 != null && c1.size() == c2.size() && c1.containsAll(c2) && c2.containsAll(c1));
} | [
"public",
"static",
"boolean",
"equalsIgnoreOrder",
"(",
"Collection",
"<",
"?",
">",
"c1",
",",
"Collection",
"<",
"?",
">",
"c2",
")",
"{",
"return",
"(",
"c1",
"==",
"null",
"&&",
"c2",
"==",
"null",
")",
"||",
"(",
"c1",
"!=",
"null",
"&&",
"c2... | Checks if two collections are equal ignoring the order of components. It's safe to pass collections that might be null.
@param c1 first collection.
@param c2 second collection.
@return True, if both lists are null or if they have exactly the same components. | [
"Checks",
"if",
"two",
"collections",
"are",
"equal",
"ignoring",
"the",
"order",
"of",
"components",
".",
"It",
"s",
"safe",
"to",
"pass",
"collections",
"that",
"might",
"be",
"null",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L728-L730 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVStructure.java | TLVStructure.verifyCriticalFlag | protected void verifyCriticalFlag(TLVElement element) throws TLVParserException {
if (!element.isNonCritical()) {
throw new TLVParserException("Unknown critical TLV element with tag=0x" + Integer.toHexString(element.getType()) + " encountered");
}
} | java | protected void verifyCriticalFlag(TLVElement element) throws TLVParserException {
if (!element.isNonCritical()) {
throw new TLVParserException("Unknown critical TLV element with tag=0x" + Integer.toHexString(element.getType()) + " encountered");
}
} | [
"protected",
"void",
"verifyCriticalFlag",
"(",
"TLVElement",
"element",
")",
"throws",
"TLVParserException",
"{",
"if",
"(",
"!",
"element",
".",
"isNonCritical",
"(",
")",
")",
"{",
"throw",
"new",
"TLVParserException",
"(",
"\"Unknown critical TLV element with tag=... | Checks if the TLV element is critical or not.
@param element
TLV element to check.
@throws TLVParserException
when unknown critical TLV element is encountered. | [
"Checks",
"if",
"the",
"TLV",
"element",
"is",
"critical",
"or",
"not",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVStructure.java#L70-L74 | train |
guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/SigningHAService.java | SigningHAService.sign | public Future<AggregationResponse> sign(DataHash dataHash, Long level) throws KSIException {
Util.notNull(dataHash, "dataHash");
Util.notNull(level, "level");
final Collection<Callable<AggregationResponse>> tasks = new ArrayList<>(subservices.size());
for (KSISigningService subservice : ... | java | public Future<AggregationResponse> sign(DataHash dataHash, Long level) throws KSIException {
Util.notNull(dataHash, "dataHash");
Util.notNull(level, "level");
final Collection<Callable<AggregationResponse>> tasks = new ArrayList<>(subservices.size());
for (KSISigningService subservice : ... | [
"public",
"Future",
"<",
"AggregationResponse",
">",
"sign",
"(",
"DataHash",
"dataHash",
",",
"Long",
"level",
")",
"throws",
"KSIException",
"{",
"Util",
".",
"notNull",
"(",
"dataHash",
",",
"\"dataHash\"",
")",
";",
"Util",
".",
"notNull",
"(",
"level",
... | Creates a non-blocking signing request. Sends the request to all the subservices in parallel. First successful response is
used, others are cancelled. Request fails only if all the subservices fail.
@see KSISigningService#sign(DataHash, Long) | [
"Creates",
"a",
"non",
"-",
"blocking",
"signing",
"request",
".",
"Sends",
"the",
"request",
"to",
"all",
"the",
"subservices",
"in",
"parallel",
".",
"First",
"successful",
"response",
"is",
"used",
"others",
"are",
"cancelled",
".",
"Request",
"fails",
"o... | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/SigningHAService.java#L71-L81 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(byte[] data) {
Util.notNull(data, "Date");
return addData(data, 0, data.length);
} | java | public final DataHasher addData(byte[] data) {
Util.notNull(data, "Date");
return addData(data, 0, data.length);
} | [
"public",
"final",
"DataHasher",
"addData",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"Util",
".",
"notNull",
"(",
"data",
",",
"\"Date\"",
")",
";",
"return",
"addData",
"(",
"data",
",",
"0",
",",
"data",
".",
"length",
")",
";",
"}"
] | Adds data to the digest using the specified array of bytes, starting at an offset of 0.
@param data the array of bytes.
@return The same {@link DataHasher} object for chaining calls.
@throws NullPointerException when input data is null. | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"array",
"of",
"bytes",
"starting",
"at",
"an",
"offset",
"of",
"0",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L161-L165 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(InputStream inStream, int bufferSize) {
Util.notNull(inStream, "Input stream");
try {
byte[] buffer = new byte[bufferSize];
while (true) {
int bytesRead = inStream.read(buffer);
if (bytesRead == -1) {
... | java | public final DataHasher addData(InputStream inStream, int bufferSize) {
Util.notNull(inStream, "Input stream");
try {
byte[] buffer = new byte[bufferSize];
while (true) {
int bytesRead = inStream.read(buffer);
if (bytesRead == -1) {
... | [
"public",
"final",
"DataHasher",
"addData",
"(",
"InputStream",
"inStream",
",",
"int",
"bufferSize",
")",
"{",
"Util",
".",
"notNull",
"(",
"inStream",
",",
"\"Input stream\"",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"... | Adds data to the digest using the specified input stream of bytes, starting at an offset of 0.
@param inStream input stream of bytes.
@param bufferSize maximum allowed buffer size for reading data.
@return The same {@link DataHasher} object for chaining calls.
@throws HashException when hash calculation fai... | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"input",
"stream",
"of",
"bytes",
"starting",
"at",
"an",
"offset",
"of",
"0",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L218-L233 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(File file, int bufferSize) {
Util.notNull(file, "File");
FileInputStream inStream = null;
try {
inStream = new FileInputStream(file);
return addData(inStream, bufferSize);
} catch (FileNotFoundException e) {
throw new Il... | java | public final DataHasher addData(File file, int bufferSize) {
Util.notNull(file, "File");
FileInputStream inStream = null;
try {
inStream = new FileInputStream(file);
return addData(inStream, bufferSize);
} catch (FileNotFoundException e) {
throw new Il... | [
"public",
"final",
"DataHasher",
"addData",
"(",
"File",
"file",
",",
"int",
"bufferSize",
")",
"{",
"Util",
".",
"notNull",
"(",
"file",
",",
"\"File\"",
")",
";",
"FileInputStream",
"inStream",
"=",
"null",
";",
"try",
"{",
"inStream",
"=",
"new",
"Fil... | Adds data to the digest using the specified file, starting at the offset 0.
@param file input file.
@param bufferSize size of buffer for reading data.
@return The same {@link DataHasher} object for chaining calls.
@throws HashException when hash calculation fails.
@throws NullPointerException when input... | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"file",
"starting",
"at",
"the",
"offset",
"0",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L246-L257 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java | BaseX.addChars | private void addChars(String chars) {
for (int i = 0; i < chars.length(); i++) {
int c = chars.codePointAt(i) - min;
if (values[c] != -1 && values[c] != i) {
throw new IllegalArgumentException("Duplicate characters in the encoding alphabet");
}
val... | java | private void addChars(String chars) {
for (int i = 0; i < chars.length(); i++) {
int c = chars.codePointAt(i) - min;
if (values[c] != -1 && values[c] != i) {
throw new IllegalArgumentException("Duplicate characters in the encoding alphabet");
}
val... | [
"private",
"void",
"addChars",
"(",
"String",
"chars",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chars",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"c",
"=",
"chars",
".",
"codePointAt",
"(",
"i",
")",
"-",
"m... | Adds the values for the given characters to the value lookup table.
@param chars
the list of characters to process. | [
"Adds",
"the",
"values",
"for",
"the",
"given",
"characters",
"to",
"the",
"value",
"lookup",
"table",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java#L149-L157 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java | BaseX.encode | public final StringBuffer encode(byte[] in, int off, int len, String sep, int freq) {
// sanitize the parameters
if (in == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off + len < 0 || off + len > in.length) {
throw new ArrayIndexOutOfBou... | java | public final StringBuffer encode(byte[] in, int off, int len, String sep, int freq) {
// sanitize the parameters
if (in == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off + len < 0 || off + len > in.length) {
throw new ArrayIndexOutOfBou... | [
"public",
"final",
"StringBuffer",
"encode",
"(",
"byte",
"[",
"]",
"in",
",",
"int",
"off",
",",
"int",
"len",
",",
"String",
"sep",
",",
"int",
"freq",
")",
"{",
"// sanitize the parameters",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"throw",
"new",
... | Encodes the given bytes into a base-X string, optionally inserting a
separator into the result with given frequency.
@param in
an array containing the bytes to encode.
@param off
the start offset of the data within {@code in}.
@param len
the number of bytes to encode.
@param sep
if {@code sep} is not {@code null} and ... | [
"Encodes",
"the",
"given",
"bytes",
"into",
"a",
"base",
"-",
"X",
"string",
"optionally",
"inserting",
"a",
"separator",
"into",
"the",
"result",
"with",
"given",
"frequency",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java#L180-L241 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java | BaseX.decode | public final byte[] decode(String in) {
// sanitize the parameters
if (in == null) {
throw new NullPointerException();
}
// create the result buffer
byte[] out = new byte[in.length() * bits / 8];
// decode
int outCount = 0; // number of output bytes... | java | public final byte[] decode(String in) {
// sanitize the parameters
if (in == null) {
throw new NullPointerException();
}
// create the result buffer
byte[] out = new byte[in.length() * bits / 8];
// decode
int outCount = 0; // number of output bytes... | [
"public",
"final",
"byte",
"[",
"]",
"decode",
"(",
"String",
"in",
")",
"{",
"// sanitize the parameters",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"// create the result buffer",
"byte",
"[",
"]",
... | Decodes the given base-X string into bytes, silently ignoring any
non-base-X characters.
@param in
the string to decode.
@return The decoded bytes. | [
"Decodes",
"the",
"given",
"base",
"-",
"X",
"string",
"into",
"bytes",
"silently",
"ignoring",
"any",
"non",
"-",
"base",
"-",
"X",
"characters",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java#L252-L293 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java | InMemoryPublicationsFile.decodePublicationsFile | private void decodePublicationsFile(TLVInputStream input) throws KSIException, IOException {
while (input.hasNextElement()) {
TLVElement element = input.readElement();
switch (element.getType()) {
case PublicationsFileHeader.ELEMENT_TYPE:
if (header !=... | java | private void decodePublicationsFile(TLVInputStream input) throws KSIException, IOException {
while (input.hasNextElement()) {
TLVElement element = input.readElement();
switch (element.getType()) {
case PublicationsFileHeader.ELEMENT_TYPE:
if (header !=... | [
"private",
"void",
"decodePublicationsFile",
"(",
"TLVInputStream",
"input",
")",
"throws",
"KSIException",
",",
"IOException",
"{",
"while",
"(",
"input",
".",
"hasNextElement",
"(",
")",
")",
"{",
"TLVElement",
"element",
"=",
"input",
".",
"readElement",
"(",... | Decodes publications file. Reads publications data from given input stream.
@param input
input stream to createSignature. not null.
@throws InvalidPublicationsFileException
@throws IOException | [
"Decodes",
"publications",
"file",
".",
"Reads",
"publications",
"data",
"from",
"given",
"input",
"stream",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java#L112-L137 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java | InMemoryPublicationsFile.verifyMagicBytes | private void verifyMagicBytes(TLVInputStream input) throws InvalidPublicationsFileException {
try {
byte[] magicBytes = new byte[PUBLICATIONS_FILE_MAGIC_BYTES_LENGTH];
input.read(magicBytes);
if (!Arrays.equals(magicBytes, FILE_BEGINNING_MAGIC_BYTES)) {
throw ... | java | private void verifyMagicBytes(TLVInputStream input) throws InvalidPublicationsFileException {
try {
byte[] magicBytes = new byte[PUBLICATIONS_FILE_MAGIC_BYTES_LENGTH];
input.read(magicBytes);
if (!Arrays.equals(magicBytes, FILE_BEGINNING_MAGIC_BYTES)) {
throw ... | [
"private",
"void",
"verifyMagicBytes",
"(",
"TLVInputStream",
"input",
")",
"throws",
"InvalidPublicationsFileException",
"{",
"try",
"{",
"byte",
"[",
"]",
"magicBytes",
"=",
"new",
"byte",
"[",
"PUBLICATIONS_FILE_MAGIC_BYTES_LENGTH",
"]",
";",
"input",
".",
"read"... | Verifies that input stream starts with publications file magic bytes.
@param input
instance of input stream to check. not null. | [
"Verifies",
"that",
"input",
"stream",
"starts",
"with",
"publications",
"file",
"magic",
"bytes",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java#L155-L165 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java | InMemoryPublicationsFile.findCertificateById | public Certificate findCertificateById(byte[] certificateId) throws CertificateNotFoundException {
if (certificateId == null) {
throw new CertificateNotFoundException("Certificate with id null not found from pubFile='" + this.toString() + "'");
}
for (InMemoryCertificateRecord record... | java | public Certificate findCertificateById(byte[] certificateId) throws CertificateNotFoundException {
if (certificateId == null) {
throw new CertificateNotFoundException("Certificate with id null not found from pubFile='" + this.toString() + "'");
}
for (InMemoryCertificateRecord record... | [
"public",
"Certificate",
"findCertificateById",
"(",
"byte",
"[",
"]",
"certificateId",
")",
"throws",
"CertificateNotFoundException",
"{",
"if",
"(",
"certificateId",
"==",
"null",
")",
"{",
"throw",
"new",
"CertificateNotFoundException",
"(",
"\"Certificate with id nu... | Finds a certificate by certificate id.
@param certificateId
certificate id bytes
@return certificate or null, if certificate is not found
@throws CertificateNotFoundException
if certificate with given id isn't found | [
"Finds",
"a",
"certificate",
"by",
"certificate",
"id",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java#L201-L211 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java | InMemoryPublicationsFile.getPublicationRecord | public PublicationRecord getPublicationRecord(Date time) {
PublicationRecord nearest = null;
for (PublicationRecord publicationRecord : publicationRecords) {
Date publicationTime = publicationRecord.getPublicationData().getPublicationTime();
if (publicationTime.equals(time) || pu... | java | public PublicationRecord getPublicationRecord(Date time) {
PublicationRecord nearest = null;
for (PublicationRecord publicationRecord : publicationRecords) {
Date publicationTime = publicationRecord.getPublicationData().getPublicationTime();
if (publicationTime.equals(time) || pu... | [
"public",
"PublicationRecord",
"getPublicationRecord",
"(",
"Date",
"time",
")",
"{",
"PublicationRecord",
"nearest",
"=",
"null",
";",
"for",
"(",
"PublicationRecord",
"publicationRecord",
":",
"publicationRecords",
")",
"{",
"Date",
"publicationTime",
"=",
"publicat... | Returns the closest publication record to given time. | [
"Returns",
"the",
"closest",
"publication",
"record",
"to",
"given",
"time",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java#L245-L258 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java | InMemoryPublicationsFile.getSignedData | protected byte[] getSignedData() throws KSIException {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
try {
byteStream.write(FILE_BEGINNING_MAGIC_BYTES);
for (TLVElement element : elements) {
if (ELEMENT_TYPE_CMS_SIGNATURE != element.getType()) {
... | java | protected byte[] getSignedData() throws KSIException {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
try {
byteStream.write(FILE_BEGINNING_MAGIC_BYTES);
for (TLVElement element : elements) {
if (ELEMENT_TYPE_CMS_SIGNATURE != element.getType()) {
... | [
"protected",
"byte",
"[",
"]",
"getSignedData",
"(",
")",
"throws",
"KSIException",
"{",
"ByteArrayOutputStream",
"byteStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"byteStream",
".",
"write",
"(",
"FILE_BEGINNING_MAGIC_BYTES",
")",
";",... | Get publications file bytes without signature.
@return byte array of publication file bytes without signature | [
"Get",
"publications",
"file",
"bytes",
"without",
"signature",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java#L265-L279 | train |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/AggregationHashChainUtil.java | AggregationHashChainUtil.calculateIndex | public static long calculateIndex(List<AggregationChainLink> links) {
notNull(links, "Aggregation chain links");
long chainIndex = 0;
for (int i = 0; i < links.size(); i++) {
if (links.get(i).isLeft()) {
chainIndex |= 1L << i;
}
}
chainInde... | java | public static long calculateIndex(List<AggregationChainLink> links) {
notNull(links, "Aggregation chain links");
long chainIndex = 0;
for (int i = 0; i < links.size(); i++) {
if (links.get(i).isLeft()) {
chainIndex |= 1L << i;
}
}
chainInde... | [
"public",
"static",
"long",
"calculateIndex",
"(",
"List",
"<",
"AggregationChainLink",
">",
"links",
")",
"{",
"notNull",
"(",
"links",
",",
"\"Aggregation chain links\"",
")",
";",
"long",
"chainIndex",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";... | Calculates chain index
@param links Chain links for which to calculate the index
@return Index of the chain | [
"Calculates",
"chain",
"index"
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/AggregationHashChainUtil.java#L35-L45 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.create | public static TLVElement create(byte[] bytes) throws TLVParserException {
Util.notNull(bytes, "Byte array");
TLVInputStream input = null;
try {
input = new TLVInputStream(new ByteArrayInputStream(bytes));
TLVElement element = input.readElement();
if (input.has... | java | public static TLVElement create(byte[] bytes) throws TLVParserException {
Util.notNull(bytes, "Byte array");
TLVInputStream input = null;
try {
input = new TLVInputStream(new ByteArrayInputStream(bytes));
TLVElement element = input.readElement();
if (input.has... | [
"public",
"static",
"TLVElement",
"create",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"TLVParserException",
"{",
"Util",
".",
"notNull",
"(",
"bytes",
",",
"\"Byte array\"",
")",
";",
"TLVInputStream",
"input",
"=",
"null",
";",
"try",
"{",
"input",
"... | Creates TLVElement form byte array.
@param bytes byte array to create the TLV element from.
@return {@link TLVElement}
@throws TLVParserException | [
"Creates",
"TLVElement",
"form",
"byte",
"array",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L103-L118 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.create | public static TLVElement create(int type, byte[] value) throws TLVParserException {
TLVElement element = create(type);
element.setContent(value);
return element;
} | java | public static TLVElement create(int type, byte[] value) throws TLVParserException {
TLVElement element = create(type);
element.setContent(value);
return element;
} | [
"public",
"static",
"TLVElement",
"create",
"(",
"int",
"type",
",",
"byte",
"[",
"]",
"value",
")",
"throws",
"TLVParserException",
"{",
"TLVElement",
"element",
"=",
"create",
"(",
"type",
")",
";",
"element",
".",
"setContent",
"(",
"value",
")",
";",
... | Creates TLV element with byte array content.
TLV element nonCritical and forwarded flags are set to false.
@param type TLV element type.
@param value value to be the content of the TLV element.
@return {@link TLVElement}
@throws TLVParserException | [
"Creates",
"TLV",
"element",
"with",
"byte",
"array",
"content",
".",
"TLV",
"element",
"nonCritical",
"and",
"forwarded",
"flags",
"are",
"set",
"to",
"false",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L199-L203 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.getDecodedString | public final String getDecodedString() throws TLVParserException {
byte[] data = getContent();
if (!(data.length > 0 && data[data.length - 1] == '\0')) {
throw new TLVParserException("String must be null terminated");
}
try {
return Util.decodeString(data, 0, data... | java | public final String getDecodedString() throws TLVParserException {
byte[] data = getContent();
if (!(data.length > 0 && data[data.length - 1] == '\0')) {
throw new TLVParserException("String must be null terminated");
}
try {
return Util.decodeString(data, 0, data... | [
"public",
"final",
"String",
"getDecodedString",
"(",
")",
"throws",
"TLVParserException",
"{",
"byte",
"[",
"]",
"data",
"=",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"(",
"data",
".",
"length",
">",
"0",
"&&",
"data",
"[",
"data",
".",
"length",
... | Converts the TLV element content data to UTF-8 string.
@return Decoded instance of string.
@throws TLVParserException
when content string isn't null terminated or is malformed UTF-8 data. | [
"Converts",
"the",
"TLV",
"element",
"content",
"data",
"to",
"UTF",
"-",
"8",
"string",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L257-L267 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.getDecodedHashAlgorithm | public HashAlgorithm getDecodedHashAlgorithm() throws TLVParserException {
int algorithmId = getDecodedLong().intValue();
if (HashAlgorithm.isHashAlgorithmId(algorithmId)) {
return HashAlgorithm.getById(algorithmId);
}
throw new TLVParserException("Unknown hash algorithm with... | java | public HashAlgorithm getDecodedHashAlgorithm() throws TLVParserException {
int algorithmId = getDecodedLong().intValue();
if (HashAlgorithm.isHashAlgorithmId(algorithmId)) {
return HashAlgorithm.getById(algorithmId);
}
throw new TLVParserException("Unknown hash algorithm with... | [
"public",
"HashAlgorithm",
"getDecodedHashAlgorithm",
"(",
")",
"throws",
"TLVParserException",
"{",
"int",
"algorithmId",
"=",
"getDecodedLong",
"(",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"HashAlgorithm",
".",
"isHashAlgorithmId",
"(",
"algorithmId",
")... | Gets HashAlgorithm form TLV element.
@return Instance of {@link HashAlgorithm}.
@throws TLVParserException | [
"Gets",
"HashAlgorithm",
"form",
"TLV",
"element",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L304-L310 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.getContent | public byte[] getContent() throws TLVParserException {
byte[] content = this.content;
if (!children.isEmpty()) {
for (TLVElement child : children) {
content = Util.join(content, child.encodeHeader());
content = Util.join(content, child.getContent());
... | java | public byte[] getContent() throws TLVParserException {
byte[] content = this.content;
if (!children.isEmpty()) {
for (TLVElement child : children) {
content = Util.join(content, child.encodeHeader());
content = Util.join(content, child.getContent());
... | [
"public",
"byte",
"[",
"]",
"getContent",
"(",
")",
"throws",
"TLVParserException",
"{",
"byte",
"[",
"]",
"content",
"=",
"this",
".",
"content",
";",
"if",
"(",
"!",
"children",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"TLVElement",
"child",
... | Returns the TLV content. If TLV does not include content then empty array is returned.
@return Byte array including TLV element content.
@throws TLVParserException | [
"Returns",
"the",
"TLV",
"content",
".",
"If",
"TLV",
"does",
"not",
"include",
"content",
"then",
"empty",
"array",
"is",
"returned",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L319-L328 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.setContent | public void setContent(byte[] content) throws TLVParserException {
Util.notNull(content, "Content");
assertActualContentLengthIsInTLVLimits(content.length);
this.content = content;
} | java | public void setContent(byte[] content) throws TLVParserException {
Util.notNull(content, "Content");
assertActualContentLengthIsInTLVLimits(content.length);
this.content = content;
} | [
"public",
"void",
"setContent",
"(",
"byte",
"[",
"]",
"content",
")",
"throws",
"TLVParserException",
"{",
"Util",
".",
"notNull",
"(",
"content",
",",
"\"Content\"",
")",
";",
"assertActualContentLengthIsInTLVLimits",
"(",
"content",
".",
"length",
")",
";",
... | Sets the value to TLV element content.
@param content
value to set.
@throws TLVParserException | [
"Sets",
"the",
"value",
"to",
"TLV",
"element",
"content",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L338-L342 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.getFirstChildElement | public TLVElement getFirstChildElement(int tag) {
for (TLVElement element : children) {
if (tag == element.getType()) {
return element;
}
}
return null;
} | java | public TLVElement getFirstChildElement(int tag) {
for (TLVElement element : children) {
if (tag == element.getType()) {
return element;
}
}
return null;
} | [
"public",
"TLVElement",
"getFirstChildElement",
"(",
"int",
"tag",
")",
"{",
"for",
"(",
"TLVElement",
"element",
":",
"children",
")",
"{",
"if",
"(",
"tag",
"==",
"element",
".",
"getType",
"(",
")",
")",
"{",
"return",
"element",
";",
"}",
"}",
"ret... | Returns the first child element with specified tag. If tag doesn't exist then null is returned.
@param tag
tag to search.
@return The first instance of {@link TLVElement} with specified tag,
or null when the child element with specified tag doesn't exist. | [
"Returns",
"the",
"first",
"child",
"element",
"with",
"specified",
"tag",
".",
"If",
"tag",
"doesn",
"t",
"exist",
"then",
"null",
"is",
"returned",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L388-L395 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.getChildElements | public List<TLVElement> getChildElements(int tag) {
List<TLVElement> elements = new LinkedList<>();
for (TLVElement element : children) {
if (tag == element.getType()) {
elements.add(element);
}
}
return elements;
} | java | public List<TLVElement> getChildElements(int tag) {
List<TLVElement> elements = new LinkedList<>();
for (TLVElement element : children) {
if (tag == element.getType()) {
elements.add(element);
}
}
return elements;
} | [
"public",
"List",
"<",
"TLVElement",
">",
"getChildElements",
"(",
"int",
"tag",
")",
"{",
"List",
"<",
"TLVElement",
">",
"elements",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"TLVElement",
"element",
":",
"children",
")",
"{",
"if",
... | Returns all the tags with the specified tag.
@param tag
tag to search.
@return The list of {@link TLVElement}'s with specified tag or empty list. | [
"Returns",
"all",
"the",
"tags",
"with",
"the",
"specified",
"tag",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L426-L434 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.encodeHeader | public byte[] encodeHeader() throws TLVParserException {
DataOutputStream out = null;
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
out = new DataOutputStream(byteArrayOutputStream);
int dataLength = getContentLength();
... | java | public byte[] encodeHeader() throws TLVParserException {
DataOutputStream out = null;
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
out = new DataOutputStream(byteArrayOutputStream);
int dataLength = getContentLength();
... | [
"public",
"byte",
"[",
"]",
"encodeHeader",
"(",
")",
"throws",
"TLVParserException",
"{",
"DataOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"ByteArrayOutputStream",
"byteArrayOutputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"out",
"=",
... | Encodes TLV header.
@return Byte array containing encoded TLV header.
@throws TLVParserException
when TLV header encoding fails or I/O error occurs. | [
"Encodes",
"TLV",
"header",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L484-L520 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.replace | public void replace(TLVElement childToBeReplaced, TLVElement newChild) {
for (int i = 0; i < children.size(); i++) {
if (children.get(i).equals(childToBeReplaced)) {
children.set(i, newChild);
return;
}
}
} | java | public void replace(TLVElement childToBeReplaced, TLVElement newChild) {
for (int i = 0; i < children.size(); i++) {
if (children.get(i).equals(childToBeReplaced)) {
children.set(i, newChild);
return;
}
}
} | [
"public",
"void",
"replace",
"(",
"TLVElement",
"childToBeReplaced",
",",
"TLVElement",
"newChild",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"children",
".",
... | Replaces first element with given one.
@param childToBeReplaced
TLV element to be replaced.
@param newChild
new TLV element. | [
"Replaces",
"first",
"element",
"with",
"given",
"one",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L548-L555 | train |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.writeTo | public void writeTo(OutputStream out) throws TLVParserException {
Util.notNull(out, "Output stream");
try {
assertActualContentLengthIsInTLVLimits(getContentLength());
out.write(encodeHeader());
out.write(getContent());
} catch (IOException e) {
th... | java | public void writeTo(OutputStream out) throws TLVParserException {
Util.notNull(out, "Output stream");
try {
assertActualContentLengthIsInTLVLimits(getContentLength());
out.write(encodeHeader());
out.write(getContent());
} catch (IOException e) {
th... | [
"public",
"void",
"writeTo",
"(",
"OutputStream",
"out",
")",
"throws",
"TLVParserException",
"{",
"Util",
".",
"notNull",
"(",
"out",
",",
"\"Output stream\"",
")",
";",
"try",
"{",
"assertActualContentLengthIsInTLVLimits",
"(",
"getContentLength",
"(",
")",
")",... | Writes the encoded TLV element to the specified output stream.
@param out
the output stream to which to write the TLV element data.
@throws TLVParserException
when I/O error occurred or TLV encoding failed. | [
"Writes",
"the",
"encoded",
"TLV",
"element",
"to",
"the",
"specified",
"output",
"stream",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L582-L591 | train |
guardtime/ksi-java-sdk | ksi-service-client-tcp/src/main/java/com/guardtime/ksi/service/tcp/TransactionDecoder.java | TransactionDecoder.extractNextTlvElementLength | private int extractNextTlvElementLength(IoBuffer in) {
if (!hasRemainingData(in, 2)) {
return NOT_ENOUGH_DATA;
}
try {
in.mark();
int firstByte = in.getUnsigned();
boolean tlv8 = (firstByte & TLV16_MASK) == 0;
if (tlv8) {
... | java | private int extractNextTlvElementLength(IoBuffer in) {
if (!hasRemainingData(in, 2)) {
return NOT_ENOUGH_DATA;
}
try {
in.mark();
int firstByte = in.getUnsigned();
boolean tlv8 = (firstByte & TLV16_MASK) == 0;
if (tlv8) {
... | [
"private",
"int",
"extractNextTlvElementLength",
"(",
"IoBuffer",
"in",
")",
"{",
"if",
"(",
"!",
"hasRemainingData",
"(",
"in",
",",
"2",
")",
")",
"{",
"return",
"NOT_ENOUGH_DATA",
";",
"}",
"try",
"{",
"in",
".",
"mark",
"(",
")",
";",
"int",
"first... | Returns the length of the next TLV element. Returns -1 when buffer doesn't contain enough data for next TLV
element.
@return The length of the TLV element. | [
"Returns",
"the",
"length",
"of",
"the",
"next",
"TLV",
"element",
".",
"Returns",
"-",
"1",
"when",
"buffer",
"doesn",
"t",
"contain",
"enough",
"data",
"for",
"next",
"TLV",
"element",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client-tcp/src/main/java/com/guardtime/ksi/service/tcp/TransactionDecoder.java#L69-L91 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Servers.java | Servers.create | public Server create(ServerCreateOptions serverCreateOptions) throws IOException, MailosaurException {
return client.request("POST", "api/servers", serverCreateOptions).parseAs(Server.class);
} | java | public Server create(ServerCreateOptions serverCreateOptions) throws IOException, MailosaurException {
return client.request("POST", "api/servers", serverCreateOptions).parseAs(Server.class);
} | [
"public",
"Server",
"create",
"(",
"ServerCreateOptions",
"serverCreateOptions",
")",
"throws",
"IOException",
",",
"MailosaurException",
"{",
"return",
"client",
".",
"request",
"(",
"\"POST\"",
",",
"\"api/servers\"",
",",
"serverCreateOptions",
")",
".",
"parseAs",... | Create a server.
Creates a new virtual SMTP server and returns it.
@param serverCreateOptions the ServerCreateOptions value
@throws MailosaurException thrown if the request is rejected by server
@throws IOException
@return the Server object if successful. | [
"Create",
"a",
"server",
".",
"Creates",
"a",
"new",
"virtual",
"SMTP",
"server",
"and",
"returns",
"it",
"."
] | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Servers.java#L48-L50 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Servers.java | Servers.get | public Server get(String id) throws IOException, MailosaurException {
return client.request("GET", "api/servers/" + id).parseAs(Server.class);
} | java | public Server get(String id) throws IOException, MailosaurException {
return client.request("GET", "api/servers/" + id).parseAs(Server.class);
} | [
"public",
"Server",
"get",
"(",
"String",
"id",
")",
"throws",
"IOException",
",",
"MailosaurException",
"{",
"return",
"client",
".",
"request",
"(",
"\"GET\"",
",",
"\"api/servers/\"",
"+",
"id",
")",
".",
"parseAs",
"(",
"Server",
".",
"class",
")",
";"... | Retrieve a server.
Retrieves the detail for a single server. Simply supply the unique identifier for the required server.
@param id The identifier of the server to be retrieved.
@throws MailosaurException thrown if the request is rejected by server
@throws IOException
@return the Server object if successful. | [
"Retrieve",
"a",
"server",
".",
"Retrieves",
"the",
"detail",
"for",
"a",
"single",
"server",
".",
"Simply",
"supply",
"the",
"unique",
"identifier",
"for",
"the",
"required",
"server",
"."
] | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Servers.java#L61-L63 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Servers.java | Servers.update | public Server update(String id, Server server) throws IOException, MailosaurException {
return client.request("PUT", "api/servers/" + id, server).parseAs(Server.class);
} | java | public Server update(String id, Server server) throws IOException, MailosaurException {
return client.request("PUT", "api/servers/" + id, server).parseAs(Server.class);
} | [
"public",
"Server",
"update",
"(",
"String",
"id",
",",
"Server",
"server",
")",
"throws",
"IOException",
",",
"MailosaurException",
"{",
"return",
"client",
".",
"request",
"(",
"\"PUT\"",
",",
"\"api/servers/\"",
"+",
"id",
",",
"server",
")",
".",
"parseA... | Update a server.
Updats a single server and returns it.
@param id The identifier of the server to be updated.
@param server the Server value
@throws MailosaurException thrown if the request is rejected by server
@throws IOException
@return the Server object if successful. | [
"Update",
"a",
"server",
".",
"Updats",
"a",
"single",
"server",
"and",
"returns",
"it",
"."
] | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Servers.java#L75-L77 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Messages.java | Messages.get | public Message get(String id) throws IOException, MailosaurException {
return client.request("GET", "api/messages/" + id).parseAs(Message.class);
} | java | public Message get(String id) throws IOException, MailosaurException {
return client.request("GET", "api/messages/" + id).parseAs(Message.class);
} | [
"public",
"Message",
"get",
"(",
"String",
"id",
")",
"throws",
"IOException",
",",
"MailosaurException",
"{",
"return",
"client",
".",
"request",
"(",
"\"GET\"",
",",
"\"api/messages/\"",
"+",
"id",
")",
".",
"parseAs",
"(",
"Message",
".",
"class",
")",
... | Retrieve an message.
Retrieves the detail for a single message. Simply supply the unique identifier for the required message.
@param id The identifier of the message to be retrieved.
@throws MailosaurException thrown if the request is rejected by server
@throws IOException
@return the Message object if successful. | [
"Retrieve",
"an",
"message",
".",
"Retrieves",
"the",
"detail",
"for",
"a",
"single",
"message",
".",
"Simply",
"supply",
"the",
"unique",
"identifier",
"for",
"the",
"required",
"message",
"."
] | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Messages.java#L36-L38 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Messages.java | Messages.deleteAll | public void deleteAll(String server) throws MailosaurException {
HashMap<String, String> query = new HashMap<String, String>();
query.put("server", server);
client.request("DELETE", "api/messages", query);
} | java | public void deleteAll(String server) throws MailosaurException {
HashMap<String, String> query = new HashMap<String, String>();
query.put("server", server);
client.request("DELETE", "api/messages", query);
} | [
"public",
"void",
"deleteAll",
"(",
"String",
"server",
")",
"throws",
"MailosaurException",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"query",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"query",
".",
"put",
"(",
... | Delete all messages.
Permanently deletes all messages held by the specified server. This operation cannot be undone. Also deletes any attachments related to each message.
@param server The identifier of the server to be emptied.
@throws MailosaurException thrown if the request is rejected by server | [
"Delete",
"all",
"messages",
".",
"Permanently",
"deletes",
"all",
"messages",
"held",
"by",
"the",
"specified",
"server",
".",
"This",
"operation",
"cannot",
"be",
"undone",
".",
"Also",
"deletes",
"any",
"attachments",
"related",
"to",
"each",
"message",
"."... | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Messages.java#L59-L63 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Messages.java | Messages.list | public MessageListResult list(String server) throws IOException, MailosaurException {
HashMap<String, String> query = new HashMap<String, String>();
query.put("server", server);
return client.request("GET", "api/messages", query).parseAs(MessageListResult.class);
} | java | public MessageListResult list(String server) throws IOException, MailosaurException {
HashMap<String, String> query = new HashMap<String, String>();
query.put("server", server);
return client.request("GET", "api/messages", query).parseAs(MessageListResult.class);
} | [
"public",
"MessageListResult",
"list",
"(",
"String",
"server",
")",
"throws",
"IOException",
",",
"MailosaurException",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"query",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"q... | List all messages.
Returns a list of your messages. The messages are returned sorted by received date, with the most recently-received messages appearing first.
@param server The identifier of the server hosting the messages.
@throws MailosaurException thrown if the request is rejected by server
@throws IOException
@r... | [
"List",
"all",
"messages",
".",
"Returns",
"a",
"list",
"of",
"your",
"messages",
".",
"The",
"messages",
"are",
"returned",
"sorted",
"by",
"received",
"date",
"with",
"the",
"most",
"recently",
"-",
"received",
"messages",
"appearing",
"first",
"."
] | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Messages.java#L74-L78 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Messages.java | Messages.search | public MessageListResult search(String server, SearchCriteria criteria) throws IOException, MailosaurException {
HashMap<String, String> query = new HashMap<String, String>();
query.put("server", server);
return client.request("POST", "api/messages/search", criteria, query).parseAs(MessageListResult.clas... | java | public MessageListResult search(String server, SearchCriteria criteria) throws IOException, MailosaurException {
HashMap<String, String> query = new HashMap<String, String>();
query.put("server", server);
return client.request("POST", "api/messages/search", criteria, query).parseAs(MessageListResult.clas... | [
"public",
"MessageListResult",
"search",
"(",
"String",
"server",
",",
"SearchCriteria",
"criteria",
")",
"throws",
"IOException",
",",
"MailosaurException",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"query",
"=",
"new",
"HashMap",
"<",
"String",
",",
... | Search for messages.
Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
@param server The identifier of the server hosting the messages.
@param criteria The search criteria to match results agai... | [
"Search",
"for",
"messages",
".",
"Returns",
"a",
"list",
"of",
"messages",
"matching",
"the",
"specified",
"search",
"criteria",
".",
"The",
"messages",
"are",
"returned",
"sorted",
"by",
"received",
"date",
"with",
"the",
"most",
"recently",
"-",
"received",... | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Messages.java#L90-L94 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Messages.java | Messages.waitFor | public Message waitFor(String server, SearchCriteria criteria) throws IOException, MailosaurException {
HashMap<String, String> query = new HashMap<String, String>();
query.put("server", server);
return client.request("POST", "api/messages/await", criteria, query).parseAs(Message.class);
} | java | public Message waitFor(String server, SearchCriteria criteria) throws IOException, MailosaurException {
HashMap<String, String> query = new HashMap<String, String>();
query.put("server", server);
return client.request("POST", "api/messages/await", criteria, query).parseAs(Message.class);
} | [
"public",
"Message",
"waitFor",
"(",
"String",
"server",
",",
"SearchCriteria",
"criteria",
")",
"throws",
"IOException",
",",
"MailosaurException",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"query",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String"... | Wait for a specific message.
Returns as soon as an message matching the specified search criteria is found.
@param server The identifier of the server hosting the message.
@param criteria The search criteria to use in order to find a match.
@throws MailosaurException thrown if the request is rejected by server
@throws... | [
"Wait",
"for",
"a",
"specific",
"message",
".",
"Returns",
"as",
"soon",
"as",
"an",
"message",
"matching",
"the",
"specified",
"search",
"criteria",
"is",
"found",
"."
] | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Messages.java#L106-L110 | train |
mailosaur/mailosaur-java | src/main/java/com/mailosaur/Analysis.java | Analysis.spam | public SpamAnalysisResult spam(String email) throws IOException, MailosaurException {
return client.request("GET", "api/analysis/spam/" + email).parseAs(SpamAnalysisResult.class);
} | java | public SpamAnalysisResult spam(String email) throws IOException, MailosaurException {
return client.request("GET", "api/analysis/spam/" + email).parseAs(SpamAnalysisResult.class);
} | [
"public",
"SpamAnalysisResult",
"spam",
"(",
"String",
"email",
")",
"throws",
"IOException",
",",
"MailosaurException",
"{",
"return",
"client",
".",
"request",
"(",
"\"GET\"",
",",
"\"api/analysis/spam/\"",
"+",
"email",
")",
".",
"parseAs",
"(",
"SpamAnalysisRe... | Perform spam analysis on the specified email.
@param email The identifier of the email to be analyzed.
@throws MailosaurException thrown if the request is rejected by server
@throws IOException
@return the SpamCheckResult object if successful. | [
"Perform",
"spam",
"analysis",
"on",
"the",
"specified",
"email",
"."
] | a580760f2eb41e034127d93104c7050639eced97 | https://github.com/mailosaur/mailosaur-java/blob/a580760f2eb41e034127d93104c7050639eced97/src/main/java/com/mailosaur/Analysis.java#L32-L34 | train |
BroadleafCommerce/blc-paypal | src/main/java/org/broadleafcommerce/vendor/paypal/web/controller/BroadleafPayPalCheckoutController.java | BroadleafPayPalCheckoutController.completeCheckout | @RequestMapping(value = "/checkout/complete", method = RequestMethod.POST)
public String completeCheckout() throws PaymentException {
paymentService.updatePayPalPaymentForFulfillment();
String paymentId = paymentService.getPayPalPaymentIdFromCurrentOrder();
String payerId = paymentService.ge... | java | @RequestMapping(value = "/checkout/complete", method = RequestMethod.POST)
public String completeCheckout() throws PaymentException {
paymentService.updatePayPalPaymentForFulfillment();
String paymentId = paymentService.getPayPalPaymentIdFromCurrentOrder();
String payerId = paymentService.ge... | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/checkout/complete\"",
",",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"public",
"String",
"completeCheckout",
"(",
")",
"throws",
"PaymentException",
"{",
"paymentService",
".",
"updatePayPalPaymentForFulfillment",
... | Completes checkout for a PayPal payment. If there's already a PayPal payment we go ahead and make sure the details
of the payment are updated to all of the forms filled out by the customer since they could've updated shipping
information, added a promotion, or other various things to the order.
@return Redirect URL to... | [
"Completes",
"checkout",
"for",
"a",
"PayPal",
"payment",
".",
"If",
"there",
"s",
"already",
"a",
"PayPal",
"payment",
"we",
"go",
"ahead",
"and",
"make",
"sure",
"the",
"details",
"of",
"the",
"payment",
"are",
"updated",
"to",
"all",
"of",
"the",
"for... | 2b38e25722411f136f9012c030519013f6cb010a | https://github.com/BroadleafCommerce/blc-paypal/blob/2b38e25722411f136f9012c030519013f6cb010a/src/main/java/org/broadleafcommerce/vendor/paypal/web/controller/BroadleafPayPalCheckoutController.java#L161-L173 | train |
digipost/signature-api-client-java | src/main/java/no/digipost/signature/client/portal/PortalJobStatusChanged.java | PortalJobStatusChanged.getSignatureFrom | public Signature getSignatureFrom(SignerIdentifier signer) {
return signatures.stream()
.filter(signatureFrom(signer))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unable to find signature from this signer"));
} | java | public Signature getSignatureFrom(SignerIdentifier signer) {
return signatures.stream()
.filter(signatureFrom(signer))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unable to find signature from this signer"));
} | [
"public",
"Signature",
"getSignatureFrom",
"(",
"SignerIdentifier",
"signer",
")",
"{",
"return",
"signatures",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"signatureFrom",
"(",
"signer",
")",
")",
".",
"findFirst",
"(",
")",
".",
"orElseThrow",
"(",
"(",
... | Gets the signature from a given signer.
@param signer an identifier referring to a signer of the job. It may be a personal identification number or
contact information, depending of how the {@link PortalSigner signer} was initially created
(using {@link PortalSigner#identifiedByPersonalIdentificationNumber(String, Not... | [
"Gets",
"the",
"signature",
"from",
"a",
"given",
"signer",
"."
] | 246207571641fbac6beda5ffc585eec188825c45 | https://github.com/digipost/signature-api-client-java/blob/246207571641fbac6beda5ffc585eec188825c45/src/main/java/no/digipost/signature/client/portal/PortalJobStatusChanged.java#L115-L120 | train |
digipost/signature-api-client-java | src/main/java/no/digipost/signature/client/direct/RedirectUrls.java | RedirectUrls.getFor | public String getFor(String personalIdentificationNumber) {
for (RedirectUrl redirectUrl : urls) {
if (redirectUrl.signer.equals(personalIdentificationNumber)) {
return redirectUrl.url;
}
}
throw new IllegalArgumentException("Unable to find redirect URL fo... | java | public String getFor(String personalIdentificationNumber) {
for (RedirectUrl redirectUrl : urls) {
if (redirectUrl.signer.equals(personalIdentificationNumber)) {
return redirectUrl.url;
}
}
throw new IllegalArgumentException("Unable to find redirect URL fo... | [
"public",
"String",
"getFor",
"(",
"String",
"personalIdentificationNumber",
")",
"{",
"for",
"(",
"RedirectUrl",
"redirectUrl",
":",
"urls",
")",
"{",
"if",
"(",
"redirectUrl",
".",
"signer",
".",
"equals",
"(",
"personalIdentificationNumber",
")",
")",
"{",
... | Gets the redirect URL for a given signer.
@throws IllegalArgumentException if the job response doesn't contain a redirect URL for this signer
@see DirectJobResponse#getSingleRedirectUrl() | [
"Gets",
"the",
"redirect",
"URL",
"for",
"a",
"given",
"signer",
"."
] | 246207571641fbac6beda5ffc585eec188825c45 | https://github.com/digipost/signature-api-client-java/blob/246207571641fbac6beda5ffc585eec188825c45/src/main/java/no/digipost/signature/client/direct/RedirectUrls.java#L27-L34 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.getMetadataFor | public <T> IMetadataDictionary getMetadataFor(T instance) {
if (instance == null) {
throw new IllegalArgumentException("Instance cannot be null");
}
DocumentInfo documentInfo = getDocumentInfo(instance);
if (documentInfo.getMetadataInstance() != null) {
return do... | java | public <T> IMetadataDictionary getMetadataFor(T instance) {
if (instance == null) {
throw new IllegalArgumentException("Instance cannot be null");
}
DocumentInfo documentInfo = getDocumentInfo(instance);
if (documentInfo.getMetadataInstance() != null) {
return do... | [
"public",
"<",
"T",
">",
"IMetadataDictionary",
"getMetadataFor",
"(",
"T",
"instance",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Instance cannot be null\"",
")",
";",
"}",
"DocumentInfo",
"docum... | Gets the metadata for the specified entity.
@param <T> instance class
@param instance Instance to get metadata from
@return document metadata | [
"Gets",
"the",
"metadata",
"for",
"the",
"specified",
"entity",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L351-L365 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.getCountersFor | public <T> List<String> getCountersFor(T instance) {
if (instance == null) {
throw new IllegalArgumentException("Instance cannot be null");
}
DocumentInfo documentInfo = getDocumentInfo(instance);
ArrayNode countersArray = (ArrayNode) documentInfo.getMetadata().get(Constant... | java | public <T> List<String> getCountersFor(T instance) {
if (instance == null) {
throw new IllegalArgumentException("Instance cannot be null");
}
DocumentInfo documentInfo = getDocumentInfo(instance);
ArrayNode countersArray = (ArrayNode) documentInfo.getMetadata().get(Constant... | [
"public",
"<",
"T",
">",
"List",
"<",
"String",
">",
"getCountersFor",
"(",
"T",
"instance",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Instance cannot be null\"",
")",
";",
"}",
"DocumentInfo... | Gets all counter names for the specified entity.
@param instance Instance
@param <T> Instance class
@return All counters names | [
"Gets",
"all",
"counter",
"names",
"for",
"the",
"specified",
"entity",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L373-L388 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.getChangeVectorFor | public <T> String getChangeVectorFor(T instance) {
if (instance == null) {
throw new IllegalArgumentException("instance cannot be null");
}
DocumentInfo documentInfo = getDocumentInfo(instance);
JsonNode changeVector = documentInfo.getMetadata().get(Constants.Documents.Metad... | java | public <T> String getChangeVectorFor(T instance) {
if (instance == null) {
throw new IllegalArgumentException("instance cannot be null");
}
DocumentInfo documentInfo = getDocumentInfo(instance);
JsonNode changeVector = documentInfo.getMetadata().get(Constants.Documents.Metad... | [
"public",
"<",
"T",
">",
"String",
"getChangeVectorFor",
"(",
"T",
"instance",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"instance cannot be null\"",
")",
";",
"}",
"DocumentInfo",
"documentInfo",... | Gets the Change Vector for the specified entity.
If the entity is transient, it will load the change vector from the store
and associate the current state of the entity with the change vector from the server.
@param <T> instance class
@param instance Instance to get change vector from
@return change vector | [
"Gets",
"the",
"Change",
"Vector",
"for",
"the",
"specified",
"entity",
".",
"If",
"the",
"entity",
"is",
"transient",
"it",
"will",
"load",
"the",
"change",
"vector",
"from",
"the",
"store",
"and",
"associate",
"the",
"current",
"state",
"of",
"the",
"ent... | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L399-L410 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.getDocumentId | public String getDocumentId(Object instance) {
if (instance == null) {
return null;
}
DocumentInfo value = documentsByEntity.get(instance);
return value != null ? value.getId() : null;
} | java | public String getDocumentId(Object instance) {
if (instance == null) {
return null;
}
DocumentInfo value = documentsByEntity.get(instance);
return value != null ? value.getId() : null;
} | [
"public",
"String",
"getDocumentId",
"(",
"Object",
"instance",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"DocumentInfo",
"value",
"=",
"documentsByEntity",
".",
"get",
"(",
"instance",
")",
";",
"return",
"value"... | Gets the document id.
@param instance instance to get document id from
@return document id | [
"Gets",
"the",
"document",
"id",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L475-L481 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.trackEntity | @SuppressWarnings("unchecked")
public <T> T trackEntity(Class<T> clazz, DocumentInfo documentFound) {
return (T) trackEntity(clazz, documentFound.getId(), documentFound.getDocument(), documentFound.getMetadata(), noTracking);
} | java | @SuppressWarnings("unchecked")
public <T> T trackEntity(Class<T> clazz, DocumentInfo documentFound) {
return (T) trackEntity(clazz, documentFound.getId(), documentFound.getDocument(), documentFound.getMetadata(), noTracking);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"trackEntity",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"DocumentInfo",
"documentFound",
")",
"{",
"return",
"(",
"T",
")",
"trackEntity",
"(",
"clazz",
",",
"documentFound... | Tracks the entity inside the unit of work
@param <T> entity class
@param clazz entity class
@param documentFound Document info
@return tracked entity | [
"Tracks",
"the",
"entity",
"inside",
"the",
"unit",
"of",
"work"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L501-L504 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.trackEntity | public Object trackEntity(Class entityType, String id, ObjectNode document, ObjectNode metadata, boolean noTracking) {
noTracking = this.noTracking || noTracking; // if noTracking is session-wide then we want to override the passed argument
if (StringUtils.isEmpty(id)) {
return deserializ... | java | public Object trackEntity(Class entityType, String id, ObjectNode document, ObjectNode metadata, boolean noTracking) {
noTracking = this.noTracking || noTracking; // if noTracking is session-wide then we want to override the passed argument
if (StringUtils.isEmpty(id)) {
return deserializ... | [
"public",
"Object",
"trackEntity",
"(",
"Class",
"entityType",
",",
"String",
"id",
",",
"ObjectNode",
"document",
",",
"ObjectNode",
"metadata",
",",
"boolean",
"noTracking",
")",
"{",
"noTracking",
"=",
"this",
".",
"noTracking",
"||",
"noTracking",
";",
"//... | Tracks the entity.
@param entityType Entity class
@param id Id of document
@param document raw entity
@param metadata raw document metadata
@param noTracking no tracking
@return entity | [
"Tracks",
"the",
"entity",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L545-L605 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.delete | public <T> void delete(T entity) {
if (entity == null) {
throw new IllegalArgumentException("Entity cannot be null");
}
DocumentInfo value = documentsByEntity.get(entity);
if (value == null) {
throw new IllegalStateException(entity + " is not associated with the ... | java | public <T> void delete(T entity) {
if (entity == null) {
throw new IllegalArgumentException("Entity cannot be null");
}
DocumentInfo value = documentsByEntity.get(entity);
if (value == null) {
throw new IllegalStateException(entity + " is not associated with the ... | [
"public",
"<",
"T",
">",
"void",
"delete",
"(",
"T",
"entity",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Entity cannot be null\"",
")",
";",
"}",
"DocumentInfo",
"value",
"=",
"documentsByEntit... | Marks the specified entity for deletion. The entity will be deleted when SaveChanges is called.
@param <T> entity class
@param entity Entity to delete | [
"Marks",
"the",
"specified",
"entity",
"for",
"deletion",
".",
"The",
"entity",
"will",
"be",
"deleted",
"when",
"SaveChanges",
"is",
"called",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L624-L640 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.store | public void store(Object entity) {
Reference<String> stringReference = new Reference<>();
boolean hasId = generateEntityIdOnTheClient.tryGetIdFromInstance(entity, stringReference);
storeInternal(entity, null, null, !hasId ? ConcurrencyCheckMode.FORCED : ConcurrencyCheckMode.AUTO);
} | java | public void store(Object entity) {
Reference<String> stringReference = new Reference<>();
boolean hasId = generateEntityIdOnTheClient.tryGetIdFromInstance(entity, stringReference);
storeInternal(entity, null, null, !hasId ? ConcurrencyCheckMode.FORCED : ConcurrencyCheckMode.AUTO);
} | [
"public",
"void",
"store",
"(",
"Object",
"entity",
")",
"{",
"Reference",
"<",
"String",
">",
"stringReference",
"=",
"new",
"Reference",
"<>",
"(",
")",
";",
"boolean",
"hasId",
"=",
"generateEntityIdOnTheClient",
".",
"tryGetIdFromInstance",
"(",
"entity",
... | Stores the specified entity in the session. The entity will be saved when SaveChanges is called.
@param entity Entity to store | [
"Stores",
"the",
"specified",
"entity",
"in",
"the",
"session",
".",
"The",
"entity",
"will",
"be",
"saved",
"when",
"SaveChanges",
"is",
"called",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L686-L690 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.hasChanges | public boolean hasChanges() {
for (Map.Entry<Object, DocumentInfo> entity : documentsByEntity.entrySet()) {
ObjectNode document = entityToJson.convertEntityToJson(entity.getKey(), entity.getValue());
if (entityChanged(document, entity.getValue(), null)) {
return true;
... | java | public boolean hasChanges() {
for (Map.Entry<Object, DocumentInfo> entity : documentsByEntity.entrySet()) {
ObjectNode document = entityToJson.convertEntityToJson(entity.getKey(), entity.getValue());
if (entityChanged(document, entity.getValue(), null)) {
return true;
... | [
"public",
"boolean",
"hasChanges",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"DocumentInfo",
">",
"entity",
":",
"documentsByEntity",
".",
"entrySet",
"(",
")",
")",
"{",
"ObjectNode",
"document",
"=",
"entityToJson",
".",
"conver... | Gets a value indicating whether any of the entities tracked by the session has changes.
@return true if session has changes | [
"Gets",
"a",
"value",
"indicating",
"whether",
"any",
"of",
"the",
"entities",
"tracked",
"by",
"the",
"session",
"has",
"changes",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L1074-L1083 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.hasChanged | public boolean hasChanged(Object entity) {
DocumentInfo documentInfo = documentsByEntity.get(entity);
if (documentInfo == null) {
return false;
}
ObjectNode document = entityToJson.convertEntityToJson(entity, documentInfo);
return entityChanged(document, documentInf... | java | public boolean hasChanged(Object entity) {
DocumentInfo documentInfo = documentsByEntity.get(entity);
if (documentInfo == null) {
return false;
}
ObjectNode document = entityToJson.convertEntityToJson(entity, documentInfo);
return entityChanged(document, documentInf... | [
"public",
"boolean",
"hasChanged",
"(",
"Object",
"entity",
")",
"{",
"DocumentInfo",
"documentInfo",
"=",
"documentsByEntity",
".",
"get",
"(",
"entity",
")",
";",
"if",
"(",
"documentInfo",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"ObjectNode",... | Determines whether the specified entity has changed.
@param entity Entity to check
@return true if entity has changed | [
"Determines",
"whether",
"the",
"specified",
"entity",
"has",
"changed",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L1091-L1100 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.evict | public <T> void evict(T entity) {
DocumentInfo documentInfo = documentsByEntity.get(entity);
if (documentInfo != null) {
documentsByEntity.remove(entity);
documentsById.remove(documentInfo.getId());
}
deletedEntities.remove(entity);
if (_countersByDocId !... | java | public <T> void evict(T entity) {
DocumentInfo documentInfo = documentsByEntity.get(entity);
if (documentInfo != null) {
documentsByEntity.remove(entity);
documentsById.remove(documentInfo.getId());
}
deletedEntities.remove(entity);
if (_countersByDocId !... | [
"public",
"<",
"T",
">",
"void",
"evict",
"(",
"T",
"entity",
")",
"{",
"DocumentInfo",
"documentInfo",
"=",
"documentsByEntity",
".",
"get",
"(",
"entity",
")",
";",
"if",
"(",
"documentInfo",
"!=",
"null",
")",
"{",
"documentsByEntity",
".",
"remove",
... | Evicts the specified entity from the session.
Remove the entity from the delete queue and stops tracking changes for this entity.
@param <T> entity class
@param entity Entity to evict | [
"Evicts",
"the",
"specified",
"entity",
"from",
"the",
"session",
".",
"Remove",
"the",
"entity",
"from",
"the",
"delete",
"queue",
"and",
"stops",
"tracking",
"changes",
"for",
"this",
"entity",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L1172-L1183 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.clear | public void clear() {
documentsByEntity.clear();
deletedEntities.clear();
documentsById.clear();
_knownMissingIds.clear();
if (_countersByDocId != null) {
_countersByDocId.clear();
}
} | java | public void clear() {
documentsByEntity.clear();
deletedEntities.clear();
documentsById.clear();
_knownMissingIds.clear();
if (_countersByDocId != null) {
_countersByDocId.clear();
}
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"documentsByEntity",
".",
"clear",
"(",
")",
";",
"deletedEntities",
".",
"clear",
"(",
")",
";",
"documentsById",
".",
"clear",
"(",
")",
";",
"_knownMissingIds",
".",
"clear",
"(",
")",
";",
"if",
"(",
"_coun... | Clears this instance.
Remove all entities from the delete queue and stops tracking changes for all entities. | [
"Clears",
"this",
"instance",
".",
"Remove",
"all",
"entities",
"from",
"the",
"delete",
"queue",
"and",
"stops",
"tracking",
"changes",
"for",
"all",
"entities",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L1189-L1197 | train |
wcm-io/wcm-io-wcm | ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/impl/servlets/TemplateFilterPageTreeProvider.java | TemplateFilterPageTreeProvider.getPagePathsForTemplate | private Set<String> getPagePathsForTemplate(String[] templates, String rootPath, SlingHttpServletRequest request) {
Set<String> pagePaths = new HashSet<>();
if (templates != null && templates.length > 0) {
try {
NodeIterator nodes = searchNodesByTemplate(templates, rootPath, request);
whi... | java | private Set<String> getPagePathsForTemplate(String[] templates, String rootPath, SlingHttpServletRequest request) {
Set<String> pagePaths = new HashSet<>();
if (templates != null && templates.length > 0) {
try {
NodeIterator nodes = searchNodesByTemplate(templates, rootPath, request);
whi... | [
"private",
"Set",
"<",
"String",
">",
"getPagePathsForTemplate",
"(",
"String",
"[",
"]",
"templates",
",",
"String",
"rootPath",
",",
"SlingHttpServletRequest",
"request",
")",
"{",
"Set",
"<",
"String",
">",
"pagePaths",
"=",
"new",
"HashSet",
"<>",
"(",
"... | Get paths for pages that use the given template
@param templates
@param rootPath
@return a set of nodes that should be displayed in the tree | [
"Get",
"paths",
"for",
"pages",
"that",
"use",
"the",
"given",
"template"
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/impl/servlets/TemplateFilterPageTreeProvider.java#L99-L117 | train |
wcm-io/wcm-io-wcm | parsys/src/main/java/io/wcm/wcm/parsys/controller/Parsys.java | Parsys.isParagraphValid | private Optional<@NotNull Boolean> isParagraphValid(Resource resource) {
// use reflection to access the method "getModelFromResource" from ModelFactory, as it is not present in earlier version
// but we want still to support earlier versions of AEM as well which do not contain this method
// validation is ... | java | private Optional<@NotNull Boolean> isParagraphValid(Resource resource) {
// use reflection to access the method "getModelFromResource" from ModelFactory, as it is not present in earlier version
// but we want still to support earlier versions of AEM as well which do not contain this method
// validation is ... | [
"private",
"Optional",
"<",
"@",
"NotNull",
"Boolean",
">",
"isParagraphValid",
"(",
"Resource",
"resource",
")",
"{",
"// use reflection to access the method \"getModelFromResource\" from ModelFactory, as it is not present in earlier version",
"// but we want still to support earlier ve... | Checks if the given paragraph is valid.
@param resource Resource
@return if the return value is empty there is no model associated with this resource, or
it does not support validation via {@link ParsysItem} interface. Otherwise it contains the valid status. | [
"Checks",
"if",
"the",
"given",
"paragraph",
"is",
"valid",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/parsys/src/main/java/io/wcm/wcm/parsys/controller/Parsys.java#L202-L237 | train |
wcm-io/wcm-io-wcm | parsys/src/main/java/io/wcm/wcm/parsys/controller/Parsys.java | Parsys.getComponentHtmlTagAttributes | private Map<String, String> getComponentHtmlTagAttributes(String resourceType) {
if (StringUtils.isNotEmpty(resourceType)) {
Component component = componentManager().getComponent(resourceType);
if (component != null && component.getHtmlTagAttributes() != null) {
return component.getHtmlTagAttrib... | java | private Map<String, String> getComponentHtmlTagAttributes(String resourceType) {
if (StringUtils.isNotEmpty(resourceType)) {
Component component = componentManager().getComponent(resourceType);
if (component != null && component.getHtmlTagAttributes() != null) {
return component.getHtmlTagAttrib... | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"getComponentHtmlTagAttributes",
"(",
"String",
"resourceType",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"resourceType",
")",
")",
"{",
"Component",
"component",
"=",
"componentManager",
"("... | Get HTML tag attributes from component.
@param resourceType Component path
@return Map (never null) | [
"Get",
"HTML",
"tag",
"attributes",
"from",
"component",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/parsys/src/main/java/io/wcm/wcm/parsys/controller/Parsys.java#L245-L253 | train |
wcm-io/wcm-io-wcm | parsys/src/main/java/io/wcm/wcm/parsys/controller/Parsys.java | Parsys.getNewAreaResourceType | private String getNewAreaResourceType(String componentPath) {
Resource componentResource = resolver.getResource(componentPath);
if (componentResource != null) {
if (componentResource.getChild(NEWAREA_CHILD_NAME) != null) {
return componentPath + "/" + NEWAREA_CHILD_NAME;
}
String resou... | java | private String getNewAreaResourceType(String componentPath) {
Resource componentResource = resolver.getResource(componentPath);
if (componentResource != null) {
if (componentResource.getChild(NEWAREA_CHILD_NAME) != null) {
return componentPath + "/" + NEWAREA_CHILD_NAME;
}
String resou... | [
"private",
"String",
"getNewAreaResourceType",
"(",
"String",
"componentPath",
")",
"{",
"Resource",
"componentResource",
"=",
"resolver",
".",
"getResource",
"(",
"componentPath",
")",
";",
"if",
"(",
"componentResource",
"!=",
"null",
")",
"{",
"if",
"(",
"com... | Get resource type for new area - from current parsys component or from a supertype component.
@param componentPath Component path
@return Resource type (never null) | [
"Get",
"resource",
"type",
"for",
"new",
"area",
"-",
"from",
"current",
"parsys",
"component",
"or",
"from",
"a",
"supertype",
"component",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/parsys/src/main/java/io/wcm/wcm/parsys/controller/Parsys.java#L287-L299 | train |
wcm-io/wcm-io-wcm | ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/impl/util/PageIterator.java | PageIterator.seek | private Page seek() {
Page prev = next;
next = null;
while (resources.hasNext() && next == null) {
Resource nextResource = resources.next();
next = nextResource.adaptTo(Page.class);
if (next == null) {
// handle sling:Folder and sling:OrderedFolder as "virtual pages" to allow brow... | java | private Page seek() {
Page prev = next;
next = null;
while (resources.hasNext() && next == null) {
Resource nextResource = resources.next();
next = nextResource.adaptTo(Page.class);
if (next == null) {
// handle sling:Folder and sling:OrderedFolder as "virtual pages" to allow brow... | [
"private",
"Page",
"seek",
"(",
")",
"{",
"Page",
"prev",
"=",
"next",
";",
"next",
"=",
"null",
";",
"while",
"(",
"resources",
".",
"hasNext",
"(",
")",
"&&",
"next",
"==",
"null",
")",
"{",
"Resource",
"nextResource",
"=",
"resources",
".",
"next"... | Seeks the next available page
@return the previous element | [
"Seeks",
"the",
"next",
"available",
"page"
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/impl/util/PageIterator.java#L69-L89 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java | GenerateEntityIdOnTheClient.tryGetIdFromInstance | public boolean tryGetIdFromInstance(Object entity, Reference<String> idHolder) {
if (entity == null) {
throw new IllegalArgumentException("Entity cannot be null");
}
try {
Field identityProperty = getIdentityProperty(entity.getClass());
if (identityProperty !=... | java | public boolean tryGetIdFromInstance(Object entity, Reference<String> idHolder) {
if (entity == null) {
throw new IllegalArgumentException("Entity cannot be null");
}
try {
Field identityProperty = getIdentityProperty(entity.getClass());
if (identityProperty !=... | [
"public",
"boolean",
"tryGetIdFromInstance",
"(",
"Object",
"entity",
",",
"Reference",
"<",
"String",
">",
"idHolder",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Entity cannot be null\"",
")",
";",... | Attempts to get the document key from an instance
@param entity Entity to get id from
@param idHolder output parameter which holds document id
@return true if id was read from entity | [
"Attempts",
"to",
"get",
"the",
"document",
"key",
"from",
"an",
"instance"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java#L30-L48 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java | GenerateEntityIdOnTheClient.getOrGenerateDocumentId | public String getOrGenerateDocumentId(Object entity) {
Reference<String> idHolder = new Reference<>();
tryGetIdFromInstance(entity, idHolder);
String id = idHolder.value;
if (id == null) {
// Generate the key up front
id = _generateId.apply(entity);
}
... | java | public String getOrGenerateDocumentId(Object entity) {
Reference<String> idHolder = new Reference<>();
tryGetIdFromInstance(entity, idHolder);
String id = idHolder.value;
if (id == null) {
// Generate the key up front
id = _generateId.apply(entity);
}
... | [
"public",
"String",
"getOrGenerateDocumentId",
"(",
"Object",
"entity",
")",
"{",
"Reference",
"<",
"String",
">",
"idHolder",
"=",
"new",
"Reference",
"<>",
"(",
")",
";",
"tryGetIdFromInstance",
"(",
"entity",
",",
"idHolder",
")",
";",
"String",
"id",
"="... | Tries to get the identity.
@param entity Entity
@return Document id | [
"Tries",
"to",
"get",
"the",
"identity",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java#L55-L68 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java | GenerateEntityIdOnTheClient.trySetIdentity | public void trySetIdentity(Object entity, String id) {
Class<?> entityType = entity.getClass();
Field identityProperty = _conventions.getIdentityProperty(entityType);
if (identityProperty == null) {
return;
}
setPropertyOrField(identityProperty.getType(), entity, id... | java | public void trySetIdentity(Object entity, String id) {
Class<?> entityType = entity.getClass();
Field identityProperty = _conventions.getIdentityProperty(entityType);
if (identityProperty == null) {
return;
}
setPropertyOrField(identityProperty.getType(), entity, id... | [
"public",
"void",
"trySetIdentity",
"(",
"Object",
"entity",
",",
"String",
"id",
")",
"{",
"Class",
"<",
"?",
">",
"entityType",
"=",
"entity",
".",
"getClass",
"(",
")",
";",
"Field",
"identityProperty",
"=",
"_conventions",
".",
"getIdentityProperty",
"("... | Tries to set the identity property
@param entity Entity
@param id Id to set | [
"Tries",
"to",
"set",
"the",
"identity",
"property"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java#L81-L90 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java | DocumentConventions.defaultGetCollectionName | public static String defaultGetCollectionName(Class clazz) {
String result = _cachedDefaultTypeCollectionNames.get(clazz);
if (result != null) {
return result;
}
// we want to reject queries and other operations on abstract types, because you usually
// want to use t... | java | public static String defaultGetCollectionName(Class clazz) {
String result = _cachedDefaultTypeCollectionNames.get(clazz);
if (result != null) {
return result;
}
// we want to reject queries and other operations on abstract types, because you usually
// want to use t... | [
"public",
"static",
"String",
"defaultGetCollectionName",
"(",
"Class",
"clazz",
")",
"{",
"String",
"result",
"=",
"_cachedDefaultTypeCollectionNames",
".",
"get",
"(",
"clazz",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"return",
"result",
";",
... | Default method used when finding a collection name for a type
@param clazz Class
@return default collection name for class | [
"Default",
"method",
"used",
"when",
"finding",
"a",
"collection",
"name",
"for",
"a",
"type"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java#L297-L318 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java | DocumentConventions.generateDocumentId | @SuppressWarnings("unchecked")
public String generateDocumentId(String databaseName, Object entity) {
Class<?> clazz = entity.getClass();
for (Tuple<Class, BiFunction<String, Object, String>> listOfRegisteredIdConvention : _listOfRegisteredIdConventions) {
if (listOfRegisteredIdConventi... | java | @SuppressWarnings("unchecked")
public String generateDocumentId(String databaseName, Object entity) {
Class<?> clazz = entity.getClass();
for (Tuple<Class, BiFunction<String, Object, String>> listOfRegisteredIdConvention : _listOfRegisteredIdConventions) {
if (listOfRegisteredIdConventi... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"String",
"generateDocumentId",
"(",
"String",
"databaseName",
",",
"Object",
"entity",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"entity",
".",
"getClass",
"(",
")",
";",
"for",
"(",
"Tup... | Generates the document id.
@param databaseName Database name
@param entity Entity
@return document id | [
"Generates",
"the",
"document",
"id",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java#L354-L365 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java | DocumentConventions.registerIdConvention | @SuppressWarnings("unchecked")
public <TEntity> DocumentConventions registerIdConvention(Class<TEntity> clazz, BiFunction<String, TEntity, String> function) {
assertNotFrozen();
_listOfRegisteredIdConventions.stream()
.filter(x -> x.first.equals(clazz))
.findFirst()
... | java | @SuppressWarnings("unchecked")
public <TEntity> DocumentConventions registerIdConvention(Class<TEntity> clazz, BiFunction<String, TEntity, String> function) {
assertNotFrozen();
_listOfRegisteredIdConventions.stream()
.filter(x -> x.first.equals(clazz))
.findFirst()
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"TEntity",
">",
"DocumentConventions",
"registerIdConvention",
"(",
"Class",
"<",
"TEntity",
">",
"clazz",
",",
"BiFunction",
"<",
"String",
",",
"TEntity",
",",
"String",
">",
"function",
")",
... | Register an id convention for a single type (and all of its derived types.
Note that you can still fall back to the DocumentIdGenerator if you want.
@param <TEntity> Entity class
@param clazz Class
@param function Function to use
@return document conventions | [
"Register",
"an",
"id",
"convention",
"for",
"a",
"single",
"type",
"(",
"and",
"all",
"of",
"its",
"derived",
"types",
".",
"Note",
"that",
"you",
"can",
"still",
"fall",
"back",
"to",
"the",
"DocumentIdGenerator",
"if",
"you",
"want",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java#L375-L395 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java | DocumentConventions.getIdentityProperty | public Field getIdentityProperty(Class clazz) {
Field info = _idPropertyCache.get(clazz);
if (info != null) {
return info;
}
try {
Field idField = Arrays.stream(Introspector.getBeanInfo(clazz).getPropertyDescriptors())
.filter(x -> _findIdenti... | java | public Field getIdentityProperty(Class clazz) {
Field info = _idPropertyCache.get(clazz);
if (info != null) {
return info;
}
try {
Field idField = Arrays.stream(Introspector.getBeanInfo(clazz).getPropertyDescriptors())
.filter(x -> _findIdenti... | [
"public",
"Field",
"getIdentityProperty",
"(",
"Class",
"clazz",
")",
"{",
"Field",
"info",
"=",
"_idPropertyCache",
".",
"get",
"(",
"clazz",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"return",
"info",
";",
"}",
"try",
"{",
"Field",
"idFiel... | Gets the identity property.
@param clazz Class of entity
@return Identity property (field) | [
"Gets",
"the",
"identity",
"property",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java#L462-L481 | train |
wcm-io/wcm-io-wcm | ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java | ColumnView.getDataSource | private DataSource getDataSource(ComponentHelper cmp, Resource resource) {
try {
/*
* by default the path is read from request "path" parameter
* here we overwrite it via a synthetic resource because the path may be overwritten by validation logic
* to ensure the path is not beyond the co... | java | private DataSource getDataSource(ComponentHelper cmp, Resource resource) {
try {
/*
* by default the path is read from request "path" parameter
* here we overwrite it via a synthetic resource because the path may be overwritten by validation logic
* to ensure the path is not beyond the co... | [
"private",
"DataSource",
"getDataSource",
"(",
"ComponentHelper",
"cmp",
",",
"Resource",
"resource",
")",
"{",
"try",
"{",
"/*\n * by default the path is read from request \"path\" parameter\n * here we overwrite it via a synthetic resource because the path may be overwritten ... | Get data source to list children of given resource.
@param cmp Component helper
@param resource Given resource
@return Data source | [
"Get",
"data",
"source",
"to",
"list",
"children",
"of",
"given",
"resource",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java#L132-L146 | train |
wcm-io/wcm-io-wcm | ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java | ColumnView.getCurrentResourceColumn | private static Column getCurrentResourceColumn(DataSource dataSource, Integer size,
Resource currentResource, String itemResourceType) {
Iterator<Resource> items = dataSource.iterator();
boolean hasMore = false;
if (size != null) {
List<Resource> list = new ArrayList<Resource>();
while (... | java | private static Column getCurrentResourceColumn(DataSource dataSource, Integer size,
Resource currentResource, String itemResourceType) {
Iterator<Resource> items = dataSource.iterator();
boolean hasMore = false;
if (size != null) {
List<Resource> list = new ArrayList<Resource>();
while (... | [
"private",
"static",
"Column",
"getCurrentResourceColumn",
"(",
"DataSource",
"dataSource",
",",
"Integer",
"size",
",",
"Resource",
"currentResource",
",",
"String",
"itemResourceType",
")",
"{",
"Iterator",
"<",
"Resource",
">",
"items",
"=",
"dataSource",
".",
... | Generate column for data source items for current resource.
@param dataSource Data source
@param size Size limit
@param currentResource Current resource
@param itemResourceType Item resource type
@return Column | [
"Generate",
"column",
"for",
"data",
"source",
"items",
"for",
"current",
"resource",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java#L156-L182 | train |
wcm-io/wcm-io-wcm | ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java | ColumnView.getRootColumn | private static Column getRootColumn(Resource rootResource, String itemResourceType) {
/*
* Put a special path for columnId to avoid having the same columnId with the next column to avoid breaking the contract of columnId.
* The contract of columnId is that it should be a path of the current column, i.e. t... | java | private static Column getRootColumn(Resource rootResource, String itemResourceType) {
/*
* Put a special path for columnId to avoid having the same columnId with the next column to avoid breaking the contract of columnId.
* The contract of columnId is that it should be a path of the current column, i.e. t... | [
"private",
"static",
"Column",
"getRootColumn",
"(",
"Resource",
"rootResource",
",",
"String",
"itemResourceType",
")",
"{",
"/*\n * Put a special path for columnId to avoid having the same columnId with the next column to avoid breaking the contract of columnId.\n * The contract of... | Generate extra column representing the root resource.
@param rootResource Root resource
@param itemResourceType Item resource type
@return Column | [
"Generate",
"extra",
"column",
"representing",
"the",
"root",
"resource",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java#L190-L208 | train |
wcm-io/wcm-io-wcm | ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java | ColumnView.getAncestorColumns | private static List<Column> getAncestorColumns(Resource currentResource, Resource rootResource) {
List<Column> columns = new ArrayList<>();
List<Resource> ancestors = getAncestors(currentResource, rootResource);
for (int i = 0; i < ancestors.size(); i++) {
Resource r = ancestors.get(i);
String ... | java | private static List<Column> getAncestorColumns(Resource currentResource, Resource rootResource) {
List<Column> columns = new ArrayList<>();
List<Resource> ancestors = getAncestors(currentResource, rootResource);
for (int i = 0; i < ancestors.size(); i++) {
Resource r = ancestors.get(i);
String ... | [
"private",
"static",
"List",
"<",
"Column",
">",
"getAncestorColumns",
"(",
"Resource",
"currentResource",
",",
"Resource",
"rootResource",
")",
"{",
"List",
"<",
"Column",
">",
"columns",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"Resource"... | Generate column for each ancestor.
@param currentResource Current resource
@param rootResource Root resource
@return Columns | [
"Generate",
"column",
"for",
"each",
"ancestor",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java#L216-L237 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._waitForNonStaleResults | @Override
public void _waitForNonStaleResults(Duration waitTimeout) {
theWaitForNonStaleResults = true;
timeout = ObjectUtils.firstNonNull(waitTimeout, getDefaultTimeout());
} | java | @Override
public void _waitForNonStaleResults(Duration waitTimeout) {
theWaitForNonStaleResults = true;
timeout = ObjectUtils.firstNonNull(waitTimeout, getDefaultTimeout());
} | [
"@",
"Override",
"public",
"void",
"_waitForNonStaleResults",
"(",
"Duration",
"waitTimeout",
")",
"{",
"theWaitForNonStaleResults",
"=",
"true",
";",
"timeout",
"=",
"ObjectUtils",
".",
"firstNonNull",
"(",
"waitTimeout",
",",
"getDefaultTimeout",
"(",
")",
")",
... | Instruct the query to wait for non stale result for the specified wait timeout.
This shouldn't be used outside of unit tests unless you are well aware of the implications
@param waitTimeout Wait timeout | [
"Instruct",
"the",
"query",
"to",
"wait",
"for",
"non",
"stale",
"result",
"for",
"the",
"specified",
"wait",
"timeout",
".",
"This",
"shouldn",
"t",
"be",
"used",
"outside",
"of",
"unit",
"tests",
"unless",
"you",
"are",
"well",
"aware",
"of",
"the",
"i... | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L190-L194 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery.getProjectionFields | @Override
public List<String> getProjectionFields() {
return fieldsToFetchToken != null && fieldsToFetchToken.projections != null ? Arrays.asList(fieldsToFetchToken.projections) : Collections.emptyList();
} | java | @Override
public List<String> getProjectionFields() {
return fieldsToFetchToken != null && fieldsToFetchToken.projections != null ? Arrays.asList(fieldsToFetchToken.projections) : Collections.emptyList();
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getProjectionFields",
"(",
")",
"{",
"return",
"fieldsToFetchToken",
"!=",
"null",
"&&",
"fieldsToFetchToken",
".",
"projections",
"!=",
"null",
"?",
"Arrays",
".",
"asList",
"(",
"fieldsToFetchToken",
".",... | Gets the fields for projection
@return list of projected fields | [
"Gets",
"the",
"fields",
"for",
"projection"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L213-L216 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._randomOrdering | @Override
public void _randomOrdering(String seed) {
assertNoRawQuery();
if (StringUtils.isBlank(seed)) {
_randomOrdering();
return;
}
_noCaching();
orderByTokens.add(OrderByToken.createRandom(seed));
} | java | @Override
public void _randomOrdering(String seed) {
assertNoRawQuery();
if (StringUtils.isBlank(seed)) {
_randomOrdering();
return;
}
_noCaching();
orderByTokens.add(OrderByToken.createRandom(seed));
} | [
"@",
"Override",
"public",
"void",
"_randomOrdering",
"(",
"String",
"seed",
")",
"{",
"assertNoRawQuery",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"seed",
")",
")",
"{",
"_randomOrdering",
"(",
")",
";",
"return",
";",
"}",
"_noCach... | Order the search results randomly using the specified seed
this is useful if you want to have repeatable random queries
@param seed Seed to use | [
"Order",
"the",
"search",
"results",
"randomly",
"using",
"the",
"specified",
"seed",
"this",
"is",
"useful",
"if",
"you",
"want",
"to",
"have",
"repeatable",
"random",
"queries"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L234-L245 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._whereLucene | @SuppressWarnings("ConstantConditions")
public void _whereLucene(String fieldName, String whereClause, boolean exact) {
fieldName = ensureValidFieldName(fieldName, false);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, field... | java | @SuppressWarnings("ConstantConditions")
public void _whereLucene(String fieldName, String whereClause, boolean exact) {
fieldName = ensureValidFieldName(fieldName, false);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, field... | [
"@",
"SuppressWarnings",
"(",
"\"ConstantConditions\"",
")",
"public",
"void",
"_whereLucene",
"(",
"String",
"fieldName",
",",
"String",
"whereClause",
",",
"boolean",
"exact",
")",
"{",
"fieldName",
"=",
"ensureValidFieldName",
"(",
"fieldName",
",",
"false",
")... | Filter the results from the index using the specified where clause.
@param fieldName Field name
@param whereClause Where clause
@param exact Use exact matcher | [
"Filter",
"the",
"results",
"from",
"the",
"index",
"using",
"the",
"specified",
"where",
"clause",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L413-L424 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._openSubclause | @Override
public void _openSubclause() {
_currentClauseDepth++;
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, null);
tokens.add(OpenSubclauseToken.INSTANCE);
} | java | @Override
public void _openSubclause() {
_currentClauseDepth++;
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, null);
tokens.add(OpenSubclauseToken.INSTANCE);
} | [
"@",
"Override",
"public",
"void",
"_openSubclause",
"(",
")",
"{",
"_currentClauseDepth",
"++",
";",
"List",
"<",
"QueryToken",
">",
"tokens",
"=",
"getCurrentWhereTokens",
"(",
")",
";",
"appendOperatorIfNeeded",
"(",
"tokens",
")",
";",
"negateIfNeeded",
"(",... | Simplified method for opening a new clause within the query | [
"Simplified",
"method",
"for",
"opening",
"a",
"new",
"clause",
"within",
"the",
"query"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L429-L438 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._closeSubclause | @Override
public void _closeSubclause() {
_currentClauseDepth--;
List<QueryToken> tokens = getCurrentWhereTokens();
tokens.add(CloseSubclauseToken.INSTANCE);
} | java | @Override
public void _closeSubclause() {
_currentClauseDepth--;
List<QueryToken> tokens = getCurrentWhereTokens();
tokens.add(CloseSubclauseToken.INSTANCE);
} | [
"@",
"Override",
"public",
"void",
"_closeSubclause",
"(",
")",
"{",
"_currentClauseDepth",
"--",
";",
"List",
"<",
"QueryToken",
">",
"tokens",
"=",
"getCurrentWhereTokens",
"(",
")",
";",
"tokens",
".",
"add",
"(",
"CloseSubclauseToken",
".",
"INSTANCE",
")"... | Simplified method for closing a clause within the query | [
"Simplified",
"method",
"for",
"closing",
"a",
"clause",
"within",
"the",
"query"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L443-L449 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._whereIn | @Override
public void _whereIn(String fieldName, Collection<Object> values) {
_whereIn(fieldName, values, false);
} | java | @Override
public void _whereIn(String fieldName, Collection<Object> values) {
_whereIn(fieldName, values, false);
} | [
"@",
"Override",
"public",
"void",
"_whereIn",
"(",
"String",
"fieldName",
",",
"Collection",
"<",
"Object",
">",
"values",
")",
"{",
"_whereIn",
"(",
"fieldName",
",",
"values",
",",
"false",
")",
";",
"}"
] | Check that the field has one of the specified value
@param fieldName Field name to use
@param values Values to find | [
"Check",
"that",
"the",
"field",
"has",
"one",
"of",
"the",
"specified",
"value"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L577-L580 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._whereEndsWith | public void _whereEndsWith(String fieldName, Object value, boolean exact) {
WhereParams whereParams = new WhereParams();
whereParams.setFieldName(fieldName);
whereParams.setValue(value);
whereParams.setAllowWildcards(true);
Object transformToEqualValue = transformValue(wherePara... | java | public void _whereEndsWith(String fieldName, Object value, boolean exact) {
WhereParams whereParams = new WhereParams();
whereParams.setFieldName(fieldName);
whereParams.setValue(value);
whereParams.setAllowWildcards(true);
Object transformToEqualValue = transformValue(wherePara... | [
"public",
"void",
"_whereEndsWith",
"(",
"String",
"fieldName",
",",
"Object",
"value",
",",
"boolean",
"exact",
")",
"{",
"WhereParams",
"whereParams",
"=",
"new",
"WhereParams",
"(",
")",
";",
"whereParams",
".",
"setFieldName",
"(",
"fieldName",
")",
";",
... | Matches fields which ends with the specified value.
@param fieldName Field name to use
@param value Values to find | [
"Matches",
"fields",
"which",
"ends",
"with",
"the",
"specified",
"value",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L631-L647 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._whereBetween | @Override
public void _whereBetween(String fieldName, Object start, Object end, boolean exact) {
fieldName = ensureValidFieldName(fieldName, false);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, fieldName);
WherePa... | java | @Override
public void _whereBetween(String fieldName, Object start, Object end, boolean exact) {
fieldName = ensureValidFieldName(fieldName, false);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, fieldName);
WherePa... | [
"@",
"Override",
"public",
"void",
"_whereBetween",
"(",
"String",
"fieldName",
",",
"Object",
"start",
",",
"Object",
"end",
",",
"boolean",
"exact",
")",
"{",
"fieldName",
"=",
"ensureValidFieldName",
"(",
"fieldName",
",",
"false",
")",
";",
"List",
"<",
... | Matches fields where the value is between the specified start and end, inclusive
@param fieldName Field name to use
@param start Range start
@param end Range end
@param exact Use exact matcher | [
"Matches",
"fields",
"where",
"the",
"value",
"is",
"between",
"the",
"specified",
"start",
"and",
"end",
"inclusive"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L661-L682 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.