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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java | LayoutService.cloneLayout | @Override
public void cloneLayout(LayoutIdentifier layout, LayoutIdentifier layout2) {
String text = getLayoutContent(layout);
saveLayout(layout2, text);
} | java | @Override
public void cloneLayout(LayoutIdentifier layout, LayoutIdentifier layout2) {
String text = getLayoutContent(layout);
saveLayout(layout2, text);
} | [
"@",
"Override",
"public",
"void",
"cloneLayout",
"(",
"LayoutIdentifier",
"layout",
",",
"LayoutIdentifier",
"layout2",
")",
"{",
"String",
"text",
"=",
"getLayoutContent",
"(",
"layout",
")",
";",
"saveLayout",
"(",
"layout2",
",",
"text",
")",
";",
"}"
] | Clone a layout.
@param layout The original layout identifier.
@param layout2 The new layout identifier. | [
"Clone",
"a",
"layout",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java#L103-L107 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java | LayoutService.getLayoutContent | @Override
public String getLayoutContent(LayoutIdentifier layout) {
return propertyService.getValue(getPropertyName(layout.shared), layout.name);
} | java | @Override
public String getLayoutContent(LayoutIdentifier layout) {
return propertyService.getValue(getPropertyName(layout.shared), layout.name);
} | [
"@",
"Override",
"public",
"String",
"getLayoutContent",
"(",
"LayoutIdentifier",
"layout",
")",
"{",
"return",
"propertyService",
".",
"getValue",
"(",
"getPropertyName",
"(",
"layout",
".",
"shared",
")",
",",
"layout",
".",
"name",
")",
";",
"}"
] | Returns the layout content.
@param layout The layout identifier.
@return The layout content. | [
"Returns",
"the",
"layout",
"content",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java#L125-L128 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java | LayoutService.getLayoutContentByAppId | @Override
public String getLayoutContentByAppId(String appId) {
String value = propertyService.getValue(PROPERTY_LAYOUT_ASSOCIATION, appId);
return value == null ? null : getLayoutContent(new LayoutIdentifier(value, true));
} | java | @Override
public String getLayoutContentByAppId(String appId) {
String value = propertyService.getValue(PROPERTY_LAYOUT_ASSOCIATION, appId);
return value == null ? null : getLayoutContent(new LayoutIdentifier(value, true));
} | [
"@",
"Override",
"public",
"String",
"getLayoutContentByAppId",
"(",
"String",
"appId",
")",
"{",
"String",
"value",
"=",
"propertyService",
".",
"getValue",
"(",
"PROPERTY_LAYOUT_ASSOCIATION",
",",
"appId",
")",
";",
"return",
"value",
"==",
"null",
"?",
"null"... | Load the layout associated with the specified application id.
@param appId An application id.
@return The layout content. | [
"Load",
"the",
"layout",
"associated",
"with",
"the",
"specified",
"application",
"id",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java#L136-L140 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java | LayoutService.getLayouts | @Override
public List<String> getLayouts(boolean shared) {
List<String> layouts = propertyService.getInstances(getPropertyName(shared), shared);
Collections.sort(layouts, String.CASE_INSENSITIVE_ORDER);
return layouts;
} | java | @Override
public List<String> getLayouts(boolean shared) {
List<String> layouts = propertyService.getInstances(getPropertyName(shared), shared);
Collections.sort(layouts, String.CASE_INSENSITIVE_ORDER);
return layouts;
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getLayouts",
"(",
"boolean",
"shared",
")",
"{",
"List",
"<",
"String",
">",
"layouts",
"=",
"propertyService",
".",
"getInstances",
"(",
"getPropertyName",
"(",
"shared",
")",
",",
"shared",
")",
";"... | Returns a list of saved layouts.
@param shared If true, return shared layouts; otherwise, return personal layouts.
@return List of saved layouts. | [
"Returns",
"a",
"list",
"of",
"saved",
"layouts",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java#L148-L153 | train |
carewebframework/carewebframework-core | org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetailsSource.java | CWFAuthenticationDetailsSource.buildDetails | @Override
public CWFAuthenticationDetails buildDetails(HttpServletRequest request) {
log.trace("Building details");
CWFAuthenticationDetails details = new CWFAuthenticationDetails(request);
return details;
} | java | @Override
public CWFAuthenticationDetails buildDetails(HttpServletRequest request) {
log.trace("Building details");
CWFAuthenticationDetails details = new CWFAuthenticationDetails(request);
return details;
} | [
"@",
"Override",
"public",
"CWFAuthenticationDetails",
"buildDetails",
"(",
"HttpServletRequest",
"request",
")",
"{",
"log",
".",
"trace",
"(",
"\"Building details\"",
")",
";",
"CWFAuthenticationDetails",
"details",
"=",
"new",
"CWFAuthenticationDetails",
"(",
"reques... | Returns an instance of a CWFAuthenticationDetails object.
@param request The servlet request object. | [
"Returns",
"an",
"instance",
"of",
"a",
"CWFAuthenticationDetails",
"object",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetailsSource.java#L47-L52 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java | BaseMojo.init | protected void init(String classifier, String moduleBase) throws MojoExecutionException {
this.classifier = classifier;
this.moduleBase = moduleBase;
stagingDirectory = new File(buildDirectory, classifier + "-staging");
configTemplate = new ConfigTemplate(classifier + "-spring.xml");
exclusionFilter = exclusions == null || exclusions.isEmpty() ? null : new WildcardFileFilter(exclusions);
archiveConfig.setAddMavenDescriptor(false);
} | java | protected void init(String classifier, String moduleBase) throws MojoExecutionException {
this.classifier = classifier;
this.moduleBase = moduleBase;
stagingDirectory = new File(buildDirectory, classifier + "-staging");
configTemplate = new ConfigTemplate(classifier + "-spring.xml");
exclusionFilter = exclusions == null || exclusions.isEmpty() ? null : new WildcardFileFilter(exclusions);
archiveConfig.setAddMavenDescriptor(false);
} | [
"protected",
"void",
"init",
"(",
"String",
"classifier",
",",
"String",
"moduleBase",
")",
"throws",
"MojoExecutionException",
"{",
"this",
".",
"classifier",
"=",
"classifier",
";",
"this",
".",
"moduleBase",
"=",
"moduleBase",
";",
"stagingDirectory",
"=",
"n... | Subclasses must call this method early in their execute method.
@param classifier The output jar classifier.
@param moduleBase The base path for generated resources.
@throws MojoExecutionException Unspecified exception. | [
"Subclasses",
"must",
"call",
"this",
"method",
"early",
"in",
"their",
"execute",
"method",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java#L138-L145 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java | BaseMojo.getModuleVersion | protected String getModuleVersion() {
StringBuilder sb = new StringBuilder();
int pcs = 0;
for (String pc : projectVersion.split("\\.")) {
if (pcs++ > 3) {
break;
} else {
appendVersionPiece(sb, pc);
}
}
appendVersionPiece(sb, buildNumber);
return sb.toString();
} | java | protected String getModuleVersion() {
StringBuilder sb = new StringBuilder();
int pcs = 0;
for (String pc : projectVersion.split("\\.")) {
if (pcs++ > 3) {
break;
} else {
appendVersionPiece(sb, pc);
}
}
appendVersionPiece(sb, buildNumber);
return sb.toString();
} | [
"protected",
"String",
"getModuleVersion",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"pcs",
"=",
"0",
";",
"for",
"(",
"String",
"pc",
":",
"projectVersion",
".",
"split",
"(",
"\"\\\\.\"",
")",
")",
"{",
... | Form a version string from the project version and build number.
@return Version string. | [
"Form",
"a",
"version",
"string",
"from",
"the",
"project",
"version",
"and",
"build",
"number",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java#L164-L178 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java | BaseMojo.newStagingFile | public File newStagingFile(String entryName, long modTime) {
File file = new File(stagingDirectory, entryName);
if (modTime != 0) {
file.setLastModified(modTime);
}
file.getParentFile().mkdirs();
return file;
} | java | public File newStagingFile(String entryName, long modTime) {
File file = new File(stagingDirectory, entryName);
if (modTime != 0) {
file.setLastModified(modTime);
}
file.getParentFile().mkdirs();
return file;
} | [
"public",
"File",
"newStagingFile",
"(",
"String",
"entryName",
",",
"long",
"modTime",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"stagingDirectory",
",",
"entryName",
")",
";",
"if",
"(",
"modTime",
"!=",
"0",
")",
"{",
"file",
".",
"setLastMod... | Creates a new file in the staging directory. Ensures that all folders in the path are also
created.
@param entryName Entry name to create.
@param modTime Modification timestamp for the new entry. If 0, defaults to the current time.
@return the new file | [
"Creates",
"a",
"new",
"file",
"in",
"the",
"staging",
"directory",
".",
"Ensures",
"that",
"all",
"folders",
"in",
"the",
"path",
"are",
"also",
"created",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java#L217-L226 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java | BaseMojo.throwMojoException | public void throwMojoException(String msg, Throwable e) throws MojoExecutionException {
if (failOnError) {
throw new MojoExecutionException(msg, e);
} else {
getLog().error(msg, e);
}
} | java | public void throwMojoException(String msg, Throwable e) throws MojoExecutionException {
if (failOnError) {
throw new MojoExecutionException(msg, e);
} else {
getLog().error(msg, e);
}
} | [
"public",
"void",
"throwMojoException",
"(",
"String",
"msg",
",",
"Throwable",
"e",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"failOnError",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"msg",
",",
"e",
")",
";",
"}",
"else",
"{",... | If "failOnError" is enabled, throws a MojoExecutionException. Otherwise, logs the exception
and resumes execution.
@param msg The exception message.
@param e The original exceptions.
@throws MojoExecutionException Thrown exception. | [
"If",
"failOnError",
"is",
"enabled",
"throws",
"a",
"MojoExecutionException",
".",
"Otherwise",
"logs",
"the",
"exception",
"and",
"resumes",
"execution",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java#L256-L262 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java | BaseMojo.assembleArchive | protected void assembleArchive() throws Exception {
getLog().info("Assembling " + classifier + " archive");
if (resources != null && !resources.isEmpty()) {
getLog().info("Copying additional resources.");
new ResourceProcessor(this, moduleBase, resources).transform();
}
if (configTemplate != null) {
getLog().info("Creating config file.");
configTemplate.addEntry("info", pluginDescriptor.getName(), pluginDescriptor.getVersion(),
new Date().toString());
configTemplate.createFile(stagingDirectory);
}
try {
File archive = createArchive();
if ("war".equalsIgnoreCase(mavenProject.getPackaging()) && this.warInclusion) {
webappLibDirectory.mkdirs();
File webappLibArchive = new File(this.webappLibDirectory, archive.getName());
Files.copy(archive, webappLibArchive);
}
} catch (Exception e) {
throw new RuntimeException("Exception occurred assembling archive.", e);
}
} | java | protected void assembleArchive() throws Exception {
getLog().info("Assembling " + classifier + " archive");
if (resources != null && !resources.isEmpty()) {
getLog().info("Copying additional resources.");
new ResourceProcessor(this, moduleBase, resources).transform();
}
if (configTemplate != null) {
getLog().info("Creating config file.");
configTemplate.addEntry("info", pluginDescriptor.getName(), pluginDescriptor.getVersion(),
new Date().toString());
configTemplate.createFile(stagingDirectory);
}
try {
File archive = createArchive();
if ("war".equalsIgnoreCase(mavenProject.getPackaging()) && this.warInclusion) {
webappLibDirectory.mkdirs();
File webappLibArchive = new File(this.webappLibDirectory, archive.getName());
Files.copy(archive, webappLibArchive);
}
} catch (Exception e) {
throw new RuntimeException("Exception occurred assembling archive.", e);
}
} | [
"protected",
"void",
"assembleArchive",
"(",
")",
"throws",
"Exception",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Assembling \"",
"+",
"classifier",
"+",
"\" archive\"",
")",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"!",
"resources",
".",
"isE... | Assembles the archive file. Optionally, copies to the war application directory if the
packaging type is "war".
@throws Exception Unspecified exception. | [
"Assembles",
"the",
"archive",
"file",
".",
"Optionally",
"copies",
"to",
"the",
"war",
"application",
"directory",
"if",
"the",
"packaging",
"type",
"is",
"war",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java#L270-L297 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java | BaseMojo.createArchive | private File createArchive() throws Exception {
getLog().info("Creating archive.");
Artifact artifact = mavenProject.getArtifact();
String clsfr = noclassifier ? "" : ("-" + classifier);
String archiveName = artifact.getArtifactId() + "-" + artifact.getVersion() + clsfr + ".jar";
File jarFile = new File(mavenProject.getBuild().getDirectory(), archiveName);
MavenArchiver archiver = new MavenArchiver();
jarArchiver.addDirectory(stagingDirectory);
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
archiver.createArchive(mavenSession, mavenProject, archiveConfig);
if (noclassifier) {
artifact.setFile(jarFile);
} else {
projectHelper.attachArtifact(mavenProject, jarFile, classifier);
}
FileUtils.deleteDirectory(stagingDirectory);
return jarFile;
} | java | private File createArchive() throws Exception {
getLog().info("Creating archive.");
Artifact artifact = mavenProject.getArtifact();
String clsfr = noclassifier ? "" : ("-" + classifier);
String archiveName = artifact.getArtifactId() + "-" + artifact.getVersion() + clsfr + ".jar";
File jarFile = new File(mavenProject.getBuild().getDirectory(), archiveName);
MavenArchiver archiver = new MavenArchiver();
jarArchiver.addDirectory(stagingDirectory);
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
archiver.createArchive(mavenSession, mavenProject, archiveConfig);
if (noclassifier) {
artifact.setFile(jarFile);
} else {
projectHelper.attachArtifact(mavenProject, jarFile, classifier);
}
FileUtils.deleteDirectory(stagingDirectory);
return jarFile;
} | [
"private",
"File",
"createArchive",
"(",
")",
"throws",
"Exception",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Creating archive.\"",
")",
";",
"Artifact",
"artifact",
"=",
"mavenProject",
".",
"getArtifact",
"(",
")",
";",
"String",
"clsfr",
"=",
"noclas... | Creates the archive from data in the staging directory.
@return The archive file.
@throws Exception Unspecified exception. | [
"Creates",
"the",
"archive",
"from",
"data",
"in",
"the",
"staging",
"directory",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java#L305-L325 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/thread/ThreadUtil.java | ThreadUtil.startThread | public static void startThread(Thread thread) {
if (log.isDebugEnabled()) {
log.debug("Starting background thread: " + thread);
}
ExecutorService executor = getTaskExecutor();
if (executor != null) {
executor.execute(thread);
} else {
thread.start();
}
} | java | public static void startThread(Thread thread) {
if (log.isDebugEnabled()) {
log.debug("Starting background thread: " + thread);
}
ExecutorService executor = getTaskExecutor();
if (executor != null) {
executor.execute(thread);
} else {
thread.start();
}
} | [
"public",
"static",
"void",
"startThread",
"(",
"Thread",
"thread",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Starting background thread: \"",
"+",
"thread",
")",
";",
"}",
"ExecutorService",
"executo... | Starts a thread. If an executor service is available, that is used. Otherwise, the thread's
start method is called.
@param thread Thread to start. | [
"Starts",
"a",
"thread",
".",
"If",
"an",
"executor",
"service",
"is",
"available",
"that",
"is",
"used",
".",
"Otherwise",
"the",
"thread",
"s",
"start",
"method",
"is",
"called",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/thread/ThreadUtil.java#L77-L89 | train |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionService.java | SessionService.create | protected static SessionService create(IPublisherInfo self, String sessionId, IEventManager eventManager,
ISessionUpdate callback) {
String sendEvent = StrUtil.formatMessage(EVENT_SEND, sessionId);
String joinEvent = StrUtil.formatMessage(EVENT_JOIN, sessionId);
String leaveEvent = StrUtil.formatMessage(EVENT_LEAVE, sessionId);
return new SessionService(self, sendEvent, joinEvent, leaveEvent, eventManager, callback);
} | java | protected static SessionService create(IPublisherInfo self, String sessionId, IEventManager eventManager,
ISessionUpdate callback) {
String sendEvent = StrUtil.formatMessage(EVENT_SEND, sessionId);
String joinEvent = StrUtil.formatMessage(EVENT_JOIN, sessionId);
String leaveEvent = StrUtil.formatMessage(EVENT_LEAVE, sessionId);
return new SessionService(self, sendEvent, joinEvent, leaveEvent, eventManager, callback);
} | [
"protected",
"static",
"SessionService",
"create",
"(",
"IPublisherInfo",
"self",
",",
"String",
"sessionId",
",",
"IEventManager",
"eventManager",
",",
"ISessionUpdate",
"callback",
")",
"{",
"String",
"sendEvent",
"=",
"StrUtil",
".",
"formatMessage",
"(",
"EVENT_... | Creates a service handler for a chat session.
@param self Creator of the chat session.
@param sessionId Unique id of the chat session.
@param eventManager Event manager instance.
@param callback Call back method for session-related events.
@return The newly created service. | [
"Creates",
"a",
"service",
"handler",
"for",
"a",
"chat",
"session",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionService.java#L68-L74 | train |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionService.java | SessionService.sendMessage | public ChatMessage sendMessage(String text) {
if (text != null && !text.isEmpty()) {
ChatMessage message = new ChatMessage(self, text);
eventManager.fireRemoteEvent(sendEvent, message);
return message;
}
return null;
} | java | public ChatMessage sendMessage(String text) {
if (text != null && !text.isEmpty()) {
ChatMessage message = new ChatMessage(self, text);
eventManager.fireRemoteEvent(sendEvent, message);
return message;
}
return null;
} | [
"public",
"ChatMessage",
"sendMessage",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"!=",
"null",
"&&",
"!",
"text",
".",
"isEmpty",
"(",
")",
")",
"{",
"ChatMessage",
"message",
"=",
"new",
"ChatMessage",
"(",
"self",
",",
"text",
")",
";",
... | Sends a message to a chat session.
@param text The message text.
@return The message that was sent (may be null if no text). | [
"Sends",
"a",
"message",
"to",
"a",
"chat",
"session",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionService.java#L107-L115 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpSearchHit.java | HelpSearchHit.compareTo | @Override
public int compareTo(HelpSearchHit hit) {
int result = -NumUtil.compare(confidence, hit.confidence);
return result != 0 ? result : topic.compareTo(hit.topic);
} | java | @Override
public int compareTo(HelpSearchHit hit) {
int result = -NumUtil.compare(confidence, hit.confidence);
return result != 0 ? result : topic.compareTo(hit.topic);
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"HelpSearchHit",
"hit",
")",
"{",
"int",
"result",
"=",
"-",
"NumUtil",
".",
"compare",
"(",
"confidence",
",",
"hit",
".",
"confidence",
")",
";",
"return",
"result",
"!=",
"0",
"?",
"result",
":",
"... | Used to sort hits by confidence level. | [
"Used",
"to",
"sort",
"hits",
"by",
"confidence",
"level",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpSearchHit.java#L74-L78 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/print/FormPrintServiceImpl.java | FormPrintServiceImpl.toUnsignedByte | protected static byte toUnsignedByte(int intVal) {
byte byteVal;
if (intVal > 127) {
int temp = intVal - 256;
byteVal = (byte) temp;
} else {
byteVal = (byte) intVal;
}
return byteVal;
} | java | protected static byte toUnsignedByte(int intVal) {
byte byteVal;
if (intVal > 127) {
int temp = intVal - 256;
byteVal = (byte) temp;
} else {
byteVal = (byte) intVal;
}
return byteVal;
} | [
"protected",
"static",
"byte",
"toUnsignedByte",
"(",
"int",
"intVal",
")",
"{",
"byte",
"byteVal",
";",
"if",
"(",
"intVal",
">",
"127",
")",
"{",
"int",
"temp",
"=",
"intVal",
"-",
"256",
";",
"byteVal",
"=",
"(",
"byte",
")",
"temp",
";",
"}",
"... | convert int to unsigned byte | [
"convert",
"int",
"to",
"unsigned",
"byte"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/print/FormPrintServiceImpl.java#L680-L689 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java | CipherUtil.getKeyStore | public static KeyStore getKeyStore(String keystoreLocation, String keystoreType) throws NoSuchAlgorithmException,
CertificateException, IOException,
KeyStoreException {
KeyStore keystore = KeyStore.getInstance(keystoreType);
InputStream is = CipherUtil.class.getResourceAsStream(keystoreLocation);
if (is == null) {
is = new FileInputStream(keystoreLocation);
}
keystore.load(is, null);
return keystore;
} | java | public static KeyStore getKeyStore(String keystoreLocation, String keystoreType) throws NoSuchAlgorithmException,
CertificateException, IOException,
KeyStoreException {
KeyStore keystore = KeyStore.getInstance(keystoreType);
InputStream is = CipherUtil.class.getResourceAsStream(keystoreLocation);
if (is == null) {
is = new FileInputStream(keystoreLocation);
}
keystore.load(is, null);
return keystore;
} | [
"public",
"static",
"KeyStore",
"getKeyStore",
"(",
"String",
"keystoreLocation",
",",
"String",
"keystoreType",
")",
"throws",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"IOException",
",",
"KeyStoreException",
"{",
"KeyStore",
"keystore",
"=",
"KeyS... | Returns a key store instance of the specified type from the specified resource.
@param keystoreLocation Path to key store location.
@param keystoreType Key store type.
@return A key store instance.
@throws NoSuchAlgorithmException If algorithm not supported.
@throws CertificateException If certificate invalid.
@throws IOException If IO exception.
@throws KeyStoreException If key store invalid. | [
"Returns",
"a",
"key",
"store",
"instance",
"of",
"the",
"specified",
"type",
"from",
"the",
"specified",
"resource",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L71-L83 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java | CipherUtil.verify | public static boolean verify(PublicKey key, String base64Signature, String content, String timestamp, int duration)
throws Exception {
if (key == null || base64Signature == null || content == null || timestamp == null) {
return false;
}
try {
if (timestamp != null && duration > 0) {
validateTime(timestamp, duration);
}
Signature signature = Signature.getInstance(SIGN_ALGORITHM);
signature.initVerify(key);
signature.update(content.getBytes());
byte[] signatureBytes = Base64.decodeBase64(base64Signature);
return signature.verify(signatureBytes);
} catch (Exception e) {
log.error("Authentication Exception:verifySignature", e);
throw e;
}
} | java | public static boolean verify(PublicKey key, String base64Signature, String content, String timestamp, int duration)
throws Exception {
if (key == null || base64Signature == null || content == null || timestamp == null) {
return false;
}
try {
if (timestamp != null && duration > 0) {
validateTime(timestamp, duration);
}
Signature signature = Signature.getInstance(SIGN_ALGORITHM);
signature.initVerify(key);
signature.update(content.getBytes());
byte[] signatureBytes = Base64.decodeBase64(base64Signature);
return signature.verify(signatureBytes);
} catch (Exception e) {
log.error("Authentication Exception:verifySignature", e);
throw e;
}
} | [
"public",
"static",
"boolean",
"verify",
"(",
"PublicKey",
"key",
",",
"String",
"base64Signature",
",",
"String",
"content",
",",
"String",
"timestamp",
",",
"int",
"duration",
")",
"throws",
"Exception",
"{",
"if",
"(",
"key",
"==",
"null",
"||",
"base64Si... | Verifies a digitally signed payload.
@param key Public key to verify digital signature.
@param base64Signature Digital signature of content.
@param content The content that was signed.
@param timestamp Optional timestamp for time-sensitive payloads.
@param duration Optional validity duration in minutes for time-sensitive payloads.
@return True if signature is valid.
@throws Exception Unspecified exception. | [
"Verifies",
"a",
"digitally",
"signed",
"payload",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L96-L116 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java | CipherUtil.sign | public static String sign(PrivateKey key, String content) throws Exception {
Signature signature = Signature.getInstance(SIGN_ALGORITHM);
signature.initSign(key);
signature.update(content.getBytes());
return Base64.encodeBase64String(signature.sign());
} | java | public static String sign(PrivateKey key, String content) throws Exception {
Signature signature = Signature.getInstance(SIGN_ALGORITHM);
signature.initSign(key);
signature.update(content.getBytes());
return Base64.encodeBase64String(signature.sign());
} | [
"public",
"static",
"String",
"sign",
"(",
"PrivateKey",
"key",
",",
"String",
"content",
")",
"throws",
"Exception",
"{",
"Signature",
"signature",
"=",
"Signature",
".",
"getInstance",
"(",
"SIGN_ALGORITHM",
")",
";",
"signature",
".",
"initSign",
"(",
"key"... | Returns the digital signature for the specified content.
@param key The private key to sign the content.
@param content The content to sign.
@return The digital signature.
@throws Exception Unspecified exception. | [
"Returns",
"the",
"digital",
"signature",
"for",
"the",
"specified",
"content",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L126-L131 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java | CipherUtil.validateTime | public static void validateTime(String timestamp, int duration) throws Exception {
Date date = getTimestampFormatter().parse(timestamp);
long sign_time = date.getTime();
long now_time = System.currentTimeMillis();
long diff = now_time - sign_time;
long min_diff = diff / (60 * 1000);
if (min_diff >= duration) {
throw new GeneralSecurityException("Authorization token has expired.");
}
} | java | public static void validateTime(String timestamp, int duration) throws Exception {
Date date = getTimestampFormatter().parse(timestamp);
long sign_time = date.getTime();
long now_time = System.currentTimeMillis();
long diff = now_time - sign_time;
long min_diff = diff / (60 * 1000);
if (min_diff >= duration) {
throw new GeneralSecurityException("Authorization token has expired.");
}
} | [
"public",
"static",
"void",
"validateTime",
"(",
"String",
"timestamp",
",",
"int",
"duration",
")",
"throws",
"Exception",
"{",
"Date",
"date",
"=",
"getTimestampFormatter",
"(",
")",
".",
"parse",
"(",
"timestamp",
")",
";",
"long",
"sign_time",
"=",
"date... | Validates the timestamp and insures that it falls within the specified duration.
@param timestamp Timestamp in yyyyMMddHHmmssz format.
@param duration Validity duration in minutes.
@throws Exception Unspecified exception. | [
"Validates",
"the",
"timestamp",
"and",
"insures",
"that",
"it",
"falls",
"within",
"the",
"specified",
"duration",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L140-L150 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java | CipherUtil.getTimestamp | public static String getTimestamp(Date time) {
return getTimestampFormatter().format(time == null ? new Date() : time);
} | java | public static String getTimestamp(Date time) {
return getTimestampFormatter().format(time == null ? new Date() : time);
} | [
"public",
"static",
"String",
"getTimestamp",
"(",
"Date",
"time",
")",
"{",
"return",
"getTimestampFormatter",
"(",
")",
".",
"format",
"(",
"time",
"==",
"null",
"?",
"new",
"Date",
"(",
")",
":",
"time",
")",
";",
"}"
] | Converts a time to timestamp format.
@param time Time to convert, or null for current time.
@return Time in timestamp format. | [
"Converts",
"a",
"time",
"to",
"timestamp",
"format",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L158-L160 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java | CipherUtil.encrypt | public static String encrypt(Key key, String content) throws Exception {
try {
Cipher cipher = Cipher.getInstance(CRYPTO_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, key);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes()));
} catch (Exception e) {
log.error("Error while encrypting", e);
throw e;
}
} | java | public static String encrypt(Key key, String content) throws Exception {
try {
Cipher cipher = Cipher.getInstance(CRYPTO_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, key);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes()));
} catch (Exception e) {
log.error("Error while encrypting", e);
throw e;
}
} | [
"public",
"static",
"String",
"encrypt",
"(",
"Key",
"key",
",",
"String",
"content",
")",
"throws",
"Exception",
"{",
"try",
"{",
"Cipher",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"CRYPTO_ALGORITHM",
")",
";",
"cipher",
".",
"init",
"(",
"Cipher... | Encrypts the content with the specified key using the default algorithm.
@param key The cryptographic key.
@param content The content to encrypt.
@return The encrypted content.
@throws Exception Unspecified exception. | [
"Encrypts",
"the",
"content",
"with",
"the",
"specified",
"key",
"using",
"the",
"default",
"algorithm",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L179-L188 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java | CipherUtil.decrypt | public static String decrypt(Key key, String content) throws Exception {
try {
Cipher cipher = Cipher.getInstance(CRYPTO_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, key);
return new String(cipher.doFinal(Base64.decodeBase64(content)));
} catch (Exception e) {
log.error("Error while decrypting", e);
throw e;
}
} | java | public static String decrypt(Key key, String content) throws Exception {
try {
Cipher cipher = Cipher.getInstance(CRYPTO_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, key);
return new String(cipher.doFinal(Base64.decodeBase64(content)));
} catch (Exception e) {
log.error("Error while decrypting", e);
throw e;
}
} | [
"public",
"static",
"String",
"decrypt",
"(",
"Key",
"key",
",",
"String",
"content",
")",
"throws",
"Exception",
"{",
"try",
"{",
"Cipher",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"CRYPTO_ALGORITHM",
")",
";",
"cipher",
".",
"init",
"(",
"Cipher... | Decrypts the content with the specified key using the default algorithm.
@param key The cryptographic key.
@param content The content to decrypt.
@return The decrypted content.
@throws Exception Unspecified exception. | [
"Decrypts",
"the",
"content",
"with",
"the",
"specified",
"key",
"using",
"the",
"default",
"algorithm",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L198-L208 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/ManifestUtils.java | ManifestUtils.getManifestAttribute | public String getManifestAttribute(String attributeName) {
if (attributeName != null) {
Map<Object,Object> mf = getManifestAttributes();
for (Object att : mf.keySet()) {
if (attributeName.equals(att.toString())) {
return mf.get(att).toString();
}
}
}
//In case not found return null;
return null;
} | java | public String getManifestAttribute(String attributeName) {
if (attributeName != null) {
Map<Object,Object> mf = getManifestAttributes();
for (Object att : mf.keySet()) {
if (attributeName.equals(att.toString())) {
return mf.get(att).toString();
}
}
}
//In case not found return null;
return null;
} | [
"public",
"String",
"getManifestAttribute",
"(",
"String",
"attributeName",
")",
"{",
"if",
"(",
"attributeName",
"!=",
"null",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"mf",
"=",
"getManifestAttributes",
"(",
")",
";",
"for",
"(",
"Object",
"at... | Retrieves a value for a specific manifest attribute.
Or null if not found
@param attributeName to locate in the manifest
@return String value for or null case not found | [
"Retrieves",
"a",
"value",
"for",
"a",
"specific",
"manifest",
"attribute",
".",
"Or",
"null",
"if",
"not",
"found"
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/ManifestUtils.java#L40-L52 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/ManifestUtils.java | ManifestUtils.getManifestAttributes | public Map<Object, Object> getManifestAttributes() {
Map<Object, Object> manifestAttributes = null;
manifestAttributes = getExplodedWarManifestAttributes();
if (manifestAttributes == null) {
manifestAttributes = getPackagedWarManifestAttributes();
}
if (manifestAttributes == null) {
manifestAttributes = getClassPathManifestAttributes();
}
if (manifestAttributes == null) {
manifestAttributes = new HashMap<>();
}
return manifestAttributes;
} | java | public Map<Object, Object> getManifestAttributes() {
Map<Object, Object> manifestAttributes = null;
manifestAttributes = getExplodedWarManifestAttributes();
if (manifestAttributes == null) {
manifestAttributes = getPackagedWarManifestAttributes();
}
if (manifestAttributes == null) {
manifestAttributes = getClassPathManifestAttributes();
}
if (manifestAttributes == null) {
manifestAttributes = new HashMap<>();
}
return manifestAttributes;
} | [
"public",
"Map",
"<",
"Object",
",",
"Object",
">",
"getManifestAttributes",
"(",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"manifestAttributes",
"=",
"null",
";",
"manifestAttributes",
"=",
"getExplodedWarManifestAttributes",
"(",
")",
";",
"if",
"(... | Reads the manifest entries for this application. Returns empty if anything fails.
First tries from Exploded WAR, second Packaged WAR, third from classpath.
if not found returns an empty map
@return Map manifest entries if found otherwise empty map | [
"Reads",
"the",
"manifest",
"entries",
"for",
"this",
"application",
".",
"Returns",
"empty",
"if",
"anything",
"fails",
".",
"First",
"tries",
"from",
"Exploded",
"WAR",
"second",
"Packaged",
"WAR",
"third",
"from",
"classpath",
".",
"if",
"not",
"found",
"... | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/ManifestUtils.java#L61-L76 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/ManifestUtils.java | ManifestUtils.getExplodedWarManifestAttributes | private Map<Object, Object> getExplodedWarManifestAttributes() {
Map<Object, Object> manifestAttributes = null;
FileInputStream fis = null;
try {
if (servletContext != null) {
final String appServerHome = servletContext.getRealPath("");
final File manifestFile = new File(appServerHome, MANIFEST);
LOGGER.debug("Using Manifest file:{}", manifestFile.getPath());
fis = new FileInputStream(manifestFile);
Manifest mf = new Manifest(fis);
manifestAttributes = mf.getMainAttributes();
}
} catch (Exception e) {
LOGGER.warn("Unable to read the manifest file from the servlet context.");
LOGGER.debug("Unable to read the manifest file", e);
} finally {
IOUtils.closeQuietly(fis);
}
return manifestAttributes;
} | java | private Map<Object, Object> getExplodedWarManifestAttributes() {
Map<Object, Object> manifestAttributes = null;
FileInputStream fis = null;
try {
if (servletContext != null) {
final String appServerHome = servletContext.getRealPath("");
final File manifestFile = new File(appServerHome, MANIFEST);
LOGGER.debug("Using Manifest file:{}", manifestFile.getPath());
fis = new FileInputStream(manifestFile);
Manifest mf = new Manifest(fis);
manifestAttributes = mf.getMainAttributes();
}
} catch (Exception e) {
LOGGER.warn("Unable to read the manifest file from the servlet context.");
LOGGER.debug("Unable to read the manifest file", e);
} finally {
IOUtils.closeQuietly(fis);
}
return manifestAttributes;
} | [
"private",
"Map",
"<",
"Object",
",",
"Object",
">",
"getExplodedWarManifestAttributes",
"(",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"manifestAttributes",
"=",
"null",
";",
"FileInputStream",
"fis",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"se... | reads the manifest from a exploded WAR
@return Map<Object, Object> manifest entries if found otherwise empty map | [
"reads",
"the",
"manifest",
"from",
"a",
"exploded",
"WAR"
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/ManifestUtils.java#L84-L106 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/ManifestUtils.java | ManifestUtils.getPackagedWarManifestAttributes | private Map<Object, Object> getPackagedWarManifestAttributes() {
Map<Object, Object> manifestAttributes = null;
try {
LOGGER.debug("Using Manifest file:{}", servletContext.getResource(MANIFEST).getPath());
Manifest manifest = new Manifest(servletContext.getResourceAsStream(MANIFEST));
manifestAttributes = manifest.getMainAttributes();
} catch (Exception e) {
LOGGER.warn("Unable to read the manifest from the packaged war");
LOGGER.debug("Unable to read the manifest from the packaged", e);
}
return manifestAttributes;
} | java | private Map<Object, Object> getPackagedWarManifestAttributes() {
Map<Object, Object> manifestAttributes = null;
try {
LOGGER.debug("Using Manifest file:{}", servletContext.getResource(MANIFEST).getPath());
Manifest manifest = new Manifest(servletContext.getResourceAsStream(MANIFEST));
manifestAttributes = manifest.getMainAttributes();
} catch (Exception e) {
LOGGER.warn("Unable to read the manifest from the packaged war");
LOGGER.debug("Unable to read the manifest from the packaged", e);
}
return manifestAttributes;
} | [
"private",
"Map",
"<",
"Object",
",",
"Object",
">",
"getPackagedWarManifestAttributes",
"(",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"manifestAttributes",
"=",
"null",
";",
"try",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Using Manifest file:{}\"",
","... | Retrieve the Manifest from a packaged war
@return Map manifest entries if found otherwise empty map | [
"Retrieve",
"the",
"Manifest",
"from",
"a",
"packaged",
"war"
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/ManifestUtils.java#L132-L144 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/location/S2SLocationServiceImpl.java | S2SLocationServiceImpl.getCountryFromCode | @Override
public CountryContract getCountryFromCode(String countryCode) {
if(StringUtils.isBlank(countryCode)) return null;
CountryContract country = getKcCountryService().getCountryByAlternateCode(countryCode);
if(country==null){
country = getKcCountryService().getCountry(countryCode);
}
return country;
} | java | @Override
public CountryContract getCountryFromCode(String countryCode) {
if(StringUtils.isBlank(countryCode)) return null;
CountryContract country = getKcCountryService().getCountryByAlternateCode(countryCode);
if(country==null){
country = getKcCountryService().getCountry(countryCode);
}
return country;
} | [
"@",
"Override",
"public",
"CountryContract",
"getCountryFromCode",
"(",
"String",
"countryCode",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"countryCode",
")",
")",
"return",
"null",
";",
"CountryContract",
"country",
"=",
"getKcCountryService",
"("... | This method is to get a Country object from the country code
@param countryCode country code for the country.
@return Country object matching the code | [
"This",
"method",
"is",
"to",
"get",
"a",
"Country",
"object",
"from",
"the",
"country",
"code"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/location/S2SLocationServiceImpl.java#L47-L55 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/location/S2SLocationServiceImpl.java | S2SLocationServiceImpl.getStateFromName | @Override
public StateContract getStateFromName(String countryAlternateCode, String stateName) {
CountryContract country = getCountryFromCode(countryAlternateCode);
return getKcStateService().getState(country.getCode(), stateName);
} | java | @Override
public StateContract getStateFromName(String countryAlternateCode, String stateName) {
CountryContract country = getCountryFromCode(countryAlternateCode);
return getKcStateService().getState(country.getCode(), stateName);
} | [
"@",
"Override",
"public",
"StateContract",
"getStateFromName",
"(",
"String",
"countryAlternateCode",
",",
"String",
"stateName",
")",
"{",
"CountryContract",
"country",
"=",
"getCountryFromCode",
"(",
"countryAlternateCode",
")",
";",
"return",
"getKcStateService",
"(... | This method is to get a State object from the state name
@param stateName Name of the state
@return State object matching the name. | [
"This",
"method",
"is",
"to",
"get",
"a",
"State",
"object",
"from",
"the",
"state",
"name"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/location/S2SLocationServiceImpl.java#L65-L70 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java | SegmentationHelper.isSegmented | public static boolean isSegmented(Name name, byte marker) {
return name.size() > 0 && name.get(-1).getValue().buf().get(0) == marker;
} | java | public static boolean isSegmented(Name name, byte marker) {
return name.size() > 0 && name.get(-1).getValue().buf().get(0) == marker;
} | [
"public",
"static",
"boolean",
"isSegmented",
"(",
"Name",
"name",
",",
"byte",
"marker",
")",
"{",
"return",
"name",
".",
"size",
"(",
")",
">",
"0",
"&&",
"name",
".",
"get",
"(",
"-",
"1",
")",
".",
"getValue",
"(",
")",
".",
"buf",
"(",
")",
... | Determine if a name is segmented, i.e. if it ends with the correct marker type.
@param name the name of a packet
@param marker the marker type (the initial byte of the component)
@return true if the name is segmented | [
"Determine",
"if",
"a",
"name",
"is",
"segmented",
"i",
".",
"e",
".",
"if",
"it",
"ends",
"with",
"the",
"correct",
"marker",
"type",
"."
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java#L56-L58 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java | SegmentationHelper.parseSegment | public static long parseSegment(Name name, byte marker) throws EncodingException {
if (name.size() == 0) {
throw new EncodingException("No components to parse.");
}
return name.get(-1).toNumberWithMarker(marker);
} | java | public static long parseSegment(Name name, byte marker) throws EncodingException {
if (name.size() == 0) {
throw new EncodingException("No components to parse.");
}
return name.get(-1).toNumberWithMarker(marker);
} | [
"public",
"static",
"long",
"parseSegment",
"(",
"Name",
"name",
",",
"byte",
"marker",
")",
"throws",
"EncodingException",
"{",
"if",
"(",
"name",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"EncodingException",
"(",
"\"No components to pars... | Retrieve the segment number from the last component of a name.
@param name the name of a packet
@param marker the marker type (the initial byte of the component)
@return the segment number
@throws EncodingException if the name does not have a final component of the correct marker type | [
"Retrieve",
"the",
"segment",
"number",
"from",
"the",
"last",
"component",
"of",
"a",
"name",
"."
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java#L68-L73 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java | SegmentationHelper.removeSegment | public static Name removeSegment(Name name, byte marker) {
return isSegmented(name, marker) ? name.getPrefix(-1) : new Name(name);
} | java | public static Name removeSegment(Name name, byte marker) {
return isSegmented(name, marker) ? name.getPrefix(-1) : new Name(name);
} | [
"public",
"static",
"Name",
"removeSegment",
"(",
"Name",
"name",
",",
"byte",
"marker",
")",
"{",
"return",
"isSegmented",
"(",
"name",
",",
"marker",
")",
"?",
"name",
".",
"getPrefix",
"(",
"-",
"1",
")",
":",
"new",
"Name",
"(",
"name",
")",
";",... | Remove a segment component from the end of a name
@param name the name of a packet
@param marker the marker type (the initial byte of the component)
@return the new name with the segment component removed or a copy of the name if no segment component was present | [
"Remove",
"a",
"segment",
"component",
"from",
"the",
"end",
"of",
"a",
"name"
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java#L82-L84 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java | SegmentationHelper.segment | public static List<Data> segment(Data template, InputStream bytes) throws IOException {
return segment(template, bytes, DEFAULT_SEGMENT_SIZE);
} | java | public static List<Data> segment(Data template, InputStream bytes) throws IOException {
return segment(template, bytes, DEFAULT_SEGMENT_SIZE);
} | [
"public",
"static",
"List",
"<",
"Data",
">",
"segment",
"(",
"Data",
"template",
",",
"InputStream",
"bytes",
")",
"throws",
"IOException",
"{",
"return",
"segment",
"(",
"template",
",",
"bytes",
",",
"DEFAULT_SEGMENT_SIZE",
")",
";",
"}"
] | Segment a stream of bytes into a list of Data packets; this must read all
the bytes first in order to determine the end segment for FinalBlockId.
@param template the {@link Data} packet to use for the segment {@link Name}, {@link net.named_data.jndn.MetaInfo},
etc.
@param bytes an {@link InputStream} to the bytes to segment
@return a list of segmented {@link Data} packets
@throws IOException if the stream fails | [
"Segment",
"a",
"stream",
"of",
"bytes",
"into",
"a",
"list",
"of",
"Data",
"packets",
";",
"this",
"must",
"read",
"all",
"the",
"bytes",
"first",
"in",
"order",
"to",
"determine",
"the",
"end",
"segment",
"for",
"FinalBlockId",
"."
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java#L96-L98 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java | SegmentationHelper.readAll | public static byte[] readAll(InputStream bytes) throws IOException {
ByteArrayOutputStream builder = new ByteArrayOutputStream();
int read = bytes.read();
while (read != -1) {
builder.write(read);
read = bytes.read();
}
builder.flush();
bytes.close();
return builder.toByteArray();
} | java | public static byte[] readAll(InputStream bytes) throws IOException {
ByteArrayOutputStream builder = new ByteArrayOutputStream();
int read = bytes.read();
while (read != -1) {
builder.write(read);
read = bytes.read();
}
builder.flush();
bytes.close();
return builder.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"readAll",
"(",
"InputStream",
"bytes",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"builder",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"int",
"read",
"=",
"bytes",
".",
"read",
"(",
")",
";",
... | Read all of the bytes in an input stream.
@param bytes the {@link InputStream} of bytes to read
@return an array of all bytes retrieved from the stream
@throws IOException if the stream fails | [
"Read",
"all",
"of",
"the",
"bytes",
"in",
"an",
"input",
"stream",
"."
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java#L138-L148 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorAction.java | PropertyEditorAction.init | @Override
protected void init(Object target, PropertyInfo propInfo, PropertyGrid propGrid) {
propInfo.getConfig().setProperty("readonly", Boolean.toString(!SecurityUtil.hasDebugRole()));
super.init(target, propInfo, propGrid);
List<IAction> actions = new ArrayList<>(ActionRegistry.getRegisteredActions(ActionScope.BOTH));
Collections.sort(actions, ActionUtil.comparator);
for (IAction action : actions) {
appendItem(action.toString(), action.getId());
}
} | java | @Override
protected void init(Object target, PropertyInfo propInfo, PropertyGrid propGrid) {
propInfo.getConfig().setProperty("readonly", Boolean.toString(!SecurityUtil.hasDebugRole()));
super.init(target, propInfo, propGrid);
List<IAction> actions = new ArrayList<>(ActionRegistry.getRegisteredActions(ActionScope.BOTH));
Collections.sort(actions, ActionUtil.comparator);
for (IAction action : actions) {
appendItem(action.toString(), action.getId());
}
} | [
"@",
"Override",
"protected",
"void",
"init",
"(",
"Object",
"target",
",",
"PropertyInfo",
"propInfo",
",",
"PropertyGrid",
"propGrid",
")",
"{",
"propInfo",
".",
"getConfig",
"(",
")",
".",
"setProperty",
"(",
"\"readonly\"",
",",
"Boolean",
".",
"toString",... | Initialize the list from the action registry. | [
"Initialize",
"the",
"list",
"from",
"the",
"action",
"registry",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorAction.java#L47-L57 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java | GlobalLibraryV2_0Generator.getCountryCodeDataType | public CountryCodeDataType.Enum getCountryCodeDataType(String countryCode) {
CountryCodeDataType.Enum countryCodeDataType = null;
CountryContract country = s2SLocationService.getCountryFromCode(countryCode);
if (country != null) {
StringBuilder countryDetail = new StringBuilder();
countryDetail.append(country.getAlternateCode());
countryDetail.append(": ");
countryDetail.append(country.getName().toUpperCase());
countryCodeDataType = CountryCodeDataType.Enum
.forString(countryDetail.toString());
}
return countryCodeDataType;
} | java | public CountryCodeDataType.Enum getCountryCodeDataType(String countryCode) {
CountryCodeDataType.Enum countryCodeDataType = null;
CountryContract country = s2SLocationService.getCountryFromCode(countryCode);
if (country != null) {
StringBuilder countryDetail = new StringBuilder();
countryDetail.append(country.getAlternateCode());
countryDetail.append(": ");
countryDetail.append(country.getName().toUpperCase());
countryCodeDataType = CountryCodeDataType.Enum
.forString(countryDetail.toString());
}
return countryCodeDataType;
} | [
"public",
"CountryCodeDataType",
".",
"Enum",
"getCountryCodeDataType",
"(",
"String",
"countryCode",
")",
"{",
"CountryCodeDataType",
".",
"Enum",
"countryCodeDataType",
"=",
"null",
";",
"CountryContract",
"country",
"=",
"s2SLocationService",
".",
"getCountryFromCode",... | Create a CountryCodeDataType.Enum as defined in UniversalCodes 2.0 from
the given country code.
@param countryCode
The country code
@return The CountryCodeDataType type corresponding to the given country
code | [
"Create",
"a",
"CountryCodeDataType",
".",
"Enum",
"as",
"defined",
"in",
"UniversalCodes",
"2",
".",
"0",
"from",
"the",
"given",
"country",
"code",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java#L61-L73 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java | GlobalLibraryV2_0Generator.getStateCodeDataType | public StateCodeDataType.Enum getStateCodeDataType(String countryAlternateCode, String stateName) {
StateCodeDataType.Enum stateCodeDataType = null;
StateContract state = s2SLocationService.getStateFromName(countryAlternateCode, stateName);
if (state != null) {
StringBuilder stateDetail = new StringBuilder();
stateDetail.append(state.getCode());
stateDetail.append(": ");
String stateNameCapital = WordUtils.capitalizeFully(state.getName());
stateNameCapital = stateNameCapital.replace(" Of ", " of ");
stateNameCapital = stateNameCapital.replace(" The ", " the ");
stateNameCapital = stateNameCapital.replace(" And ", " and ");
stateDetail.append(stateNameCapital);
stateCodeDataType = StateCodeDataType.Enum.forString(stateDetail
.toString());
}
return stateCodeDataType;
} | java | public StateCodeDataType.Enum getStateCodeDataType(String countryAlternateCode, String stateName) {
StateCodeDataType.Enum stateCodeDataType = null;
StateContract state = s2SLocationService.getStateFromName(countryAlternateCode, stateName);
if (state != null) {
StringBuilder stateDetail = new StringBuilder();
stateDetail.append(state.getCode());
stateDetail.append(": ");
String stateNameCapital = WordUtils.capitalizeFully(state.getName());
stateNameCapital = stateNameCapital.replace(" Of ", " of ");
stateNameCapital = stateNameCapital.replace(" The ", " the ");
stateNameCapital = stateNameCapital.replace(" And ", " and ");
stateDetail.append(stateNameCapital);
stateCodeDataType = StateCodeDataType.Enum.forString(stateDetail
.toString());
}
return stateCodeDataType;
} | [
"public",
"StateCodeDataType",
".",
"Enum",
"getStateCodeDataType",
"(",
"String",
"countryAlternateCode",
",",
"String",
"stateName",
")",
"{",
"StateCodeDataType",
".",
"Enum",
"stateCodeDataType",
"=",
"null",
";",
"StateContract",
"state",
"=",
"s2SLocationService",... | Create a StateCodeDataType.Enum as defined in UniversalCodes 2.0 from the
given name of the state.
@param stateName
The state name
@return The StateCodeDataType type corresponding to the given State code. | [
"Create",
"a",
"StateCodeDataType",
".",
"Enum",
"as",
"defined",
"in",
"UniversalCodes",
"2",
".",
"0",
"from",
"the",
"given",
"name",
"of",
"the",
"state",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java#L83-L99 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java | GlobalLibraryV2_0Generator.getAddressDataType | public AddressDataType getAddressDataType(RolodexContract rolodex) {
AddressDataType addressDataType = AddressDataType.Factory.newInstance();
if (rolodex != null) {
String street1 = rolodex.getAddressLine1();
addressDataType.setStreet1(street1);
String street2 = rolodex.getAddressLine2();
if (street2 != null && !street2.equals("")) {
addressDataType.setStreet2(street2);
}
String city = rolodex.getCity();
addressDataType.setCity(city);
String county = rolodex.getCounty();
if (county != null && !county.equals("")) {
addressDataType.setCounty(county);
}
String postalCode = rolodex.getPostalCode();
if (postalCode != null && !postalCode.equals("")) {
addressDataType.setZipPostalCode(postalCode);
}
String country = rolodex.getCountryCode();
CountryCodeDataType.Enum countryCodeDataType = getCountryCodeDataType(country);
addressDataType.setCountry(countryCodeDataType);
String state = rolodex.getState();
if (state != null && !state.equals("")) {
if (countryCodeDataType != null) {
if (countryCodeDataType
.equals(CountryCodeDataType.USA_UNITED_STATES)) {
addressDataType.setState(getStateCodeDataType(country, state));
} else {
addressDataType.setProvince(state);
}
}
}
}
return addressDataType;
} | java | public AddressDataType getAddressDataType(RolodexContract rolodex) {
AddressDataType addressDataType = AddressDataType.Factory.newInstance();
if (rolodex != null) {
String street1 = rolodex.getAddressLine1();
addressDataType.setStreet1(street1);
String street2 = rolodex.getAddressLine2();
if (street2 != null && !street2.equals("")) {
addressDataType.setStreet2(street2);
}
String city = rolodex.getCity();
addressDataType.setCity(city);
String county = rolodex.getCounty();
if (county != null && !county.equals("")) {
addressDataType.setCounty(county);
}
String postalCode = rolodex.getPostalCode();
if (postalCode != null && !postalCode.equals("")) {
addressDataType.setZipPostalCode(postalCode);
}
String country = rolodex.getCountryCode();
CountryCodeDataType.Enum countryCodeDataType = getCountryCodeDataType(country);
addressDataType.setCountry(countryCodeDataType);
String state = rolodex.getState();
if (state != null && !state.equals("")) {
if (countryCodeDataType != null) {
if (countryCodeDataType
.equals(CountryCodeDataType.USA_UNITED_STATES)) {
addressDataType.setState(getStateCodeDataType(country, state));
} else {
addressDataType.setProvince(state);
}
}
}
}
return addressDataType;
} | [
"public",
"AddressDataType",
"getAddressDataType",
"(",
"RolodexContract",
"rolodex",
")",
"{",
"AddressDataType",
"addressDataType",
"=",
"AddressDataType",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"rolodex",
"!=",
"null",
")",
"{",
"String",... | Create AddressDataType from rolodex entry
@param rolodex
Rolodex entry
@return The AddressDataType corresponding to the rolodex entry. | [
"Create",
"AddressDataType",
"from",
"rolodex",
"entry"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java#L108-L147 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java | GlobalLibraryV2_0Generator.getHumanNameDataType | public HumanNameDataType getHumanNameDataType(ProposalPersonContract person) {
HumanNameDataType humanName = HumanNameDataType.Factory.newInstance();
if (person != null) {
humanName.setFirstName(person.getFirstName());
humanName.setLastName(person.getLastName());
String middleName = person.getMiddleName();
if (middleName != null && !middleName.equals("")) {
humanName.setMiddleName(middleName);
}
}
return humanName;
} | java | public HumanNameDataType getHumanNameDataType(ProposalPersonContract person) {
HumanNameDataType humanName = HumanNameDataType.Factory.newInstance();
if (person != null) {
humanName.setFirstName(person.getFirstName());
humanName.setLastName(person.getLastName());
String middleName = person.getMiddleName();
if (middleName != null && !middleName.equals("")) {
humanName.setMiddleName(middleName);
}
}
return humanName;
} | [
"public",
"HumanNameDataType",
"getHumanNameDataType",
"(",
"ProposalPersonContract",
"person",
")",
"{",
"HumanNameDataType",
"humanName",
"=",
"HumanNameDataType",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"person",
"!=",
"null",
")",
"{",
"h... | Create HumanNameDataType from ProposalPerson object
@param person
ProposalPerson
@return HumanNameDataType corresponding to the ProposalPerson object. | [
"Create",
"HumanNameDataType",
"from",
"ProposalPerson",
"object"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java#L257-L269 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java | GlobalLibraryV2_0Generator.getHumanNameDataType | public HumanNameDataType getHumanNameDataType(RolodexContract rolodex) {
HumanNameDataType humanName = HumanNameDataType.Factory.newInstance();
if (rolodex != null) {
humanName.setFirstName(rolodex.getFirstName());
humanName.setLastName(rolodex.getLastName());
String middleName = rolodex.getMiddleName();
if (middleName != null && !middleName.equals("")) {
humanName.setMiddleName(middleName);
}
}
return humanName;
} | java | public HumanNameDataType getHumanNameDataType(RolodexContract rolodex) {
HumanNameDataType humanName = HumanNameDataType.Factory.newInstance();
if (rolodex != null) {
humanName.setFirstName(rolodex.getFirstName());
humanName.setLastName(rolodex.getLastName());
String middleName = rolodex.getMiddleName();
if (middleName != null && !middleName.equals("")) {
humanName.setMiddleName(middleName);
}
}
return humanName;
} | [
"public",
"HumanNameDataType",
"getHumanNameDataType",
"(",
"RolodexContract",
"rolodex",
")",
"{",
"HumanNameDataType",
"humanName",
"=",
"HumanNameDataType",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"rolodex",
"!=",
"null",
")",
"{",
"humanN... | Create a HumanNameDataType from Rolodex object
@param rolodex
Rolodex object
@return HumanNameDataType corresponding to the rolodex object. | [
"Create",
"a",
"HumanNameDataType",
"from",
"Rolodex",
"object"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java#L300-L312 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java | GlobalLibraryV2_0Generator.getContactPersonDataType | public ContactPersonDataType getContactPersonDataType(ProposalPersonContract person) {
ContactPersonDataType contactPerson = ContactPersonDataType.Factory
.newInstance();
if (person != null) {
contactPerson.setName((getHumanNameDataType(person)));
String phone = person.getOfficePhone();
if (phone != null && !phone.equals("")) {
contactPerson.setPhone(phone);
}
String email = person.getEmailAddress();
if (email != null && !email.equals("")) {
contactPerson.setEmail(email);
}
String title = person.getPrimaryTitle();
if (title != null && !title.equals("")) {
contactPerson.setTitle(title);
}
String fax = person.getFaxNumber();
if (StringUtils.isNotEmpty(fax)) {
contactPerson.setFax(fax);
}
contactPerson.setAddress(getAddressDataType(person));
}
return contactPerson;
} | java | public ContactPersonDataType getContactPersonDataType(ProposalPersonContract person) {
ContactPersonDataType contactPerson = ContactPersonDataType.Factory
.newInstance();
if (person != null) {
contactPerson.setName((getHumanNameDataType(person)));
String phone = person.getOfficePhone();
if (phone != null && !phone.equals("")) {
contactPerson.setPhone(phone);
}
String email = person.getEmailAddress();
if (email != null && !email.equals("")) {
contactPerson.setEmail(email);
}
String title = person.getPrimaryTitle();
if (title != null && !title.equals("")) {
contactPerson.setTitle(title);
}
String fax = person.getFaxNumber();
if (StringUtils.isNotEmpty(fax)) {
contactPerson.setFax(fax);
}
contactPerson.setAddress(getAddressDataType(person));
}
return contactPerson;
} | [
"public",
"ContactPersonDataType",
"getContactPersonDataType",
"(",
"ProposalPersonContract",
"person",
")",
"{",
"ContactPersonDataType",
"contactPerson",
"=",
"ContactPersonDataType",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"person",
"!=",
"null"... | Create ContactPersonDataType from ProposalPerson object
@param person
Proposalperson
@return ContactPersonDataType created from ProposalPerson object | [
"Create",
"ContactPersonDataType",
"from",
"ProposalPerson",
"object"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java#L342-L366 | train |
tomdcc/sham | sham-core/src/main/java/org/shamdata/image/BaseImagePicker.java | BaseImagePicker.nextImageSet | public Map<String, URL> nextImageSet() {
return buildImageSet(dirs.get(random.nextInt(dirs.size())));
} | java | public Map<String, URL> nextImageSet() {
return buildImageSet(dirs.get(random.nextInt(dirs.size())));
} | [
"public",
"Map",
"<",
"String",
",",
"URL",
">",
"nextImageSet",
"(",
")",
"{",
"return",
"buildImageSet",
"(",
"dirs",
".",
"get",
"(",
"random",
".",
"nextInt",
"(",
"dirs",
".",
"size",
"(",
")",
")",
")",
")",
";",
"}"
] | Returns a random image set found as a subdirectory of the base directory.
@return random image set | [
"Returns",
"a",
"random",
"image",
"set",
"found",
"as",
"a",
"subdirectory",
"of",
"the",
"base",
"directory",
"."
] | 33ede5e7130888736d6c84368e16a56e9e31e033 | https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/image/BaseImagePicker.java#L50-L52 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/controller/FrameworkController.java | FrameworkController.getController | public static Object getController(BaseComponent comp, boolean recurse) {
return recurse ? comp.findAttribute(Constants.ATTR_COMPOSER) : comp.getAttribute(Constants.ATTR_COMPOSER);
} | java | public static Object getController(BaseComponent comp, boolean recurse) {
return recurse ? comp.findAttribute(Constants.ATTR_COMPOSER) : comp.getAttribute(Constants.ATTR_COMPOSER);
} | [
"public",
"static",
"Object",
"getController",
"(",
"BaseComponent",
"comp",
",",
"boolean",
"recurse",
")",
"{",
"return",
"recurse",
"?",
"comp",
".",
"findAttribute",
"(",
"Constants",
".",
"ATTR_COMPOSER",
")",
":",
"comp",
".",
"getAttribute",
"(",
"Const... | Returns the controller associated with the specified component, if any.
@param comp The component whose controller is sought.
@param recurse If true, search up the parent chain until a controller is found.
@return The associated controller, or null if none found. | [
"Returns",
"the",
"controller",
"associated",
"with",
"the",
"specified",
"component",
"if",
"any",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/controller/FrameworkController.java#L114-L116 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/controller/FrameworkController.java | FrameworkController.getController | @SuppressWarnings("unchecked")
public static <T> T getController(BaseComponent comp, Class<T> type) {
while (comp != null) {
Object controller = getController(comp);
if (type.isInstance(controller)) {
return (T) controller;
}
comp = comp.getParent();
}
return null;
} | java | @SuppressWarnings("unchecked")
public static <T> T getController(BaseComponent comp, Class<T> type) {
while (comp != null) {
Object controller = getController(comp);
if (type.isInstance(controller)) {
return (T) controller;
}
comp = comp.getParent();
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getController",
"(",
"BaseComponent",
"comp",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"while",
"(",
"comp",
"!=",
"null",
")",
"{",
"Object",
"controller"... | Locates and returns a controller of the given type by searching up the component tree
starting at the specified component.
@param <T> The type of controller sought.
@param comp Component for start of search.
@param type The type of controller sought.
@return The controller instance, or null if not found. | [
"Locates",
"and",
"returns",
"a",
"controller",
"of",
"the",
"given",
"type",
"by",
"searching",
"up",
"the",
"component",
"tree",
"starting",
"at",
"the",
"specified",
"component",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/controller/FrameworkController.java#L127-L140 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/controller/FrameworkController.java | FrameworkController.afterInitialized | @Override
public void afterInitialized(BaseComponent comp) {
root = (BaseUIComponent) comp;
this.comp = root;
comp.setAttribute(Constants.ATTR_COMPOSER, this);
comp.addEventListener(ThreadEx.ON_THREAD_COMPLETE, threadCompletionListener);
appContext = SpringUtil.getAppContext();
appFramework = FrameworkUtil.getAppFramework();
eventManager = EventManager.getInstance();
initialize();
} | java | @Override
public void afterInitialized(BaseComponent comp) {
root = (BaseUIComponent) comp;
this.comp = root;
comp.setAttribute(Constants.ATTR_COMPOSER, this);
comp.addEventListener(ThreadEx.ON_THREAD_COMPLETE, threadCompletionListener);
appContext = SpringUtil.getAppContext();
appFramework = FrameworkUtil.getAppFramework();
eventManager = EventManager.getInstance();
initialize();
} | [
"@",
"Override",
"public",
"void",
"afterInitialized",
"(",
"BaseComponent",
"comp",
")",
"{",
"root",
"=",
"(",
"BaseUIComponent",
")",
"comp",
";",
"this",
".",
"comp",
"=",
"root",
";",
"comp",
".",
"setAttribute",
"(",
"Constants",
".",
"ATTR_COMPOSER",
... | Override the doAfterCompose method to set references to the application context and the
framework and register the controller with the framework.
@param comp BaseComponent associated with this controller. | [
"Override",
"the",
"doAfterCompose",
"method",
"to",
"set",
"references",
"to",
"the",
"application",
"context",
"and",
"the",
"framework",
"and",
"register",
"the",
"controller",
"with",
"the",
"framework",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/controller/FrameworkController.java#L175-L185 | train |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/DropContainer.java | DropContainer.render | public static DropContainer render(BaseComponent dropRoot, BaseComponent droppedItem) {
IDropRenderer dropRenderer = DropUtil.getDropRenderer(droppedItem);
if (dropRenderer == null || !dropRenderer.isEnabled()) {
return null;
}
BaseComponent renderedItem = dropRenderer.renderDroppedItem(droppedItem);
DropContainer dropContainer = null;
if (renderedItem != null) {
String title = dropRenderer.getDisplayText(droppedItem);
dropContainer = renderedItem.getAncestor(DropContainer.class);
if (dropContainer != null) {
dropContainer.setTitle(title);
dropContainer.moveToTop(dropRoot);
} else {
dropContainer = DropContainer.create(dropRoot, renderedItem, title,
InfoPanelService.getActionListeners(droppedItem));
}
}
return dropContainer;
} | java | public static DropContainer render(BaseComponent dropRoot, BaseComponent droppedItem) {
IDropRenderer dropRenderer = DropUtil.getDropRenderer(droppedItem);
if (dropRenderer == null || !dropRenderer.isEnabled()) {
return null;
}
BaseComponent renderedItem = dropRenderer.renderDroppedItem(droppedItem);
DropContainer dropContainer = null;
if (renderedItem != null) {
String title = dropRenderer.getDisplayText(droppedItem);
dropContainer = renderedItem.getAncestor(DropContainer.class);
if (dropContainer != null) {
dropContainer.setTitle(title);
dropContainer.moveToTop(dropRoot);
} else {
dropContainer = DropContainer.create(dropRoot, renderedItem, title,
InfoPanelService.getActionListeners(droppedItem));
}
}
return dropContainer;
} | [
"public",
"static",
"DropContainer",
"render",
"(",
"BaseComponent",
"dropRoot",
",",
"BaseComponent",
"droppedItem",
")",
"{",
"IDropRenderer",
"dropRenderer",
"=",
"DropUtil",
".",
"getDropRenderer",
"(",
"droppedItem",
")",
";",
"if",
"(",
"dropRenderer",
"==",
... | Renders a droppedItem in a container.
@param dropRoot The root component that will host the container.
@param droppedItem The item being dropped.
@return The container hosting the rendered item. If the droppedItem was previously rendered,
its hosting container is returned after moving it in front of its siblings. If the
droppedItem is successfully rendered, its newly created container is returned. If the
droppedItem cannot be rendered, null will be returned. | [
"Renders",
"a",
"droppedItem",
"in",
"a",
"container",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/DropContainer.java#L62-L86 | train |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/DropContainer.java | DropContainer.create | private static DropContainer create(BaseComponent dropRoot, BaseComponent cmpt, String title,
List<ActionListener> actionListeners) {
DropContainer dc = (DropContainer) PageUtil.createPage(TEMPLATE, null);
dc.actionListeners = actionListeners;
dc.setTitle(title);
dc.setDropid(SCLASS);
dc.setDragid(SCLASS);
dc.addChild(cmpt);
dc.moveToTop(dropRoot);
ActionListener.bindActionListeners(dc, actionListeners);
return dc;
} | java | private static DropContainer create(BaseComponent dropRoot, BaseComponent cmpt, String title,
List<ActionListener> actionListeners) {
DropContainer dc = (DropContainer) PageUtil.createPage(TEMPLATE, null);
dc.actionListeners = actionListeners;
dc.setTitle(title);
dc.setDropid(SCLASS);
dc.setDragid(SCLASS);
dc.addChild(cmpt);
dc.moveToTop(dropRoot);
ActionListener.bindActionListeners(dc, actionListeners);
return dc;
} | [
"private",
"static",
"DropContainer",
"create",
"(",
"BaseComponent",
"dropRoot",
",",
"BaseComponent",
"cmpt",
",",
"String",
"title",
",",
"List",
"<",
"ActionListener",
">",
"actionListeners",
")",
"{",
"DropContainer",
"dc",
"=",
"(",
"DropContainer",
")",
"... | Creates a new container for the contents to be rendered by the drop provider.
@param dropRoot The root component that will host the container.
@param cmpt BaseComponent rendered by the drop renderer.
@param title Title to be associated with the container.
@param actionListeners Listeners to be bound to the drop container (optional).
@return The drop container. | [
"Creates",
"a",
"new",
"container",
"for",
"the",
"contents",
"to",
"be",
"rendered",
"by",
"the",
"drop",
"provider",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/DropContainer.java#L97-L108 | train |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/DropContainer.java | DropContainer.doAction | @Override
public void doAction(Action action) {
switch (action) {
case REMOVE:
close();
break;
case HIDE:
setVisible(false);
break;
case SHOW:
setVisible(true);
break;
case COLLAPSE:
setSize(Size.MINIMIZED);
break;
case EXPAND:
setSize(Size.NORMAL);
break;
case TOP:
moveToTop();
break;
}
} | java | @Override
public void doAction(Action action) {
switch (action) {
case REMOVE:
close();
break;
case HIDE:
setVisible(false);
break;
case SHOW:
setVisible(true);
break;
case COLLAPSE:
setSize(Size.MINIMIZED);
break;
case EXPAND:
setSize(Size.NORMAL);
break;
case TOP:
moveToTop();
break;
}
} | [
"@",
"Override",
"public",
"void",
"doAction",
"(",
"Action",
"action",
")",
"{",
"switch",
"(",
"action",
")",
"{",
"case",
"REMOVE",
":",
"close",
"(",
")",
";",
"break",
";",
"case",
"HIDE",
":",
"setVisible",
"(",
"false",
")",
";",
"break",
";",... | Perform the specified action on the drop container.
@param action An action. | [
"Perform",
"the",
"specified",
"action",
"on",
"the",
"drop",
"container",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/DropContainer.java#L115-L142 | train |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/DropContainer.java | DropContainer.onDrop | @EventHandler("drop")
private void onDrop(DropEvent event) {
BaseComponent dragged = event.getRelatedTarget();
if (dragged instanceof DropContainer) {
getParent().addChild(dragged, this);
}
} | java | @EventHandler("drop")
private void onDrop(DropEvent event) {
BaseComponent dragged = event.getRelatedTarget();
if (dragged instanceof DropContainer) {
getParent().addChild(dragged, this);
}
} | [
"@",
"EventHandler",
"(",
"\"drop\"",
")",
"private",
"void",
"onDrop",
"(",
"DropEvent",
"event",
")",
"{",
"BaseComponent",
"dragged",
"=",
"event",
".",
"getRelatedTarget",
"(",
")",
";",
"if",
"(",
"dragged",
"instanceof",
"DropContainer",
")",
"{",
"get... | Supports dragging drop container to a new position in the stream.
@param event The drop event. | [
"Supports",
"dragging",
"drop",
"container",
"to",
"a",
"new",
"position",
"in",
"the",
"stream",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/DropContainer.java#L168-L175 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/manifest/BaseRenderer.java | BaseRenderer.addContent | public Span addContent(Row row, String label) {
Span cell = new Span();
cell.addChild(CWFUtil.getTextComponent(label));
row.addChild(cell);
return cell;
} | java | public Span addContent(Row row, String label) {
Span cell = new Span();
cell.addChild(CWFUtil.getTextComponent(label));
row.addChild(cell);
return cell;
} | [
"public",
"Span",
"addContent",
"(",
"Row",
"row",
",",
"String",
"label",
")",
"{",
"Span",
"cell",
"=",
"new",
"Span",
"(",
")",
";",
"cell",
".",
"addChild",
"(",
"CWFUtil",
".",
"getTextComponent",
"(",
"label",
")",
")",
";",
"row",
".",
"addChi... | Adds a cell with the specified content to the grid row.
@param row List row.
@param label Content for cell. Auto-detects type of content.
@return Newly created cell. | [
"Adds",
"a",
"cell",
"with",
"the",
"specified",
"content",
"to",
"the",
"grid",
"row",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/manifest/BaseRenderer.java#L28-L33 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/manifest/BaseRenderer.java | BaseRenderer.addCell | public Cell addCell(Row row, String label) {
Cell cell = new Cell(label);
row.addChild(cell);
return cell;
} | java | public Cell addCell(Row row, String label) {
Cell cell = new Cell(label);
row.addChild(cell);
return cell;
} | [
"public",
"Cell",
"addCell",
"(",
"Row",
"row",
",",
"String",
"label",
")",
"{",
"Cell",
"cell",
"=",
"new",
"Cell",
"(",
"label",
")",
";",
"row",
".",
"addChild",
"(",
"cell",
")",
";",
"return",
"cell",
";",
"}"
] | Adds a cell to the grid row.
@param row List row.
@param label Label text for cell.
@return Newly created cell. | [
"Adds",
"a",
"cell",
"to",
"the",
"grid",
"row",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/manifest/BaseRenderer.java#L42-L46 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/manifest/BaseRenderer.java | BaseRenderer.addColumn | public Column addColumn(Grid grid, String label, String width, String sortBy) {
Column column = new Column();
grid.getColumns().addChild(column);
column.setLabel(label);
column.setWidth(width);
column.setSortComparator(sortBy);
column.setSortOrder(SortOrder.ASCENDING);
return column;
} | java | public Column addColumn(Grid grid, String label, String width, String sortBy) {
Column column = new Column();
grid.getColumns().addChild(column);
column.setLabel(label);
column.setWidth(width);
column.setSortComparator(sortBy);
column.setSortOrder(SortOrder.ASCENDING);
return column;
} | [
"public",
"Column",
"addColumn",
"(",
"Grid",
"grid",
",",
"String",
"label",
",",
"String",
"width",
",",
"String",
"sortBy",
")",
"{",
"Column",
"column",
"=",
"new",
"Column",
"(",
")",
";",
"grid",
".",
"getColumns",
"(",
")",
".",
"addChild",
"(",... | Adds a column to a grid.
@param grid Grid.
@param label Label for column.
@param width Width for column.
@param sortBy Field for sorting.
@return Newly created column. | [
"Adds",
"a",
"column",
"to",
"a",
"grid",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/manifest/BaseRenderer.java#L57-L65 | train |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/report/FileReportGenerator.java | FileReportGenerator.outputNameFor | public String outputNameFor(String output) {
Report report = openReport(output);
return outputNameOf(report);
} | java | public String outputNameFor(String output) {
Report report = openReport(output);
return outputNameOf(report);
} | [
"public",
"String",
"outputNameFor",
"(",
"String",
"output",
")",
"{",
"Report",
"report",
"=",
"openReport",
"(",
"output",
")",
";",
"return",
"outputNameOf",
"(",
"report",
")",
";",
"}"
] | Utility method to guess the output name generated for this output parameter.
@param output the specified output.
@return the real generated filename. | [
"Utility",
"method",
"to",
"guess",
"the",
"output",
"name",
"generated",
"for",
"this",
"output",
"parameter",
"."
] | 2a61e6c179b74085babcc559d677490b0cad2d30 | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/report/FileReportGenerator.java#L123-L126 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorEnum.java | PropertyEditorEnum.init | @Override
protected void init(Object target, PropertyInfo propInfo, PropertyGrid propGrid) {
super.init(target, propInfo, propGrid);
Iterable<?> iter = (Iterable<?>) propInfo.getPropertyType().getSerializer();
for (Object value : iter) {
appendItem(value.toString(), value);
}
} | java | @Override
protected void init(Object target, PropertyInfo propInfo, PropertyGrid propGrid) {
super.init(target, propInfo, propGrid);
Iterable<?> iter = (Iterable<?>) propInfo.getPropertyType().getSerializer();
for (Object value : iter) {
appendItem(value.toString(), value);
}
} | [
"@",
"Override",
"protected",
"void",
"init",
"(",
"Object",
"target",
",",
"PropertyInfo",
"propInfo",
",",
"PropertyGrid",
"propGrid",
")",
"{",
"super",
".",
"init",
"(",
"target",
",",
"propInfo",
",",
"propGrid",
")",
";",
"Iterable",
"<",
"?",
">",
... | Initialize the list, based on the configuration data which can specify an enumeration class,
an iterable class, or the id of an iterable bean. | [
"Initialize",
"the",
"list",
"based",
"on",
"the",
"configuration",
"data",
"which",
"can",
"specify",
"an",
"enumeration",
"class",
"an",
"iterable",
"class",
"or",
"the",
"id",
"of",
"an",
"iterable",
"bean",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorEnum.java#L41-L51 | train |
avarabyeu/jashing | jashing/src/main/java/com/github/avarabyeu/jashing/core/Jashing.java | Jashing.bootstrap | public Jashing bootstrap() {
if (bootstrapped.compareAndSet(false, true)) {
/* bootstrap event sources* */
ServiceManager eventSources = injector.getInstance(ServiceManager.class);
eventSources.startAsync();
/* bootstrap server */
Service application = injector.getInstance(JashingServer.class);
application.startAsync();
Runtime.getRuntime().addShutdownHook(shutdownHook);
LOGGER.info("Jashing has started!");
} else {
throw new IllegalStateException("Jashing already bootstrapped");
}
return this;
} | java | public Jashing bootstrap() {
if (bootstrapped.compareAndSet(false, true)) {
/* bootstrap event sources* */
ServiceManager eventSources = injector.getInstance(ServiceManager.class);
eventSources.startAsync();
/* bootstrap server */
Service application = injector.getInstance(JashingServer.class);
application.startAsync();
Runtime.getRuntime().addShutdownHook(shutdownHook);
LOGGER.info("Jashing has started!");
} else {
throw new IllegalStateException("Jashing already bootstrapped");
}
return this;
} | [
"public",
"Jashing",
"bootstrap",
"(",
")",
"{",
"if",
"(",
"bootstrapped",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"/* bootstrap event sources* */",
"ServiceManager",
"eventSources",
"=",
"injector",
".",
"getInstance",
"(",
"ServiceManage... | Bootstaps Jashing. This operation is allowed only once. Bootstrapping already started Jashing is not permitted
@return yourself | [
"Bootstaps",
"Jashing",
".",
"This",
"operation",
"is",
"allowed",
"only",
"once",
".",
"Bootstrapping",
"already",
"started",
"Jashing",
"is",
"not",
"permitted"
] | fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8 | https://github.com/avarabyeu/jashing/blob/fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8/jashing/src/main/java/com/github/avarabyeu/jashing/core/Jashing.java#L44-L61 | train |
avarabyeu/jashing | jashing/src/main/java/com/github/avarabyeu/jashing/core/Jashing.java | Jashing.shutdown | public void shutdown() {
if (bootstrapped.compareAndSet(true, false)) {
LOGGER.info("Shutting down Jashing...");
injector.getInstance(ServiceManager.class).stopAsync().awaitStopped();
injector.getInstance(JashingServer.class).stopAsync().awaitTerminated();
/* shutdown method might be called by this hook. So, trying to remove
* hook which is currently is progress causes error
*/
if (!shutdownHook.isAlive()) {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
}
LOGGER.info("Jashing has stopped.");
} else {
throw new IllegalStateException("Jashing is not bootstrapped");
}
} | java | public void shutdown() {
if (bootstrapped.compareAndSet(true, false)) {
LOGGER.info("Shutting down Jashing...");
injector.getInstance(ServiceManager.class).stopAsync().awaitStopped();
injector.getInstance(JashingServer.class).stopAsync().awaitTerminated();
/* shutdown method might be called by this hook. So, trying to remove
* hook which is currently is progress causes error
*/
if (!shutdownHook.isAlive()) {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
}
LOGGER.info("Jashing has stopped.");
} else {
throw new IllegalStateException("Jashing is not bootstrapped");
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"bootstrapped",
".",
"compareAndSet",
"(",
"true",
",",
"false",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Shutting down Jashing...\"",
")",
";",
"injector",
".",
"getInstance",
"(",
"ServiceManager... | Shutdowns Jashing. Permitted only for bootstrapped instance | [
"Shutdowns",
"Jashing",
".",
"Permitted",
"only",
"for",
"bootstrapped",
"instance"
] | fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8 | https://github.com/avarabyeu/jashing/blob/fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8/jashing/src/main/java/com/github/avarabyeu/jashing/core/Jashing.java#L66-L84 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutUtil.java | LayoutUtil.copyAttributes | public static void copyAttributes(Element source, Map<String, String> dest) {
NamedNodeMap attributes = source.getAttributes();
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
dest.put(attribute.getNodeName(), attribute.getNodeValue());
}
}
} | java | public static void copyAttributes(Element source, Map<String, String> dest) {
NamedNodeMap attributes = source.getAttributes();
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
dest.put(attribute.getNodeName(), attribute.getNodeValue());
}
}
} | [
"public",
"static",
"void",
"copyAttributes",
"(",
"Element",
"source",
",",
"Map",
"<",
"String",
",",
"String",
">",
"dest",
")",
"{",
"NamedNodeMap",
"attributes",
"=",
"source",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"!=",
"null"... | Copy attributes from a DOM node to a map.
@param source DOM node.
@param dest Destination map. | [
"Copy",
"attributes",
"from",
"a",
"DOM",
"node",
"to",
"a",
"map",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutUtil.java#L147-L156 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutUtil.java | LayoutUtil.copyAttributes | public static void copyAttributes(Map<String, String> source, Element dest) {
for (Entry<String, String> entry : source.entrySet()) {
dest.setAttribute(entry.getKey(), entry.getValue());
}
} | java | public static void copyAttributes(Map<String, String> source, Element dest) {
for (Entry<String, String> entry : source.entrySet()) {
dest.setAttribute(entry.getKey(), entry.getValue());
}
} | [
"public",
"static",
"void",
"copyAttributes",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"source",
",",
"Element",
"dest",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"source",
".",
"entrySet",
"(",
")",
")",
"... | Copy attributes from a map to a DOM node.
@param source Source map.
@param dest DOM node. | [
"Copy",
"attributes",
"from",
"a",
"map",
"to",
"a",
"DOM",
"node",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutUtil.java#L164-L168 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java | HelpView.initTopicTree | private void initTopicTree() {
DefaultMutableTreeNode topicTree = getDataAsTree();
if (topicTree != null) {
initTopicTree(rootNode, topicTree.getRoot());
}
} | java | private void initTopicTree() {
DefaultMutableTreeNode topicTree = getDataAsTree();
if (topicTree != null) {
initTopicTree(rootNode, topicTree.getRoot());
}
} | [
"private",
"void",
"initTopicTree",
"(",
")",
"{",
"DefaultMutableTreeNode",
"topicTree",
"=",
"getDataAsTree",
"(",
")",
";",
"if",
"(",
"topicTree",
"!=",
"null",
")",
"{",
"initTopicTree",
"(",
"rootNode",
",",
"topicTree",
".",
"getRoot",
"(",
")",
")",
... | Initializes the topic tree, if there is one associated with this view. | [
"Initializes",
"the",
"topic",
"tree",
"if",
"there",
"is",
"one",
"associated",
"with",
"this",
"view",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java#L68-L75 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java | HelpView.initTopicTree | private void initTopicTree(HelpTopicNode htnParent, TreeNode ttnParent) {
for (int i = 0; i < ttnParent.getChildCount(); i++) {
TreeNode ttnChild = ttnParent.getChildAt(i);
HelpTopic ht = getTopic(ttnChild);
HelpTopicNode htnChild = new HelpTopicNode(ht);
htnParent.addChild(htnChild);
initTopicTree(htnChild, ttnChild);
}
} | java | private void initTopicTree(HelpTopicNode htnParent, TreeNode ttnParent) {
for (int i = 0; i < ttnParent.getChildCount(); i++) {
TreeNode ttnChild = ttnParent.getChildAt(i);
HelpTopic ht = getTopic(ttnChild);
HelpTopicNode htnChild = new HelpTopicNode(ht);
htnParent.addChild(htnChild);
initTopicTree(htnChild, ttnChild);
}
} | [
"private",
"void",
"initTopicTree",
"(",
"HelpTopicNode",
"htnParent",
",",
"TreeNode",
"ttnParent",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ttnParent",
".",
"getChildCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"TreeNode",
"ttnChild",... | Duplicates JavaHelp topic tree into HelpTopicNode-based tree.
@param htnParent Current parent for HelpTopicNode-based tree.
@param ttnParent Current parent for JavaHelp TreeNode-based tree. | [
"Duplicates",
"JavaHelp",
"topic",
"tree",
"into",
"HelpTopicNode",
"-",
"based",
"tree",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java#L83-L93 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java | HelpView.getDataAsTree | protected DefaultMutableTreeNode getDataAsTree() {
try {
return (DefaultMutableTreeNode) MethodUtils.invokeMethod(view, "getDataAsTree", null);
} catch (Exception e) {
return null;
}
} | java | protected DefaultMutableTreeNode getDataAsTree() {
try {
return (DefaultMutableTreeNode) MethodUtils.invokeMethod(view, "getDataAsTree", null);
} catch (Exception e) {
return null;
}
} | [
"protected",
"DefaultMutableTreeNode",
"getDataAsTree",
"(",
")",
"{",
"try",
"{",
"return",
"(",
"DefaultMutableTreeNode",
")",
"MethodUtils",
".",
"invokeMethod",
"(",
"view",
",",
"\"getDataAsTree\"",
",",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"e"... | Invokes the "getDataAsTree" method on the underlying view, if such a method exists.
@return The view's topic tree, or null if none. | [
"Invokes",
"the",
"getDataAsTree",
"method",
"on",
"the",
"underlying",
"view",
"if",
"such",
"a",
"method",
"exists",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.javahelp/src/main/java/org/carewebframework/help/javahelp/HelpView.java#L124-L130 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java | TreeUtil.findNodeByLabel | public static Treenode findNodeByLabel(Treeview tree, String label, boolean caseSensitive) {
for (Treenode item : tree.getChildren(Treenode.class)) {
if (caseSensitive ? label.equals(item.getLabel()) : label.equalsIgnoreCase(item.getLabel())) {
return item;
}
}
return null;
} | java | public static Treenode findNodeByLabel(Treeview tree, String label, boolean caseSensitive) {
for (Treenode item : tree.getChildren(Treenode.class)) {
if (caseSensitive ? label.equals(item.getLabel()) : label.equalsIgnoreCase(item.getLabel())) {
return item;
}
}
return null;
} | [
"public",
"static",
"Treenode",
"findNodeByLabel",
"(",
"Treeview",
"tree",
",",
"String",
"label",
",",
"boolean",
"caseSensitive",
")",
"{",
"for",
"(",
"Treenode",
"item",
":",
"tree",
".",
"getChildren",
"(",
"Treenode",
".",
"class",
")",
")",
"{",
"i... | Search the entire tree for a tree item matching the specified label.
@param tree Tree containing the item of interest.
@param label Label to match.
@param caseSensitive If true, match is case-sensitive.
@return The matching tree item, or null if not found. | [
"Search",
"the",
"entire",
"tree",
"for",
"a",
"tree",
"item",
"matching",
"the",
"specified",
"label",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java#L172-L180 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java | TreeUtil.getPath | public static String getPath(Treenode item, boolean useLabels) {
StringBuilder sb = new StringBuilder();
boolean needsDelim = false;
while (item != null) {
if (needsDelim) {
sb.insert(0, '\\');
} else {
needsDelim = true;
}
sb.insert(0, useLabels ? item.getLabel() : item.getIndex());
item = (Treenode) item.getParent();
}
return sb.toString();
} | java | public static String getPath(Treenode item, boolean useLabels) {
StringBuilder sb = new StringBuilder();
boolean needsDelim = false;
while (item != null) {
if (needsDelim) {
sb.insert(0, '\\');
} else {
needsDelim = true;
}
sb.insert(0, useLabels ? item.getLabel() : item.getIndex());
item = (Treenode) item.getParent();
}
return sb.toString();
} | [
"public",
"static",
"String",
"getPath",
"(",
"Treenode",
"item",
",",
"boolean",
"useLabels",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"needsDelim",
"=",
"false",
";",
"while",
"(",
"item",
"!=",
"null",
")",... | Returns the path of the specified tree node. This consists of the indexes or labels of this
and all parent nodes separated by a "\" character.
@param item The node (tree item) whose path is to be returned. If this value is null, a zero
length string is returned.
@param useLabels If true, use the labels as identifiers; otherwise, use indexes.
@return The path of the node as described. | [
"Returns",
"the",
"path",
"of",
"the",
"specified",
"tree",
"node",
".",
"This",
"consists",
"of",
"the",
"indexes",
"or",
"labels",
"of",
"this",
"and",
"all",
"parent",
"nodes",
"separated",
"by",
"a",
"\\",
"character",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java#L191-L207 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java | TreeUtil.sort | public static void sort(BaseComponent parent, boolean recurse) {
if (parent == null || parent.getChildren().size() < 2) {
return;
}
int i = 1;
int size = parent.getChildren().size();
while (i < size) {
Treenode item1 = (Treenode) parent.getChildren().get(i - 1);
Treenode item2 = (Treenode) parent.getChildren().get(i);
if (compare(item1, item2) > 0) {
parent.swapChildren(i - 1, i);
i = i == 1 ? 2 : i - 1;
} else {
i++;
}
}
if (recurse) {
for (BaseComponent child : parent.getChildren()) {
sort(child, recurse);
}
}
} | java | public static void sort(BaseComponent parent, boolean recurse) {
if (parent == null || parent.getChildren().size() < 2) {
return;
}
int i = 1;
int size = parent.getChildren().size();
while (i < size) {
Treenode item1 = (Treenode) parent.getChildren().get(i - 1);
Treenode item2 = (Treenode) parent.getChildren().get(i);
if (compare(item1, item2) > 0) {
parent.swapChildren(i - 1, i);
i = i == 1 ? 2 : i - 1;
} else {
i++;
}
}
if (recurse) {
for (BaseComponent child : parent.getChildren()) {
sort(child, recurse);
}
}
} | [
"public",
"static",
"void",
"sort",
"(",
"BaseComponent",
"parent",
",",
"boolean",
"recurse",
")",
"{",
"if",
"(",
"parent",
"==",
"null",
"||",
"parent",
".",
"getChildren",
"(",
")",
".",
"size",
"(",
")",
"<",
"2",
")",
"{",
"return",
";",
"}",
... | Alphabetically sorts children under the specified parent.
@param parent Parent whose child nodes (Treenode) are to be sorted.
@param recurse If true, sorting is recursed through all children. | [
"Alphabetically",
"sorts",
"children",
"under",
"the",
"specified",
"parent",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java#L224-L249 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java | TreeUtil.compare | private static int compare(Treenode item1, Treenode item2) {
String label1 = item1.getLabel();
String label2 = item2.getLabel();
return label1 == label2 ? 0 : label1 == null ? -1 : label2 == null ? -1 : label1.compareToIgnoreCase(label2);
} | java | private static int compare(Treenode item1, Treenode item2) {
String label1 = item1.getLabel();
String label2 = item2.getLabel();
return label1 == label2 ? 0 : label1 == null ? -1 : label2 == null ? -1 : label1.compareToIgnoreCase(label2);
} | [
"private",
"static",
"int",
"compare",
"(",
"Treenode",
"item1",
",",
"Treenode",
"item2",
")",
"{",
"String",
"label1",
"=",
"item1",
".",
"getLabel",
"(",
")",
";",
"String",
"label2",
"=",
"item2",
".",
"getLabel",
"(",
")",
";",
"return",
"label1",
... | Case insensitive comparison of labels of two tree items.
@param item1 First tree item.
@param item2 Second tree item.
@return Result of the comparison. | [
"Case",
"insensitive",
"comparison",
"of",
"labels",
"of",
"two",
"tree",
"items",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java#L258-L262 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java | TreeUtil.search | private static Treenode search(Iterable<Treenode> root, String text, ITreenodeSearch search) {
for (Treenode node : root) {
if (search.isMatch(node, text)) {
return node;
}
}
return null;
} | java | private static Treenode search(Iterable<Treenode> root, String text, ITreenodeSearch search) {
for (Treenode node : root) {
if (search.isMatch(node, text)) {
return node;
}
}
return null;
} | [
"private",
"static",
"Treenode",
"search",
"(",
"Iterable",
"<",
"Treenode",
">",
"root",
",",
"String",
"text",
",",
"ITreenodeSearch",
"search",
")",
"{",
"for",
"(",
"Treenode",
"node",
":",
"root",
")",
"{",
"if",
"(",
"search",
".",
"isMatch",
"(",
... | Search the tree for a tree node whose label contains the specified text.
@param root Node where search should begin.
@param text Text to find.
@param search Search logic.
@return The first matching tree item after the last item, or null if none found. | [
"Search",
"the",
"tree",
"for",
"a",
"tree",
"node",
"whose",
"label",
"contains",
"the",
"specified",
"text",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java#L336-L343 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandRegistry.java | CommandRegistry.get | public Command get(String commandName, boolean forceCreate) {
Command command = commands.get(commandName);
if (command == null && forceCreate) {
command = new Command(commandName);
add(command);
}
return command;
} | java | public Command get(String commandName, boolean forceCreate) {
Command command = commands.get(commandName);
if (command == null && forceCreate) {
command = new Command(commandName);
add(command);
}
return command;
} | [
"public",
"Command",
"get",
"(",
"String",
"commandName",
",",
"boolean",
"forceCreate",
")",
"{",
"Command",
"command",
"=",
"commands",
".",
"get",
"(",
"commandName",
")",
";",
"if",
"(",
"command",
"==",
"null",
"&&",
"forceCreate",
")",
"{",
"command"... | Retrieves the command associated with the specified name from the registry.
@param commandName Name of the command sought.
@param forceCreate If true and the command does not exist, one is created and added to the
registry.
@return The associated command, or null if it does not exist (and forceCreate is false). | [
"Retrieves",
"the",
"command",
"associated",
"with",
"the",
"specified",
"name",
"from",
"the",
"registry",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandRegistry.java#L84-L93 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandRegistry.java | CommandRegistry.bindShortcuts | private void bindShortcuts(Map<Object, Object> shortcuts) {
for (Object commandName : shortcuts.keySet()) {
bindShortcuts(commandName.toString(), shortcuts.get(commandName).toString());
}
} | java | private void bindShortcuts(Map<Object, Object> shortcuts) {
for (Object commandName : shortcuts.keySet()) {
bindShortcuts(commandName.toString(), shortcuts.get(commandName).toString());
}
} | [
"private",
"void",
"bindShortcuts",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"shortcuts",
")",
"{",
"for",
"(",
"Object",
"commandName",
":",
"shortcuts",
".",
"keySet",
"(",
")",
")",
"{",
"bindShortcuts",
"(",
"commandName",
".",
"toString",
"(",
... | Binds the shortcuts specified in the map to the associated commands. The map key is the
command name and the associated value is a list of shortcuts bound to the command.
@param shortcuts Shortcut map. | [
"Binds",
"the",
"shortcuts",
"specified",
"in",
"the",
"map",
"to",
"the",
"associated",
"commands",
".",
"The",
"map",
"key",
"is",
"the",
"command",
"name",
"and",
"the",
"associated",
"value",
"is",
"a",
"list",
"of",
"shortcuts",
"bound",
"to",
"the",
... | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandRegistry.java#L101-L105 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/property/PropertiesLoaderBuilder.java | PropertiesLoaderBuilder.loadProperty | public PropertiesLoaderBuilder loadProperty(String name) {
if (env.containsProperty(name)) {
props.put(name, env.getProperty(name));
}
return this;
} | java | public PropertiesLoaderBuilder loadProperty(String name) {
if (env.containsProperty(name)) {
props.put(name, env.getProperty(name));
}
return this;
} | [
"public",
"PropertiesLoaderBuilder",
"loadProperty",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"env",
".",
"containsProperty",
"(",
"name",
")",
")",
"{",
"props",
".",
"put",
"(",
"name",
",",
"env",
".",
"getProperty",
"(",
"name",
")",
")",
";",
"... | Loads a property from Spring Context by the name.
@param name of the property to be loaded from Spring Context.
@return PropertyLoaderBuilder to continue the builder chain | [
"Loads",
"a",
"property",
"from",
"Spring",
"Context",
"by",
"the",
"name",
"."
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/property/PropertiesLoaderBuilder.java#L43-L48 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/property/PropertiesLoaderBuilder.java | PropertiesLoaderBuilder.addProperty | public PropertiesLoaderBuilder addProperty(String name, String value) {
props.put(name, value);
return this;
} | java | public PropertiesLoaderBuilder addProperty(String name, String value) {
props.put(name, value);
return this;
} | [
"public",
"PropertiesLoaderBuilder",
"addProperty",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"props",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a new property. Giving both name and value.
This methods does not lookup in the Spring Context, it only adds property and value as given.
@param name to be added in the properties
@param value to be added in the properties
@return PropertyLoaderBuilder to continue the builder chain | [
"Adds",
"a",
"new",
"property",
".",
"Giving",
"both",
"name",
"and",
"value",
".",
"This",
"methods",
"does",
"not",
"lookup",
"in",
"the",
"Spring",
"Context",
"it",
"only",
"adds",
"property",
"and",
"value",
"as",
"given",
"."
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/property/PropertiesLoaderBuilder.java#L58-L61 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/render/AbstractRenderer.java | AbstractRenderer.createCell | protected <C extends BaseUIComponent> C createCell(BaseComponent parent, Object value, String prefix, String style,
String width, Class<C> clazz) {
C container = null;
try {
container = clazz.newInstance();
container.setParent(parent);
container.setStyles(cellStyle);
if (width != null) {
container.setWidth(width);
}
if (value instanceof BaseComponent) {
((BaseComponent) value).setParent(container);
} else if (value != null) {
createLabel(container, value, prefix, style);
}
} catch (Exception e) {}
;
return container;
} | java | protected <C extends BaseUIComponent> C createCell(BaseComponent parent, Object value, String prefix, String style,
String width, Class<C> clazz) {
C container = null;
try {
container = clazz.newInstance();
container.setParent(parent);
container.setStyles(cellStyle);
if (width != null) {
container.setWidth(width);
}
if (value instanceof BaseComponent) {
((BaseComponent) value).setParent(container);
} else if (value != null) {
createLabel(container, value, prefix, style);
}
} catch (Exception e) {}
;
return container;
} | [
"protected",
"<",
"C",
"extends",
"BaseUIComponent",
">",
"C",
"createCell",
"(",
"BaseComponent",
"parent",
",",
"Object",
"value",
",",
"String",
"prefix",
",",
"String",
"style",
",",
"String",
"width",
",",
"Class",
"<",
"C",
">",
"clazz",
")",
"{",
... | Creates a component containing a label with the specified parameters.
@param <C> Class of created component.
@param parent BaseComponent that will be the parent of the created component.
@param value Value to be used as label text.
@param prefix Value to be used as a prefix for the label text.
@param style Style to be applied to the label.
@param width Width of the created component.
@param clazz The class of the component to be created.
@return The newly created component. | [
"Creates",
"a",
"component",
"containing",
"a",
"label",
"with",
"the",
"specified",
"parameters",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/render/AbstractRenderer.java#L133-L156 | train |
mgormley/prim | src/main/java_generated/edu/jhu/prim/arrays/ByteArrays.java | ByteArrays.removeEntry | public static byte[] removeEntry(byte[] a, int idx) {
byte[] b = new byte[a.length - 1];
for (int i = 0; i < b.length; i++) {
if (i < idx) {
b[i] = a[i];
} else {
b[i] = a[i + 1];
}
}
return b;
} | java | public static byte[] removeEntry(byte[] a, int idx) {
byte[] b = new byte[a.length - 1];
for (int i = 0; i < b.length; i++) {
if (i < idx) {
b[i] = a[i];
} else {
b[i] = a[i + 1];
}
}
return b;
} | [
"public",
"static",
"byte",
"[",
"]",
"removeEntry",
"(",
"byte",
"[",
"]",
"a",
",",
"int",
"idx",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"a",
".",
"length",
"-",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i"... | Gets a copy of the array with the specified entry removed.
@param a The input array.
@param idx The entry to remove.
@return A new array with the entry removed. | [
"Gets",
"a",
"copy",
"of",
"the",
"array",
"with",
"the",
"specified",
"entry",
"removed",
"."
] | 5dce5e1ae94a9ae558a6262fc246e1a24f56686c | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/arrays/ByteArrays.java#L247-L257 | train |
carewebframework/carewebframework-core | org.carewebframework.messaging-parent/org.carewebframework.messaging.kafka-parent/org.carewebframework.messaging.kafka/src/main/java/org/carewebframework/messaging/kafka/KafkaService.java | KafkaService.getConfigParams | private Map<String, Object> getConfigParams(Class<?> clazz) {
Map<String, Object> params = new HashMap<>();
for (Field field : clazz.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && field.getName().endsWith("_CONFIG")) {
try {
String key = field.get(null).toString();
String value = SpringUtil.getProperty("org.carewebframework.messaging.kafka." + key);
if (value != null) {
params.put(key, value);
}
} catch (Exception e) {}
}
}
return params;
} | java | private Map<String, Object> getConfigParams(Class<?> clazz) {
Map<String, Object> params = new HashMap<>();
for (Field field : clazz.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && field.getName().endsWith("_CONFIG")) {
try {
String key = field.get(null).toString();
String value = SpringUtil.getProperty("org.carewebframework.messaging.kafka." + key);
if (value != null) {
params.put(key, value);
}
} catch (Exception e) {}
}
}
return params;
} | [
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"getConfigParams",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Field",
"field",
":... | A bit of a hack to return configuration parameters from the Spring property store as a map,
which is required to initialize Kafka consumers and producers. Uses reflection on the
specified class to enumerate static fields with a name ending in "_CONFIG". By Kafka
convention, these fields contain the names of configuration parameters.
@param clazz Class defining configuration parameters as static fields.
@return A map of configuration parameters with their values from the Spring property store. | [
"A",
"bit",
"of",
"a",
"hack",
"to",
"return",
"configuration",
"parameters",
"from",
"the",
"Spring",
"property",
"store",
"as",
"a",
"map",
"which",
"is",
"required",
"to",
"initialize",
"Kafka",
"consumers",
"and",
"producers",
".",
"Uses",
"reflection",
... | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.kafka-parent/org.carewebframework.messaging.kafka/src/main/java/org/carewebframework/messaging/kafka/KafkaService.java#L98-L116 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/jdbc/QueryWhereClauseBuilder.java | QueryWhereClauseBuilder.buildWhereClause | public static String buildWhereClause(Object object, MapSqlParameterSource params) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
LOGGER.debug("Building query");
final StringBuilder query = new StringBuilder();
boolean first = true;
for (Field field : object.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(QueryWhereClause.class)
|| field.isAnnotationPresent(QueryWhereClauses.class)) {
final String fieldName = field.getName();
LOGGER.trace("New annotated field found: {}", fieldName);
QueryWhereClause[] annotations = field.getAnnotationsByType(QueryWhereClause.class);
for (QueryWhereClause annotation : annotations) {
String whereValue = annotation.value();
int[] types = annotation.fieldTypes();
int index = 0;
LOGGER.trace("Unprocessed whereClause: {}", whereValue);
Matcher matcher = PARAM_PATTERN.matcher(whereValue);
boolean hasValue = false;
while (matcher.find()) {
String originalParam = matcher.group(1);
LOGGER.debug("New parameter found in the query: {}", originalParam);
String convertedParam = originalParam.replaceAll("this", fieldName);
Object value = null;
try {
value = BeanUtils.getNestedProperty(object, convertedParam);
} catch (NestedNullException e) {
LOGGER.info("Bean not accessible= {}", e.getMessage());
}
if (value == null) {
LOGGER.debug("Param {} was null, ignoring in the query", convertedParam);
} else {
hasValue = true;
whereValue = StringUtils.replace(whereValue, "{"+originalParam+ "}", ":" + convertedParam);
if (params != null) {
if (index <= types.length-1) {
params.addValue(convertedParam, value, types[index]);
} else {
params.addValue(convertedParam, value);
}
}
}
index ++;
}
if (hasValue) {
if (!first) {
query.append(" AND ");
} else {
first = false;
}
query.append(whereValue);
}
}
}
}
LOGGER.debug("built query={}", query);
return query.toString();
} | java | public static String buildWhereClause(Object object, MapSqlParameterSource params) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
LOGGER.debug("Building query");
final StringBuilder query = new StringBuilder();
boolean first = true;
for (Field field : object.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(QueryWhereClause.class)
|| field.isAnnotationPresent(QueryWhereClauses.class)) {
final String fieldName = field.getName();
LOGGER.trace("New annotated field found: {}", fieldName);
QueryWhereClause[] annotations = field.getAnnotationsByType(QueryWhereClause.class);
for (QueryWhereClause annotation : annotations) {
String whereValue = annotation.value();
int[] types = annotation.fieldTypes();
int index = 0;
LOGGER.trace("Unprocessed whereClause: {}", whereValue);
Matcher matcher = PARAM_PATTERN.matcher(whereValue);
boolean hasValue = false;
while (matcher.find()) {
String originalParam = matcher.group(1);
LOGGER.debug("New parameter found in the query: {}", originalParam);
String convertedParam = originalParam.replaceAll("this", fieldName);
Object value = null;
try {
value = BeanUtils.getNestedProperty(object, convertedParam);
} catch (NestedNullException e) {
LOGGER.info("Bean not accessible= {}", e.getMessage());
}
if (value == null) {
LOGGER.debug("Param {} was null, ignoring in the query", convertedParam);
} else {
hasValue = true;
whereValue = StringUtils.replace(whereValue, "{"+originalParam+ "}", ":" + convertedParam);
if (params != null) {
if (index <= types.length-1) {
params.addValue(convertedParam, value, types[index]);
} else {
params.addValue(convertedParam, value);
}
}
}
index ++;
}
if (hasValue) {
if (!first) {
query.append(" AND ");
} else {
first = false;
}
query.append(whereValue);
}
}
}
}
LOGGER.debug("built query={}", query);
return query.toString();
} | [
"public",
"static",
"String",
"buildWhereClause",
"(",
"Object",
"object",
",",
"MapSqlParameterSource",
"params",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Building query\... | Builds a where clause based upon the object values
@param object object to read annotation and values
@param params map of parameters to set values for execution
@return String with the where clause
@throws IllegalAccessException In Case of Error
@throws InvocationTargetException In Case of Error
@throws NoSuchMethodException In Case of Error | [
"Builds",
"a",
"where",
"clause",
"based",
"upon",
"the",
"object",
"values"
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/jdbc/QueryWhereClauseBuilder.java#L48-L109 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/LayoutManager.java | LayoutManager.show | public static void show(boolean manage, String deflt, IEventListener closeListener) {
Map<String, Object> args = new HashMap<>();
args.put("manage", manage);
args.put("deflt", deflt);
PopupDialog.show(RESOURCE_PREFIX + "layoutManager.fsp", args, true, true, true, closeListener);
} | java | public static void show(boolean manage, String deflt, IEventListener closeListener) {
Map<String, Object> args = new HashMap<>();
args.put("manage", manage);
args.put("deflt", deflt);
PopupDialog.show(RESOURCE_PREFIX + "layoutManager.fsp", args, true, true, true, closeListener);
} | [
"public",
"static",
"void",
"show",
"(",
"boolean",
"manage",
",",
"String",
"deflt",
",",
"IEventListener",
"closeListener",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"args",
".",
"put",
"(... | Invokes the layout manager dialog.
@param manage If true, open in management mode; otherwise, in selection mode.
@param deflt Default layout name.
@param closeListener Close event listener. | [
"Invokes",
"the",
"layout",
"manager",
"dialog",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/LayoutManager.java#L171-L176 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ManagedContext.java | ManagedContext.compareTo | @Override
public int compareTo(IManagedContext<DomainClass> o) {
int pri1 = o.getPriority();
int pri2 = getPriority();
return this == o ? 0 : pri1 < pri2 ? -1 : 1;
} | java | @Override
public int compareTo(IManagedContext<DomainClass> o) {
int pri1 = o.getPriority();
int pri2 = getPriority();
return this == o ? 0 : pri1 < pri2 ? -1 : 1;
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"IManagedContext",
"<",
"DomainClass",
">",
"o",
")",
"{",
"int",
"pri1",
"=",
"o",
".",
"getPriority",
"(",
")",
";",
"int",
"pri2",
"=",
"getPriority",
"(",
")",
";",
"return",
"this",
"==",
"o",
... | Compares by priority, with higher priorities collating first. | [
"Compares",
"by",
"priority",
"with",
"higher",
"priorities",
"collating",
"first",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ManagedContext.java#L474-L479 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java | MenuUtil.pruneMenus | public static void pruneMenus(BaseComponent parent) {
while (parent != null && parent instanceof BaseMenuComponent) {
if (parent.getChildren().isEmpty()) {
BaseComponent newParent = parent.getParent();
parent.destroy();
parent = newParent;
} else {
break;
}
}
} | java | public static void pruneMenus(BaseComponent parent) {
while (parent != null && parent instanceof BaseMenuComponent) {
if (parent.getChildren().isEmpty()) {
BaseComponent newParent = parent.getParent();
parent.destroy();
parent = newParent;
} else {
break;
}
}
} | [
"public",
"static",
"void",
"pruneMenus",
"(",
"BaseComponent",
"parent",
")",
"{",
"while",
"(",
"parent",
"!=",
"null",
"&&",
"parent",
"instanceof",
"BaseMenuComponent",
")",
"{",
"if",
"(",
"parent",
".",
"getChildren",
"(",
")",
".",
"isEmpty",
"(",
"... | Recursively remove empty menu container elements. This is done after removing menu items to
keep the menu structure lean.
@param parent The starting menu container. | [
"Recursively",
"remove",
"empty",
"menu",
"container",
"elements",
".",
"This",
"is",
"done",
"after",
"removing",
"menu",
"items",
"to",
"keep",
"the",
"menu",
"structure",
"lean",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java#L75-L85 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java | MenuUtil.findMenu | public static BaseMenuComponent findMenu(BaseComponent parent, String label, BaseComponent insertBefore) {
for (BaseMenuComponent child : parent.getChildren(BaseMenuComponent.class)) {
if (label.equalsIgnoreCase(child.getLabel())) {
return child;
}
}
BaseMenuComponent cmp = createMenuOrMenuitem(parent);
cmp.setLabel(label);
parent.addChild(cmp, insertBefore);
return cmp;
} | java | public static BaseMenuComponent findMenu(BaseComponent parent, String label, BaseComponent insertBefore) {
for (BaseMenuComponent child : parent.getChildren(BaseMenuComponent.class)) {
if (label.equalsIgnoreCase(child.getLabel())) {
return child;
}
}
BaseMenuComponent cmp = createMenuOrMenuitem(parent);
cmp.setLabel(label);
parent.addChild(cmp, insertBefore);
return cmp;
} | [
"public",
"static",
"BaseMenuComponent",
"findMenu",
"(",
"BaseComponent",
"parent",
",",
"String",
"label",
",",
"BaseComponent",
"insertBefore",
")",
"{",
"for",
"(",
"BaseMenuComponent",
"child",
":",
"parent",
".",
"getChildren",
"(",
"BaseMenuComponent",
".",
... | Returns the menu with the specified label, or creates one if it does not exist.
@param parent The parent component under which to search. May be a Toolbar or a Menupopup
component.
@param label Label of menu to search.
@param insertBefore If not null, the new menu is inserted before this one. If null, the menu
is appended.
@return Menu or menu item with the specified label. | [
"Returns",
"the",
"menu",
"with",
"the",
"specified",
"label",
"or",
"creates",
"one",
"if",
"it",
"does",
"not",
"exist",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java#L97-L109 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java | MenuUtil.sortMenu | public static void sortMenu(BaseComponent parent, int startIndex, int endIndex) {
List<BaseComponent> items = parent.getChildren();
int bottom = startIndex + 1;
for (int i = startIndex; i < endIndex;) {
BaseComponent item1 = items.get(i++);
BaseComponent item2 = items.get(i);
if (item1 instanceof BaseMenuComponent && item2 instanceof BaseMenuComponent && ((BaseMenuComponent) item1)
.getLabel().compareToIgnoreCase(((BaseMenuComponent) item2).getLabel()) > 0) {
parent.swapChildren(i - 1, i);
if (i > bottom) {
i -= 2;
}
}
}
} | java | public static void sortMenu(BaseComponent parent, int startIndex, int endIndex) {
List<BaseComponent> items = parent.getChildren();
int bottom = startIndex + 1;
for (int i = startIndex; i < endIndex;) {
BaseComponent item1 = items.get(i++);
BaseComponent item2 = items.get(i);
if (item1 instanceof BaseMenuComponent && item2 instanceof BaseMenuComponent && ((BaseMenuComponent) item1)
.getLabel().compareToIgnoreCase(((BaseMenuComponent) item2).getLabel()) > 0) {
parent.swapChildren(i - 1, i);
if (i > bottom) {
i -= 2;
}
}
}
} | [
"public",
"static",
"void",
"sortMenu",
"(",
"BaseComponent",
"parent",
",",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"List",
"<",
"BaseComponent",
">",
"items",
"=",
"parent",
".",
"getChildren",
"(",
")",
";",
"int",
"bottom",
"=",
"startIn... | Alphabetically sorts a range of menu items.
@param parent Parent whose children are to be sorted alphabetically.
@param startIndex Index of first child to be sorted.
@param endIndex Index of last child to be sorted. | [
"Alphabetically",
"sorts",
"a",
"range",
"of",
"menu",
"items",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java#L127-L144 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java | MenuUtil.getPath | public static String getPath(BaseMenuComponent comp) {
StringBuilder sb = new StringBuilder();
getPath(comp, sb);
return sb.toString();
} | java | public static String getPath(BaseMenuComponent comp) {
StringBuilder sb = new StringBuilder();
getPath(comp, sb);
return sb.toString();
} | [
"public",
"static",
"String",
"getPath",
"(",
"BaseMenuComponent",
"comp",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"getPath",
"(",
"comp",
",",
"sb",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Returns the path of the given menu or menu item.
@param comp A menu or menu item.
@return The full path of the menu item. | [
"Returns",
"the",
"path",
"of",
"the",
"given",
"menu",
"or",
"menu",
"item",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java#L152-L156 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java | MenuUtil.getPath | private static void getPath(BaseComponent comp, StringBuilder sb) {
while (comp instanceof BaseMenuComponent) {
sb.insert(0, "\\" + ((BaseMenuComponent) comp).getLabel());
comp = comp.getParent();
}
} | java | private static void getPath(BaseComponent comp, StringBuilder sb) {
while (comp instanceof BaseMenuComponent) {
sb.insert(0, "\\" + ((BaseMenuComponent) comp).getLabel());
comp = comp.getParent();
}
} | [
"private",
"static",
"void",
"getPath",
"(",
"BaseComponent",
"comp",
",",
"StringBuilder",
"sb",
")",
"{",
"while",
"(",
"comp",
"instanceof",
"BaseMenuComponent",
")",
"{",
"sb",
".",
"insert",
"(",
"0",
",",
"\"\\\\\"",
"+",
"(",
"(",
"BaseMenuComponent",... | Recurses parent menu nodes to build the menu path.
@param comp Current component in menu tree.
@param sb String builder to receive path. | [
"Recurses",
"parent",
"menu",
"nodes",
"to",
"build",
"the",
"menu",
"path",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java#L164-L169 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginWakeOnMessage.java | PluginWakeOnMessage.onPluginEvent | @Override
public void onPluginEvent(PluginEvent event) {
switch (event.getAction()) {
case SUBSCRIBE: // Upon initial subscription, begin listening for specified generic events.
plugin = event.getPlugin();
doSubscribe(true);
break;
case LOAD: // Stop listening once loaded.
plugin.unregisterListener(this);
break;
case UNSUBSCRIBE: // Stop listening for generic events once unsubscribed from plugin events.
doSubscribe(false);
break;
}
} | java | @Override
public void onPluginEvent(PluginEvent event) {
switch (event.getAction()) {
case SUBSCRIBE: // Upon initial subscription, begin listening for specified generic events.
plugin = event.getPlugin();
doSubscribe(true);
break;
case LOAD: // Stop listening once loaded.
plugin.unregisterListener(this);
break;
case UNSUBSCRIBE: // Stop listening for generic events once unsubscribed from plugin events.
doSubscribe(false);
break;
}
} | [
"@",
"Override",
"public",
"void",
"onPluginEvent",
"(",
"PluginEvent",
"event",
")",
"{",
"switch",
"(",
"event",
".",
"getAction",
"(",
")",
")",
"{",
"case",
"SUBSCRIBE",
":",
"// Upon initial subscription, begin listening for specified generic events.",
"plugin",
... | Listen for plugin lifecycle events.
@see org.carewebframework.shell.plugins.IPluginEventListener#onPluginEvent(org.carewebframework.shell.plugins.PluginEvent) | [
"Listen",
"for",
"plugin",
"lifecycle",
"events",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginWakeOnMessage.java#L79-L95 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java | DefaultRetryClient.retry | @Override
public void retry(Face face, Interest interest, OnData onData, OnTimeout onTimeout) throws IOException {
RetryContext context = new RetryContext(face, interest, onData, onTimeout);
retryInterest(context);
} | java | @Override
public void retry(Face face, Interest interest, OnData onData, OnTimeout onTimeout) throws IOException {
RetryContext context = new RetryContext(face, interest, onData, onTimeout);
retryInterest(context);
} | [
"@",
"Override",
"public",
"void",
"retry",
"(",
"Face",
"face",
",",
"Interest",
"interest",
",",
"OnData",
"onData",
",",
"OnTimeout",
"onTimeout",
")",
"throws",
"IOException",
"{",
"RetryContext",
"context",
"=",
"new",
"RetryContext",
"(",
"face",
",",
... | On timeout, retry the request until the maximum number of allowed retries
is reached.
@param face the {@link Face} on which to retry requests
@param interest the {@link Interest} to retry
@param onData the application's success callback
@param onTimeout the application's failure callback
@throws IOException when the client cannot perform the necessary network IO | [
"On",
"timeout",
"retry",
"the",
"request",
"until",
"the",
"maximum",
"number",
"of",
"allowed",
"retries",
"is",
"reached",
"."
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java#L52-L56 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java | DefaultRetryClient.retryInterest | private synchronized void retryInterest(RetryContext context) throws IOException {
LOGGER.info("Retrying interest: " + context.interest.toUri());
context.face.expressInterest(context.interest, context, context);
totalRetries++;
} | java | private synchronized void retryInterest(RetryContext context) throws IOException {
LOGGER.info("Retrying interest: " + context.interest.toUri());
context.face.expressInterest(context.interest, context, context);
totalRetries++;
} | [
"private",
"synchronized",
"void",
"retryInterest",
"(",
"RetryContext",
"context",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"info",
"(",
"\"Retrying interest: \"",
"+",
"context",
".",
"interest",
".",
"toUri",
"(",
")",
")",
";",
"context",
".",
"fa... | Synchronized helper method to prevent multiple threads from mashing
totalRetries
@param context the current request context
@throws IOException when the client cannot perform the necessary network IO | [
"Synchronized",
"helper",
"method",
"to",
"prevent",
"multiple",
"threads",
"from",
"mashing",
"totalRetries"
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java#L65-L69 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java | ServerBaseImpl.register | public void register() throws IOException {
try {
registeredPrefixId = face.registerPrefix(prefix, this, new OnRegisterFailed() {
@Override
public void onRegisterFailed(Name prefix) {
registeredPrefixId = UNREGISTERED;
logger.log(Level.SEVERE, "Failed to register prefix: " + prefix.toUri());
}
}, new ForwardingFlags());
logger.log(Level.FINER, "Registered a new prefix: " + prefix.toUri());
} catch (net.named_data.jndn.security.SecurityException e) {
throw new IOException("Failed to communicate to face due to security error", e);
}
} | java | public void register() throws IOException {
try {
registeredPrefixId = face.registerPrefix(prefix, this, new OnRegisterFailed() {
@Override
public void onRegisterFailed(Name prefix) {
registeredPrefixId = UNREGISTERED;
logger.log(Level.SEVERE, "Failed to register prefix: " + prefix.toUri());
}
}, new ForwardingFlags());
logger.log(Level.FINER, "Registered a new prefix: " + prefix.toUri());
} catch (net.named_data.jndn.security.SecurityException e) {
throw new IOException("Failed to communicate to face due to security error", e);
}
} | [
"public",
"void",
"register",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"registeredPrefixId",
"=",
"face",
".",
"registerPrefix",
"(",
"prefix",
",",
"this",
",",
"new",
"OnRegisterFailed",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onRegis... | Register a prefix for responding to interests.
@throws java.io.IOException if IO fails | [
"Register",
"a",
"prefix",
"for",
"responding",
"to",
"interests",
"."
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java#L87-L100 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/MessageUtil.java | MessageUtil.isMessageExcluded | public static boolean isMessageExcluded(Message message, Recipient recipient) {
return isMessageExcluded(message, recipient.getType(), recipient.getValue());
} | java | public static boolean isMessageExcluded(Message message, Recipient recipient) {
return isMessageExcluded(message, recipient.getType(), recipient.getValue());
} | [
"public",
"static",
"boolean",
"isMessageExcluded",
"(",
"Message",
"message",
",",
"Recipient",
"recipient",
")",
"{",
"return",
"isMessageExcluded",
"(",
"message",
",",
"recipient",
".",
"getType",
"(",
")",
",",
"recipient",
".",
"getValue",
"(",
")",
")",... | Returns true if the message should be excluded based on the given recipient. A message is
considered excluded if it has any constraint on the recipient's type and does not have a
matching recipient for that type.
@param message The message to examine.
@param recipient The recipient.
@return True if the message should be excluded. | [
"Returns",
"true",
"if",
"the",
"message",
"should",
"be",
"excluded",
"based",
"on",
"the",
"given",
"recipient",
".",
"A",
"message",
"is",
"considered",
"excluded",
"if",
"it",
"has",
"any",
"constraint",
"on",
"the",
"recipient",
"s",
"type",
"and",
"d... | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/MessageUtil.java#L44-L46 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/MessageUtil.java | MessageUtil.isMessageExcluded | public static boolean isMessageExcluded(Message message, RecipientType recipientType, String recipientValue) {
Recipient[] recipients = (Recipient[]) message.getMetadata("cwf.pub.recipients");
if (recipients == null || recipients.length == 0) {
return false;
}
boolean excluded = false;
for (Recipient recipient : recipients) {
if (recipient.getType() == recipientType) {
excluded = true;
if (recipient.getValue().equals(recipientValue)) {
return false;
}
}
}
return excluded;
} | java | public static boolean isMessageExcluded(Message message, RecipientType recipientType, String recipientValue) {
Recipient[] recipients = (Recipient[]) message.getMetadata("cwf.pub.recipients");
if (recipients == null || recipients.length == 0) {
return false;
}
boolean excluded = false;
for (Recipient recipient : recipients) {
if (recipient.getType() == recipientType) {
excluded = true;
if (recipient.getValue().equals(recipientValue)) {
return false;
}
}
}
return excluded;
} | [
"public",
"static",
"boolean",
"isMessageExcluded",
"(",
"Message",
"message",
",",
"RecipientType",
"recipientType",
",",
"String",
"recipientValue",
")",
"{",
"Recipient",
"[",
"]",
"recipients",
"=",
"(",
"Recipient",
"[",
"]",
")",
"message",
".",
"getMetada... | Returns true if the message should be excluded based on the given recipient values. A message
is considered excluded if it has any constraint on the recipient type and does not have a
matching recipient for that type.
@param message The message to examine.
@param recipientType The type of recipient.
@param recipientValue The recipient's value.
@return True if the message should be excluded. | [
"Returns",
"true",
"if",
"the",
"message",
"should",
"be",
"excluded",
"based",
"on",
"the",
"given",
"recipient",
"values",
".",
"A",
"message",
"is",
"considered",
"excluded",
"if",
"it",
"has",
"any",
"constraint",
"on",
"the",
"recipient",
"type",
"and",... | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/MessageUtil.java#L58-L78 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorCustomTree.java | Proxy.getLabel | public String getLabel() {
String label = getProperty(labelProperty);
label = label == null ? node.getLabel() : label;
if (label == null) {
label = getDefaultInstanceName();
setProperty(labelProperty, label);
}
return label;
} | java | public String getLabel() {
String label = getProperty(labelProperty);
label = label == null ? node.getLabel() : label;
if (label == null) {
label = getDefaultInstanceName();
setProperty(labelProperty, label);
}
return label;
} | [
"public",
"String",
"getLabel",
"(",
")",
"{",
"String",
"label",
"=",
"getProperty",
"(",
"labelProperty",
")",
";",
"label",
"=",
"label",
"==",
"null",
"?",
"node",
".",
"getLabel",
"(",
")",
":",
"label",
";",
"if",
"(",
"label",
"==",
"null",
")... | Returns the label property value.
@return The label text, or null if none. | [
"Returns",
"the",
"label",
"property",
"value",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorCustomTree.java#L98-L108 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorCustomTree.java | Proxy.getProperty | private String getProperty(String propertyName) {
return propertyName == null ? null : (String) getPropertyValue(propertyName);
} | java | private String getProperty(String propertyName) {
return propertyName == null ? null : (String) getPropertyValue(propertyName);
} | [
"private",
"String",
"getProperty",
"(",
"String",
"propertyName",
")",
"{",
"return",
"propertyName",
"==",
"null",
"?",
"null",
":",
"(",
"String",
")",
"getPropertyValue",
"(",
"propertyName",
")",
";",
"}"
] | Returns a property value.
@param propertyName The property name.
@return The property value, or null if none. | [
"Returns",
"a",
"property",
"value",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorCustomTree.java#L121-L123 | train |
DDTH/ddth-queue | ddth-queue-core/src/main/java/com/github/ddth/queue/QueueSpec.java | QueueSpec.setField | public QueueSpec setField(String fieldName, Object value) {
fieldData.put(fieldName, value);
return this;
} | java | public QueueSpec setField(String fieldName, Object value) {
fieldData.put(fieldName, value);
return this;
} | [
"public",
"QueueSpec",
"setField",
"(",
"String",
"fieldName",
",",
"Object",
"value",
")",
"{",
"fieldData",
".",
"put",
"(",
"fieldName",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Set a field's value.
@param fieldName
@param value
@return | [
"Set",
"a",
"field",
"s",
"value",
"."
] | b20776850d23111d3d71fc8ed6023c590bc3621f | https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/QueueSpec.java#L83-L86 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/UserContext.java | UserContext.changeUser | public static void changeUser(IUser user) {
try {
getUserContext().requestContextChange(user);
} catch (Exception e) {
log.error("Error during user context change.", e);
}
} | java | public static void changeUser(IUser user) {
try {
getUserContext().requestContextChange(user);
} catch (Exception e) {
log.error("Error during user context change.", e);
}
} | [
"public",
"static",
"void",
"changeUser",
"(",
"IUser",
"user",
")",
"{",
"try",
"{",
"getUserContext",
"(",
")",
".",
"requestContextChange",
"(",
"user",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Error during... | Request a user context change.
@param user New user | [
"Request",
"a",
"user",
"context",
"change",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/UserContext.java#L53-L59 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/UserContext.java | UserContext.getUserContext | @SuppressWarnings("unchecked")
public static ISharedContext<IUser> getUserContext() {
return (ISharedContext<IUser>) ContextManager.getInstance().getSharedContext(UserContext.class.getName());
} | java | @SuppressWarnings("unchecked")
public static ISharedContext<IUser> getUserContext() {
return (ISharedContext<IUser>) ContextManager.getInstance().getSharedContext(UserContext.class.getName());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"ISharedContext",
"<",
"IUser",
">",
"getUserContext",
"(",
")",
"{",
"return",
"(",
"ISharedContext",
"<",
"IUser",
">",
")",
"ContextManager",
".",
"getInstance",
"(",
")",
".",
"getShar... | Returns the managed user context.
@return User context | [
"Returns",
"the",
"managed",
"user",
"context",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/UserContext.java#L66-L69 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHSCoverLetterV1_2Generator.java | PHSCoverLetterV1_2Generator.getPHSCoverLetter | private PHSCoverLetter12Document getPHSCoverLetter() {
PHSCoverLetter12Document phsCoverLetterDocument = PHSCoverLetter12Document.Factory
.newInstance();
PHSCoverLetter12 phsCoverLetter = PHSCoverLetter12.Factory
.newInstance();
CoverLetterFile coverLetterFile = CoverLetterFile.Factory.newInstance();
phsCoverLetter.setFormVersion(FormVersion.v1_2.getVersion());
AttachedFileDataType attachedFileDataType = null;
for (NarrativeContract narrative : pdDoc.getDevelopmentProposal()
.getNarratives()) {
if (narrative.getNarrativeType().getCode() != null
&& Integer.parseInt(narrative.getNarrativeType().getCode()) == NARRATIVE_PHS_COVER_LETTER) {
attachedFileDataType = getAttachedFileType(narrative);
if(attachedFileDataType != null){
coverLetterFile.setCoverLetterFilename(attachedFileDataType);
break;
}
}
}
phsCoverLetter.setCoverLetterFile(coverLetterFile);
phsCoverLetterDocument.setPHSCoverLetter12(phsCoverLetter);
return phsCoverLetterDocument;
} | java | private PHSCoverLetter12Document getPHSCoverLetter() {
PHSCoverLetter12Document phsCoverLetterDocument = PHSCoverLetter12Document.Factory
.newInstance();
PHSCoverLetter12 phsCoverLetter = PHSCoverLetter12.Factory
.newInstance();
CoverLetterFile coverLetterFile = CoverLetterFile.Factory.newInstance();
phsCoverLetter.setFormVersion(FormVersion.v1_2.getVersion());
AttachedFileDataType attachedFileDataType = null;
for (NarrativeContract narrative : pdDoc.getDevelopmentProposal()
.getNarratives()) {
if (narrative.getNarrativeType().getCode() != null
&& Integer.parseInt(narrative.getNarrativeType().getCode()) == NARRATIVE_PHS_COVER_LETTER) {
attachedFileDataType = getAttachedFileType(narrative);
if(attachedFileDataType != null){
coverLetterFile.setCoverLetterFilename(attachedFileDataType);
break;
}
}
}
phsCoverLetter.setCoverLetterFile(coverLetterFile);
phsCoverLetterDocument.setPHSCoverLetter12(phsCoverLetter);
return phsCoverLetterDocument;
} | [
"private",
"PHSCoverLetter12Document",
"getPHSCoverLetter",
"(",
")",
"{",
"PHSCoverLetter12Document",
"phsCoverLetterDocument",
"=",
"PHSCoverLetter12Document",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"PHSCoverLetter12",
"phsCoverLetter",
"=",
"PHSCoverLetter12",
... | This method is used to get PHSCoverLetter12Document attachment from the
narrative attachments.
@return phsCoverLetter12Document {@link XmlObject} of type
PHS398CoverLetterDocument. | [
"This",
"method",
"is",
"used",
"to",
"get",
"PHSCoverLetter12Document",
"attachment",
"from",
"the",
"narrative",
"attachments",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHSCoverLetterV1_2Generator.java#L59-L82 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_3Generator.java | RRBudget10V1_3Generator.setBudgetYearDataType | private void setBudgetYearDataType(RRBudget1013 rrBudget,BudgetPeriodDto periodInfo) {
BudgetYearDataType budgetYear = rrBudget.addNewBudgetYear();
if (periodInfo != null) {
budgetYear.setBudgetPeriodStartDate(s2SDateTimeService.convertDateToCalendar(periodInfo.getStartDate()));
budgetYear.setBudgetPeriodEndDate(s2SDateTimeService.convertDateToCalendar(periodInfo.getEndDate()));
budgetYear.setKeyPersons(getKeyPersons(periodInfo));
budgetYear.setOtherPersonnel(getOtherPersonnel(periodInfo));
if (periodInfo.getTotalCompensation() != null) {
budgetYear.setTotalCompensation(periodInfo
.getTotalCompensation().bigDecimalValue());
}
budgetYear.setEquipment(getEquipment(periodInfo));
budgetYear.setTravel(getTravel(periodInfo));
budgetYear
.setParticipantTraineeSupportCosts(getParticipantTraineeSupportCosts(periodInfo));
budgetYear.setOtherDirectCosts(getOtherDirectCosts(periodInfo));
BigDecimal directCosts = periodInfo.getDirectCostsTotal()
.bigDecimalValue();
budgetYear.setDirectCosts(directCosts);
IndirectCosts indirectCosts = getIndirectCosts(periodInfo);
if (indirectCosts != null) {
budgetYear.setIndirectCosts(indirectCosts);
budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue().add(indirectCosts.getTotalIndirectCosts()));
}else{
budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue());
}
budgetYear.setCognizantFederalAgency(periodInfo
.getCognizantFedAgency());
}
} | java | private void setBudgetYearDataType(RRBudget1013 rrBudget,BudgetPeriodDto periodInfo) {
BudgetYearDataType budgetYear = rrBudget.addNewBudgetYear();
if (periodInfo != null) {
budgetYear.setBudgetPeriodStartDate(s2SDateTimeService.convertDateToCalendar(periodInfo.getStartDate()));
budgetYear.setBudgetPeriodEndDate(s2SDateTimeService.convertDateToCalendar(periodInfo.getEndDate()));
budgetYear.setKeyPersons(getKeyPersons(periodInfo));
budgetYear.setOtherPersonnel(getOtherPersonnel(periodInfo));
if (periodInfo.getTotalCompensation() != null) {
budgetYear.setTotalCompensation(periodInfo
.getTotalCompensation().bigDecimalValue());
}
budgetYear.setEquipment(getEquipment(periodInfo));
budgetYear.setTravel(getTravel(periodInfo));
budgetYear
.setParticipantTraineeSupportCosts(getParticipantTraineeSupportCosts(periodInfo));
budgetYear.setOtherDirectCosts(getOtherDirectCosts(periodInfo));
BigDecimal directCosts = periodInfo.getDirectCostsTotal()
.bigDecimalValue();
budgetYear.setDirectCosts(directCosts);
IndirectCosts indirectCosts = getIndirectCosts(periodInfo);
if (indirectCosts != null) {
budgetYear.setIndirectCosts(indirectCosts);
budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue().add(indirectCosts.getTotalIndirectCosts()));
}else{
budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue());
}
budgetYear.setCognizantFederalAgency(periodInfo
.getCognizantFedAgency());
}
} | [
"private",
"void",
"setBudgetYearDataType",
"(",
"RRBudget1013",
"rrBudget",
",",
"BudgetPeriodDto",
"periodInfo",
")",
"{",
"BudgetYearDataType",
"budgetYear",
"=",
"rrBudget",
".",
"addNewBudgetYear",
"(",
")",
";",
"if",
"(",
"periodInfo",
"!=",
"null",
")",
"{... | This method gets BudgetYearDataType details like
BudgetPeriodStartDate,BudgetPeriodEndDate,BudgetPeriod
KeyPersons,OtherPersonnel,TotalCompensation,Equipment,ParticipantTraineeSupportCosts,Travel,OtherDirectCosts
DirectCosts,IndirectCosts,CognizantFederalAgency,TotalCosts based on
BudgetPeriodInfo for the RRBudget1013.
@param periodInfo
(BudgetPeriodInfo) budget period entry. | [
"This",
"method",
"gets",
"BudgetYearDataType",
"details",
"like",
"BudgetPeriodStartDate",
"BudgetPeriodEndDate",
"BudgetPeriod",
"KeyPersons",
"OtherPersonnel",
"TotalCompensation",
"Equipment",
"ParticipantTraineeSupportCosts",
"Travel",
"OtherDirectCosts",
"DirectCosts",
"Indir... | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_3Generator.java#L149-L179 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/PropertyAwareResource.java | PropertyAwareResource.setApplicationContext | @Override
public void setApplicationContext(ApplicationContext appContext) throws BeansException {
try (InputStream is = originalResource.getInputStream();) {
ConfigurableListableBeanFactory beanFactory = ((AbstractRefreshableApplicationContext) appContext)
.getBeanFactory();
StringBuilder sb = new StringBuilder();
Iterator<String> iter = IOUtils.lineIterator(is, "UTF-8");
boolean transformed = false;
while (iter.hasNext()) {
String line = iter.next();
if (line.contains("${")) {
transformed = true;
line = beanFactory.resolveEmbeddedValue(line);
}
sb.append(line);
}
transformedResource = !transformed ? originalResource : new ByteArrayResource(sb.toString().getBytes());
} catch (IOException e) {
throw MiscUtil.toUnchecked(e);
}
} | java | @Override
public void setApplicationContext(ApplicationContext appContext) throws BeansException {
try (InputStream is = originalResource.getInputStream();) {
ConfigurableListableBeanFactory beanFactory = ((AbstractRefreshableApplicationContext) appContext)
.getBeanFactory();
StringBuilder sb = new StringBuilder();
Iterator<String> iter = IOUtils.lineIterator(is, "UTF-8");
boolean transformed = false;
while (iter.hasNext()) {
String line = iter.next();
if (line.contains("${")) {
transformed = true;
line = beanFactory.resolveEmbeddedValue(line);
}
sb.append(line);
}
transformedResource = !transformed ? originalResource : new ByteArrayResource(sb.toString().getBytes());
} catch (IOException e) {
throw MiscUtil.toUnchecked(e);
}
} | [
"@",
"Override",
"public",
"void",
"setApplicationContext",
"(",
"ApplicationContext",
"appContext",
")",
"throws",
"BeansException",
"{",
"try",
"(",
"InputStream",
"is",
"=",
"originalResource",
".",
"getInputStream",
"(",
")",
";",
")",
"{",
"ConfigurableListable... | Use the application context to resolve any embedded property values within the original
resource. | [
"Use",
"the",
"application",
"context",
"to",
"resolve",
"any",
"embedded",
"property",
"values",
"within",
"the",
"original",
"resource",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/PropertyAwareResource.java#L125-L149 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398CoverPageSupplementBaseGenerator.java | PHS398CoverPageSupplementBaseGenerator.getCellLines | protected List<String> getCellLines(String explanation) {
int startPos = 0;
List<String> cellLines = new ArrayList<>();
for (int commaPos = 0; commaPos > -1;) {
commaPos = explanation.indexOf(",", startPos);
if (commaPos >= 0) {
String cellLine = (explanation.substring(startPos, commaPos).trim());
explanation = explanation.substring(commaPos + 1);
if (cellLine.length() > 0) {
cellLines.add(cellLine);
}
} else if (explanation.length() > 0) {
cellLines.add(explanation.trim());
}
}
return cellLines;
} | java | protected List<String> getCellLines(String explanation) {
int startPos = 0;
List<String> cellLines = new ArrayList<>();
for (int commaPos = 0; commaPos > -1;) {
commaPos = explanation.indexOf(",", startPos);
if (commaPos >= 0) {
String cellLine = (explanation.substring(startPos, commaPos).trim());
explanation = explanation.substring(commaPos + 1);
if (cellLine.length() > 0) {
cellLines.add(cellLine);
}
} else if (explanation.length() > 0) {
cellLines.add(explanation.trim());
}
}
return cellLines;
} | [
"protected",
"List",
"<",
"String",
">",
"getCellLines",
"(",
"String",
"explanation",
")",
"{",
"int",
"startPos",
"=",
"0",
";",
"List",
"<",
"String",
">",
"cellLines",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"commaPos",
"="... | This method splits the passed explanation comprising cell line
information, puts into a list and returns the list.
@param explanation
String of cell lines
@return {@link List} | [
"This",
"method",
"splits",
"the",
"passed",
"explanation",
"comprising",
"cell",
"line",
"information",
"puts",
"into",
"a",
"list",
"and",
"returns",
"the",
"list",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398CoverPageSupplementBaseGenerator.java#L85-L101 | train |
ologolo/streamline-engine | src/org/daisy/streamline/engine/TempFileHandler.java | TempFileHandler.reset | public void reset() throws IOException {
if (t1==null || t2==null) {
throw new IllegalStateException("Cannot swap after close.");
}
if (getOutput().length()>0) {
toggle = !toggle;
// reset the new output to length()=0
try (OutputStream unused = new FileOutputStream(getOutput())) {
//this is empty because we only need to close it
}
} else {
throw new IOException("Cannot swap to an empty file.");
}
} | java | public void reset() throws IOException {
if (t1==null || t2==null) {
throw new IllegalStateException("Cannot swap after close.");
}
if (getOutput().length()>0) {
toggle = !toggle;
// reset the new output to length()=0
try (OutputStream unused = new FileOutputStream(getOutput())) {
//this is empty because we only need to close it
}
} else {
throw new IOException("Cannot swap to an empty file.");
}
} | [
"public",
"void",
"reset",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"t1",
"==",
"null",
"||",
"t2",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot swap after close.\"",
")",
";",
"}",
"if",
"(",
"getOutput",
"(",
... | Resets the input and output file before writing to the output again
@throws IOException
An IOException is thrown if TempFileHandler has been
closed or if the output file is open or empty. | [
"Resets",
"the",
"input",
"and",
"output",
"file",
"before",
"writing",
"to",
"the",
"output",
"again"
] | 04b7adc85d84d91dc5f0eaaa401d2738f9401b17 | https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/TempFileHandler.java#L89-L102 | train |
ologolo/streamline-engine | src/org/daisy/streamline/engine/TempFileHandler.java | TempFileHandler.close | public void close() throws IOException {
if (t1==null || t2==null) {
return;
}
try {
if (getOutput().length() > 0) {
Files.copy(getOutput().toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
else if (getInput().length() > 0) {
Files.copy(getInput().toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
else {
throw new IOException("Temporary files corrupted.");
}
} finally {
t1.delete();
t2.delete();
t1 = null;
t2 = null;
}
} | java | public void close() throws IOException {
if (t1==null || t2==null) {
return;
}
try {
if (getOutput().length() > 0) {
Files.copy(getOutput().toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
else if (getInput().length() > 0) {
Files.copy(getInput().toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
else {
throw new IOException("Temporary files corrupted.");
}
} finally {
t1.delete();
t2.delete();
t1 = null;
t2 = null;
}
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"t1",
"==",
"null",
"||",
"t2",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"if",
"(",
"getOutput",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",... | Closes the temporary files and copies the result to the output file.
Closing the TempFileHandler is a mandatory last step after which no other
calls to the object should be made.
@throws IOException
An IOException is thrown if the temporary files have been
deleted, or are empty. | [
"Closes",
"the",
"temporary",
"files",
"and",
"copies",
"the",
"result",
"to",
"the",
"output",
"file",
".",
"Closing",
"the",
"TempFileHandler",
"is",
"a",
"mandatory",
"last",
"step",
"after",
"which",
"no",
"other",
"calls",
"to",
"the",
"object",
"should... | 04b7adc85d84d91dc5f0eaaa401d2738f9401b17 | https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/TempFileHandler.java#L113-L133 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV1_0Generator.java | GlobalLibraryV1_0Generator.getAddressRequireCountryDataType | public AddressRequireCountryDataType getAddressRequireCountryDataType(DepartmentalPersonDto person) {
AddressRequireCountryDataType address = AddressRequireCountryDataType.Factory.newInstance();
if (person != null) {
String street1 = person.getAddress1();
address.setStreet1(street1);
String street2 = person.getAddress2();
if (street2 != null && !street2.equals("")) {
address.setStreet2(street2);
}
String city = person.getCity();
address.setCity(city);
String county = person.getCounty();
if (county != null && !county.equals("")) {
address.setCounty(county);
}
String state = person.getState();
if (state != null && !state.equals("")) {
address.setState(state);
}
String zipcode = person.getPostalCode();
if (zipcode != null && !zipcode.equals("")) {
address.setZipCode(zipcode);
}
String country = person.getCountryCode();
address.setCountry(CountryCodeType.Enum.forString(country));
}
return address;
} | java | public AddressRequireCountryDataType getAddressRequireCountryDataType(DepartmentalPersonDto person) {
AddressRequireCountryDataType address = AddressRequireCountryDataType.Factory.newInstance();
if (person != null) {
String street1 = person.getAddress1();
address.setStreet1(street1);
String street2 = person.getAddress2();
if (street2 != null && !street2.equals("")) {
address.setStreet2(street2);
}
String city = person.getCity();
address.setCity(city);
String county = person.getCounty();
if (county != null && !county.equals("")) {
address.setCounty(county);
}
String state = person.getState();
if (state != null && !state.equals("")) {
address.setState(state);
}
String zipcode = person.getPostalCode();
if (zipcode != null && !zipcode.equals("")) {
address.setZipCode(zipcode);
}
String country = person.getCountryCode();
address.setCountry(CountryCodeType.Enum.forString(country));
}
return address;
} | [
"public",
"AddressRequireCountryDataType",
"getAddressRequireCountryDataType",
"(",
"DepartmentalPersonDto",
"person",
")",
"{",
"AddressRequireCountryDataType",
"address",
"=",
"AddressRequireCountryDataType",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"... | Create AddressRequireCountryDataType from DepartmentalPerson object
@param person DepartmentalPerson
@return AddressRequireCountryDataType corresponding to the DepartmentalPerson object. | [
"Create",
"AddressRequireCountryDataType",
"from",
"DepartmentalPerson",
"object"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV1_0Generator.java#L200-L230 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV1_0Generator.java | GlobalLibraryV1_0Generator.getHumanNameDataType | public HumanNameDataType getHumanNameDataType(KeyPersonDto keyPerson) {
HumanNameDataType humanName = HumanNameDataType.Factory.newInstance();
humanName.setFirstName(keyPerson.getFirstName());
humanName.setLastName(keyPerson.getLastName());
String middleName = keyPerson.getMiddleName();
if (middleName != null && !middleName.equals("")) {
humanName.setMiddleName(middleName);
}
return humanName;
} | java | public HumanNameDataType getHumanNameDataType(KeyPersonDto keyPerson) {
HumanNameDataType humanName = HumanNameDataType.Factory.newInstance();
humanName.setFirstName(keyPerson.getFirstName());
humanName.setLastName(keyPerson.getLastName());
String middleName = keyPerson.getMiddleName();
if (middleName != null && !middleName.equals("")) {
humanName.setMiddleName(middleName);
}
return humanName;
} | [
"public",
"HumanNameDataType",
"getHumanNameDataType",
"(",
"KeyPersonDto",
"keyPerson",
")",
"{",
"HumanNameDataType",
"humanName",
"=",
"HumanNameDataType",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"humanName",
".",
"setFirstName",
"(",
"keyPerson",
".",
... | Create HumanNameDataType from KeyPersonInfo object
@param keyPerson KeyPersonInfo
@return HumanNameDataType corresponding to the KeyPersonInfo object | [
"Create",
"HumanNameDataType",
"from",
"KeyPersonInfo",
"object"
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV1_0Generator.java#L302-L312 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.