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
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/token/revocation/RevocationStatus.java
RevocationStatus.markRevoked
public void markRevoked (@Nonnull @Nonempty final String sRevocationUserID, @Nonnull final LocalDateTime aRevocationDT, @Nonnull @Nonempty final String sRevocationReason) { ValueEnforcer.notEmpty (sRevocationUserID, "RevocationUserID"); ValueEnforcer.notNull (aRevocationDT, "RevocationDT"); ValueEnforcer.notEmpty (sRevocationReason, "RevocationReason"); if (m_bRevoked) throw new IllegalStateException ("This object is already revoked!"); m_bRevoked = true; m_sRevocationUserID = sRevocationUserID; m_aRevocationDT = aRevocationDT; m_sRevocationReason = sRevocationReason; }
java
public void markRevoked (@Nonnull @Nonempty final String sRevocationUserID, @Nonnull final LocalDateTime aRevocationDT, @Nonnull @Nonempty final String sRevocationReason) { ValueEnforcer.notEmpty (sRevocationUserID, "RevocationUserID"); ValueEnforcer.notNull (aRevocationDT, "RevocationDT"); ValueEnforcer.notEmpty (sRevocationReason, "RevocationReason"); if (m_bRevoked) throw new IllegalStateException ("This object is already revoked!"); m_bRevoked = true; m_sRevocationUserID = sRevocationUserID; m_aRevocationDT = aRevocationDT; m_sRevocationReason = sRevocationReason; }
[ "public", "void", "markRevoked", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sRevocationUserID", ",", "@", "Nonnull", "final", "LocalDateTime", "aRevocationDT", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sRevocationReason", ")", "{", ...
Mark the owning item as revoked. @param sRevocationUserID The ID of the user who revoked it. May neither be <code>null</code> nor empty. @param aRevocationDT The date and time when the revocation took place. May not be <code>null</code>. @param sRevocationReason A human readable reason why revocation took place. May neither be <code>null</code> nor empty. @throws IllegalStateException If this status already denotes a revoked object.
[ "Mark", "the", "owning", "item", "as", "revoked", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/token/revocation/RevocationStatus.java#L104-L117
train
NICTA/t3as-snomedct-service
snomed-coder-web/src/main/java/org/t3as/snomedct/service/SnomedCoderService.java
SnomedCoderService.doc
@GET @Produces(MediaType.TEXT_PLAIN) public InputStream doc() throws IOException { //noinspection ConstantConditions return getClass().getClassLoader().getResource("SnomedCoderService_help.txt").openStream(); }
java
@GET @Produces(MediaType.TEXT_PLAIN) public InputStream doc() throws IOException { //noinspection ConstantConditions return getClass().getClassLoader().getResource("SnomedCoderService_help.txt").openStream(); }
[ "@", "GET", "@", "Produces", "(", "MediaType", ".", "TEXT_PLAIN", ")", "public", "InputStream", "doc", "(", ")", "throws", "IOException", "{", "//noinspection ConstantConditions", "return", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResource...
Return some docs about how to call this webservice
[ "Return", "some", "docs", "about", "how", "to", "call", "this", "webservice" ]
70a82d5c889f97eef2d17a648970575c152983e9
https://github.com/NICTA/t3as-snomedct-service/blob/70a82d5c889f97eef2d17a648970575c152983e9/snomed-coder-web/src/main/java/org/t3as/snomedct/service/SnomedCoderService.java#L82-L87
train
NICTA/t3as-snomedct-service
snomed-coder-web/src/main/java/org/t3as/snomedct/service/SnomedCoderService.java
SnomedCoderService.mapTextWithOptions
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML}) public static Collection<Utterance> mapTextWithOptions(final AnalysisRequest r) throws IOException, InterruptedException, JAXBException, SQLException, ParserConfigurationException, SAXException { System.out.println(r); // metamap options final Collection<Option> opts = new ArrayList<>(); final Set<String> optionNames = new HashSet<>(); for (final String o : r.getOptions()) { final Option opt = MetaMapOptions.strToOpt(o); if (opt != null) { optionNames.add(opt.name()); if (!opt.useProcessorDefault()) opts.add(opt); } } // always make sure we have a restrict_to_sources option if (!optionNames.contains(new RestrictToSources().name())) opts.add(new RestrictToSources()); // tmp files for metamap in/out final File infile = File.createTempFile("metamap-input-", ".txt"); final File outfile = File.createTempFile("metamap-output-", ".xml"); final String s = r.getText() + (r.getText().endsWith("\n") ? "" : "\n"); final String ascii = MetaMap.decomposeToAscii(URLDecoder.decode(s, "UTF-8")); Files.write(ascii, infile, Charsets.UTF_8); // we don't want too much data for a free service if (infile.length() > MAX_DATA_BYTES) { throw new WebApplicationException( Response.status(Responses.NOT_ACCEPTABLE) .entity("Too much data, currently limited to " + MAX_DATA_BYTES + " bytes.") .type("text/plain").build() ); } // process the data with MetaMap final MetaMap metaMap = new MetaMap(PUBLIC_MM_DIR, opts); if (!metaMap.process(infile, outfile)) { throw new WebApplicationException(Response.status(INTERNAL_SERVER_ERROR) .entity("Processing failed, aborting.") .type("text/plain").build()); } // look up the SNOMED codes from the UMLS CUI code/description combinations returned by MetaMap final MMOs root = JaxbLoader.loadXml(outfile); try (final SnomedLookup snomedLookup = new SnomedLookup(DB_PATH)) { snomedLookup.enrichXml(root); } //noinspection ResultOfMethodCallIgnored infile.delete(); //noinspection ResultOfMethodCallIgnored outfile.delete(); return destructiveFilter(root); }
java
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML}) public static Collection<Utterance> mapTextWithOptions(final AnalysisRequest r) throws IOException, InterruptedException, JAXBException, SQLException, ParserConfigurationException, SAXException { System.out.println(r); // metamap options final Collection<Option> opts = new ArrayList<>(); final Set<String> optionNames = new HashSet<>(); for (final String o : r.getOptions()) { final Option opt = MetaMapOptions.strToOpt(o); if (opt != null) { optionNames.add(opt.name()); if (!opt.useProcessorDefault()) opts.add(opt); } } // always make sure we have a restrict_to_sources option if (!optionNames.contains(new RestrictToSources().name())) opts.add(new RestrictToSources()); // tmp files for metamap in/out final File infile = File.createTempFile("metamap-input-", ".txt"); final File outfile = File.createTempFile("metamap-output-", ".xml"); final String s = r.getText() + (r.getText().endsWith("\n") ? "" : "\n"); final String ascii = MetaMap.decomposeToAscii(URLDecoder.decode(s, "UTF-8")); Files.write(ascii, infile, Charsets.UTF_8); // we don't want too much data for a free service if (infile.length() > MAX_DATA_BYTES) { throw new WebApplicationException( Response.status(Responses.NOT_ACCEPTABLE) .entity("Too much data, currently limited to " + MAX_DATA_BYTES + " bytes.") .type("text/plain").build() ); } // process the data with MetaMap final MetaMap metaMap = new MetaMap(PUBLIC_MM_DIR, opts); if (!metaMap.process(infile, outfile)) { throw new WebApplicationException(Response.status(INTERNAL_SERVER_ERROR) .entity("Processing failed, aborting.") .type("text/plain").build()); } // look up the SNOMED codes from the UMLS CUI code/description combinations returned by MetaMap final MMOs root = JaxbLoader.loadXml(outfile); try (final SnomedLookup snomedLookup = new SnomedLookup(DB_PATH)) { snomedLookup.enrichXml(root); } //noinspection ResultOfMethodCallIgnored infile.delete(); //noinspection ResultOfMethodCallIgnored outfile.delete(); return destructiveFilter(root); }
[ "@", "POST", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Produces", "(", "{", "MediaType", ".", "APPLICATION_JSON", ",", "MediaType", ".", "TEXT_XML", "}", ")", "public", "static", "Collection", "<", "Utterance", ">", "mapTextWithOpt...
Accepts a JSON object with text and possible options for the analysis.
[ "Accepts", "a", "JSON", "object", "with", "text", "and", "possible", "options", "for", "the", "analysis", "." ]
70a82d5c889f97eef2d17a648970575c152983e9
https://github.com/NICTA/t3as-snomedct-service/blob/70a82d5c889f97eef2d17a648970575c152983e9/snomed-coder-web/src/main/java/org/t3as/snomedct/service/SnomedCoderService.java#L104-L161
train
NICTA/t3as-snomedct-service
snomed-coder-web/src/main/java/org/t3as/snomedct/service/SnomedCoderService.java
SnomedCoderService.destructiveFilter
private static Collection<Utterance> destructiveFilter(final MMOs root) { final Collection<Utterance> utterances = new ArrayList<>(); for (final MMO mmo : root.getMMO()) { for (final Utterance utterance : mmo.getUtterances().getUtterance()) { // clear candidates to save heaps of bytes for (final Phrase phrase : utterance.getPhrases().getPhrase()) { phrase.setCandidates(null); } utterances.add(utterance); } } return utterances; }
java
private static Collection<Utterance> destructiveFilter(final MMOs root) { final Collection<Utterance> utterances = new ArrayList<>(); for (final MMO mmo : root.getMMO()) { for (final Utterance utterance : mmo.getUtterances().getUtterance()) { // clear candidates to save heaps of bytes for (final Phrase phrase : utterance.getPhrases().getPhrase()) { phrase.setCandidates(null); } utterances.add(utterance); } } return utterances; }
[ "private", "static", "Collection", "<", "Utterance", ">", "destructiveFilter", "(", "final", "MMOs", "root", ")", "{", "final", "Collection", "<", "Utterance", ">", "utterances", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "MMO", "mm...
Beware! Destructive filtering of things we are not interested in in the JAXB data structure.
[ "Beware!", "Destructive", "filtering", "of", "things", "we", "are", "not", "interested", "in", "in", "the", "JAXB", "data", "structure", "." ]
70a82d5c889f97eef2d17a648970575c152983e9
https://github.com/NICTA/t3as-snomedct-service/blob/70a82d5c889f97eef2d17a648970575c152983e9/snomed-coder-web/src/main/java/org/t3as/snomedct/service/SnomedCoderService.java#L166-L179
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/servlet/AbstractObjectDeliveryHttpHandler.java
AbstractObjectDeliveryHttpHandler._initialFillSet
private static void _initialFillSet (@Nonnull final ICommonsOrderedSet <String> aSet, @Nullable final String sItemList, final boolean bUnify) { ValueEnforcer.notNull (aSet, "Set"); if (!aSet.isEmpty ()) throw new IllegalArgumentException ("The provided set must be empty, but it is not: " + aSet); if (StringHelper.hasText (sItemList)) { // Perform some default replacements to avoid updating all references at // once before splitting final String sRealItemList = StringHelper.replaceAll (sItemList, EXTENSION_MACRO_WEB_DEFAULT, "js,css,png,jpg,jpeg,gif,eot,svg,ttf,woff,woff2,map"); for (final String sItem : StringHelper.getExploded (',', sRealItemList)) { String sRealItem = sItem.trim (); if (bUnify) sRealItem = getUnifiedItem (sRealItem); // Add only non-empty items if (StringHelper.hasText (sRealItem)) aSet.add (sRealItem); } } }
java
private static void _initialFillSet (@Nonnull final ICommonsOrderedSet <String> aSet, @Nullable final String sItemList, final boolean bUnify) { ValueEnforcer.notNull (aSet, "Set"); if (!aSet.isEmpty ()) throw new IllegalArgumentException ("The provided set must be empty, but it is not: " + aSet); if (StringHelper.hasText (sItemList)) { // Perform some default replacements to avoid updating all references at // once before splitting final String sRealItemList = StringHelper.replaceAll (sItemList, EXTENSION_MACRO_WEB_DEFAULT, "js,css,png,jpg,jpeg,gif,eot,svg,ttf,woff,woff2,map"); for (final String sItem : StringHelper.getExploded (',', sRealItemList)) { String sRealItem = sItem.trim (); if (bUnify) sRealItem = getUnifiedItem (sRealItem); // Add only non-empty items if (StringHelper.hasText (sRealItem)) aSet.add (sRealItem); } } }
[ "private", "static", "void", "_initialFillSet", "(", "@", "Nonnull", "final", "ICommonsOrderedSet", "<", "String", ">", "aSet", ",", "@", "Nullable", "final", "String", "sItemList", ",", "final", "boolean", "bUnify", ")", "{", "ValueEnforcer", ".", "notNull", ...
Helper function to convert the configuration string to a collection. @param aSet The set to be filled. May not be <code>null</code>. @param sItemList The string to be separated to a list. Each item is separated by a ",". @param bUnify To unify the found item by converting them all to lowercase. This makes only sense for file extensions but not for file names. This unification is only relevant because of the case insensitive file system on Windows machines.
[ "Helper", "function", "to", "convert", "the", "configuration", "string", "to", "a", "collection", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/servlet/AbstractObjectDeliveryHttpHandler.java#L122-L149
train
Arnauld/gutenberg
src/main/java/gutenberg/itext/TextStripper.java
TextStripper.extractText
public List<Page> extractText(InputStream src) throws IOException { List<Page> pages = Lists.newArrayList(); PdfReader reader = new PdfReader(src); RenderListener listener = new InternalListener(); PdfContentStreamProcessor processor = new PdfContentStreamProcessor(listener); for (int i = 1; i <= reader.getNumberOfPages(); i++) { pages.add(currentPage = new Page()); PdfDictionary pageDic = reader.getPageN(i); PdfDictionary resourcesDic = pageDic.getAsDict(PdfName.RESOURCES); processor.processContent(ContentByteUtils.getContentBytesForPage(reader, i), resourcesDic); } reader.close(); return pages; }
java
public List<Page> extractText(InputStream src) throws IOException { List<Page> pages = Lists.newArrayList(); PdfReader reader = new PdfReader(src); RenderListener listener = new InternalListener(); PdfContentStreamProcessor processor = new PdfContentStreamProcessor(listener); for (int i = 1; i <= reader.getNumberOfPages(); i++) { pages.add(currentPage = new Page()); PdfDictionary pageDic = reader.getPageN(i); PdfDictionary resourcesDic = pageDic.getAsDict(PdfName.RESOURCES); processor.processContent(ContentByteUtils.getContentBytesForPage(reader, i), resourcesDic); } reader.close(); return pages; }
[ "public", "List", "<", "Page", ">", "extractText", "(", "InputStream", "src", ")", "throws", "IOException", "{", "List", "<", "Page", ">", "pages", "=", "Lists", ".", "newArrayList", "(", ")", ";", "PdfReader", "reader", "=", "new", "PdfReader", "(", "sr...
Extracts text from a PDF document. @param src the original PDF document @throws java.io.IOException
[ "Extracts", "text", "from", "a", "PDF", "document", "." ]
18d761ddba378ee58a3f3dc6316f66742df8d985
https://github.com/Arnauld/gutenberg/blob/18d761ddba378ee58a3f3dc6316f66742df8d985/src/main/java/gutenberg/itext/TextStripper.java#L47-L63
train
spotify/crtauth-java
src/main/java/com/spotify/crtauth/CrtAuthClient.java
CrtAuthClient.createResponse
public String createResponse(String challenge) throws IllegalArgumentException, KeyNotFoundException, ProtocolVersionException { byte[] decodedChallenge = decode(challenge); Challenge deserializedChallenge = CrtAuthCodec.deserializeChallenge(decodedChallenge); if (!deserializedChallenge.getServerName().equals(serverName)) { throw new IllegalArgumentException( String.format("Server name mismatch (%s != %s). Possible MITM attack.", deserializedChallenge.getServerName(), serverName) ); } byte[] signature = signer.sign(decodedChallenge, deserializedChallenge.getFingerprint()); return encode(CrtAuthCodec.serialize(new Response(decodedChallenge, signature))); }
java
public String createResponse(String challenge) throws IllegalArgumentException, KeyNotFoundException, ProtocolVersionException { byte[] decodedChallenge = decode(challenge); Challenge deserializedChallenge = CrtAuthCodec.deserializeChallenge(decodedChallenge); if (!deserializedChallenge.getServerName().equals(serverName)) { throw new IllegalArgumentException( String.format("Server name mismatch (%s != %s). Possible MITM attack.", deserializedChallenge.getServerName(), serverName) ); } byte[] signature = signer.sign(decodedChallenge, deserializedChallenge.getFingerprint()); return encode(CrtAuthCodec.serialize(new Response(decodedChallenge, signature))); }
[ "public", "String", "createResponse", "(", "String", "challenge", ")", "throws", "IllegalArgumentException", ",", "KeyNotFoundException", ",", "ProtocolVersionException", "{", "byte", "[", "]", "decodedChallenge", "=", "decode", "(", "challenge", ")", ";", "Challenge"...
Generate a response String using the Signer of this instance, additionally verifying that the embedded serverName matches the serverName of this instance. @param challenge A challenge String obtained from a server. @return The response String to be returned to the server. @throws IllegalArgumentException if there is something wrong with the challenge.
[ "Generate", "a", "response", "String", "using", "the", "Signer", "of", "this", "instance", "additionally", "verifying", "that", "the", "embedded", "serverName", "matches", "the", "serverName", "of", "this", "instance", "." ]
90f3b40323848740c915b195ad1b547fbeb41700
https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/CrtAuthClient.java#L60-L72
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziAgent.java
EkstaziAgent.initSingleCoverageMode
private static boolean initSingleCoverageMode(final String runName, Instrumentation instrumentation) { // Check if run is affected and if not start coverage. if (Ekstazi.inst().checkIfAffected(runName)) { Ekstazi.inst().startCollectingDependencies(runName); // End coverage when VM ends execution. Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { Ekstazi.inst().finishCollectingDependencies(runName); } }); return true; } else { instrumentation.addTransformer(new RemoveMainCFT()); return false; } }
java
private static boolean initSingleCoverageMode(final String runName, Instrumentation instrumentation) { // Check if run is affected and if not start coverage. if (Ekstazi.inst().checkIfAffected(runName)) { Ekstazi.inst().startCollectingDependencies(runName); // End coverage when VM ends execution. Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { Ekstazi.inst().finishCollectingDependencies(runName); } }); return true; } else { instrumentation.addTransformer(new RemoveMainCFT()); return false; } }
[ "private", "static", "boolean", "initSingleCoverageMode", "(", "final", "String", "runName", ",", "Instrumentation", "instrumentation", ")", "{", "// Check if run is affected and if not start coverage.", "if", "(", "Ekstazi", ".", "inst", "(", ")", ".", "checkIfAffected",...
Initialize SingleMode run. We first check if run is affected and only in that case start coverage, otherwise we remove bodies of all main methods to avoid any execution.
[ "Initialize", "SingleMode", "run", ".", "We", "first", "check", "if", "run", "is", "affected", "and", "only", "in", "that", "case", "start", "coverage", "otherwise", "we", "remove", "bodies", "of", "all", "main", "methods", "to", "avoid", "any", "execution",...
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziAgent.java#L171-L187
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/html/AbstractHTMLProvider.java
AbstractHTMLProvider.addMetaElements
@OverrideOnDemand protected void addMetaElements (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final HCHead aHead) { final ICommonsList <IMetaElement> aMetaElements = new CommonsArrayList <> (); { // add special meta element at the beginning final IMimeType aMimeType = PhotonHTMLHelper.getMimeType (aRequestScope); aMetaElements.add (EStandardMetaElement.CONTENT_TYPE.getAsMetaElement (aMimeType.getAsString ())); } PhotonMetaElements.getAllRegisteredMetaElementsForGlobal (aMetaElements); PhotonMetaElements.getAllRegisteredMetaElementsForThisRequest (aMetaElements); for (final IMetaElement aMetaElement : aMetaElements) for (final Map.Entry <Locale, String> aEntry : aMetaElement.getContent ()) { final HCMeta aMeta = new HCMeta (); if (aMetaElement.isHttpEquiv ()) aMeta.setHttpEquiv (aMetaElement.getName ()); else aMeta.setName (aMetaElement.getName ()); aMeta.setContent (aEntry.getValue ()); final Locale aContentLocale = aEntry.getKey (); if (aContentLocale != null && !LocaleHelper.isSpecialLocale (aContentLocale)) aMeta.setLanguage (aContentLocale.toString ()); aHead.metaElements ().add (aMeta); } }
java
@OverrideOnDemand protected void addMetaElements (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final HCHead aHead) { final ICommonsList <IMetaElement> aMetaElements = new CommonsArrayList <> (); { // add special meta element at the beginning final IMimeType aMimeType = PhotonHTMLHelper.getMimeType (aRequestScope); aMetaElements.add (EStandardMetaElement.CONTENT_TYPE.getAsMetaElement (aMimeType.getAsString ())); } PhotonMetaElements.getAllRegisteredMetaElementsForGlobal (aMetaElements); PhotonMetaElements.getAllRegisteredMetaElementsForThisRequest (aMetaElements); for (final IMetaElement aMetaElement : aMetaElements) for (final Map.Entry <Locale, String> aEntry : aMetaElement.getContent ()) { final HCMeta aMeta = new HCMeta (); if (aMetaElement.isHttpEquiv ()) aMeta.setHttpEquiv (aMetaElement.getName ()); else aMeta.setName (aMetaElement.getName ()); aMeta.setContent (aEntry.getValue ()); final Locale aContentLocale = aEntry.getKey (); if (aContentLocale != null && !LocaleHelper.isSpecialLocale (aContentLocale)) aMeta.setLanguage (aContentLocale.toString ()); aHead.metaElements ().add (aMeta); } }
[ "@", "OverrideOnDemand", "protected", "void", "addMetaElements", "(", "@", "Nonnull", "final", "IRequestWebScopeWithoutResponse", "aRequestScope", ",", "@", "Nonnull", "final", "HCHead", "aHead", ")", "{", "final", "ICommonsList", "<", "IMetaElement", ">", "aMetaEleme...
Add all meta elements to the HTML head element. @param aRequestScope Current request scope. Never <code>null</code>. @param aHead The HTML head object. Never <code>null</code>.
[ "Add", "all", "meta", "elements", "to", "the", "HTML", "head", "element", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/html/AbstractHTMLProvider.java#L78-L108
train
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Core.java
FineUploader5Core.setMaxConnections
@Nonnull public FineUploader5Core setMaxConnections (@Nonnegative final int nMaxConnections) { ValueEnforcer.isGT0 (nMaxConnections, "MaxConnections"); m_nCoreMaxConnections = nMaxConnections; return this; }
java
@Nonnull public FineUploader5Core setMaxConnections (@Nonnegative final int nMaxConnections) { ValueEnforcer.isGT0 (nMaxConnections, "MaxConnections"); m_nCoreMaxConnections = nMaxConnections; return this; }
[ "@", "Nonnull", "public", "FineUploader5Core", "setMaxConnections", "(", "@", "Nonnegative", "final", "int", "nMaxConnections", ")", "{", "ValueEnforcer", ".", "isGT0", "(", "nMaxConnections", ",", "\"MaxConnections\"", ")", ";", "m_nCoreMaxConnections", "=", "nMaxCon...
Maximum allowable concurrent requests @param nMaxConnections Maximum number. Must be &gt; 0. @return this
[ "Maximum", "allowable", "concurrent", "requests" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Core.java#L239-L245
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSFormatter.java
JSFormatter.outdentAlways
@Nonnull public JSFormatter outdentAlways () { if (m_nIndentLevel == 0) throw new IllegalStateException ("Nothing left to outdent!"); m_nIndentLevel--; m_sIndentCache = m_sIndentCache.substring (0, m_nIndentLevel * m_aSettings.getIndent ().length ()); return this; }
java
@Nonnull public JSFormatter outdentAlways () { if (m_nIndentLevel == 0) throw new IllegalStateException ("Nothing left to outdent!"); m_nIndentLevel--; m_sIndentCache = m_sIndentCache.substring (0, m_nIndentLevel * m_aSettings.getIndent ().length ()); return this; }
[ "@", "Nonnull", "public", "JSFormatter", "outdentAlways", "(", ")", "{", "if", "(", "m_nIndentLevel", "==", "0", ")", "throw", "new", "IllegalStateException", "(", "\"Nothing left to outdent!\"", ")", ";", "m_nIndentLevel", "--", ";", "m_sIndentCache", "=", "m_sIn...
Decrement the indentation level. @return this
[ "Decrement", "the", "indentation", "level", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSFormatter.java#L137-L145
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSDefinedClass.java
JSDefinedClass._extends
@Nonnull @CodingStyleguideUnaware public JSDefinedClass _extends (@Nonnull final AbstractJSClass aSuperClass) { m_aSuperClass = ValueEnforcer.notNull (aSuperClass, "SuperClass"); return this; }
java
@Nonnull @CodingStyleguideUnaware public JSDefinedClass _extends (@Nonnull final AbstractJSClass aSuperClass) { m_aSuperClass = ValueEnforcer.notNull (aSuperClass, "SuperClass"); return this; }
[ "@", "Nonnull", "@", "CodingStyleguideUnaware", "public", "JSDefinedClass", "_extends", "(", "@", "Nonnull", "final", "AbstractJSClass", "aSuperClass", ")", "{", "m_aSuperClass", "=", "ValueEnforcer", ".", "notNull", "(", "aSuperClass", ",", "\"SuperClass\"", ")", "...
This class extends the specified class. @param aSuperClass Superclass for this class @return This class
[ "This", "class", "extends", "the", "specified", "class", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSDefinedClass.java#L88-L94
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSDefinedClass.java
JSDefinedClass.method
@Nonnull public JSMethod method (@Nonnull @Nonempty final String sName) { final JSMethod aMethod = new JSMethod (this, sName); m_aMethods.add (aMethod); return aMethod; }
java
@Nonnull public JSMethod method (@Nonnull @Nonempty final String sName) { final JSMethod aMethod = new JSMethod (this, sName); m_aMethods.add (aMethod); return aMethod; }
[ "@", "Nonnull", "public", "JSMethod", "method", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sName", ")", "{", "final", "JSMethod", "aMethod", "=", "new", "JSMethod", "(", "this", ",", "sName", ")", ";", "m_aMethods", ".", "add", "(", "aMeth...
Add a method to the list of method members of this JS class instance. @param sName Name of the method @return Newly generated method
[ "Add", "a", "method", "to", "the", "list", "of", "method", "members", "of", "this", "JS", "class", "instance", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSDefinedClass.java#L234-L240
train
phax/ph-oton
ph-oton-bootstrap4/src/main/java/com/helger/photon/bootstrap4/modal/BootstrapModal.java
BootstrapModal.openModal
@Nonnull public JSPackage openModal (@Nullable final EBootstrapModalOptionBackdrop aBackdrop, @Nullable final Boolean aKeyboard, @Nullable final Boolean aFocus, @Nullable final Boolean aShow, @Nullable final String sRemotePath) { final JSPackage ret = new JSPackage (); final JSAssocArray aOptions = new JSAssocArray (); if (aBackdrop != null) aOptions.add ("backdrop", aBackdrop.getJSExpression ()); if (aFocus != null) aOptions.add ("focus", aFocus.booleanValue ()); if (aKeyboard != null) aOptions.add ("keyboard", aKeyboard.booleanValue ()); if (aShow != null) aOptions.add ("show", aShow.booleanValue ()); ret.add (jsModal ().arg (aOptions)); if (StringHelper.hasText (sRemotePath)) { // Load content into modal ret.add (JQuery.idRef (_getContentID ()).load (sRemotePath)); } return ret; }
java
@Nonnull public JSPackage openModal (@Nullable final EBootstrapModalOptionBackdrop aBackdrop, @Nullable final Boolean aKeyboard, @Nullable final Boolean aFocus, @Nullable final Boolean aShow, @Nullable final String sRemotePath) { final JSPackage ret = new JSPackage (); final JSAssocArray aOptions = new JSAssocArray (); if (aBackdrop != null) aOptions.add ("backdrop", aBackdrop.getJSExpression ()); if (aFocus != null) aOptions.add ("focus", aFocus.booleanValue ()); if (aKeyboard != null) aOptions.add ("keyboard", aKeyboard.booleanValue ()); if (aShow != null) aOptions.add ("show", aShow.booleanValue ()); ret.add (jsModal ().arg (aOptions)); if (StringHelper.hasText (sRemotePath)) { // Load content into modal ret.add (JQuery.idRef (_getContentID ()).load (sRemotePath)); } return ret; }
[ "@", "Nonnull", "public", "JSPackage", "openModal", "(", "@", "Nullable", "final", "EBootstrapModalOptionBackdrop", "aBackdrop", ",", "@", "Nullable", "final", "Boolean", "aKeyboard", ",", "@", "Nullable", "final", "Boolean", "aFocus", ",", "@", "Nullable", "final...
Activates your content as a modal. Accepts an optional options object. @param aBackdrop Includes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn't close the modal on click. @param aKeyboard Closes the modal when escape key is pressed @param aFocus Puts the focus on the modal when initialized. @param aShow Shows the modal when initialized. @param sRemotePath If a remote URL is provided, content will be loaded one time via jQuery's load method and injected into the .modal-content div. @return JS invocation to open this modal dialog with the specified options.
[ "Activates", "your", "content", "as", "a", "modal", ".", "Accepts", "an", "optional", "options", "object", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap4/src/main/java/com/helger/photon/bootstrap4/modal/BootstrapModal.java#L312-L338
train
phax/ph-oton
ph-oton-bootstrap3-pages/src/main/java/com/helger/photon/bootstrap3/pages/security/AbstractWebPageSecurityObjectWithAttributes.java
AbstractWebPageSecurityObjectWithAttributes.onShowSelectedObjectCustomAttrs
@Nullable @OverrideOnDemand protected ICommonsSet <String> onShowSelectedObjectCustomAttrs (@Nonnull final WPECTYPE aWPEC, @Nonnull final DATATYPE aSelectedObject, @Nonnull final Map <String, String> aCustomAttrs, @Nonnull final BootstrapViewForm aViewForm) { return null; }
java
@Nullable @OverrideOnDemand protected ICommonsSet <String> onShowSelectedObjectCustomAttrs (@Nonnull final WPECTYPE aWPEC, @Nonnull final DATATYPE aSelectedObject, @Nonnull final Map <String, String> aCustomAttrs, @Nonnull final BootstrapViewForm aViewForm) { return null; }
[ "@", "Nullable", "@", "OverrideOnDemand", "protected", "ICommonsSet", "<", "String", ">", "onShowSelectedObjectCustomAttrs", "(", "@", "Nonnull", "final", "WPECTYPE", "aWPEC", ",", "@", "Nonnull", "final", "DATATYPE", "aSelectedObject", ",", "@", "Nonnull", "final",...
Callback for manually extracting custom attributes. This method is called independently if custom attributes are present or not. @param aWPEC The current web page execution context. Never <code>null</code>. @param aSelectedObject The object currently shown. Never <code>null</code>. @param aCustomAttrs The available custom attributes. Never <code>null</code> but maybe empty. @param aViewForm The table to be add custom information @return A set of all attribute names that were handled in this method or <code>null</code>. All attributes handled in this method will not be displayed generically.
[ "Callback", "for", "manually", "extracting", "custom", "attributes", ".", "This", "method", "is", "called", "independently", "if", "custom", "attributes", "are", "present", "or", "not", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap3-pages/src/main/java/com/helger/photon/bootstrap3/pages/security/AbstractWebPageSecurityObjectWithAttributes.java#L107-L115
train
phax/ph-oton
ph-oton-bootstrap3-pages/src/main/java/com/helger/photon/bootstrap3/pages/security/AbstractWebPageSecurityObjectWithAttributes.java
AbstractWebPageSecurityObjectWithAttributes.validateCustomInputParameters
@OverrideOnDemand @Nullable protected ICommonsMap <String, String> validateCustomInputParameters (@Nonnull final WPECTYPE aWPEC, @Nullable final DATATYPE aSelectedObject, @Nonnull final FormErrorList aFormErrors, @Nonnull final EWebPageFormAction eFormAction) { return null; }
java
@OverrideOnDemand @Nullable protected ICommonsMap <String, String> validateCustomInputParameters (@Nonnull final WPECTYPE aWPEC, @Nullable final DATATYPE aSelectedObject, @Nonnull final FormErrorList aFormErrors, @Nonnull final EWebPageFormAction eFormAction) { return null; }
[ "@", "OverrideOnDemand", "@", "Nullable", "protected", "ICommonsMap", "<", "String", ",", "String", ">", "validateCustomInputParameters", "(", "@", "Nonnull", "final", "WPECTYPE", "aWPEC", ",", "@", "Nullable", "final", "DATATYPE", "aSelectedObject", ",", "@", "No...
Validate custom data of the input field. @param aWPEC Current web page execution context. Never <code>null</code>. @param aSelectedObject The selected object. May be <code>null</code>. @param aFormErrors The form errors to be filled. Never <code>null</code>. @param eFormAction The form action mode. Either create, copy or edit. @return The custom parameter to be added to the used upon success. If an error occurred, this map may be <code>null</code>.
[ "Validate", "custom", "data", "of", "the", "input", "field", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap3-pages/src/main/java/com/helger/photon/bootstrap3/pages/security/AbstractWebPageSecurityObjectWithAttributes.java#L145-L153
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java
UserUploadManager.addUploadedFile
public void addUploadedFile (@Nonnull @Nonempty final String sFieldName, @Nonnull final TemporaryUserDataObject aUDO) { ValueEnforcer.notEmpty (sFieldName, "FieldName"); ValueEnforcer.notNull (aUDO, "UDO"); m_aRWLock.writeLocked ( () -> { // Remove an eventually existing old UDO with the same filename - avoid // bloating the list final TemporaryUserDataObject aOldUDO = m_aMap.remove (sFieldName); if (aOldUDO != null) _deleteUDO (aOldUDO); // Add the new one m_aMap.put (sFieldName, aUDO); }); }
java
public void addUploadedFile (@Nonnull @Nonempty final String sFieldName, @Nonnull final TemporaryUserDataObject aUDO) { ValueEnforcer.notEmpty (sFieldName, "FieldName"); ValueEnforcer.notNull (aUDO, "UDO"); m_aRWLock.writeLocked ( () -> { // Remove an eventually existing old UDO with the same filename - avoid // bloating the list final TemporaryUserDataObject aOldUDO = m_aMap.remove (sFieldName); if (aOldUDO != null) _deleteUDO (aOldUDO); // Add the new one m_aMap.put (sFieldName, aUDO); }); }
[ "public", "void", "addUploadedFile", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sFieldName", ",", "@", "Nonnull", "final", "TemporaryUserDataObject", "aUDO", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "sFieldName", ",", "\"FieldName\"", ")", ...
Add an uploaded file. Existing UDOs with the same field name are overwritten and the underlying file is deleted. By default an uploaded file is not confirmed and will be deleted when the session expires. By confirming the uploaded image it is safe for later reuse. @param sFieldName The ID of the uploaded file. May neither be <code>null</code> nor empty. @param aUDO The user data object to be added. May not be <code>null</code>. @see #confirmUploadedFiles(String...)
[ "Add", "an", "uploaded", "file", ".", "Existing", "UDOs", "with", "the", "same", "field", "name", "are", "overwritten", "and", "the", "underlying", "file", "is", "deleted", ".", "By", "default", "an", "uploaded", "file", "is", "not", "confirmed", "and", "w...
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java#L103-L118
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java
UserUploadManager.confirmUploadedFiles
@Nonnull @ReturnsMutableCopy public ICommonsOrderedMap <String, UserDataObject> confirmUploadedFiles (@Nullable final String... aFieldNames) { final ICommonsOrderedMap <String, UserDataObject> ret = new CommonsLinkedHashMap <> (); if (aFieldNames != null) { m_aRWLock.writeLocked ( () -> { for (final String sFieldName : aFieldNames) { // Remove an eventually existing old UDO final TemporaryUserDataObject aUDO = m_aMap.remove (sFieldName); if (aUDO != null) { LOGGER.info ("Confirmed uploaded file " + aUDO); // Convert from temporary to real UDO ret.put (sFieldName, new UserDataObject (aUDO.getPath ())); } } }); } return ret; }
java
@Nonnull @ReturnsMutableCopy public ICommonsOrderedMap <String, UserDataObject> confirmUploadedFiles (@Nullable final String... aFieldNames) { final ICommonsOrderedMap <String, UserDataObject> ret = new CommonsLinkedHashMap <> (); if (aFieldNames != null) { m_aRWLock.writeLocked ( () -> { for (final String sFieldName : aFieldNames) { // Remove an eventually existing old UDO final TemporaryUserDataObject aUDO = m_aMap.remove (sFieldName); if (aUDO != null) { LOGGER.info ("Confirmed uploaded file " + aUDO); // Convert from temporary to real UDO ret.put (sFieldName, new UserDataObject (aUDO.getPath ())); } } }); } return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "ICommonsOrderedMap", "<", "String", ",", "UserDataObject", ">", "confirmUploadedFiles", "(", "@", "Nullable", "final", "String", "...", "aFieldNames", ")", "{", "final", "ICommonsOrderedMap", "<", "String", ",", ...
Confirm the uploaded files with the passed field names. @param aFieldNames The field names to be confirmed. May be <code>null</code>. @return A map from the passed field name to the (non-temporary) user data objects for all resolved IDs. Never <code>null</code>. Field names that could not be resolved are not returned. If a field name is contained more than once, it is returned only once. @see #cancelUploadedFiles(String...)
[ "Confirm", "the", "uploaded", "files", "with", "the", "passed", "field", "names", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java#L131-L153
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java
UserUploadManager.confirmUploadedFile
@Nullable public UserDataObject confirmUploadedFile (@Nullable final String sFieldName) { return m_aRWLock.writeLocked ( () -> { if (StringHelper.hasText (sFieldName)) { // Remove an eventually existing old UDO final TemporaryUserDataObject aUDO = m_aMap.remove (sFieldName); if (aUDO != null) { LOGGER.info ("Confirmed uploaded file " + aUDO); // Convert from temporary to real UDO return new UserDataObject (aUDO.getPath ()); } } return null; }); }
java
@Nullable public UserDataObject confirmUploadedFile (@Nullable final String sFieldName) { return m_aRWLock.writeLocked ( () -> { if (StringHelper.hasText (sFieldName)) { // Remove an eventually existing old UDO final TemporaryUserDataObject aUDO = m_aMap.remove (sFieldName); if (aUDO != null) { LOGGER.info ("Confirmed uploaded file " + aUDO); // Convert from temporary to real UDO return new UserDataObject (aUDO.getPath ()); } } return null; }); }
[ "@", "Nullable", "public", "UserDataObject", "confirmUploadedFile", "(", "@", "Nullable", "final", "String", "sFieldName", ")", "{", "return", "m_aRWLock", ".", "writeLocked", "(", "(", ")", "->", "{", "if", "(", "StringHelper", ".", "hasText", "(", "sFieldNam...
Confirm a single uploaded file with the passed field name. @param sFieldName The field name to be confirmed. May be <code>null</code>. @return The (non-temporary) user data object for the resolved field name. May be <code>null</code> if the passed field name is not contained. @see #cancelUploadedFiles(String...)
[ "Confirm", "a", "single", "uploaded", "file", "with", "the", "passed", "field", "name", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java#L164-L181
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java
UserUploadManager.cancelUploadedFiles
@Nonnull @ReturnsMutableCopy public ICommonsList <String> cancelUploadedFiles (@Nullable final String... aFieldNames) { final ICommonsList <String> ret = new CommonsArrayList <> (); if (ArrayHelper.isNotEmpty (aFieldNames)) { m_aRWLock.writeLocked ( () -> { for (final String sFieldName : aFieldNames) { final TemporaryUserDataObject aUDO = m_aMap.remove (sFieldName); if (aUDO != null) { _deleteUDO (aUDO); ret.add (sFieldName); } } }); } return ret; }
java
@Nonnull @ReturnsMutableCopy public ICommonsList <String> cancelUploadedFiles (@Nullable final String... aFieldNames) { final ICommonsList <String> ret = new CommonsArrayList <> (); if (ArrayHelper.isNotEmpty (aFieldNames)) { m_aRWLock.writeLocked ( () -> { for (final String sFieldName : aFieldNames) { final TemporaryUserDataObject aUDO = m_aMap.remove (sFieldName); if (aUDO != null) { _deleteUDO (aUDO); ret.add (sFieldName); } } }); } return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "ICommonsList", "<", "String", ">", "cancelUploadedFiles", "(", "@", "Nullable", "final", "String", "...", "aFieldNames", ")", "{", "final", "ICommonsList", "<", "String", ">", "ret", "=", "new", "CommonsArray...
Remove all uploaded files and delete the underlying UDO objects. This is usually called, when the operation is cancelled without saving. @param aFieldNames The IDs to be removed and deleted. @return A non-<code>null</code> list with all field names that could be resolved and were removed. @see #confirmUploadedFiles(String...)
[ "Remove", "all", "uploaded", "files", "and", "delete", "the", "underlying", "UDO", "objects", ".", "This", "is", "usually", "called", "when", "the", "operation", "is", "cancelled", "without", "saving", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java#L193-L213
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java
UserUploadManager.getUploadedFile
@Nullable public TemporaryUserDataObject getUploadedFile (@Nullable final String sFieldName) { if (StringHelper.hasNoText (sFieldName)) return null; return m_aRWLock.readLocked ( () -> m_aMap.get (sFieldName)); }
java
@Nullable public TemporaryUserDataObject getUploadedFile (@Nullable final String sFieldName) { if (StringHelper.hasNoText (sFieldName)) return null; return m_aRWLock.readLocked ( () -> m_aMap.get (sFieldName)); }
[ "@", "Nullable", "public", "TemporaryUserDataObject", "getUploadedFile", "(", "@", "Nullable", "final", "String", "sFieldName", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sFieldName", ")", ")", "return", "null", ";", "return", "m_aRWLock", ".",...
Get the user data object matching the specified field name. @param sFieldName The ID to be searched. May be <code>null</code>. @return <code>null</code> if the passed field name could not be resolved.
[ "Get", "the", "user", "data", "object", "matching", "the", "specified", "field", "name", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/userdata/UserUploadManager.java#L222-L229
train
phax/ph-oton
ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/form/DefaultBootstrapFormGroupRenderer.java
DefaultBootstrapFormGroupRenderer.modifyFirstControlIfLabelIsPresent
@OverrideOnDemand protected void modifyFirstControlIfLabelIsPresent (@Nonnull final IHCElementWithChildren <?> aLabel, @Nonnull final IHCControl <?> aFirstControl) { // Set the default placeholder (if none is present) if (aFirstControl instanceof IHCInput <?>) { final IHCInput <?> aEdit = (IHCInput <?>) aFirstControl; final EHCInputType eType = aEdit.getType (); if (eType != null && eType.hasPlaceholder () && !aEdit.hasPlaceholder ()) aEdit.setPlaceholder (_getPlaceholderText (aLabel)); } else if (aFirstControl instanceof IHCTextArea <?>) { final IHCTextArea <?> aTextArea = (IHCTextArea <?>) aFirstControl; if (!aTextArea.hasPlaceholder ()) aTextArea.setPlaceholder (_getPlaceholderText (aLabel)); } }
java
@OverrideOnDemand protected void modifyFirstControlIfLabelIsPresent (@Nonnull final IHCElementWithChildren <?> aLabel, @Nonnull final IHCControl <?> aFirstControl) { // Set the default placeholder (if none is present) if (aFirstControl instanceof IHCInput <?>) { final IHCInput <?> aEdit = (IHCInput <?>) aFirstControl; final EHCInputType eType = aEdit.getType (); if (eType != null && eType.hasPlaceholder () && !aEdit.hasPlaceholder ()) aEdit.setPlaceholder (_getPlaceholderText (aLabel)); } else if (aFirstControl instanceof IHCTextArea <?>) { final IHCTextArea <?> aTextArea = (IHCTextArea <?>) aFirstControl; if (!aTextArea.hasPlaceholder ()) aTextArea.setPlaceholder (_getPlaceholderText (aLabel)); } }
[ "@", "OverrideOnDemand", "protected", "void", "modifyFirstControlIfLabelIsPresent", "(", "@", "Nonnull", "final", "IHCElementWithChildren", "<", "?", ">", "aLabel", ",", "@", "Nonnull", "final", "IHCControl", "<", "?", ">", "aFirstControl", ")", "{", "// Set the def...
Modify the first control that is inserted. This method is only called when a label is present. @param aLabel The label that was provided. Never <code>null</code>. @param aFirstControl The first control that was provided. Never <code>null</code>.
[ "Modify", "the", "first", "control", "that", "is", "inserted", ".", "This", "method", "is", "only", "called", "when", "a", "label", "is", "present", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/form/DefaultBootstrapFormGroupRenderer.java#L127-L146
train
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/chart/HCChart.java
HCChart.getJSUpdateCode
@Nonnull public IHasJSCode getJSUpdateCode (@Nonnull final IJSExpression aJSDataVar) { final JSPackage ret = new JSPackage (); // Cleanup old chart ret.invoke (JSExpr.ref (getJSChartVar ()), "destroy"); // Use new chart ret.assign (JSExpr.ref (getJSChartVar ()), new JSDefinedClass ("Chart")._new () .arg (JSExpr.ref (getCanvasID ()) .invoke ("getContext") .arg ("2d")) .invoke (m_aChart.getJSMethodName ()) .arg (aJSDataVar) .arg (getJSOptions ())); return ret; }
java
@Nonnull public IHasJSCode getJSUpdateCode (@Nonnull final IJSExpression aJSDataVar) { final JSPackage ret = new JSPackage (); // Cleanup old chart ret.invoke (JSExpr.ref (getJSChartVar ()), "destroy"); // Use new chart ret.assign (JSExpr.ref (getJSChartVar ()), new JSDefinedClass ("Chart")._new () .arg (JSExpr.ref (getCanvasID ()) .invoke ("getContext") .arg ("2d")) .invoke (m_aChart.getJSMethodName ()) .arg (aJSDataVar) .arg (getJSOptions ())); return ret; }
[ "@", "Nonnull", "public", "IHasJSCode", "getJSUpdateCode", "(", "@", "Nonnull", "final", "IJSExpression", "aJSDataVar", ")", "{", "final", "JSPackage", "ret", "=", "new", "JSPackage", "(", ")", ";", "// Cleanup old chart", "ret", ".", "invoke", "(", "JSExpr", ...
Update the chart with new datasets. This destroys the old chart. @param aJSDataVar The data parameter used to draw the graph. @return The JS code needed to do so.
[ "Update", "the", "chart", "with", "new", "datasets", ".", "This", "destroys", "the", "old", "chart", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/chart/HCChart.java#L327-L342
train
phax/ph-oton
ph-oton-app/src/main/java/com/helger/photon/app/html/PhotonJS.java
PhotonJS.unregisterJSIncludeFromThisRequest
public static void unregisterJSIncludeFromThisRequest (@Nonnull final IJSPathProvider aJSPathProvider) { final JSResourceSet aSet = _getPerRequestSet (false); if (aSet != null) aSet.removeItem (aJSPathProvider); }
java
public static void unregisterJSIncludeFromThisRequest (@Nonnull final IJSPathProvider aJSPathProvider) { final JSResourceSet aSet = _getPerRequestSet (false); if (aSet != null) aSet.removeItem (aJSPathProvider); }
[ "public", "static", "void", "unregisterJSIncludeFromThisRequest", "(", "@", "Nonnull", "final", "IJSPathProvider", "aJSPathProvider", ")", "{", "final", "JSResourceSet", "aSet", "=", "_getPerRequestSet", "(", "false", ")", ";", "if", "(", "aSet", "!=", "null", ")"...
Unregister a existing JS item only from this request @param aJSPathProvider The JS path provider to use. May not be <code>null</code>.
[ "Unregister", "a", "existing", "JS", "item", "only", "from", "this", "request" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/html/PhotonJS.java#L207-L212
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java
FileUtil.readFile
public static byte[] readFile(File file) throws IOException { // Open file RandomAccessFile f = new RandomAccessFile(file, "r"); try { // Get and check length long longlength = f.length(); int length = (int) longlength; if (length != longlength) { throw new IOException("File size >= 2 GB"); } // Read file and return data byte[] data = new byte[length]; f.readFully(data); return data; } finally { // Close file f.close(); } }
java
public static byte[] readFile(File file) throws IOException { // Open file RandomAccessFile f = new RandomAccessFile(file, "r"); try { // Get and check length long longlength = f.length(); int length = (int) longlength; if (length != longlength) { throw new IOException("File size >= 2 GB"); } // Read file and return data byte[] data = new byte[length]; f.readFully(data); return data; } finally { // Close file f.close(); } }
[ "public", "static", "byte", "[", "]", "readFile", "(", "File", "file", ")", "throws", "IOException", "{", "// Open file", "RandomAccessFile", "f", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ";", "try", "{", "// Get and check length", "long...
Loads bytes of the given file. @return Bytes of the given file.
[ "Loads", "bytes", "of", "the", "given", "file", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java#L54-L72
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java
FileUtil.writeFile
public static void writeFile(File file, byte[] bytes) throws IOException { FileOutputStream fos = null; try { fos = new FileOutputStream(file); fos.write(bytes); } finally { if (fos != null) { fos.close(); } } }
java
public static void writeFile(File file, byte[] bytes) throws IOException { FileOutputStream fos = null; try { fos = new FileOutputStream(file); fos.write(bytes); } finally { if (fos != null) { fos.close(); } } }
[ "public", "static", "void", "writeFile", "(", "File", "file", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "FileOutputStream", "fos", "=", "null", ";", "try", "{", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "fos",...
Write bytes to the given file.
[ "Write", "bytes", "to", "the", "given", "file", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java#L77-L87
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java
FileUtil.isSecondNewerThanFirst
public static boolean isSecondNewerThanFirst(File first, File second) { boolean isSecondNewerThanFirst = false; // If file does not exist, it cannot be newer. if (second.exists()) { long firstLastModified = first.lastModified(); long secondLastModified = second.lastModified(); // 0L is returned if there was any error, so we check if both last // modification stamps are != 0L. if (firstLastModified != 0L && secondLastModified != 0L) { isSecondNewerThanFirst = secondLastModified > firstLastModified; } } return isSecondNewerThanFirst; }
java
public static boolean isSecondNewerThanFirst(File first, File second) { boolean isSecondNewerThanFirst = false; // If file does not exist, it cannot be newer. if (second.exists()) { long firstLastModified = first.lastModified(); long secondLastModified = second.lastModified(); // 0L is returned if there was any error, so we check if both last // modification stamps are != 0L. if (firstLastModified != 0L && secondLastModified != 0L) { isSecondNewerThanFirst = secondLastModified > firstLastModified; } } return isSecondNewerThanFirst; }
[ "public", "static", "boolean", "isSecondNewerThanFirst", "(", "File", "first", ",", "File", "second", ")", "{", "boolean", "isSecondNewerThanFirst", "=", "false", ";", "// If file does not exist, it cannot be newer.", "if", "(", "second", ".", "exists", "(", ")", ")...
Checks if tool jar is newer than JUnit jar. If tool jar is newer, return true; false otherwise.
[ "Checks", "if", "tool", "jar", "is", "newer", "than", "JUnit", "jar", ".", "If", "tool", "jar", "is", "newer", "return", "true", ";", "false", "otherwise", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java#L93-L106
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java
FileUtil.loadBytes
public static byte[] loadBytes(URL url) { byte[] bytes = null; try { bytes = loadBytes(url.openStream()); } catch (IOException ex) { // ex.printStackTrace(); } return bytes; }
java
public static byte[] loadBytes(URL url) { byte[] bytes = null; try { bytes = loadBytes(url.openStream()); } catch (IOException ex) { // ex.printStackTrace(); } return bytes; }
[ "public", "static", "byte", "[", "]", "loadBytes", "(", "URL", "url", ")", "{", "byte", "[", "]", "bytes", "=", "null", ";", "try", "{", "bytes", "=", "loadBytes", "(", "url", ".", "openStream", "(", ")", ")", ";", "}", "catch", "(", "IOException",...
Load bytes from the given url. @param url Local of the file to load. @return Bytes loaded from the given url.
[ "Load", "bytes", "from", "the", "given", "url", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java#L189-L197
train
phax/ph-oton
ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceBundleManager.java
WebSiteResourceBundleManager.getResourceBundleOfID
@Nullable public WebSiteResourceBundleSerialized getResourceBundleOfID (@Nullable final String sBundleID) { if (StringHelper.hasNoText (sBundleID)) return null; return m_aRWLock.readLocked ( () -> m_aMapToBundle.get (sBundleID)); }
java
@Nullable public WebSiteResourceBundleSerialized getResourceBundleOfID (@Nullable final String sBundleID) { if (StringHelper.hasNoText (sBundleID)) return null; return m_aRWLock.readLocked ( () -> m_aMapToBundle.get (sBundleID)); }
[ "@", "Nullable", "public", "WebSiteResourceBundleSerialized", "getResourceBundleOfID", "(", "@", "Nullable", "final", "String", "sBundleID", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sBundleID", ")", ")", "return", "null", ";", "return", "m_aRWL...
Get the serialized resource bundle with the passed ID. @param sBundleID The bundle ID to be resolved. May be <code>null</code>. @return <code>null</code> if no such bundle exists.
[ "Get", "the", "serialized", "resource", "bundle", "with", "the", "passed", "ID", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceBundleManager.java#L272-L279
train
phax/ph-oton
ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceBundleManager.java
WebSiteResourceBundleManager.containsResourceBundleOfID
public boolean containsResourceBundleOfID (@Nullable final String sBundleID) { if (StringHelper.hasNoText (sBundleID)) return false; return m_aRWLock.readLocked ( () -> m_aMapToBundle.containsKey (sBundleID)); }
java
public boolean containsResourceBundleOfID (@Nullable final String sBundleID) { if (StringHelper.hasNoText (sBundleID)) return false; return m_aRWLock.readLocked ( () -> m_aMapToBundle.containsKey (sBundleID)); }
[ "public", "boolean", "containsResourceBundleOfID", "(", "@", "Nullable", "final", "String", "sBundleID", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sBundleID", ")", ")", "return", "false", ";", "return", "m_aRWLock", ".", "readLocked", "(", "...
Check if the passed resource bundle ID is contained. @param sBundleID The bundle ID to be checked. May be <code>null</code>. @return <code>true</code> if the passed bundle exists, <code>false</code> otherwise.
[ "Check", "if", "the", "passed", "resource", "bundle", "ID", "is", "contained", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceBundleManager.java#L289-L295
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java
AbstractMojoInterceptor.throwMojoExecutionException
protected static void throwMojoExecutionException(Object mojo, String message, Exception cause) throws Exception { Class<?> clz = mojo.getClass().getClassLoader().loadClass(MavenNames.MOJO_EXECUTION_EXCEPTION_BIN); Constructor<?> con = clz.getConstructor(String.class, Exception.class); Exception ex = (Exception) con.newInstance(message, cause); throw ex; }
java
protected static void throwMojoExecutionException(Object mojo, String message, Exception cause) throws Exception { Class<?> clz = mojo.getClass().getClassLoader().loadClass(MavenNames.MOJO_EXECUTION_EXCEPTION_BIN); Constructor<?> con = clz.getConstructor(String.class, Exception.class); Exception ex = (Exception) con.newInstance(message, cause); throw ex; }
[ "protected", "static", "void", "throwMojoExecutionException", "(", "Object", "mojo", ",", "String", "message", ",", "Exception", "cause", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "clz", "=", "mojo", ".", "getClass", "(", ")", ".", "getClassLo...
Throws MojoExecutionException. @param mojo Surefire plugin @param message Message for the exception @param cause The actual exception @throws Exception MojoExecutionException
[ "Throws", "MojoExecutionException", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L80-L85
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java
AbstractMojoInterceptor.invokeAndGetString
protected static String invokeAndGetString(String methodName, Object mojo) throws Exception { return (String) invokeGetMethod(methodName, mojo); }
java
protected static String invokeAndGetString(String methodName, Object mojo) throws Exception { return (String) invokeGetMethod(methodName, mojo); }
[ "protected", "static", "String", "invokeAndGetString", "(", "String", "methodName", ",", "Object", "mojo", ")", "throws", "Exception", "{", "return", "(", "String", ")", "invokeGetMethod", "(", "methodName", ",", "mojo", ")", ";", "}" ]
Gets String field value from the given mojo based on the given method name.
[ "Gets", "String", "field", "value", "from", "the", "given", "mojo", "based", "on", "the", "given", "method", "name", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L91-L93
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java
AbstractMojoInterceptor.invokeAndGetBoolean
protected static boolean invokeAndGetBoolean(String methodName, Object mojo) throws Exception { return (Boolean) invokeGetMethod(methodName, mojo); }
java
protected static boolean invokeAndGetBoolean(String methodName, Object mojo) throws Exception { return (Boolean) invokeGetMethod(methodName, mojo); }
[ "protected", "static", "boolean", "invokeAndGetBoolean", "(", "String", "methodName", ",", "Object", "mojo", ")", "throws", "Exception", "{", "return", "(", "Boolean", ")", "invokeGetMethod", "(", "methodName", ",", "mojo", ")", ";", "}" ]
Gets boolean field value from the given mojo based on the given method name. @param methodName Method name to be used to get the value @param mojo Mojo from which to extract the value @return Boolean value by invoking method on Mojo @throws Exception If reflection invocation goes wrong
[ "Gets", "boolean", "field", "value", "from", "the", "given", "mojo", "based", "on", "the", "given", "method", "name", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L107-L109
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java
AbstractMojoInterceptor.invokeAndGetList
@SuppressWarnings("unchecked") protected static List<String> invokeAndGetList(String methodName, Object mojo) throws Exception { return (List<String>) invokeGetMethod(methodName, mojo); }
java
@SuppressWarnings("unchecked") protected static List<String> invokeAndGetList(String methodName, Object mojo) throws Exception { return (List<String>) invokeGetMethod(methodName, mojo); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "static", "List", "<", "String", ">", "invokeAndGetList", "(", "String", "methodName", ",", "Object", "mojo", ")", "throws", "Exception", "{", "return", "(", "List", "<", "String", ">", ")", "i...
Gets List field value from the given mojo based on the given method name.
[ "Gets", "List", "field", "value", "from", "the", "given", "mojo", "based", "on", "the", "given", "method", "name", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L114-L117
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java
AbstractMojoInterceptor.setField
protected static void setField(String fieldName, Object mojo, Object value) throws Exception { Field field = null; try { field = mojo.getClass().getDeclaredField(fieldName); } catch (NoSuchFieldException ex) { // Ignore exception and try superclass. field = mojo.getClass().getSuperclass().getDeclaredField(fieldName); } field.setAccessible(true); field.set(mojo, value); }
java
protected static void setField(String fieldName, Object mojo, Object value) throws Exception { Field field = null; try { field = mojo.getClass().getDeclaredField(fieldName); } catch (NoSuchFieldException ex) { // Ignore exception and try superclass. field = mojo.getClass().getSuperclass().getDeclaredField(fieldName); } field.setAccessible(true); field.set(mojo, value); }
[ "protected", "static", "void", "setField", "(", "String", "fieldName", ",", "Object", "mojo", ",", "Object", "value", ")", "throws", "Exception", "{", "Field", "field", "=", "null", ";", "try", "{", "field", "=", "mojo", ".", "getClass", "(", ")", ".", ...
Sets the given field to the given value. This is an alternative to invoking a set method. @param fieldName Name of the field to set @param mojo Mojo @param value New value for the field @throws Exception If setting the field using reflection goes wrong
[ "Sets", "the", "given", "field", "to", "the", "given", "value", ".", "This", "is", "an", "alternative", "to", "invoking", "a", "set", "method", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L144-L154
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java
AbstractMojoInterceptor.getField
protected static Object getField(String fieldName, Object mojo) throws Exception { Field field = null; try { field = mojo.getClass().getDeclaredField(fieldName); } catch (NoSuchFieldException ex) { // Ignore exception and try superclass. field = mojo.getClass().getSuperclass().getDeclaredField(fieldName); } field.setAccessible(true); return field.get(mojo); }
java
protected static Object getField(String fieldName, Object mojo) throws Exception { Field field = null; try { field = mojo.getClass().getDeclaredField(fieldName); } catch (NoSuchFieldException ex) { // Ignore exception and try superclass. field = mojo.getClass().getSuperclass().getDeclaredField(fieldName); } field.setAccessible(true); return field.get(mojo); }
[ "protected", "static", "Object", "getField", "(", "String", "fieldName", ",", "Object", "mojo", ")", "throws", "Exception", "{", "Field", "field", "=", "null", ";", "try", "{", "field", "=", "mojo", ".", "getClass", "(", ")", ".", "getDeclaredField", "(", ...
Gets the value of the field. This is an alternative to invoking a get method. @param fieldName Name of the field to get @param mojo Mojo @return Value of the field @throws Exception If getting the field value using relection goes wrong
[ "Gets", "the", "value", "of", "the", "field", ".", "This", "is", "an", "alternative", "to", "invoking", "a", "get", "method", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L168-L178
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java
AgentLoader.loadAgent
public static boolean loadAgent(URL agentJarURL) throws Exception { File toolsJarFile = findToolsJar(); Class<?> vmClass = null; if (toolsJarFile == null || !toolsJarFile.exists()) { // likely Java 9+ (when tools.jar is not available). Java // 9 also requires that // -Djvm.options=jdk.attach.allowAttachSelf=true is set. vmClass = ClassLoader.getSystemClassLoader().loadClass("com.sun.tools.attach.VirtualMachine"); } else { vmClass = loadVirtualMachine(toolsJarFile); } if (vmClass == null) { return false; } attachAgent(vmClass, agentJarURL); return true; }
java
public static boolean loadAgent(URL agentJarURL) throws Exception { File toolsJarFile = findToolsJar(); Class<?> vmClass = null; if (toolsJarFile == null || !toolsJarFile.exists()) { // likely Java 9+ (when tools.jar is not available). Java // 9 also requires that // -Djvm.options=jdk.attach.allowAttachSelf=true is set. vmClass = ClassLoader.getSystemClassLoader().loadClass("com.sun.tools.attach.VirtualMachine"); } else { vmClass = loadVirtualMachine(toolsJarFile); } if (vmClass == null) { return false; } attachAgent(vmClass, agentJarURL); return true; }
[ "public", "static", "boolean", "loadAgent", "(", "URL", "agentJarURL", ")", "throws", "Exception", "{", "File", "toolsJarFile", "=", "findToolsJar", "(", ")", ";", "Class", "<", "?", ">", "vmClass", "=", "null", ";", "if", "(", "toolsJarFile", "==", "null"...
Loads agent from the given URL. @param agentJarURL Agent location @return True if loading was successful, false otherwise @throws Exception If unexpected behavior
[ "Loads", "agent", "from", "the", "given", "URL", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java#L84-L103
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java
AgentLoader.attachAgent
private static void attachAgent(Class<?> vmClass, URL agentJarURL) throws Exception { String pid = getPID(); String agentAbsolutePath = new File(agentJarURL.toURI().getSchemeSpecificPart()).getAbsolutePath(); Object vm = getAttachMethod(vmClass).invoke(null, new Object[] { pid }); getLoadAgentMethod(vmClass).invoke(vm, new Object[] { agentAbsolutePath }); getDetachMethod(vmClass).invoke(vm); }
java
private static void attachAgent(Class<?> vmClass, URL agentJarURL) throws Exception { String pid = getPID(); String agentAbsolutePath = new File(agentJarURL.toURI().getSchemeSpecificPart()).getAbsolutePath(); Object vm = getAttachMethod(vmClass).invoke(null, new Object[] { pid }); getLoadAgentMethod(vmClass).invoke(vm, new Object[] { agentAbsolutePath }); getDetachMethod(vmClass).invoke(vm); }
[ "private", "static", "void", "attachAgent", "(", "Class", "<", "?", ">", "vmClass", ",", "URL", "agentJarURL", ")", "throws", "Exception", "{", "String", "pid", "=", "getPID", "(", ")", ";", "String", "agentAbsolutePath", "=", "new", "File", "(", "agentJar...
Attaches jar where this class belongs to the current VirtualMachine as an agent. @param vmClass VirtualMachine @throws Exception If unexpected behavior
[ "Attaches", "jar", "where", "this", "class", "belongs", "to", "the", "current", "VirtualMachine", "as", "an", "agent", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java#L116-L123
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java
AgentLoader.getAttachMethod
private static Method getAttachMethod(Class<?> vmClass) throws SecurityException, NoSuchMethodException { return vmClass.getMethod("attach", new Class<?>[] { String.class }); }
java
private static Method getAttachMethod(Class<?> vmClass) throws SecurityException, NoSuchMethodException { return vmClass.getMethod("attach", new Class<?>[] { String.class }); }
[ "private", "static", "Method", "getAttachMethod", "(", "Class", "<", "?", ">", "vmClass", ")", "throws", "SecurityException", ",", "NoSuchMethodException", "{", "return", "vmClass", ".", "getMethod", "(", "\"attach\"", ",", "new", "Class", "<", "?", ">", "[", ...
Finds attach method in VirtualMachine. @param vmClass VirtualMachine class @return 'attach' Method @throws SecurityException If access is not legal @throws NoSuchMethodException If no such method is found
[ "Finds", "attach", "method", "in", "VirtualMachine", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java#L136-L138
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java
AgentLoader.getLoadAgentMethod
private static Method getLoadAgentMethod(Class<?> vmClass) throws SecurityException, NoSuchMethodException { return vmClass.getMethod("loadAgent", new Class[] { String.class }); }
java
private static Method getLoadAgentMethod(Class<?> vmClass) throws SecurityException, NoSuchMethodException { return vmClass.getMethod("loadAgent", new Class[] { String.class }); }
[ "private", "static", "Method", "getLoadAgentMethod", "(", "Class", "<", "?", ">", "vmClass", ")", "throws", "SecurityException", ",", "NoSuchMethodException", "{", "return", "vmClass", ".", "getMethod", "(", "\"loadAgent\"", ",", "new", "Class", "[", "]", "{", ...
Finds loadAgent method in VirtualMachine. @param vmClass VirtualMachine class @return 'loadAgent' Method @throws SecurityException If access is not legal @throws NoSuchMethodException If no such method is found
[ "Finds", "loadAgent", "method", "in", "VirtualMachine", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java#L151-L153
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java
AgentLoader.getPID
private static String getPID() { String vmName = ManagementFactory.getRuntimeMXBean().getName(); return vmName.substring(0, vmName.indexOf("@")); }
java
private static String getPID() { String vmName = ManagementFactory.getRuntimeMXBean().getName(); return vmName.substring(0, vmName.indexOf("@")); }
[ "private", "static", "String", "getPID", "(", ")", "{", "String", "vmName", "=", "ManagementFactory", ".", "getRuntimeMXBean", "(", ")", ".", "getName", "(", ")", ";", "return", "vmName", ".", "substring", "(", "0", ",", "vmName", ".", "indexOf", "(", "\...
Returns process id. Note that Java does not guarantee any format for id, so this is just a common heuristic. @return Current process id
[ "Returns", "process", "id", ".", "Note", "that", "Java", "does", "not", "guarantee", "any", "format", "for", "id", "so", "this", "is", "just", "a", "common", "heuristic", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java#L198-L201
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java
AgentLoader.findToolsJar
private static File findToolsJar() { String javaHome = System.getProperty("java.home"); File javaHomeFile = new File(javaHome); File toolsJarFile = new File(javaHomeFile, "lib" + File.separator + TOOLS_JAR_NAME); if (!toolsJarFile.exists()) { toolsJarFile = new File(System.getenv("java_home"), "lib" + File.separator + TOOLS_JAR_NAME); } if (!toolsJarFile.exists() && javaHomeFile.getAbsolutePath().endsWith(File.separator + "jre")) { javaHomeFile = javaHomeFile.getParentFile(); toolsJarFile = new File(javaHomeFile, "lib" + File.separator + TOOLS_JAR_NAME); } if (!toolsJarFile.exists() && isMac() && javaHomeFile.getAbsolutePath().endsWith(File.separator + "Home")) { javaHomeFile = javaHomeFile.getParentFile(); toolsJarFile = new File(javaHomeFile, "Classes" + File.separator + CLASSES_JAR_NAME); } return toolsJarFile; }
java
private static File findToolsJar() { String javaHome = System.getProperty("java.home"); File javaHomeFile = new File(javaHome); File toolsJarFile = new File(javaHomeFile, "lib" + File.separator + TOOLS_JAR_NAME); if (!toolsJarFile.exists()) { toolsJarFile = new File(System.getenv("java_home"), "lib" + File.separator + TOOLS_JAR_NAME); } if (!toolsJarFile.exists() && javaHomeFile.getAbsolutePath().endsWith(File.separator + "jre")) { javaHomeFile = javaHomeFile.getParentFile(); toolsJarFile = new File(javaHomeFile, "lib" + File.separator + TOOLS_JAR_NAME); } if (!toolsJarFile.exists() && isMac() && javaHomeFile.getAbsolutePath().endsWith(File.separator + "Home")) { javaHomeFile = javaHomeFile.getParentFile(); toolsJarFile = new File(javaHomeFile, "Classes" + File.separator + CLASSES_JAR_NAME); } return toolsJarFile; }
[ "private", "static", "File", "findToolsJar", "(", ")", "{", "String", "javaHome", "=", "System", ".", "getProperty", "(", "\"java.home\"", ")", ";", "File", "javaHomeFile", "=", "new", "File", "(", "javaHome", ")", ";", "File", "toolsJarFile", "=", "new", ...
Finds tools.jar in JDK. @return File for tools.jar, which may not be valid if tools.jar could have not been located
[ "Finds", "tools", ".", "jar", "in", "JDK", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java#L209-L229
train
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/javadoc/javacc/JavaDocParserImpl.java
JavaDocParserImpl.lookahead
public Token lookahead() { Token current = token; if (current.next == null) { current.next = token_source.getNextToken(); } return current.next; }
java
public Token lookahead() { Token current = token; if (current.next == null) { current.next = token_source.getNextToken(); } return current.next; }
[ "public", "Token", "lookahead", "(", ")", "{", "Token", "current", "=", "token", ";", "if", "(", "current", ".", "next", "==", "null", ")", "{", "current", ".", "next", "=", "token_source", ".", "getNextToken", "(", ")", ";", "}", "return", "current", ...
look ahead 1 token
[ "look", "ahead", "1", "token" ]
92ee94b6624cd673851497d78c218837dcf02b8a
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/javadoc/javacc/JavaDocParserImpl.java#L23-L29
train
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/javadoc/javacc/JavaDocParserImpl.java
JavaDocParserImpl.whiteSpace
protected List<JDToken> whiteSpace(Token token) { final List<JDToken> wss = new ArrayList<JDToken>(); Token ws = token.specialToken; while(ws != null) { switch(ws.kind) { case WS: wss.add(_JDWhiteSpace(ws.image)); break; default: // anything else is not whitespace and not our problem. } ws = ws.specialToken; } Collections.reverse(wss); return wss; }
java
protected List<JDToken> whiteSpace(Token token) { final List<JDToken> wss = new ArrayList<JDToken>(); Token ws = token.specialToken; while(ws != null) { switch(ws.kind) { case WS: wss.add(_JDWhiteSpace(ws.image)); break; default: // anything else is not whitespace and not our problem. } ws = ws.specialToken; } Collections.reverse(wss); return wss; }
[ "protected", "List", "<", "JDToken", ">", "whiteSpace", "(", "Token", "token", ")", "{", "final", "List", "<", "JDToken", ">", "wss", "=", "new", "ArrayList", "<", "JDToken", ">", "(", ")", ";", "Token", "ws", "=", "token", ".", "specialToken", ";", ...
Return all the comments attached to the specified token
[ "Return", "all", "the", "comments", "attached", "to", "the", "specified", "token" ]
92ee94b6624cd673851497d78c218837dcf02b8a
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/javadoc/javacc/JavaDocParserImpl.java#L43-L58
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java
JSOp.hasOperator
public static boolean hasOperator (@Nullable final IJSExpression aExpr) { return aExpr instanceof JSOpUnary || aExpr instanceof JSOpBinary || aExpr instanceof JSOpTernary; }
java
public static boolean hasOperator (@Nullable final IJSExpression aExpr) { return aExpr instanceof JSOpUnary || aExpr instanceof JSOpBinary || aExpr instanceof JSOpTernary; }
[ "public", "static", "boolean", "hasOperator", "(", "@", "Nullable", "final", "IJSExpression", "aExpr", ")", "{", "return", "aExpr", "instanceof", "JSOpUnary", "||", "aExpr", "instanceof", "JSOpBinary", "||", "aExpr", "instanceof", "JSOpTernary", ";", "}" ]
Determine whether the top level of an expression involves an operator. @param aExpr Expression to check @return <code>true</code> if it involves an operator
[ "Determine", "whether", "the", "top", "level", "of", "an", "expression", "involves", "an", "operator", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java#L47-L50
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java
JSOp.band
@Nonnull public static JSOpBinary band (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { return new JSOpBinary (aLeft, "&", aRight); }
java
@Nonnull public static JSOpBinary band (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { return new JSOpBinary (aLeft, "&", aRight); }
[ "@", "Nonnull", "public", "static", "JSOpBinary", "band", "(", "@", "Nonnull", "final", "IJSExpression", "aLeft", ",", "@", "Nonnull", "final", "IJSExpression", "aRight", ")", "{", "return", "new", "JSOpBinary", "(", "aLeft", ",", "\"&\"", ",", "aRight", ")"...
Binary-and @param aLeft lhs @param aRight rhs @return operator
[ "Binary", "-", "and" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java#L223-L227
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java
JSOp.bor
@Nonnull public static JSOpBinary bor (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { return new JSOpBinary (aLeft, "|", aRight); }
java
@Nonnull public static JSOpBinary bor (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { return new JSOpBinary (aLeft, "|", aRight); }
[ "@", "Nonnull", "public", "static", "JSOpBinary", "bor", "(", "@", "Nonnull", "final", "IJSExpression", "aLeft", ",", "@", "Nonnull", "final", "IJSExpression", "aRight", ")", "{", "return", "new", "JSOpBinary", "(", "aLeft", ",", "\"|\"", ",", "aRight", ")",...
Binary-or @param aLeft lhs @param aRight rhs @return operator
[ "Binary", "-", "or" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java#L238-L242
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java
JSOp.cand
@Nonnull public static IJSExpression cand (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { // Some optimizations if (aLeft == JSExpr.TRUE) return aRight; if (aRight == JSExpr.TRUE) return aLeft; if (aLeft == JSExpr.FALSE || aRight == JSExpr.FALSE) return JSExpr.FALSE; return new JSOpBinary (aLeft, "&&", aRight); }
java
@Nonnull public static IJSExpression cand (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { // Some optimizations if (aLeft == JSExpr.TRUE) return aRight; if (aRight == JSExpr.TRUE) return aLeft; if (aLeft == JSExpr.FALSE || aRight == JSExpr.FALSE) return JSExpr.FALSE; return new JSOpBinary (aLeft, "&&", aRight); }
[ "@", "Nonnull", "public", "static", "IJSExpression", "cand", "(", "@", "Nonnull", "final", "IJSExpression", "aLeft", ",", "@", "Nonnull", "final", "IJSExpression", "aRight", ")", "{", "// Some optimizations", "if", "(", "aLeft", "==", "JSExpr", ".", "TRUE", ")...
Logical-and @param aLeft lhs @param aRight rhs @return operator
[ "Logical", "-", "and" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java#L253-L265
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java
JSOp.xor
@Nonnull public static JSOpBinary xor (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { return new JSOpBinary (aLeft, "^", aRight); }
java
@Nonnull public static JSOpBinary xor (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { return new JSOpBinary (aLeft, "^", aRight); }
[ "@", "Nonnull", "public", "static", "JSOpBinary", "xor", "(", "@", "Nonnull", "final", "IJSExpression", "aLeft", ",", "@", "Nonnull", "final", "IJSExpression", "aRight", ")", "{", "return", "new", "JSOpBinary", "(", "aLeft", ",", "\"^\"", ",", "aRight", ")",...
Exclusive-or @param aLeft lhs @param aRight rhs @return operator
[ "Exclusive", "-", "or" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java#L299-L303
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java
JSOp.ene
@Nonnull public static JSOpBinary ene (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { return new JSOpBinary (aLeft, "!==", aRight); }
java
@Nonnull public static JSOpBinary ene (@Nonnull final IJSExpression aLeft, @Nonnull final IJSExpression aRight) { return new JSOpBinary (aLeft, "!==", aRight); }
[ "@", "Nonnull", "public", "static", "JSOpBinary", "ene", "(", "@", "Nonnull", "final", "IJSExpression", "aLeft", ",", "@", "Nonnull", "final", "IJSExpression", "aRight", ")", "{", "return", "new", "JSOpBinary", "(", "aLeft", ",", "\"!==\"", ",", "aRight", ")...
exactly not equal
[ "exactly", "not", "equal" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSOp.java#L351-L355
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/servlet/AbstractResourceDeliveryHttpHandler.java
AbstractResourceDeliveryHttpHandler.determineMimeType
@OverrideOnDemand @Nullable protected String determineMimeType (@Nonnull final String sFilename, @Nonnull final IReadableResource aResource) { return MimeTypeInfoManager.getDefaultInstance ().getPrimaryMimeTypeStringForFilename (sFilename); }
java
@OverrideOnDemand @Nullable protected String determineMimeType (@Nonnull final String sFilename, @Nonnull final IReadableResource aResource) { return MimeTypeInfoManager.getDefaultInstance ().getPrimaryMimeTypeStringForFilename (sFilename); }
[ "@", "OverrideOnDemand", "@", "Nullable", "protected", "String", "determineMimeType", "(", "@", "Nonnull", "final", "String", "sFilename", ",", "@", "Nonnull", "final", "IReadableResource", "aResource", ")", "{", "return", "MimeTypeInfoManager", ".", "getDefaultInstan...
Determine the MIME type of the resource to deliver. @param sFilename The passed filename to stream. Never <code>null</code>. @param aResource The resolved resource. Never <code>null</code>. @return <code>null</code> if no MIME type could be determined
[ "Determine", "the", "MIME", "type", "of", "the", "resource", "to", "deliver", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/servlet/AbstractResourceDeliveryHttpHandler.java#L159-L164
train
phax/ph-oton
ph-oton-bootstrap4-uictrls/src/main/java/com/helger/photon/bootstrap4/uictrls/ext/BootstrapSecurityUI.java
BootstrapSecurityUI.createPasswordConstraintTip
@Nullable public static ICommonsList <IHCNode> createPasswordConstraintTip (@Nonnull final Locale aDisplayLocale) { final ICommonsList <String> aTexts = GlobalPasswordSettings.getPasswordConstraintList () .getAllPasswordConstraintDescriptions (aDisplayLocale); if (aTexts.isEmpty ()) return null; return HCExtHelper.list2divList (aTexts); }
java
@Nullable public static ICommonsList <IHCNode> createPasswordConstraintTip (@Nonnull final Locale aDisplayLocale) { final ICommonsList <String> aTexts = GlobalPasswordSettings.getPasswordConstraintList () .getAllPasswordConstraintDescriptions (aDisplayLocale); if (aTexts.isEmpty ()) return null; return HCExtHelper.list2divList (aTexts); }
[ "@", "Nullable", "public", "static", "ICommonsList", "<", "IHCNode", ">", "createPasswordConstraintTip", "(", "@", "Nonnull", "final", "Locale", "aDisplayLocale", ")", "{", "final", "ICommonsList", "<", "String", ">", "aTexts", "=", "GlobalPasswordSettings", ".", ...
Create a tooltip with all the requirements for a password @param aDisplayLocale Display locale to use. @return <code>null</code> if not special constraints are defined.
[ "Create", "a", "tooltip", "with", "all", "the", "requirements", "for", "a", "password" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap4-uictrls/src/main/java/com/helger/photon/bootstrap4/uictrls/ext/BootstrapSecurityUI.java#L48-L57
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/longrun/LongRunningJobManager.java
LongRunningJobManager.onStartJob
@Nonnull @Nonempty public String onStartJob (@Nonnull final ILongRunningJob aJob, @Nullable final String sStartingUserID) { ValueEnforcer.notNull (aJob, "Job"); // Create a new unique in-memory ID final String sJobID = GlobalIDFactory.getNewStringID (); final LongRunningJobData aJobData = new LongRunningJobData (sJobID, aJob.getJobDescription (), sStartingUserID); m_aRWLock.writeLocked ( () -> m_aRunningJobs.put (sJobID, aJobData)); return sJobID; }
java
@Nonnull @Nonempty public String onStartJob (@Nonnull final ILongRunningJob aJob, @Nullable final String sStartingUserID) { ValueEnforcer.notNull (aJob, "Job"); // Create a new unique in-memory ID final String sJobID = GlobalIDFactory.getNewStringID (); final LongRunningJobData aJobData = new LongRunningJobData (sJobID, aJob.getJobDescription (), sStartingUserID); m_aRWLock.writeLocked ( () -> m_aRunningJobs.put (sJobID, aJobData)); return sJobID; }
[ "@", "Nonnull", "@", "Nonempty", "public", "String", "onStartJob", "(", "@", "Nonnull", "final", "ILongRunningJob", "aJob", ",", "@", "Nullable", "final", "String", "sStartingUserID", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aJob", ",", "\"Job\"", ")",...
Start a long running job @param aJob The job that is to be started @param sStartingUserID The ID of the user who started the job @return The internal long running job ID
[ "Start", "a", "long", "running", "job" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/longrun/LongRunningJobManager.java#L62-L73
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/longrun/LongRunningJobManager.java
LongRunningJobManager.onEndJob
public void onEndJob (@Nullable final String sJobID, @Nonnull final ESuccess eExecSucess, @Nonnull final LongRunningJobResult aResult) { ValueEnforcer.notNull (eExecSucess, "ExecSuccess"); ValueEnforcer.notNull (aResult, "Result"); // Remove from running job list final LongRunningJobData aJobData = m_aRWLock.writeLocked ( () -> { final LongRunningJobData ret = m_aRunningJobs.remove (sJobID); if (ret == null) throw new IllegalArgumentException ("Illegal job ID '" + sJobID + "' passed!"); // End the job - inside the writeLock ret.onJobEnd (eExecSucess, aResult); return ret; }); // Remember it m_aResultMgr.addResult (aJobData); }
java
public void onEndJob (@Nullable final String sJobID, @Nonnull final ESuccess eExecSucess, @Nonnull final LongRunningJobResult aResult) { ValueEnforcer.notNull (eExecSucess, "ExecSuccess"); ValueEnforcer.notNull (aResult, "Result"); // Remove from running job list final LongRunningJobData aJobData = m_aRWLock.writeLocked ( () -> { final LongRunningJobData ret = m_aRunningJobs.remove (sJobID); if (ret == null) throw new IllegalArgumentException ("Illegal job ID '" + sJobID + "' passed!"); // End the job - inside the writeLock ret.onJobEnd (eExecSucess, aResult); return ret; }); // Remember it m_aResultMgr.addResult (aJobData); }
[ "public", "void", "onEndJob", "(", "@", "Nullable", "final", "String", "sJobID", ",", "@", "Nonnull", "final", "ESuccess", "eExecSucess", ",", "@", "Nonnull", "final", "LongRunningJobResult", "aResult", ")", "{", "ValueEnforcer", ".", "notNull", "(", "eExecSuces...
End a job. @param sJobID The internal long running job ID created from {@link #onStartJob(ILongRunningJob,String)}. @param eExecSucess Was the job execution successful or not from a technical point of view? May not be <code>null</code>. If a JobExecutionException was thrown, this should be {@link ESuccess#FAILURE}. @param aResult The main job results.
[ "End", "a", "job", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/longrun/LongRunningJobManager.java#L88-L108
train
phax/ph-oton
ph-oton-app/src/main/java/com/helger/photon/app/html/PhotonMetaElements.java
PhotonMetaElements.unregisterMetaElementFromThisRequest
public static void unregisterMetaElementFromThisRequest (@Nullable final String sMetaElementName) { final MetaElementList aSet = _getPerRequestSet (false); if (aSet != null) aSet.removeMetaElement (sMetaElementName); }
java
public static void unregisterMetaElementFromThisRequest (@Nullable final String sMetaElementName) { final MetaElementList aSet = _getPerRequestSet (false); if (aSet != null) aSet.removeMetaElement (sMetaElementName); }
[ "public", "static", "void", "unregisterMetaElementFromThisRequest", "(", "@", "Nullable", "final", "String", "sMetaElementName", ")", "{", "final", "MetaElementList", "aSet", "=", "_getPerRequestSet", "(", "false", ")", ";", "if", "(", "aSet", "!=", "null", ")", ...
Unregister an existing meta element only from this request @param sMetaElementName The name of the meta element to be removed. May not be <code>null</code>.
[ "Unregister", "an", "existing", "meta", "element", "only", "from", "this", "request" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/html/PhotonMetaElements.java#L173-L178
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/html/AbstractSWECHTMLProvider.java
AbstractSWECHTMLProvider.fillHead
@OverrideOnDemand @OverridingMethodsMustInvokeSuper protected void fillHead (@Nonnull final ISimpleWebExecutionContext aSWEC, @Nonnull final HCHtml aHtml) { final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope (); final HCHead aHead = aHtml.head (); // Add all meta elements addMetaElements (aRequestScope, aHead); }
java
@OverrideOnDemand @OverridingMethodsMustInvokeSuper protected void fillHead (@Nonnull final ISimpleWebExecutionContext aSWEC, @Nonnull final HCHtml aHtml) { final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope (); final HCHead aHead = aHtml.head (); // Add all meta elements addMetaElements (aRequestScope, aHead); }
[ "@", "OverrideOnDemand", "@", "OverridingMethodsMustInvokeSuper", "protected", "void", "fillHead", "(", "@", "Nonnull", "final", "ISimpleWebExecutionContext", "aSWEC", ",", "@", "Nonnull", "final", "HCHtml", "aHtml", ")", "{", "final", "IRequestWebScopeWithoutResponse", ...
Fill the HTML HEAD element. @param aSWEC Web execution context @param aHtml The HTML object to be filled.
[ "Fill", "the", "HTML", "HEAD", "element", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/html/AbstractSWECHTMLProvider.java#L67-L76
train
phax/ph-oton
ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/panel/BootstrapPanel.java
BootstrapPanel.setType
@Nonnull public final EChange setType (@Nonnull final EBootstrapPanelType eType) { ValueEnforcer.notNull (eType, "Type"); if (eType.equals (m_eType)) return EChange.UNCHANGED; removeClass (m_eType); addClass (eType); m_eType = eType; return EChange.CHANGED; }
java
@Nonnull public final EChange setType (@Nonnull final EBootstrapPanelType eType) { ValueEnforcer.notNull (eType, "Type"); if (eType.equals (m_eType)) return EChange.UNCHANGED; removeClass (m_eType); addClass (eType); m_eType = eType; return EChange.CHANGED; }
[ "@", "Nonnull", "public", "final", "EChange", "setType", "(", "@", "Nonnull", "final", "EBootstrapPanelType", "eType", ")", "{", "ValueEnforcer", ".", "notNull", "(", "eType", ",", "\"Type\"", ")", ";", "if", "(", "eType", ".", "equals", "(", "m_eType", ")...
Set the type. @param eType Panel type. May not be <code>null</code>. @return {@link EChange}
[ "Set", "the", "type", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/panel/BootstrapPanel.java#L71-L82
train
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadDataset.java
TypeaheadDataset.setLimit
@Nonnull public TypeaheadDataset setLimit (@Nonnegative final int nLimit) { ValueEnforcer.isGT0 (nLimit, "Limit"); m_nLimit = nLimit; return this; }
java
@Nonnull public TypeaheadDataset setLimit (@Nonnegative final int nLimit) { ValueEnforcer.isGT0 (nLimit, "Limit"); m_nLimit = nLimit; return this; }
[ "@", "Nonnull", "public", "TypeaheadDataset", "setLimit", "(", "@", "Nonnegative", "final", "int", "nLimit", ")", "{", "ValueEnforcer", ".", "isGT0", "(", "nLimit", ",", "\"Limit\"", ")", ";", "m_nLimit", "=", "nLimit", ";", "return", "this", ";", "}" ]
The max number of suggestions from the dataset to display for a given query. Defaults to 5. @param nLimit The new limit. Must be &ge; 1. @return this
[ "The", "max", "number", "of", "suggestions", "from", "the", "dataset", "to", "display", "for", "a", "given", "query", ".", "Defaults", "to", "5", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadDataset.java#L141-L147
train
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadDataset.java
TypeaheadDataset.setPrefetch
@Nonnull public TypeaheadDataset setPrefetch (@Nullable final ISimpleURL aURL) { return setPrefetch (aURL == null ? null : new TypeaheadPrefetch (aURL)); }
java
@Nonnull public TypeaheadDataset setPrefetch (@Nullable final ISimpleURL aURL) { return setPrefetch (aURL == null ? null : new TypeaheadPrefetch (aURL)); }
[ "@", "Nonnull", "public", "TypeaheadDataset", "setPrefetch", "(", "@", "Nullable", "final", "ISimpleURL", "aURL", ")", "{", "return", "setPrefetch", "(", "aURL", "==", "null", "?", "null", ":", "new", "TypeaheadPrefetch", "(", "aURL", ")", ")", ";", "}" ]
Can be a URL to a JSON file containing an array of datums or, if more configurability is needed, a prefetch options object. @param aURL URL to the JSON file. May be <code>null</code>. @return this
[ "Can", "be", "a", "URL", "to", "a", "JSON", "file", "containing", "an", "array", "of", "datums", "or", "if", "more", "configurability", "is", "needed", "a", "prefetch", "options", "object", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadDataset.java#L369-L373
train
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/html/embedded/AbstractHCImg.java
AbstractHCImg.scaleBestMatching
@Nonnull public final IMPLTYPE scaleBestMatching (@Nonnegative final int nMaxWidth, @Nonnegative final int nMaxHeight) { if (m_aExtent != null) m_aExtent = m_aExtent.getBestMatchingSize (nMaxWidth, nMaxHeight); return thisAsT (); }
java
@Nonnull public final IMPLTYPE scaleBestMatching (@Nonnegative final int nMaxWidth, @Nonnegative final int nMaxHeight) { if (m_aExtent != null) m_aExtent = m_aExtent.getBestMatchingSize (nMaxWidth, nMaxHeight); return thisAsT (); }
[ "@", "Nonnull", "public", "final", "IMPLTYPE", "scaleBestMatching", "(", "@", "Nonnegative", "final", "int", "nMaxWidth", ",", "@", "Nonnegative", "final", "int", "nMaxHeight", ")", "{", "if", "(", "m_aExtent", "!=", "null", ")", "m_aExtent", "=", "m_aExtent",...
Scales the image so that neither with nor height are exceeded, keeping the aspect ratio. @param nMaxWidth Maximum with @param nMaxHeight Maximum height @return the correctly resized image tag
[ "Scales", "the", "image", "so", "that", "neither", "with", "nor", "height", "are", "exceeded", "keeping", "the", "aspect", "ratio", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/embedded/AbstractHCImg.java#L159-L165
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/go/GoMappingManager.java
GoMappingManager.checkInternalMappings
@Nonnegative public int checkInternalMappings (@Nonnull final IMenuTree aMenuTree, @Nonnull final Consumer <GoMappingItem> aErrorCallback) { ValueEnforcer.notNull (aMenuTree, "MenuTree"); ValueEnforcer.notNull (aErrorCallback, "ErrorCallback"); final IRequestParameterManager aRPM = RequestParameterManager.getInstance (); int nCount = 0; int nErrors = 0; m_aRWLock.readLock ().lock (); try { for (final GoMappingItem aItem : m_aMap.values ()) if (aItem.isInternal ()) { // Get value of "menu item" parameter and check for existence final String sParamValue = aRPM.getMenuItemFromURL (aItem.getTargetURLReadonly (), aMenuTree); if (sParamValue != null) { ++nCount; if (aMenuTree.getItemWithID (sParamValue) == null) { ++nErrors; aErrorCallback.accept (aItem); } } } } finally { m_aRWLock.readLock ().unlock (); } if (nErrors == 0) LOGGER.info ("Successfully checked " + nCount + " internal go-mappings for consistency"); else LOGGER.warn ("Checked " + nCount + " internal go-mappings for consistency and found " + nErrors + " errors!"); return nErrors; }
java
@Nonnegative public int checkInternalMappings (@Nonnull final IMenuTree aMenuTree, @Nonnull final Consumer <GoMappingItem> aErrorCallback) { ValueEnforcer.notNull (aMenuTree, "MenuTree"); ValueEnforcer.notNull (aErrorCallback, "ErrorCallback"); final IRequestParameterManager aRPM = RequestParameterManager.getInstance (); int nCount = 0; int nErrors = 0; m_aRWLock.readLock ().lock (); try { for (final GoMappingItem aItem : m_aMap.values ()) if (aItem.isInternal ()) { // Get value of "menu item" parameter and check for existence final String sParamValue = aRPM.getMenuItemFromURL (aItem.getTargetURLReadonly (), aMenuTree); if (sParamValue != null) { ++nCount; if (aMenuTree.getItemWithID (sParamValue) == null) { ++nErrors; aErrorCallback.accept (aItem); } } } } finally { m_aRWLock.readLock ().unlock (); } if (nErrors == 0) LOGGER.info ("Successfully checked " + nCount + " internal go-mappings for consistency"); else LOGGER.warn ("Checked " + nCount + " internal go-mappings for consistency and found " + nErrors + " errors!"); return nErrors; }
[ "@", "Nonnegative", "public", "int", "checkInternalMappings", "(", "@", "Nonnull", "final", "IMenuTree", "aMenuTree", ",", "@", "Nonnull", "final", "Consumer", "<", "GoMappingItem", ">", "aErrorCallback", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aMenuTree"...
Check whether all internal go links, that point to a page use existing menu item IDs @param aMenuTree The menu tree to search. May not be <code>null</code>. @param aErrorCallback The callback that is invoked for all invalid {@link GoMappingItem} objects. @return The number of errors occurred. Always &ge; 0.
[ "Check", "whether", "all", "internal", "go", "links", "that", "point", "to", "a", "page", "use", "existing", "menu", "item", "IDs" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/go/GoMappingManager.java#L299-L337
train
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/util/SecurityHelper.java
SecurityHelper.getGuestUserDisplayName
@Nullable public static String getGuestUserDisplayName (@Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return ESecurityUIText.GUEST.getDisplayText (aDisplayLocale); }
java
@Nullable public static String getGuestUserDisplayName (@Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return ESecurityUIText.GUEST.getDisplayText (aDisplayLocale); }
[ "@", "Nullable", "public", "static", "String", "getGuestUserDisplayName", "(", "@", "Nonnull", "final", "Locale", "aDisplayLocale", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aDisplayLocale", ",", "\"DisplayLocale\"", ")", ";", "return", "ESecurityUIText", "."...
Get the display name of the guest user in the specified locale. @param aDisplayLocale The locale to be used. May not be <code>null</code>. @return <code>null</code> if no translation is present.
[ "Get", "the", "display", "name", "of", "the", "guest", "user", "in", "the", "specified", "locale", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/util/SecurityHelper.java#L145-L151
train
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/util/SecurityHelper.java
SecurityHelper.getUserDisplayName
@Nullable public static String getUserDisplayName (@Nullable final String sUserID, @Nonnull final Locale aDisplayLocale) { if (StringHelper.hasNoText (sUserID)) return getGuestUserDisplayName (aDisplayLocale); final IUser aUser = PhotonSecurityManager.getUserMgr ().getUserOfID (sUserID); return aUser == null ? sUserID : getUserDisplayName (aUser, aDisplayLocale); }
java
@Nullable public static String getUserDisplayName (@Nullable final String sUserID, @Nonnull final Locale aDisplayLocale) { if (StringHelper.hasNoText (sUserID)) return getGuestUserDisplayName (aDisplayLocale); final IUser aUser = PhotonSecurityManager.getUserMgr ().getUserOfID (sUserID); return aUser == null ? sUserID : getUserDisplayName (aUser, aDisplayLocale); }
[ "@", "Nullable", "public", "static", "String", "getUserDisplayName", "(", "@", "Nullable", "final", "String", "sUserID", ",", "@", "Nonnull", "final", "Locale", "aDisplayLocale", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sUserID", ")", ")", ...
Get the display name of the user. @param sUserID User ID. May be <code>null</code>. @param aDisplayLocale The display locale to be used. @return The "guest" text if no user ID was provided, the display name of the user if a valid user ID was provided or the ID of the user if an invalid user was provided.
[ "Get", "the", "display", "name", "of", "the", "user", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/util/SecurityHelper.java#L164-L172
train
spotify/crtauth-java
src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java
CrtAuthCodec.serialize
public static byte[] serialize(Challenge challenge, byte[] hmacSecret) { MiniMessagePack.Packer packer = new MiniMessagePack.Packer(); packer.pack(VERSION); packer.pack(CHALLENGE_MAGIC); packer.pack(challenge.getUniqueData()); packer.pack(challenge.getValidFromTimestamp()); packer.pack(challenge.getValidToTimestamp()); packer.pack(challenge.getFingerprint().getBytes()); packer.pack(challenge.getServerName()); packer.pack(challenge.getUserName()); byte[] bytes = packer.getBytes(); byte[] mac = getAuthenticationCode(hmacSecret, bytes); packer.pack(mac); return packer.getBytes(); }
java
public static byte[] serialize(Challenge challenge, byte[] hmacSecret) { MiniMessagePack.Packer packer = new MiniMessagePack.Packer(); packer.pack(VERSION); packer.pack(CHALLENGE_MAGIC); packer.pack(challenge.getUniqueData()); packer.pack(challenge.getValidFromTimestamp()); packer.pack(challenge.getValidToTimestamp()); packer.pack(challenge.getFingerprint().getBytes()); packer.pack(challenge.getServerName()); packer.pack(challenge.getUserName()); byte[] bytes = packer.getBytes(); byte[] mac = getAuthenticationCode(hmacSecret, bytes); packer.pack(mac); return packer.getBytes(); }
[ "public", "static", "byte", "[", "]", "serialize", "(", "Challenge", "challenge", ",", "byte", "[", "]", "hmacSecret", ")", "{", "MiniMessagePack", ".", "Packer", "packer", "=", "new", "MiniMessagePack", ".", "Packer", "(", ")", ";", "packer", ".", "pack",...
Serialize a challenge into it's binary representation @param challenge the challenge to serialize @param hmacSecret the secret used to generate the HMAC field @return an array of bytes representing the provided Challenge
[ "Serialize", "a", "challenge", "into", "it", "s", "binary", "representation" ]
90f3b40323848740c915b195ad1b547fbeb41700
https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java#L50-L64
train
spotify/crtauth-java
src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java
CrtAuthCodec.serialize
public static byte[] serialize(Response response) { MiniMessagePack.Packer packer = new MiniMessagePack.Packer(); packer.pack(VERSION); packer.pack(RESPONSE_MAGIC); packer.pack(response.getPayload()); packer.pack(response.getSignature()); return packer.getBytes(); }
java
public static byte[] serialize(Response response) { MiniMessagePack.Packer packer = new MiniMessagePack.Packer(); packer.pack(VERSION); packer.pack(RESPONSE_MAGIC); packer.pack(response.getPayload()); packer.pack(response.getSignature()); return packer.getBytes(); }
[ "public", "static", "byte", "[", "]", "serialize", "(", "Response", "response", ")", "{", "MiniMessagePack", ".", "Packer", "packer", "=", "new", "MiniMessagePack", ".", "Packer", "(", ")", ";", "packer", ".", "pack", "(", "VERSION", ")", ";", "packer", ...
Serialize a Response into binary representation @param response the Response to serialize. @return an array of bytes representing the provided Response
[ "Serialize", "a", "Response", "into", "binary", "representation" ]
90f3b40323848740c915b195ad1b547fbeb41700
https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java#L92-L99
train
spotify/crtauth-java
src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java
CrtAuthCodec.getAuthenticationCode
private static byte[] getAuthenticationCode(byte[] secret, byte[] data, int length) { try { SecretKey secretKey = new SecretKeySpec(secret, MAC_ALGORITHM); Mac mac = Mac.getInstance(MAC_ALGORITHM); mac.init(secretKey); mac.update(data, 0, length); return mac.doFinal(); } catch (Exception e) { throw new RuntimeException(e); } }
java
private static byte[] getAuthenticationCode(byte[] secret, byte[] data, int length) { try { SecretKey secretKey = new SecretKeySpec(secret, MAC_ALGORITHM); Mac mac = Mac.getInstance(MAC_ALGORITHM); mac.init(secretKey); mac.update(data, 0, length); return mac.doFinal(); } catch (Exception e) { throw new RuntimeException(e); } }
[ "private", "static", "byte", "[", "]", "getAuthenticationCode", "(", "byte", "[", "]", "secret", ",", "byte", "[", "]", "data", ",", "int", "length", ")", "{", "try", "{", "SecretKey", "secretKey", "=", "new", "SecretKeySpec", "(", "secret", ",", "MAC_AL...
Calculate and return a keyed hash message authentication code, HMAC, as specified in RFC2104 using SHA256 as hash function. @param secret the secret used to authenticate @param data the data to authenticate @param length the number of bytes from data to use when calculating the HMAC @return an HMAC code for the specified data and secret
[ "Calculate", "and", "return", "a", "keyed", "hash", "message", "authentication", "code", "HMAC", "as", "specified", "in", "RFC2104", "using", "SHA256", "as", "hash", "function", "." ]
90f3b40323848740c915b195ad1b547fbeb41700
https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java#L183-L193
train
spotify/crtauth-java
src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java
CrtAuthCodec.serializeEncodedRequest
public static String serializeEncodedRequest(String username) { MiniMessagePack.Packer packer = new MiniMessagePack.Packer(); packer.pack(1); packer.pack('q'); packer.pack(username); return ASCIICodec.encode(packer.getBytes()); }
java
public static String serializeEncodedRequest(String username) { MiniMessagePack.Packer packer = new MiniMessagePack.Packer(); packer.pack(1); packer.pack('q'); packer.pack(username); return ASCIICodec.encode(packer.getBytes()); }
[ "public", "static", "String", "serializeEncodedRequest", "(", "String", "username", ")", "{", "MiniMessagePack", ".", "Packer", "packer", "=", "new", "MiniMessagePack", ".", "Packer", "(", ")", ";", "packer", ".", "pack", "(", "1", ")", ";", "packer", ".", ...
Create a request string from a username. Request is too trivial for it to make it into a class of it's own a this stage. @param username the username to encode @return an encoded request message
[ "Create", "a", "request", "string", "from", "a", "username", ".", "Request", "is", "too", "trivial", "for", "it", "to", "make", "it", "into", "a", "class", "of", "it", "s", "own", "a", "this", "stage", "." ]
90f3b40323848740c915b195ad1b547fbeb41700
https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java#L206-L212
train
spotify/crtauth-java
src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java
CrtAuthCodec.deserializeRequest
public static String deserializeRequest(String request) throws IllegalArgumentException, ProtocolVersionException { MiniMessagePack.Unpacker unpacker = new MiniMessagePack.Unpacker(ASCIICodec.decode(request)); try { parseVersionMagic(REQUEST_MAGIC, unpacker); return unpacker.unpackString(); } catch (DeserializationException e) { throw new IllegalArgumentException(e.getMessage()); } }
java
public static String deserializeRequest(String request) throws IllegalArgumentException, ProtocolVersionException { MiniMessagePack.Unpacker unpacker = new MiniMessagePack.Unpacker(ASCIICodec.decode(request)); try { parseVersionMagic(REQUEST_MAGIC, unpacker); return unpacker.unpackString(); } catch (DeserializationException e) { throw new IllegalArgumentException(e.getMessage()); } }
[ "public", "static", "String", "deserializeRequest", "(", "String", "request", ")", "throws", "IllegalArgumentException", ",", "ProtocolVersionException", "{", "MiniMessagePack", ".", "Unpacker", "unpacker", "=", "new", "MiniMessagePack", ".", "Unpacker", "(", "ASCIICode...
Deserialize an ASCII encoded request messages and return the username string it encodes. Also verifies that the type magic value matches and that the version equals 1. @param request the ASCII encoded request String @return the username encoded in the String
[ "Deserialize", "an", "ASCII", "encoded", "request", "messages", "and", "return", "the", "username", "string", "it", "encodes", ".", "Also", "verifies", "that", "the", "type", "magic", "value", "matches", "and", "that", "the", "version", "equals", "1", "." ]
90f3b40323848740c915b195ad1b547fbeb41700
https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java#L221-L231
train
spotify/crtauth-java
src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java
CrtAuthCodec.constantTimeEquals
private static boolean constantTimeEquals(byte[] a, byte[] b) { if (a.length != b.length) { return false; } int result = 0; for (int i = 0; i < a.length; i++) { result |= a[i] ^ b[i]; } return result == 0; }
java
private static boolean constantTimeEquals(byte[] a, byte[] b) { if (a.length != b.length) { return false; } int result = 0; for (int i = 0; i < a.length; i++) { result |= a[i] ^ b[i]; } return result == 0; }
[ "private", "static", "boolean", "constantTimeEquals", "(", "byte", "[", "]", "a", ",", "byte", "[", "]", "b", ")", "{", "if", "(", "a", ".", "length", "!=", "b", ".", "length", ")", "{", "return", "false", ";", "}", "int", "result", "=", "0", ";"...
Checks if byte arrays a and be are equal in an algorithm that runs in constant time provided that their lengths are equal. @param a the first byte array @param b the second byte array @return true if a and be are equal, else false
[ "Checks", "if", "byte", "arrays", "a", "and", "be", "are", "equal", "in", "an", "algorithm", "that", "runs", "in", "constant", "time", "provided", "that", "their", "lengths", "are", "equal", "." ]
90f3b40323848740c915b195ad1b547fbeb41700
https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java#L263-L273
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/interror/InternalErrorSettings.java
InternalErrorSettings.setFallbackLocale
public static void setFallbackLocale (@Nonnull final Locale aFallbackLocale) { ValueEnforcer.notNull (aFallbackLocale, "FallbackLocale"); s_aRWLock.writeLocked ( () -> s_aFallbackLocale = aFallbackLocale); }
java
public static void setFallbackLocale (@Nonnull final Locale aFallbackLocale) { ValueEnforcer.notNull (aFallbackLocale, "FallbackLocale"); s_aRWLock.writeLocked ( () -> s_aFallbackLocale = aFallbackLocale); }
[ "public", "static", "void", "setFallbackLocale", "(", "@", "Nonnull", "final", "Locale", "aFallbackLocale", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aFallbackLocale", ",", "\"FallbackLocale\"", ")", ";", "s_aRWLock", ".", "writeLocked", "(", "(", ")", "-...
Set the fallback locale in case none could be determined. @param aFallbackLocale Locale to use. May not be <code>null</code>. @since 7.0.4
[ "Set", "the", "fallback", "locale", "in", "case", "none", "could", "be", "determined", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/interror/InternalErrorSettings.java#L154-L158
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/interror/InternalErrorSettings.java
InternalErrorSettings.setStorageFileProvider
public static void setStorageFileProvider (@Nonnull final IFunction <InternalErrorMetadata, File> aStorageFileProvider) { ValueEnforcer.notNull (aStorageFileProvider, "StorageFileProvider"); s_aStorageFileProvider = aStorageFileProvider; }
java
public static void setStorageFileProvider (@Nonnull final IFunction <InternalErrorMetadata, File> aStorageFileProvider) { ValueEnforcer.notNull (aStorageFileProvider, "StorageFileProvider"); s_aStorageFileProvider = aStorageFileProvider; }
[ "public", "static", "void", "setStorageFileProvider", "(", "@", "Nonnull", "final", "IFunction", "<", "InternalErrorMetadata", ",", "File", ">", "aStorageFileProvider", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aStorageFileProvider", ",", "\"StorageFileProvider\"...
Set the provider that defines how to build the filename to save internal error files. @param aStorageFileProvider Storage provider. May not be <code>null</code> @since 8.0.3
[ "Set", "the", "provider", "that", "defines", "how", "to", "build", "the", "filename", "to", "save", "internal", "error", "files", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/interror/InternalErrorSettings.java#L198-L202
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/interror/InternalErrorSettings.java
InternalErrorSettings.setDefaultStorageFileProvider
public static void setDefaultStorageFileProvider () { setStorageFileProvider (aMetadata -> { final LocalDateTime aNow = PDTFactory.getCurrentLocalDateTime (); final String sFilename = StringHelper.getConcatenatedOnDemand (PDTIOHelper.getLocalDateTimeForFilename (aNow), "-", aMetadata.getErrorID ()) + ".xml"; return WebFileIO.getDataIO () .getFile ("internal-errors/" + aNow.getYear () + "/" + StringHelper.getLeadingZero (aNow.getMonthValue (), 2) + "/" + sFilename); }); }
java
public static void setDefaultStorageFileProvider () { setStorageFileProvider (aMetadata -> { final LocalDateTime aNow = PDTFactory.getCurrentLocalDateTime (); final String sFilename = StringHelper.getConcatenatedOnDemand (PDTIOHelper.getLocalDateTimeForFilename (aNow), "-", aMetadata.getErrorID ()) + ".xml"; return WebFileIO.getDataIO () .getFile ("internal-errors/" + aNow.getYear () + "/" + StringHelper.getLeadingZero (aNow.getMonthValue (), 2) + "/" + sFilename); }); }
[ "public", "static", "void", "setDefaultStorageFileProvider", "(", ")", "{", "setStorageFileProvider", "(", "aMetadata", "->", "{", "final", "LocalDateTime", "aNow", "=", "PDTFactory", ".", "getCurrentLocalDateTime", "(", ")", ";", "final", "String", "sFilename", "="...
Set the default storage file provider. In case you played around and want to restore the default behavior. @see #setStorageFileProvider(IFunction) @since 8.0.3
[ "Set", "the", "default", "storage", "file", "provider", ".", "In", "case", "you", "played", "around", "and", "want", "to", "restore", "the", "default", "behavior", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/interror/InternalErrorSettings.java#L211-L227
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/job/app/CheckDiskUsableSpaceJob.java
CheckDiskUsableSpaceJob.schedule
@Nonnull public static TriggerKey schedule (@Nonnull final IScheduleBuilder <? extends ITrigger> aScheduleBuilder, @Nonnegative final long nThresholdBytes) { ValueEnforcer.notNull (aScheduleBuilder, "ScheduleBuilder"); ValueEnforcer.isGE0 (nThresholdBytes, "ThresholdBytes"); final ICommonsMap <String, Object> aJobDataMap = new CommonsHashMap <> (); aJobDataMap.put (JOB_DATA_ATTR_THRESHOLD_BYTES, Long.valueOf (nThresholdBytes)); return GlobalQuartzScheduler.getInstance ().scheduleJob (CheckDiskUsableSpaceJob.class.getName (), JDK8TriggerBuilder.newTrigger () .startNow () .withSchedule (aScheduleBuilder), CheckDiskUsableSpaceJob.class, aJobDataMap); }
java
@Nonnull public static TriggerKey schedule (@Nonnull final IScheduleBuilder <? extends ITrigger> aScheduleBuilder, @Nonnegative final long nThresholdBytes) { ValueEnforcer.notNull (aScheduleBuilder, "ScheduleBuilder"); ValueEnforcer.isGE0 (nThresholdBytes, "ThresholdBytes"); final ICommonsMap <String, Object> aJobDataMap = new CommonsHashMap <> (); aJobDataMap.put (JOB_DATA_ATTR_THRESHOLD_BYTES, Long.valueOf (nThresholdBytes)); return GlobalQuartzScheduler.getInstance ().scheduleJob (CheckDiskUsableSpaceJob.class.getName (), JDK8TriggerBuilder.newTrigger () .startNow () .withSchedule (aScheduleBuilder), CheckDiskUsableSpaceJob.class, aJobDataMap); }
[ "@", "Nonnull", "public", "static", "TriggerKey", "schedule", "(", "@", "Nonnull", "final", "IScheduleBuilder", "<", "?", "extends", "ITrigger", ">", "aScheduleBuilder", ",", "@", "Nonnegative", "final", "long", "nThresholdBytes", ")", "{", "ValueEnforcer", ".", ...
Call this method to schedule the check disk usage job to run. @param aScheduleBuilder The schedule builder to be used. May not be <code>null</code>. Example: <code>SimpleScheduleBuilder.repeatMinutelyForever (60)</code> @param nThresholdBytes If &le; than this number of bytes are free on the drive, an internal notification email is send. Must be &ge; 0. @return The created trigger key for further usage. Never <code>null</code>.
[ "Call", "this", "method", "to", "schedule", "the", "check", "disk", "usage", "job", "to", "run", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/job/app/CheckDiskUsableSpaceJob.java#L119-L135
train
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/source/StringSourceFactory.java
StringSourceFactory.createSources
@Override public List<StringSource> createSources(String sourceFileName) { return Util.list(new StringSource(sourceFileName, source)); }
java
@Override public List<StringSource> createSources(String sourceFileName) { return Util.list(new StringSource(sourceFileName, source)); }
[ "@", "Override", "public", "List", "<", "StringSource", ">", "createSources", "(", "String", "sourceFileName", ")", "{", "return", "Util", ".", "list", "(", "new", "StringSource", "(", "sourceFileName", ",", "source", ")", ")", ";", "}" ]
Create a list with a single StringSource - the sourceFileName will be used as the srcInfo in the resulting Source
[ "Create", "a", "list", "with", "a", "single", "StringSource", "-", "the", "sourceFileName", "will", "be", "used", "as", "the", "srcInfo", "in", "the", "resulting", "Source" ]
92ee94b6624cd673851497d78c218837dcf02b8a
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/source/StringSourceFactory.java#L45-L48
train
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/html/HC_Target.java
HC_Target.getFromName
@Nullable public static HC_Target getFromName (@Nonnull final String sName, @Nullable final HC_Target aDefault) { if (BLANK.getAttrValue ().equalsIgnoreCase (sName)) return BLANK; if (SELF.getAttrValue ().equalsIgnoreCase (sName)) return SELF; if (PARENT.getAttrValue ().equalsIgnoreCase (sName)) return PARENT; if (TOP.getAttrValue ().equalsIgnoreCase (sName)) return TOP; return aDefault; }
java
@Nullable public static HC_Target getFromName (@Nonnull final String sName, @Nullable final HC_Target aDefault) { if (BLANK.getAttrValue ().equalsIgnoreCase (sName)) return BLANK; if (SELF.getAttrValue ().equalsIgnoreCase (sName)) return SELF; if (PARENT.getAttrValue ().equalsIgnoreCase (sName)) return PARENT; if (TOP.getAttrValue ().equalsIgnoreCase (sName)) return TOP; return aDefault; }
[ "@", "Nullable", "public", "static", "HC_Target", "getFromName", "(", "@", "Nonnull", "final", "String", "sName", ",", "@", "Nullable", "final", "HC_Target", "aDefault", ")", "{", "if", "(", "BLANK", ".", "getAttrValue", "(", ")", ".", "equalsIgnoreCase", "(...
Try to find one of the default targets by name. The name comparison is performed case insensitive. @param sName The name to check. May not be <code>null</code>. @param aDefault The default value to be returned in case the name was never found. May be <code>null</code>. @return The constant link target representing the name or the default value. May be <code>null</code> if the passed default value is <code>null</code> and the name was not found.
[ "Try", "to", "find", "one", "of", "the", "default", "targets", "by", "name", ".", "The", "name", "comparison", "is", "performed", "case", "insensitive", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/HC_Target.java#L102-L114
train
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java
UserManager.createPredefinedUser
@Nullable public IUser createPredefinedUser (@Nonnull @Nonempty final String sID, @Nonnull @Nonempty final String sLoginName, @Nullable final String sEmailAddress, @Nonnull final String sPlainTextPassword, @Nullable final String sFirstName, @Nullable final String sLastName, @Nullable final String sDescription, @Nullable final Locale aDesiredLocale, @Nullable final Map <String, String> aCustomAttrs, final boolean bDisabled) { ValueEnforcer.notEmpty (sLoginName, "LoginName"); ValueEnforcer.notNull (sPlainTextPassword, "PlainTextPassword"); if (getUserOfLoginName (sLoginName) != null) { // Another user with this login name already exists AuditHelper.onAuditCreateFailure (User.OT, "login-name-already-in-use", sLoginName, "predefined-user"); return null; } // Create user final User aUser = new User (sID, sLoginName, sEmailAddress, GlobalPasswordSettings.createUserDefaultPasswordHash (new PasswordSalt (), sPlainTextPassword), sFirstName, sLastName, sDescription, aDesiredLocale, aCustomAttrs, bDisabled); m_aRWLock.writeLocked ( () -> { internalCreateItem (aUser); }); AuditHelper.onAuditCreateSuccess (User.OT, aUser.getID (), "predefined-user", sLoginName, sEmailAddress, sFirstName, sLastName, sDescription, aDesiredLocale, aCustomAttrs, Boolean.valueOf (bDisabled)); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserCreated (aUser, true)); return aUser; }
java
@Nullable public IUser createPredefinedUser (@Nonnull @Nonempty final String sID, @Nonnull @Nonempty final String sLoginName, @Nullable final String sEmailAddress, @Nonnull final String sPlainTextPassword, @Nullable final String sFirstName, @Nullable final String sLastName, @Nullable final String sDescription, @Nullable final Locale aDesiredLocale, @Nullable final Map <String, String> aCustomAttrs, final boolean bDisabled) { ValueEnforcer.notEmpty (sLoginName, "LoginName"); ValueEnforcer.notNull (sPlainTextPassword, "PlainTextPassword"); if (getUserOfLoginName (sLoginName) != null) { // Another user with this login name already exists AuditHelper.onAuditCreateFailure (User.OT, "login-name-already-in-use", sLoginName, "predefined-user"); return null; } // Create user final User aUser = new User (sID, sLoginName, sEmailAddress, GlobalPasswordSettings.createUserDefaultPasswordHash (new PasswordSalt (), sPlainTextPassword), sFirstName, sLastName, sDescription, aDesiredLocale, aCustomAttrs, bDisabled); m_aRWLock.writeLocked ( () -> { internalCreateItem (aUser); }); AuditHelper.onAuditCreateSuccess (User.OT, aUser.getID (), "predefined-user", sLoginName, sEmailAddress, sFirstName, sLastName, sDescription, aDesiredLocale, aCustomAttrs, Boolean.valueOf (bDisabled)); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserCreated (aUser, true)); return aUser; }
[ "@", "Nullable", "public", "IUser", "createPredefinedUser", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sID", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sLoginName", ",", "@", "Nullable", "final", "String", "sEmailAddress", ",", "@...
Create a predefined user. @param sID The ID to use @param sLoginName Login name of the user. May neither be <code>null</code> nor empty. This login name must be unique over all existing users. @param sEmailAddress The email address. May be <code>null</code>. @param sPlainTextPassword The plain text password to be used. May neither be <code>null</code> nor empty. @param sFirstName The users first name. May be <code>null</code>. @param sLastName The users last name. May be <code>null</code>. @param sDescription Optional description for the user. May be <code>null</code>. @param aDesiredLocale The users default locale. May be <code>null</code>. @param aCustomAttrs Custom attributes. May be <code>null</code>. @return The created user or <code>null</code> if another user with the same email address is already present. @param bDisabled <code>true</code> if the user is disabled
[ "Create", "a", "predefined", "user", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java#L222-L276
train
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java
UserManager.getUserOfLoginName
@Nullable public IUser getUserOfLoginName (@Nullable final String sLoginName) { if (StringHelper.hasNoText (sLoginName)) return null; return findFirst (x -> x.getLoginName ().equals (sLoginName)); }
java
@Nullable public IUser getUserOfLoginName (@Nullable final String sLoginName) { if (StringHelper.hasNoText (sLoginName)) return null; return findFirst (x -> x.getLoginName ().equals (sLoginName)); }
[ "@", "Nullable", "public", "IUser", "getUserOfLoginName", "(", "@", "Nullable", "final", "String", "sLoginName", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sLoginName", ")", ")", "return", "null", ";", "return", "findFirst", "(", "x", "->",...
Get the user with the specified login name @param sLoginName The login name to be checked. May be <code>null</code>. @return <code>null</code> if no such user exists
[ "Get", "the", "user", "with", "the", "specified", "login", "name" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java#L305-L312
train
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java
UserManager.deleteUser
@Nonnull public EChange deleteUser (@Nullable final String sUserID) { final User aUser = getOfID (sUserID); if (aUser == null) { AuditHelper.onAuditDeleteFailure (User.OT, "no-such-user-id", sUserID); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (BusinessObjectHelper.setDeletionNow (aUser).isUnchanged ()) { AuditHelper.onAuditDeleteFailure (User.OT, "already-deleted", sUserID); return EChange.UNCHANGED; } internalMarkItemDeleted (aUser); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditDeleteSuccess (User.OT, sUserID); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserDeleted (aUser)); return EChange.CHANGED; }
java
@Nonnull public EChange deleteUser (@Nullable final String sUserID) { final User aUser = getOfID (sUserID); if (aUser == null) { AuditHelper.onAuditDeleteFailure (User.OT, "no-such-user-id", sUserID); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (BusinessObjectHelper.setDeletionNow (aUser).isUnchanged ()) { AuditHelper.onAuditDeleteFailure (User.OT, "already-deleted", sUserID); return EChange.UNCHANGED; } internalMarkItemDeleted (aUser); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditDeleteSuccess (User.OT, sUserID); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserDeleted (aUser)); return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "deleteUser", "(", "@", "Nullable", "final", "String", "sUserID", ")", "{", "final", "User", "aUser", "=", "getOfID", "(", "sUserID", ")", ";", "if", "(", "aUser", "==", "null", ")", "{", "AuditHelper", ".", "onAuditD...
Delete the user with the specified ID. @param sUserID The ID of the user to delete @return {@link EChange#CHANGED} if the user was deleted, {@link EChange#UNCHANGED} otherwise.
[ "Delete", "the", "user", "with", "the", "specified", "ID", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java#L596-L626
train
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java
UserManager.undeleteUser
@Nonnull public EChange undeleteUser (@Nullable final String sUserID) { final User aUser = getOfID (sUserID); if (aUser == null) { AuditHelper.onAuditUndeleteFailure (User.OT, sUserID, "no-such-user-id"); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (BusinessObjectHelper.setUndeletionNow (aUser).isUnchanged ()) return EChange.UNCHANGED; internalMarkItemUndeleted (aUser); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditUndeleteSuccess (User.OT, sUserID); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserUndeleted (aUser)); return EChange.CHANGED; }
java
@Nonnull public EChange undeleteUser (@Nullable final String sUserID) { final User aUser = getOfID (sUserID); if (aUser == null) { AuditHelper.onAuditUndeleteFailure (User.OT, sUserID, "no-such-user-id"); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (BusinessObjectHelper.setUndeletionNow (aUser).isUnchanged ()) return EChange.UNCHANGED; internalMarkItemUndeleted (aUser); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditUndeleteSuccess (User.OT, sUserID); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserUndeleted (aUser)); return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "undeleteUser", "(", "@", "Nullable", "final", "String", "sUserID", ")", "{", "final", "User", "aUser", "=", "getOfID", "(", "sUserID", ")", ";", "if", "(", "aUser", "==", "null", ")", "{", "AuditHelper", ".", "onAudi...
Undelete the user with the specified ID. @param sUserID The ID of the user to undelete @return {@link EChange#CHANGED} if the user was undeleted, {@link EChange#UNCHANGED} otherwise.
[ "Undelete", "the", "user", "with", "the", "specified", "ID", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java#L636-L663
train
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java
UserManager.disableUser
@Nonnull public EChange disableUser (@Nullable final String sUserID) { final User aUser = getOfID (sUserID); if (aUser == null) { AuditHelper.onAuditModifyFailure (User.OT, sUserID, "no-such-user-id", "disable"); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (aUser.setDisabled (true).isUnchanged ()) return EChange.UNCHANGED; internalUpdateItem (aUser); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditModifySuccess (User.OT, "disable", sUserID); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserEnabled (aUser, false)); return EChange.CHANGED; }
java
@Nonnull public EChange disableUser (@Nullable final String sUserID) { final User aUser = getOfID (sUserID); if (aUser == null) { AuditHelper.onAuditModifyFailure (User.OT, sUserID, "no-such-user-id", "disable"); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (aUser.setDisabled (true).isUnchanged ()) return EChange.UNCHANGED; internalUpdateItem (aUser); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditModifySuccess (User.OT, "disable", sUserID); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserEnabled (aUser, false)); return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "disableUser", "(", "@", "Nullable", "final", "String", "sUserID", ")", "{", "final", "User", "aUser", "=", "getOfID", "(", "sUserID", ")", ";", "if", "(", "aUser", "==", "null", ")", "{", "AuditHelper", ".", "onAudit...
disable the user with the specified ID. @param sUserID The ID of the user to disable @return {@link EChange#CHANGED} if the user was disabled, {@link EChange#UNCHANGED} otherwise.
[ "disable", "the", "user", "with", "the", "specified", "ID", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java#L673-L700
train
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java
UserManager.areUserIDAndPasswordValid
public boolean areUserIDAndPasswordValid (@Nullable final String sUserID, @Nullable final String sPlainTextPassword) { // No password is not allowed if (sPlainTextPassword == null) return false; // Is there such a user? final IUser aUser = getOfID (sUserID); if (aUser == null) return false; // Now compare the hashes final String sPasswordHashAlgorithm = aUser.getPasswordHash ().getAlgorithmName (); final IPasswordSalt aSalt = aUser.getPasswordHash ().getSalt (); final PasswordHash aPasswordHash = GlobalPasswordSettings.createUserPasswordHash (sPasswordHashAlgorithm, aSalt, sPlainTextPassword); return aUser.getPasswordHash ().equals (aPasswordHash); }
java
public boolean areUserIDAndPasswordValid (@Nullable final String sUserID, @Nullable final String sPlainTextPassword) { // No password is not allowed if (sPlainTextPassword == null) return false; // Is there such a user? final IUser aUser = getOfID (sUserID); if (aUser == null) return false; // Now compare the hashes final String sPasswordHashAlgorithm = aUser.getPasswordHash ().getAlgorithmName (); final IPasswordSalt aSalt = aUser.getPasswordHash ().getSalt (); final PasswordHash aPasswordHash = GlobalPasswordSettings.createUserPasswordHash (sPasswordHashAlgorithm, aSalt, sPlainTextPassword); return aUser.getPasswordHash ().equals (aPasswordHash); }
[ "public", "boolean", "areUserIDAndPasswordValid", "(", "@", "Nullable", "final", "String", "sUserID", ",", "@", "Nullable", "final", "String", "sPlainTextPassword", ")", "{", "// No password is not allowed", "if", "(", "sPlainTextPassword", "==", "null", ")", "return"...
Check if the passed combination of user ID and password matches. @param sUserID The ID of the user @param sPlainTextPassword The plan text password to validate. @return <code>true</code> if the password hash matches the stored hash for the specified user, <code>false</code> otherwise.
[ "Check", "if", "the", "passed", "combination", "of", "user", "ID", "and", "password", "matches", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java#L749-L767
train
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/special/HCSpecialNodeHandler.java
HCSpecialNodeHandler.isOutOfBandNode
public static boolean isOutOfBandNode (@Nonnull final IHCNode aHCNode) { ValueEnforcer.notNull (aHCNode, "HCNode"); // Is the @OutOfBandNode annotation present? if (s_aOOBNAnnotationCache.hasAnnotation (aHCNode)) return true; // If it is a wrapped node, look into it if (HCHelper.isWrappedNode (aHCNode)) return isOutOfBandNode (HCHelper.getUnwrappedNode (aHCNode)); // Not an out of band node return false; }
java
public static boolean isOutOfBandNode (@Nonnull final IHCNode aHCNode) { ValueEnforcer.notNull (aHCNode, "HCNode"); // Is the @OutOfBandNode annotation present? if (s_aOOBNAnnotationCache.hasAnnotation (aHCNode)) return true; // If it is a wrapped node, look into it if (HCHelper.isWrappedNode (aHCNode)) return isOutOfBandNode (HCHelper.getUnwrappedNode (aHCNode)); // Not an out of band node return false; }
[ "public", "static", "boolean", "isOutOfBandNode", "(", "@", "Nonnull", "final", "IHCNode", "aHCNode", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aHCNode", ",", "\"HCNode\"", ")", ";", "// Is the @OutOfBandNode annotation present?", "if", "(", "s_aOOBNAnnotationC...
Check if the passed node is an out-of-band node. @param aHCNode The node to be checked. May not be <code>null</code>. @return <code>true</code> if it is an out-of-band node, <code>false</code> if not.
[ "Check", "if", "the", "passed", "node", "is", "an", "out", "-", "of", "-", "band", "node", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/special/HCSpecialNodeHandler.java#L89-L103
train
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/special/HCSpecialNodeHandler.java
HCSpecialNodeHandler.recursiveExtractAndRemoveOutOfBandNodes
public static void recursiveExtractAndRemoveOutOfBandNodes (@Nonnull final IHCNode aParentElement, @Nonnull final List <IHCNode> aTargetList) { ValueEnforcer.notNull (aParentElement, "ParentElement"); ValueEnforcer.notNull (aTargetList, "TargetList"); // Using HCUtils.iterateTree would be too tedious here _recursiveExtractAndRemoveOutOfBandNodes (aParentElement, aTargetList, 0); }
java
public static void recursiveExtractAndRemoveOutOfBandNodes (@Nonnull final IHCNode aParentElement, @Nonnull final List <IHCNode> aTargetList) { ValueEnforcer.notNull (aParentElement, "ParentElement"); ValueEnforcer.notNull (aTargetList, "TargetList"); // Using HCUtils.iterateTree would be too tedious here _recursiveExtractAndRemoveOutOfBandNodes (aParentElement, aTargetList, 0); }
[ "public", "static", "void", "recursiveExtractAndRemoveOutOfBandNodes", "(", "@", "Nonnull", "final", "IHCNode", "aParentElement", ",", "@", "Nonnull", "final", "List", "<", "IHCNode", ">", "aTargetList", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aParentElemen...
Extract all out-of-band child nodes for the passed element. Must be called after the element is finished! All out-of-band nodes are detached from their parent so that the original node can be reused. Wrapped nodes where the inner node is an out of band node are also considered and removed. @param aParentElement The parent element to extract the nodes from. May not be <code>null</code>. @param aTargetList The target list to be filled. May not be <code>null</code>.
[ "Extract", "all", "out", "-", "of", "-", "band", "child", "nodes", "for", "the", "passed", "element", ".", "Must", "be", "called", "after", "the", "element", "is", "finished!", "All", "out", "-", "of", "-", "band", "nodes", "are", "detached", "from", "...
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/special/HCSpecialNodeHandler.java#L158-L166
train
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/JSBlock.java
JSBlock._continue
@Nonnull @CodingStyleguideUnaware public JSBlock _continue (@Nullable final JSLabel aLabel) { addStatement (new JSContinue (aLabel)); return this; }
java
@Nonnull @CodingStyleguideUnaware public JSBlock _continue (@Nullable final JSLabel aLabel) { addStatement (new JSContinue (aLabel)); return this; }
[ "@", "Nonnull", "@", "CodingStyleguideUnaware", "public", "JSBlock", "_continue", "(", "@", "Nullable", "final", "JSLabel", "aLabel", ")", "{", "addStatement", "(", "new", "JSContinue", "(", "aLabel", ")", ")", ";", "return", "this", ";", "}" ]
Create a continue statement and add it to this block @param aLabel optional label to be used @return Created continue block
[ "Create", "a", "continue", "statement", "and", "add", "it", "to", "this", "block" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSBlock.java#L137-L143
train
phax/ph-oton
ph-oton-api/src/main/java/com/helger/photon/api/APIDescriptor.java
APIDescriptor.addRequiredHeader
@Nonnull public final APIDescriptor addRequiredHeader (@Nullable final String sHeaderName) { if (StringHelper.hasText (sHeaderName)) m_aRequiredHeaders.add (sHeaderName); return this; }
java
@Nonnull public final APIDescriptor addRequiredHeader (@Nullable final String sHeaderName) { if (StringHelper.hasText (sHeaderName)) m_aRequiredHeaders.add (sHeaderName); return this; }
[ "@", "Nonnull", "public", "final", "APIDescriptor", "addRequiredHeader", "(", "@", "Nullable", "final", "String", "sHeaderName", ")", "{", "if", "(", "StringHelper", ".", "hasText", "(", "sHeaderName", ")", ")", "m_aRequiredHeaders", ".", "add", "(", "sHeaderNam...
Add a required HTTP header. If this HTTP header is not present, invocation will not be possible. @param sHeaderName The name of the required HTTP header. May be <code>null</code> or empty in which case the header is ignored. @return this for chaining @see #addRequiredHeaders(String...)
[ "Add", "a", "required", "HTTP", "header", ".", "If", "this", "HTTP", "header", "is", "not", "present", "invocation", "will", "not", "be", "possible", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-api/src/main/java/com/helger/photon/api/APIDescriptor.java#L125-L131
train
phax/ph-oton
ph-oton-api/src/main/java/com/helger/photon/api/APIDescriptor.java
APIDescriptor.addRequiredHeaders
@Nonnull public final APIDescriptor addRequiredHeaders (@Nullable final String... aHeaderNames) { if (aHeaderNames != null) for (final String sHeaderName : aHeaderNames) addRequiredHeader (sHeaderName); return this; }
java
@Nonnull public final APIDescriptor addRequiredHeaders (@Nullable final String... aHeaderNames) { if (aHeaderNames != null) for (final String sHeaderName : aHeaderNames) addRequiredHeader (sHeaderName); return this; }
[ "@", "Nonnull", "public", "final", "APIDescriptor", "addRequiredHeaders", "(", "@", "Nullable", "final", "String", "...", "aHeaderNames", ")", "{", "if", "(", "aHeaderNames", "!=", "null", ")", "for", "(", "final", "String", "sHeaderName", ":", "aHeaderNames", ...
Add one or more required HTTP headers. If one of these HTTP headers are not present, invocation will not be possible. @param aHeaderNames The names of the required HTTP headers. May be <code>null</code> or empty. @return this for chaining @see #addRequiredHeader(String)
[ "Add", "one", "or", "more", "required", "HTTP", "headers", ".", "If", "one", "of", "these", "HTTP", "headers", "are", "not", "present", "invocation", "will", "not", "be", "possible", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-api/src/main/java/com/helger/photon/api/APIDescriptor.java#L143-L150
train
phax/ph-oton
ph-oton-api/src/main/java/com/helger/photon/api/APIDescriptor.java
APIDescriptor.addRequiredParam
@Nonnull public final APIDescriptor addRequiredParam (@Nullable final String sParamName) { if (StringHelper.hasText (sParamName)) m_aRequiredParams.add (sParamName); return this; }
java
@Nonnull public final APIDescriptor addRequiredParam (@Nullable final String sParamName) { if (StringHelper.hasText (sParamName)) m_aRequiredParams.add (sParamName); return this; }
[ "@", "Nonnull", "public", "final", "APIDescriptor", "addRequiredParam", "(", "@", "Nullable", "final", "String", "sParamName", ")", "{", "if", "(", "StringHelper", ".", "hasText", "(", "sParamName", ")", ")", "m_aRequiredParams", ".", "add", "(", "sParamName", ...
Add a required request parameter. If this request parameter is not present, invocation will not be possible. @param sParamName The name of the required request parameter. May be <code>null</code> or empty in which case the parameter is ignored. @return this for chaining @see #addRequiredParams(String...)
[ "Add", "a", "required", "request", "parameter", ".", "If", "this", "request", "parameter", "is", "not", "present", "invocation", "will", "not", "be", "possible", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-api/src/main/java/com/helger/photon/api/APIDescriptor.java#L169-L175
train
phax/ph-oton
ph-oton-api/src/main/java/com/helger/photon/api/APIDescriptor.java
APIDescriptor.addRequiredParams
@Nonnull public final APIDescriptor addRequiredParams (@Nullable final String... aParamNames) { if (aParamNames != null) for (final String sParamName : aParamNames) addRequiredParam (sParamName); return this; }
java
@Nonnull public final APIDescriptor addRequiredParams (@Nullable final String... aParamNames) { if (aParamNames != null) for (final String sParamName : aParamNames) addRequiredParam (sParamName); return this; }
[ "@", "Nonnull", "public", "final", "APIDescriptor", "addRequiredParams", "(", "@", "Nullable", "final", "String", "...", "aParamNames", ")", "{", "if", "(", "aParamNames", "!=", "null", ")", "for", "(", "final", "String", "sParamName", ":", "aParamNames", ")",...
Add one or more required request parameters. If one of these request parameters are not present, invocation will not be possible. @param aParamNames The names of the required HTTP parameters. May be <code>null</code> or empty. @return this for chaining @see #addRequiredParam(String)
[ "Add", "one", "or", "more", "required", "request", "parameters", ".", "If", "one", "of", "these", "request", "parameters", "are", "not", "present", "invocation", "will", "not", "be", "possible", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-api/src/main/java/com/helger/photon/api/APIDescriptor.java#L187-L194
train
phax/ph-oton
ph-oton-jquery/src/main/java/com/helger/html/jquery/JQueryInvocation.java
JQueryInvocation.jqinvoke
@Override @Nonnull public JQueryInvocation jqinvoke (@Nonnull @Nonempty final String sMethod) { return new JQueryInvocation (this, sMethod); }
java
@Override @Nonnull public JQueryInvocation jqinvoke (@Nonnull @Nonempty final String sMethod) { return new JQueryInvocation (this, sMethod); }
[ "@", "Override", "@", "Nonnull", "public", "JQueryInvocation", "jqinvoke", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sMethod", ")", "{", "return", "new", "JQueryInvocation", "(", "this", ",", "sMethod", ")", ";", "}" ]
Invoke an arbitrary function on this jQuery object. @param sMethod The method to be invoked. May neither be <code>null</code> nor empty. @return A new jQuery invocation object. Never <code>null</code>.
[ "Invoke", "an", "arbitrary", "function", "on", "this", "jQuery", "object", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jquery/src/main/java/com/helger/html/jquery/JQueryInvocation.java#L54-L59
train
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/html/metadata/HCLink.java
HCLink.createCSSLink
@Nonnull public static HCLink createCSSLink (@Nonnull final ISimpleURL aCSSURL) { return new HCLink ().setRel (EHCLinkType.STYLESHEET).setType (CMimeType.TEXT_CSS).setHref (aCSSURL); }
java
@Nonnull public static HCLink createCSSLink (@Nonnull final ISimpleURL aCSSURL) { return new HCLink ().setRel (EHCLinkType.STYLESHEET).setType (CMimeType.TEXT_CSS).setHref (aCSSURL); }
[ "@", "Nonnull", "public", "static", "HCLink", "createCSSLink", "(", "@", "Nonnull", "final", "ISimpleURL", "aCSSURL", ")", "{", "return", "new", "HCLink", "(", ")", ".", "setRel", "(", "EHCLinkType", ".", "STYLESHEET", ")", ".", "setType", "(", "CMimeType", ...
Shortcut to create a &lt;link&gt; element specific to CSS @param aCSSURL The CSS URL to be referenced @return Never <code>null</code>.
[ "Shortcut", "to", "create", "a", "&lt", ";", "link&gt", ";", "element", "specific", "to", "CSS" ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/metadata/HCLink.java#L348-L352
train
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/JADT.java
JADT.standardConfigDriver
public static JADT standardConfigDriver() { logger.fine("Using standard configuration."); final SourceFactory sourceFactory = new FileSourceFactory(); final ClassBodyEmitter classBodyEmitter = new StandardClassBodyEmitter(); final ConstructorEmitter constructorEmitter = new StandardConstructorEmitter(classBodyEmitter); final DataTypeEmitter dataTypeEmitter = new StandardDataTypeEmitter(classBodyEmitter, constructorEmitter); final DocEmitter docEmitter = new StandardDocEmitter(dataTypeEmitter); final Parser parser = new StandardParser(new JavaCCParserImplFactory()); final Checker checker = new StandardChecker(); final SinkFactoryFactory factoryFactory = new FileSinkFactoryFactory(); return new JADT(sourceFactory, parser, checker, docEmitter, factoryFactory); }
java
public static JADT standardConfigDriver() { logger.fine("Using standard configuration."); final SourceFactory sourceFactory = new FileSourceFactory(); final ClassBodyEmitter classBodyEmitter = new StandardClassBodyEmitter(); final ConstructorEmitter constructorEmitter = new StandardConstructorEmitter(classBodyEmitter); final DataTypeEmitter dataTypeEmitter = new StandardDataTypeEmitter(classBodyEmitter, constructorEmitter); final DocEmitter docEmitter = new StandardDocEmitter(dataTypeEmitter); final Parser parser = new StandardParser(new JavaCCParserImplFactory()); final Checker checker = new StandardChecker(); final SinkFactoryFactory factoryFactory = new FileSinkFactoryFactory(); return new JADT(sourceFactory, parser, checker, docEmitter, factoryFactory); }
[ "public", "static", "JADT", "standardConfigDriver", "(", ")", "{", "logger", ".", "fine", "(", "\"Using standard configuration.\"", ")", ";", "final", "SourceFactory", "sourceFactory", "=", "new", "FileSourceFactory", "(", ")", ";", "final", "ClassBodyEmitter", "cla...
Convenient factory method to create a complete standard configuration @return Driver configured with all the Standard bits
[ "Convenient", "factory", "method", "to", "create", "a", "complete", "standard", "configuration" ]
92ee94b6624cd673851497d78c218837dcf02b8a
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/JADT.java#L91-L103
train
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/JADT.java
JADT.parseAndEmit
public void parseAndEmit(String[] args) { logger.finest("Checking command line arguments."); if (args.length != 2) { final String version = new Version().getVersion(); logger.info("jADT version " + version + "."); logger.info("Not enough arguments provided to jADT"); logger.info("usage: java sfdc.adt.JADT [source file or directory with .jadt files] [output directory]"); throw new IllegalArgumentException("\njADT version " + version + "\nusage: java sfdc.adt.JADT [source file or directory with .jadt files] [output directory]"); } final String srcPath = args[0]; final String destDirName = args[1]; parseAndEmit(srcPath, destDirName); }
java
public void parseAndEmit(String[] args) { logger.finest("Checking command line arguments."); if (args.length != 2) { final String version = new Version().getVersion(); logger.info("jADT version " + version + "."); logger.info("Not enough arguments provided to jADT"); logger.info("usage: java sfdc.adt.JADT [source file or directory with .jadt files] [output directory]"); throw new IllegalArgumentException("\njADT version " + version + "\nusage: java sfdc.adt.JADT [source file or directory with .jadt files] [output directory]"); } final String srcPath = args[0]; final String destDirName = args[1]; parseAndEmit(srcPath, destDirName); }
[ "public", "void", "parseAndEmit", "(", "String", "[", "]", "args", ")", "{", "logger", ".", "finest", "(", "\"Checking command line arguments.\"", ")", ";", "if", "(", "args", ".", "length", "!=", "2", ")", "{", "final", "String", "version", "=", "new", ...
Do the jADT thing based on an array of String args. There must be 2 and the must be the source file and destination directory @param args
[ "Do", "the", "jADT", "thing", "based", "on", "an", "array", "of", "String", "args", ".", "There", "must", "be", "2", "and", "the", "must", "be", "the", "source", "file", "and", "destination", "directory" ]
92ee94b6624cd673851497d78c218837dcf02b8a
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/JADT.java#L126-L140
train
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/JADT.java
JADT.parseAndEmit
public void parseAndEmit(String srcPath, final String destDir) { final String version = new Version().getVersion(); logger.info("jADT version " + version + "."); logger.info("Will read from source " + srcPath); logger.info("Will write to destDir " + destDir); final List<? extends Source> sources = sourceFactory.createSources(srcPath); for (Source source : sources) { final List<UserError> errors = new ArrayList<UserError>(); final ParseResult result = parser.parse(source); for (SyntaxError error : result.errors) { errors.add(UserError._Syntactic(error)); } final List<SemanticError> semanticErrors = checker.check(result.doc); for (SemanticError error : semanticErrors) { errors.add(UserError._Semantic(error)); } if (!errors.isEmpty()) { throw new JADTUserErrorsException(errors); } emitter.emit(factoryFactory.createSinkFactory(destDir), result.doc); } }
java
public void parseAndEmit(String srcPath, final String destDir) { final String version = new Version().getVersion(); logger.info("jADT version " + version + "."); logger.info("Will read from source " + srcPath); logger.info("Will write to destDir " + destDir); final List<? extends Source> sources = sourceFactory.createSources(srcPath); for (Source source : sources) { final List<UserError> errors = new ArrayList<UserError>(); final ParseResult result = parser.parse(source); for (SyntaxError error : result.errors) { errors.add(UserError._Syntactic(error)); } final List<SemanticError> semanticErrors = checker.check(result.doc); for (SemanticError error : semanticErrors) { errors.add(UserError._Semantic(error)); } if (!errors.isEmpty()) { throw new JADTUserErrorsException(errors); } emitter.emit(factoryFactory.createSinkFactory(destDir), result.doc); } }
[ "public", "void", "parseAndEmit", "(", "String", "srcPath", ",", "final", "String", "destDir", ")", "{", "final", "String", "version", "=", "new", "Version", "(", ")", ".", "getVersion", "(", ")", ";", "logger", ".", "info", "(", "\"jADT version \"", "+", ...
Do the jADT thing given the srceFileName and destination directory @param srcPath full name of the source directory or file @param destDir full name of the destination directory (trailing slash is optional)
[ "Do", "the", "jADT", "thing", "given", "the", "srceFileName", "and", "destination", "directory" ]
92ee94b6624cd673851497d78c218837dcf02b8a
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/JADT.java#L148-L171
train
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/JADT.java
JADT.createDummyJADT
public static JADT createDummyJADT(List<SyntaxError> syntaxErrors, List<SemanticError> semanticErrors, String testSrcInfo, SinkFactoryFactory factory) { final SourceFactory sourceFactory = new StringSourceFactory(TEST_STRING); final Doc doc = new Doc(TEST_SRC_INFO, Pkg._Pkg(NO_COMMENTS, "pkg"), Util.<Imprt> list(), Util.<DataType> list()); final ParseResult parseResult = new ParseResult(doc, syntaxErrors); final DocEmitter docEmitter = new DummyDocEmitter(doc, TEST_CLASS_NAME); final Parser parser = new DummyParser(parseResult, testSrcInfo, TEST_STRING); final Checker checker = new DummyChecker(semanticErrors); final JADT jadt = new JADT(sourceFactory, parser, checker, docEmitter, factory); return jadt; }
java
public static JADT createDummyJADT(List<SyntaxError> syntaxErrors, List<SemanticError> semanticErrors, String testSrcInfo, SinkFactoryFactory factory) { final SourceFactory sourceFactory = new StringSourceFactory(TEST_STRING); final Doc doc = new Doc(TEST_SRC_INFO, Pkg._Pkg(NO_COMMENTS, "pkg"), Util.<Imprt> list(), Util.<DataType> list()); final ParseResult parseResult = new ParseResult(doc, syntaxErrors); final DocEmitter docEmitter = new DummyDocEmitter(doc, TEST_CLASS_NAME); final Parser parser = new DummyParser(parseResult, testSrcInfo, TEST_STRING); final Checker checker = new DummyChecker(semanticErrors); final JADT jadt = new JADT(sourceFactory, parser, checker, docEmitter, factory); return jadt; }
[ "public", "static", "JADT", "createDummyJADT", "(", "List", "<", "SyntaxError", ">", "syntaxErrors", ",", "List", "<", "SemanticError", ">", "semanticErrors", ",", "String", "testSrcInfo", ",", "SinkFactoryFactory", "factory", ")", "{", "final", "SourceFactory", "...
Create a dummy configged jADT based on the provided syntaxErrors, semanticErrors, testSrcInfo, and sink factory Useful for testing
[ "Create", "a", "dummy", "configged", "jADT", "based", "on", "the", "provided", "syntaxErrors", "semanticErrors", "testSrcInfo", "and", "sink", "factory", "Useful", "for", "testing" ]
92ee94b6624cd673851497d78c218837dcf02b8a
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/JADT.java#L177-L186
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/check/AbstractCheck.java
AbstractCheck.hasHashChanged
private boolean hasHashChanged(Set<RegData> regData) { for (RegData el : regData) { if (hasHashChanged(mHasher, el)) { return true; } } return false; }
java
private boolean hasHashChanged(Set<RegData> regData) { for (RegData el : regData) { if (hasHashChanged(mHasher, el)) { return true; } } return false; }
[ "private", "boolean", "hasHashChanged", "(", "Set", "<", "RegData", ">", "regData", ")", "{", "for", "(", "RegData", "el", ":", "regData", ")", "{", "if", "(", "hasHashChanged", "(", "mHasher", ",", "el", ")", ")", "{", "return", "true", ";", "}", "}...
Check if any element of the given set has changed.
[ "Check", "if", "any", "element", "of", "the", "given", "set", "has", "changed", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/check/AbstractCheck.java#L56-L63
train
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/check/AbstractCheck.java
AbstractCheck.hasHashChanged
protected final boolean hasHashChanged(Hasher hasher, RegData regDatum) { String urlExternalForm = regDatum.getURLExternalForm(); // Check hash. String newHash = hasher.hashURL(urlExternalForm); boolean anyDiff = !newHash.equals(regDatum.getHash()); return anyDiff; }
java
protected final boolean hasHashChanged(Hasher hasher, RegData regDatum) { String urlExternalForm = regDatum.getURLExternalForm(); // Check hash. String newHash = hasher.hashURL(urlExternalForm); boolean anyDiff = !newHash.equals(regDatum.getHash()); return anyDiff; }
[ "protected", "final", "boolean", "hasHashChanged", "(", "Hasher", "hasher", ",", "RegData", "regDatum", ")", "{", "String", "urlExternalForm", "=", "regDatum", ".", "getURLExternalForm", "(", ")", ";", "// Check hash.", "String", "newHash", "=", "hasher", ".", "...
Check if the given datum has changed using the given hasher.
[ "Check", "if", "the", "given", "datum", "has", "changed", "using", "the", "given", "hasher", "." ]
5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/check/AbstractCheck.java#L68-L74
train
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadRemote.java
TypeaheadRemote.setCache
@Nonnull public TypeaheadRemote setCache (@Nonnull final ETriState eCache) { m_eCache = ValueEnforcer.notNull (eCache, "Cache"); return this; }
java
@Nonnull public TypeaheadRemote setCache (@Nonnull final ETriState eCache) { m_eCache = ValueEnforcer.notNull (eCache, "Cache"); return this; }
[ "@", "Nonnull", "public", "TypeaheadRemote", "setCache", "(", "@", "Nonnull", "final", "ETriState", "eCache", ")", "{", "m_eCache", "=", "ValueEnforcer", ".", "notNull", "(", "eCache", ",", "\"Cache\"", ")", ";", "return", "this", ";", "}" ]
Determines whether or not the browser will cache responses. See the jQuery.ajax docs for more info. @param eCache Use cache? May not be <code>null</code>. @return this
[ "Determines", "whether", "or", "not", "the", "browser", "will", "cache", "responses", ".", "See", "the", "jQuery", ".", "ajax", "docs", "for", "more", "info", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadRemote.java#L162-L167
train
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/appid/PhotonGlobalState.java
PhotonGlobalState.setDefaultApplicationID
@Nonnull public PhotonGlobalState setDefaultApplicationID (@Nullable final String sDefaultApplicationID) { m_aRWLock.writeLocked ( () -> { if (!EqualsHelper.equals (m_sDefaultApplicationID, sDefaultApplicationID)) { m_sDefaultApplicationID = sDefaultApplicationID; if (LOGGER.isInfoEnabled ()) LOGGER.info ("Default application ID set to '" + sDefaultApplicationID + "'"); } }); return this; }
java
@Nonnull public PhotonGlobalState setDefaultApplicationID (@Nullable final String sDefaultApplicationID) { m_aRWLock.writeLocked ( () -> { if (!EqualsHelper.equals (m_sDefaultApplicationID, sDefaultApplicationID)) { m_sDefaultApplicationID = sDefaultApplicationID; if (LOGGER.isInfoEnabled ()) LOGGER.info ("Default application ID set to '" + sDefaultApplicationID + "'"); } }); return this; }
[ "@", "Nonnull", "public", "PhotonGlobalState", "setDefaultApplicationID", "(", "@", "Nullable", "final", "String", "sDefaultApplicationID", ")", "{", "m_aRWLock", ".", "writeLocked", "(", "(", ")", "->", "{", "if", "(", "!", "EqualsHelper", ".", "equals", "(", ...
Set the default application ID of an application servlet. @param sDefaultApplicationID The last application ID to be set. May be <code>null</code>. @return this for chaining
[ "Set", "the", "default", "application", "ID", "of", "an", "application", "servlet", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/appid/PhotonGlobalState.java#L85-L97
train
phax/ph-oton
ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/button/BootstrapUploadButton.java
BootstrapUploadButton.createSelectedFileEdit
@Nonnull public HCNodeList createSelectedFileEdit (@Nullable final String sPlaceholder) { final HCEdit aEdit = new HCEdit ().setPlaceholder (sPlaceholder).setReadOnly (true); final HCScriptInline aScript = new HCScriptInline (JQuery.idRef (m_aEdit) .on ("change", new JSAnonymousFunction (JQuery.idRef (aEdit) .val (JSExpr.THIS.ref ("value"))))); return new HCNodeList ().addChildren (aEdit, aScript); }
java
@Nonnull public HCNodeList createSelectedFileEdit (@Nullable final String sPlaceholder) { final HCEdit aEdit = new HCEdit ().setPlaceholder (sPlaceholder).setReadOnly (true); final HCScriptInline aScript = new HCScriptInline (JQuery.idRef (m_aEdit) .on ("change", new JSAnonymousFunction (JQuery.idRef (aEdit) .val (JSExpr.THIS.ref ("value"))))); return new HCNodeList ().addChildren (aEdit, aScript); }
[ "@", "Nonnull", "public", "HCNodeList", "createSelectedFileEdit", "(", "@", "Nullable", "final", "String", "sPlaceholder", ")", "{", "final", "HCEdit", "aEdit", "=", "new", "HCEdit", "(", ")", ".", "setPlaceholder", "(", "sPlaceholder", ")", ".", "setReadOnly", ...
Create a read only edit that contains the value of the selected file. It can be placed anywhere in the DOM. @param sPlaceholder The placeholder text to be used if no file is selected. @return A node list with the edit and a JavaScript
[ "Create", "a", "read", "only", "edit", "that", "contains", "the", "value", "of", "the", "selected", "file", ".", "It", "can", "be", "placed", "anywhere", "in", "the", "DOM", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/button/BootstrapUploadButton.java#L85-L94
train
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java
FineUploader5DeleteFile.setEndpoint
@Nonnull public FineUploader5DeleteFile setEndpoint (@Nonnull final ISimpleURL aEndpoint) { ValueEnforcer.notNull (aEndpoint, "Endpoint"); m_aDeleteFileEndpoint = aEndpoint; return this; }
java
@Nonnull public FineUploader5DeleteFile setEndpoint (@Nonnull final ISimpleURL aEndpoint) { ValueEnforcer.notNull (aEndpoint, "Endpoint"); m_aDeleteFileEndpoint = aEndpoint; return this; }
[ "@", "Nonnull", "public", "FineUploader5DeleteFile", "setEndpoint", "(", "@", "Nonnull", "final", "ISimpleURL", "aEndpoint", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aEndpoint", ",", "\"Endpoint\"", ")", ";", "m_aDeleteFileEndpoint", "=", "aEndpoint", ";", ...
The endpoint to which delete file requests are sent. @param aEndpoint New value. May not be <code>null</code>. @return this for chaining
[ "The", "endpoint", "to", "which", "delete", "file", "requests", "are", "sent", "." ]
f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java#L140-L146
train