_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q16800 | HelpViewerProxy.sendRequest | train | private void sendRequest(String methodName, Object... params) {
sendRequest(new InvocationRequest(methodName, params), true);
} | java | {
"resource": ""
} |
q16801 | HelpViewerProxy.sendRequest | train | private void sendRequest(InvocationRequest helpRequest, boolean startRemoteViewer) {
this.helpRequest = helpRequest;
if (helpRequest != null) {
if (remoteViewerActive()) {
remoteQueue.sendRequest(helpRequest);
this.helpRequest = null;
} else if (startRemoteViewer) {
startRemoteViewer();
} else {
this.helpRequest = null;
}
}
} | java | {
"resource": ""
} |
q16802 | HelpViewerProxy.setRemoteQueue | train | public void setRemoteQueue(InvocationRequestQueue remoteQueue) {
this.remoteQueue = remoteQueue;
InvocationRequest deferredRequest = helpRequest;
sendRequest(loadRequest, false);
sendRequest(deferredRequest, false);
} | java | {
"resource": ""
} |
q16803 | HelpSetFactory.register | train | public static Class<? extends IHelpSet> register(Class<? extends IHelpSet> clazz, String formats) {
for (String type : formats.split("\\,")) {
instance.map.put(type, clazz);
}
return clazz;
} | java | {
"resource": ""
} |
q16804 | HelpSetFactory.create | train | public static IHelpSet create(HelpModule module) {
try {
Class<? extends IHelpSet> clazz = instance.map.get(module.getFormat());
if (clazz == null) {
throw new Exception("Unsupported help format: " + module.getFormat());
}
Constructor<? extends IHelpSet> ctor = clazz.getConstructor(HelpModule.class);
return ctor.newInstance(module);
} catch (Exception e) {
log.error("Error creating help set for " + module.getUrl(), e);
throw MiscUtil.toUnchecked(e);
}
} | java | {
"resource": ""
} |
q16805 | BaseRedisQueue.setRedisHashName | train | public BaseRedisQueue<ID, DATA> setRedisHashName(String redisHashName) {
_redisHashName = redisHashName;
this.redisHashName = _redisHashName.getBytes(QueueUtils.UTF8);
return this;
} | java | {
"resource": ""
} |
q16806 | BaseRedisQueue.setRedisListName | train | public BaseRedisQueue<ID, DATA> setRedisListName(String redisListName) {
_redisListName = redisListName;
this.redisListName = _redisListName.getBytes(QueueUtils.UTF8);
return this;
} | java | {
"resource": ""
} |
q16807 | BaseRedisQueue.setRedisSortedSetName | train | public BaseRedisQueue<ID, DATA> setRedisSortedSetName(String redisSortedSetName) {
_redisSortedSetName = redisSortedSetName;
this.redisSortedSetName = _redisSortedSetName.getBytes(QueueUtils.UTF8);
return this;
} | java | {
"resource": ""
} |
q16808 | ConfigTemplate.addEntry | train | public void addEntry(String placeholder, String... params) {
ConfigEntry entry = entries.get(placeholder);
String line = entry.template;
for (int i = 0; i < params.length; i++) {
line = line.replace("{" + i + "}", StringUtils.defaultString(params[i]));
}
entry.buffer.add(line);
} | java | {
"resource": ""
} |
q16809 | ConfigTemplate.createFile | train | protected void createFile(File stagingDirectory) throws MojoExecutionException {
File targetDirectory = newSubdirectory(stagingDirectory, "META-INF");
File newEntry = new File(targetDirectory, filename);
try (FileOutputStream out = new FileOutputStream(newEntry); PrintStream ps = new PrintStream(out);) {
Iterator<ConfigEntry> iter = entries.values().iterator();
ConfigEntry entry = null;
for (int i = 0; i < buffer.size(); i++) {
if (entry == null && iter.hasNext()) {
entry = iter.next();
}
if (entry != null && entry.placeholder == i) {
for (String line : entry.buffer) {
ps.println(line);
}
entry = null;
continue;
}
ps.println(buffer.get(i));
}
} catch (Exception e) {
throw new MojoExecutionException("Unexpected error while creating configuration file.", e);
}
} | java | {
"resource": ""
} |
q16810 | ConfigTemplate.newSubdirectory | train | private File newSubdirectory(File parentDirectory, String path) {
File dir = new File(parentDirectory, path);
if (!dir.exists()) {
dir.mkdirs();
}
return dir;
} | java | {
"resource": ""
} |
q16811 | ElementPlugin.destroy | train | @Override
public void destroy() {
shell.unregisterPlugin(this);
executeAction(PluginAction.UNLOAD, false);
CommandUtil.dissociateAll(container);
if (pluginEventListeners1 != null) {
pluginEventListeners1.clear();
pluginEventListeners1 = null;
}
if (pluginEventListeners2 != null) {
executeAction(PluginAction.UNSUBSCRIBE, false);
pluginEventListeners2.clear();
pluginEventListeners2 = null;
}
if (registeredProperties != null) {
registeredProperties.clear();
registeredProperties = null;
}
if (registeredBeans != null) {
registeredBeans.clear();
registeredBeans = null;
}
if (registeredComponents != null) {
for (BaseComponent component : registeredComponents) {
component.destroy();
}
registeredComponents.clear();
registeredComponents = null;
}
super.destroy();
} | java | {
"resource": ""
} |
q16812 | ElementPlugin.getPropertyValue | train | @Override
public Object getPropertyValue(PropertyInfo propInfo) throws Exception {
Object obj = registeredProperties == null ? null : registeredProperties.get(propInfo.getId());
if (obj instanceof PropertyProxy) {
Object value = ((PropertyProxy) obj).getValue();
return value instanceof String ? propInfo.getPropertyType().getSerializer().deserialize((String) value) : value;
} else {
return obj == null ? null : propInfo.getPropertyValue(obj, obj == this);
}
} | java | {
"resource": ""
} |
q16813 | ElementPlugin.setPropertyValue | train | @Override
public void setPropertyValue(PropertyInfo propInfo, Object value) throws Exception {
String propId = propInfo.getId();
Object obj = registeredProperties == null ? null : registeredProperties.get(propId);
if (obj == null) {
obj = new PropertyProxy(propInfo, value);
registerProperties(obj, propId);
} else if (obj instanceof PropertyProxy) {
((PropertyProxy) obj).setValue(value);
} else {
propInfo.setPropertyValue(obj, value, obj == this);
}
} | java | {
"resource": ""
} |
q16814 | ElementPlugin.updateVisibility | train | @Override
protected void updateVisibility(boolean visible, boolean activated) {
super.updateVisibility(visible, activated);
if (registeredComponents != null) {
for (BaseUIComponent component : registeredComponents) {
if (!visible) {
component.setAttribute(Constants.ATTR_VISIBLE, component.isVisible());
component.setVisible(false);
} else {
component.setVisible((Boolean) component.getAttribute(Constants.ATTR_VISIBLE));
}
}
}
if (visible) {
checkBusy();
}
} | java | {
"resource": ""
} |
q16815 | ElementPlugin.setDefinition | train | @Override
public void setDefinition(PluginDefinition definition) {
super.setDefinition(definition);
if (definition != null) {
container.addClass("cwf-plugin-" + definition.getId());
shell.registerPlugin(this);
}
} | java | {
"resource": ""
} |
q16816 | ElementPlugin.setBusy | train | public void setBusy(String message) {
busyMessage = message = StrUtil.formatMessage(message);
if (busyDisabled) {
busyPending = true;
} else if (message != null) {
disableActions(true);
ClientUtil.busy(container, message);
busyPending = !isVisible();
} else {
disableActions(false);
ClientUtil.busy(container, null);
busyPending = false;
}
} | java | {
"resource": ""
} |
q16817 | ElementPlugin.executeAction | train | private void executeAction(PluginAction action, boolean async, Object data) {
if (hasListeners() || action == PluginAction.LOAD) {
PluginEvent event = new PluginEvent(this, action, data);
if (async) {
EventUtil.post(event);
} else {
onAction(event);
}
}
} | java | {
"resource": ""
} |
q16818 | ElementPlugin.onAction | train | @EventHandler("action")
private void onAction(PluginEvent event) {
PluginException exception = null;
PluginAction action = event.getAction();
boolean debug = log.isDebugEnabled();
if (pluginEventListeners1 != null) {
for (IPluginEvent listener : new ArrayList<>(pluginEventListeners1)) {
try {
if (debug) {
log.debug("Invoking IPluginEvent.on" + WordUtils.capitalizeFully(action.name()) + " for listener "
+ listener);
}
switch (action) {
case LOAD:
listener.onLoad(this);
continue;
case UNLOAD:
listener.onUnload();
continue;
case ACTIVATE:
listener.onActivate();
continue;
case INACTIVATE:
listener.onInactivate();
continue;
}
} catch (Throwable e) {
exception = createChainedException(action.name(), e, exception);
}
}
}
if (pluginEventListeners2 != null) {
for (IPluginEventListener listener : new ArrayList<>(pluginEventListeners2)) {
try {
if (debug) {
log.debug("Delivering " + action.name() + " event to IPluginEventListener listener " + listener);
}
listener.onPluginEvent(event);
} catch (Throwable e) {
exception = createChainedException(action.name(), e, exception);
}
}
}
if (action == PluginAction.LOAD) {
doAfterLoad();
}
if (exception != null) {
throw exception;
}
} | java | {
"resource": ""
} |
q16819 | ElementPlugin.onCommand | train | @EventHandler("command")
private void onCommand(CommandEvent event) {
if (isEnabled()) {
for (BaseComponent child : container.getChildren()) {
EventUtil.send(event, child);
if (event.isStopped()) {
break;
}
}
}
} | java | {
"resource": ""
} |
q16820 | ElementPlugin.createChainedException | train | private PluginException createChainedException(String action, Throwable newException,
PluginException previousException) {
String msg = action + " event generated an error.";
log.error(msg, newException);
PluginException wrapper = new PluginException(msg, previousException == null ? newException : previousException,
null);
wrapper.setStackTrace(newException.getStackTrace());
return wrapper;
} | java | {
"resource": ""
} |
q16821 | ElementPlugin.load | train | public void load() {
PluginDefinition definition = getDefinition();
if (!initialized && definition != null) {
BaseComponent top;
try {
initialized = true;
top = container.getFirstChild();
if (top == null) {
top = PageUtil.createPage(definition.getUrl(), container).get(0);
}
} catch (Throwable e) {
container.destroyChildren();
throw createChainedException("Initialize", e, null);
}
if (pluginControllers != null) {
for (Object controller : pluginControllers) {
top.wireController(controller);
}
}
findListeners(container);
executeAction(PluginAction.LOAD, true);
}
} | java | {
"resource": ""
} |
q16822 | ElementPlugin.addToolbarComponent | train | public void addToolbarComponent(BaseComponent component) {
if (tbarContainer == null) {
tbarContainer = new ToolbarContainer();
shell.addToolbarComponent(tbarContainer);
registerComponent(tbarContainer);
}
tbarContainer.addChild(component);
} | java | {
"resource": ""
} |
q16823 | ElementPlugin.registerId | train | public void registerId(String id, BaseComponent component) {
if (!StringUtils.isEmpty(id) && !container.hasAttribute(id)) {
container.setAttribute(id, component);
}
} | java | {
"resource": ""
} |
q16824 | ElementPlugin.registerListener | train | public void registerListener(IPluginEvent listener) {
if (pluginEventListeners1 == null) {
pluginEventListeners1 = new ArrayList<>();
}
if (!pluginEventListeners1.contains(listener)) {
pluginEventListeners1.add(listener);
}
} | java | {
"resource": ""
} |
q16825 | ElementPlugin.registerListener | train | public void registerListener(IPluginEventListener listener) {
if (pluginEventListeners2 == null) {
pluginEventListeners2 = new ArrayList<>();
}
if (!pluginEventListeners2.contains(listener)) {
pluginEventListeners2.add(listener);
listener.onPluginEvent(new PluginEvent(this, PluginAction.SUBSCRIBE));
}
} | java | {
"resource": ""
} |
q16826 | ElementPlugin.unregisterListener | train | public void unregisterListener(IPluginEventListener listener) {
if (pluginEventListeners2 != null && pluginEventListeners2.contains(listener)) {
pluginEventListeners2.remove(listener);
listener.onPluginEvent(new PluginEvent(this, PluginAction.UNSUBSCRIBE));
}
} | java | {
"resource": ""
} |
q16827 | ElementPlugin.tryRegisterListener | train | public boolean tryRegisterListener(Object object, boolean register) {
boolean success = false;
if (object instanceof IPluginEvent) {
if (register) {
registerListener((IPluginEvent) object);
} else {
unregisterListener((IPluginEvent) object);
}
success = true;
}
if (object instanceof IPluginEventListener) {
if (register) {
registerListener((IPluginEventListener) object);
} else {
unregisterListener((IPluginEventListener) object);
}
success = true;
}
return success;
} | java | {
"resource": ""
} |
q16828 | ElementPlugin.tryRegisterController | train | public void tryRegisterController(Object object) {
if (object instanceof IPluginController) {
if (pluginControllers == null) {
pluginControllers = new ArrayList<>();
}
pluginControllers.add((IPluginController) object);
}
} | java | {
"resource": ""
} |
q16829 | ElementPlugin.registerProperties | train | public void registerProperties(Object instance, String... propertyNames) {
for (String propertyName : propertyNames) {
registerProperty(instance, propertyName, true);
}
} | java | {
"resource": ""
} |
q16830 | ElementPlugin.registerProperty | train | public void registerProperty(Object instance, String propertyName, boolean override) {
if (registeredProperties == null) {
registeredProperties = new HashMap<>();
}
if (instance == null) {
registeredProperties.remove(propertyName);
} else {
Object oldInstance = registeredProperties.get(propertyName);
PropertyProxy proxy = oldInstance instanceof PropertyProxy ? (PropertyProxy) oldInstance : null;
if (!override && oldInstance != null && proxy == null) {
return;
}
registeredProperties.put(propertyName, instance);
// If previous registrant was a property proxy, transfer its value to new registrant.
if (proxy != null) {
try {
proxy.getPropertyInfo().setPropertyValue(instance, proxy.getValue());
} catch (Exception e) {
throw createChainedException("Register Property", e, null);
}
}
}
} | java | {
"resource": ""
} |
q16831 | ElementPlugin.registerBean | train | public void registerBean(String beanId, boolean isRequired) {
if (beanId == null || beanId.isEmpty()) {
return;
}
Object bean = SpringUtil.getBean(beanId);
if (bean == null && isRequired) {
throw new PluginException("Required bean resouce not found: " + beanId);
}
Object oldBean = getAssociatedBean(beanId);
if (bean == oldBean) {
return;
}
if (registeredBeans == null) {
registeredBeans = new HashMap<>();
}
tryRegisterListener(oldBean, false);
if (bean == null) {
registeredBeans.remove(beanId);
} else {
registeredBeans.put(beanId, bean);
tryRegisterListener(bean, true);
tryRegisterController(bean);
}
} | java | {
"resource": ""
} |
q16832 | ElementProxy.setPropertyValue | train | @Override
public void setPropertyValue(PropertyInfo propInfo, Object value) {
setPropertyValue(propInfo.getId(), value);
} | java | {
"resource": ""
} |
q16833 | ElementProxy.realize | train | public ElementBase realize(ElementBase parent) {
if (!deleted && real == null) {
real = getDefinition().createElement(parent, null, false);
} else if (deleted && real != null) {
real.remove(true);
real = null;
}
return real;
} | java | {
"resource": ""
} |
q16834 | ElementProxy.syncProperties | train | private void syncProperties(boolean fromReal) {
PluginDefinition def = getDefinition();
for (PropertyInfo propInfo : def.getProperties()) {
if (fromReal) {
syncProperty(propInfo, real, this);
} else {
syncProperty(propInfo, this, real);
}
}
} | java | {
"resource": ""
} |
q16835 | GreenPepperWiki.execute | train | @Override
public String execute(@SuppressWarnings("rawtypes") Map parameters, String body, RenderContext renderContext) throws MacroException
{
try
{
return body;
}
catch (Exception e)
{
return getErrorView("greenpepper.info.macroid", e.getMessage());
}
} | java | {
"resource": ""
} |
q16836 | GreenPepperWiki.execute | train | @Override
public String execute(Map<String, String> parameters, String body,
ConversionContext context) throws MacroExecutionException {
try
{
String xhtmlRendered = gpUtil.getWikiStyleRenderer().convertWikiToXHtml(context.getPageContext(), body);
LOGGER.trace("rendering : \n - source \n {} \n - output \n {}", body, xhtmlRendered);
return xhtmlRendered;
}
catch (Exception e)
{
return getErrorView("greenpepper.info.macroid", e.getMessage());
}
} | java | {
"resource": ""
} |
q16837 | RocksDbQueue.saveLastFetchedId | train | private void saveLastFetchedId(byte[] lastFetchedId) {
if (lastFetchedId != null) {
rocksDbWrapper.put(cfNameMetadata, writeOptions, keyLastFetchedId, lastFetchedId);
}
} | java | {
"resource": ""
} |
q16838 | HelpViewBase.createView | train | public static HelpViewBase createView(HelpViewer viewer, HelpViewType viewType) {
Class<? extends HelpViewBase> viewClass = viewType == null ? null : getViewClass(viewType);
if (viewClass == null) {
return null;
}
try {
return viewClass.getConstructor(HelpViewer.class, HelpViewType.class).newInstance(viewer, viewType);
} catch (Exception e) {
throw MiscUtil.toUnchecked(e);
}
} | java | {
"resource": ""
} |
q16839 | HelpViewBase.getViewClass | train | private static Class<? extends HelpViewBase> getViewClass(HelpViewType viewType) {
switch (viewType) {
case TOC:
return HelpViewContents.class;
case KEYWORD:
return HelpViewIndex.class;
case INDEX:
return HelpViewIndex.class;
case SEARCH:
return HelpViewSearch.class;
case HISTORY:
return HelpViewHistory.class;
case GLOSSARY:
return HelpViewIndex.class;
default:
return null;
}
} | java | {
"resource": ""
} |
q16840 | LongDoubleHashMap.computeCapacity | train | private static int computeCapacity(final int expectedSize) {
if (expectedSize == 0) {
return 1;
}
final int capacity = (int) InternalFastMath.ceil(expectedSize / LOAD_FACTOR);
final int powerOfTwo = Integer.highestOneBit(capacity);
if (powerOfTwo == capacity) {
return capacity;
}
return nextPowerOfTwo(capacity);
} | java | {
"resource": ""
} |
q16841 | LongDoubleHashMap.contains | train | public boolean contains(final long key) {
final int hash = hashOf(key);
int index = hash & mask;
if (contains(key, index)) {
return true;
}
if (states[index] == FREE) {
return false;
}
int j = index;
for (int perturb = perturb(hash); states[index] != FREE; perturb >>= PERTURB_SHIFT) {
j = probe(perturb, j);
index = j & mask;
if (contains(key, index)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q16842 | LongDoubleHashMap.findInsertionIndex | train | private static int findInsertionIndex(final long[] keys, final byte[] states,
final long key, final int mask) {
final int hash = hashOf(key);
int index = hash & mask;
if (states[index] == FREE) {
return index;
} else if (states[index] == FULL && keys[index] == key) {
return changeIndexSign(index);
}
int perturb = perturb(hash);
int j = index;
if (states[index] == FULL) {
while (true) {
j = probe(perturb, j);
index = j & mask;
perturb >>= PERTURB_SHIFT;
if (states[index] != FULL || keys[index] == key) {
break;
}
}
}
if (states[index] == FREE) {
return index;
} else if (states[index] == FULL) {
// due to the loop exit condition,
// if (states[index] == FULL) then keys[index] == key
return changeIndexSign(index);
}
final int firstRemoved = index;
while (true) {
j = probe(perturb, j);
index = j & mask;
if (states[index] == FREE) {
return firstRemoved;
} else if (states[index] == FULL && keys[index] == key) {
return changeIndexSign(index);
}
perturb >>= PERTURB_SHIFT;
}
} | java | {
"resource": ""
} |
q16843 | LongDoubleHashMap.clear | train | public void clear() {
final int capacity = keys.length;
Arrays.fill(keys, 0);
Arrays.fill(values, 0);
Arrays.fill(states, FREE);
size = 0;
mask = capacity - 1;
count = 0;
} | java | {
"resource": ""
} |
q16844 | IntLongSort.swap | train | private static void swap(long[] values, int[] index, int i, int j) {
if (i != j) {
swap(values, i, j);
swap(index, i, j);
numSwaps ++;
}
} | java | {
"resource": ""
} |
q16845 | FloatArrays.getArgmax | train | public static IntTuple getArgmax(float[][] array, float delta) {
float maxValue = Float.NEGATIVE_INFINITY;
int maxX = -1;
int maxY = -1;
float numMax = 1;
for (int x=0; x<array.length; x++) {
for (int y=0; y<array[x].length; y++) {
float diff = Primitives.compare(array[x][y], maxValue, delta);
if (diff == 0 && Prng.nextFloat() < 1.0 / numMax) {
maxValue = array[x][y];
maxX = x;
maxY = y;
numMax++;
} else if (diff > 0) {
maxValue = array[x][y];
maxX = x;
maxY = y;
numMax = 1;
}
}
}
return new IntTuple(maxX, maxY);
} | java | {
"resource": ""
} |
q16846 | FloatArrays.count | train | public static int count(float[] array, float val) {
int count = 0;
for (int i=0; i<array.length; i++) {
if (array[i] == val) {
count++;
}
}
return count;
} | java | {
"resource": ""
} |
q16847 | PairSampler.sampleOrderedPairs | train | public static Collection<OrderedPair> sampleOrderedPairs(int minI, int maxI, int minJ, int maxJ, double prop) {
int numI = maxI - minI;
int numJ = maxJ - minJ;
// Count the max number possible:
long maxPairs = numI * numJ;
Collection<OrderedPair> samples;
if (maxPairs < 400000000 || prop > 0.1) {
samples = new ArrayList<OrderedPair>();
for (int i=minI; i<maxI; i++) {
for (int j=minJ; j<maxJ; j++) {
if (prop >= 1.0 || Prng.nextDouble() < prop) {
samples.add(new OrderedPair(i, j));
}
}
}
} else {
samples = new HashSet<OrderedPair>();
double numSamples = maxPairs * prop;
while (samples.size() < numSamples) {
int i = Prng.nextInt(numI) + minI;
int j = Prng.nextInt(numJ) + minJ;
samples.add(new OrderedPair(i, j));
}
}
return samples;
} | java | {
"resource": ""
} |
q16848 | PairSampler.sampleUnorderedPairs | train | public static Collection<UnorderedPair> sampleUnorderedPairs(int minI, int maxI, int minJ, int maxJ, double prop) {
int numI = maxI - minI;
int numJ = maxJ - minJ;
// Count the max number possible:
long maxPairs = PairSampler.countUnorderedPairs(minI, maxI, minJ, maxJ);
Collection<UnorderedPair> samples;
if (maxPairs < 400000000 || prop > 0.1) {
samples = new ArrayList<UnorderedPair>();
int min = Math.min(minI, minJ);
int max = Math.max(maxI, maxJ);
for (int i=min; i<max; i++) {
for (int j=i; j<max; j++) {
if ((minI <= i && i < maxI && minJ <= j && j < maxJ) ||
(minJ <= i && i < maxJ && minI <= j && j < maxI)) {
if (prop >= 1.0 || Prng.nextDouble() < prop) {
samples.add(new UnorderedPair(i, j));
}
}
}
}
} else {
samples = new HashSet<UnorderedPair>();
double numSamples = maxPairs * prop;
while (samples.size() < numSamples) {
int i = Prng.nextInt(numI) + minI;
int j = Prng.nextInt(numJ) + minJ;
if (i <= j) {
// We must reject samples for which j < i, or else we would
// be making pairs with i==j half as likely.
samples.add(new UnorderedPair(i, j));
}
}
}
return samples;
} | java | {
"resource": ""
} |
q16849 | ParticipantListener.setActive | train | public void setActive(boolean active) {
refreshListener.setActive(active);
addListener.setActive(active);
removeListener.setActive(active);
eventManager.fireRemoteEvent(active ? addListener.eventName : removeListener.eventName, self);
if (active) {
refresh();
}
} | java | {
"resource": ""
} |
q16850 | ManifestIterator.init | train | public void init() {
if (manifests == null) {
manifests = new ArrayList<>();
try {
primaryManifest = addToList(applicationContext.getResource(MANIFEST_PATH));
Resource[] resources = applicationContext.getResources("classpath*:/" + MANIFEST_PATH);
for (Resource resource : resources) {
Manifest manifest = addToList(resource);
if (primaryManifest == null) {
primaryManifest = manifest;
}
}
} catch (Exception e) {
log.error("Error enumerating manifests.", e);
}
}
} | java | {
"resource": ""
} |
q16851 | ManifestIterator.findByPath | train | public Manifest findByPath(String path) {
for (Manifest manifest : this) {
String mpath = ((ManifestEx) manifest).path;
if (path.startsWith(mpath)) {
return manifest;
}
}
return null;
} | java | {
"resource": ""
} |
q16852 | ManifestIterator.addToList | train | private Manifest addToList(Resource resource) {
try {
if (resource != null && resource.exists()) {
Manifest manifest = new ManifestEx(resource);
manifests.add(manifest);
return manifest;
}
} catch (Exception e) {
log.debug("Exception occurred reading manifest: " + resource);
}
return null;
} | java | {
"resource": ""
} |
q16853 | InmemQueue.putToQueue | train | protected void putToQueue(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull {
if (!queue.offer(msg)) {
throw new QueueException.QueueIsFull(getBoundary());
}
} | java | {
"resource": ""
} |
q16854 | ActionTypeBase.getType | train | protected String getType(String script) {
int i = script.indexOf(':');
return i < 0 ? "" : script.substring(0, i);
} | java | {
"resource": ""
} |
q16855 | PropertyBasedConfigurator.setApplicationContext | train | @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
propertyProvider = new PropertyProvider(applicationContext);
conversionService = DefaultConversionService.getSharedInstance();
wireParams(this);
afterInitialized();
} | java | {
"resource": ""
} |
q16856 | OneProperties.initConfigs | train | void initConfigs(String propertiesAbsoluteClassPath) {
this.propertiesAbsoluteClassPath = propertiesAbsoluteClassPath;
this.propertiesFilePath = ResourceUtil.getAbsolutePath(propertiesAbsoluteClassPath);
loadConfigs();
} | java | {
"resource": ""
} |
q16857 | OneProperties.loadConfigs | train | protected void loadConfigs() {
configs = new Properties();
// If run as a jar, find in file system classpath first, if not found, then get resource in jar.
if (ClassPathUtil.testRunMainInJar()) {
String[] classPathsInFileSystem = ClassPathUtil.getAllClassPathNotInJar();
String workDir = System.getProperty("user.dir");
String mainJarRelativePath = ClassPathUtil.getClassPathsInSystemProperty()[0];
File mainJar = new File(workDir, mainJarRelativePath);
File mainJarDir = mainJar.getParentFile();
for (String classPath : classPathsInFileSystem) {
File classPathFile = new File(classPath);
File configFile;
if (classPathFile.isAbsolute()) {
configFile = new File(classPathFile, propertiesAbsoluteClassPath);
} else {
configFile = new File(new File(mainJarDir, classPath), propertiesAbsoluteClassPath);
}
if (configFile.exists() && configFile.isFile()) {
InputStream is = null;
try {
is = new FileInputStream(configFile);
loadConfigsFromStream(is);
} catch (FileNotFoundException e) {
LOGGER.warn("Load config file " + configFile.getPath() + " error!", e);
}
return;
}
}
}
if (propertiesFilePath == null) {
if (propertiesAbsoluteClassPath == null) {
return;
}
InputStream is = OneProperties.class.getResourceAsStream(propertiesAbsoluteClassPath);
loadConfigsFromStream(is);
} else {
configs = PropertiesIO.load(propertiesFilePath);
}
} | java | {
"resource": ""
} |
q16858 | OneProperties.modifyConfig | train | protected void modifyConfig(IConfigKey key, String value) throws IOException {
if (propertiesFilePath == null) {
LOGGER.warn("Config " + propertiesAbsoluteClassPath + " is not a file, maybe just a resource in library.");
}
if (configs == null) {
loadConfigs();
}
configs.setProperty(key.getKeyString(), value);
PropertiesIO.store(propertiesFilePath, configs);
} | java | {
"resource": ""
} |
q16859 | MongodbQueue.insertToCollection | train | protected boolean insertToCollection(IQueueMessage<ID, DATA> msg) {
getCollection().insertOne(toDocument(msg));
return true;
} | java | {
"resource": ""
} |
q16860 | IntObjectHashMap.get | train | public T get(final int key) {
final int hash = hashOf(key);
int index = hash & mask;
if (containsKey(key, index)) {
return (T)values[index];
}
if (states[index] == FREE) {
return missingEntries;
}
int j = index;
for (int perturb = perturb(hash); states[index] != FREE; perturb >>= PERTURB_SHIFT) {
j = probe(perturb, j);
index = j & mask;
if (containsKey(key, index)) {
return (T)values[index];
}
}
return missingEntries;
} | java | {
"resource": ""
} |
q16861 | IntObjectHashMap.doRemove | train | private T doRemove(int index) {
keys[index] = 0;
states[index] = REMOVED;
final Object previous = values[index];
values[index] = missingEntries;
--size;
++count;
return (T)previous;
} | java | {
"resource": ""
} |
q16862 | AbstractQueue.serialize | train | protected byte[] serialize(IQueueMessage<ID, DATA> queueMsg) {
return queueMsg != null ? SerializationUtils.toByteArray(queueMsg) : null;
} | java | {
"resource": ""
} |
q16863 | RRBudget10V1_1Generator.getRRBudget10 | train | private RRBudget10Document getRRBudget10() {
deleteAutoGenNarratives();
RRBudget10Document rrBudgetDocument = RRBudget10Document.Factory
.newInstance();
RRBudget10 rrBudget = RRBudget10.Factory.newInstance();
rrBudget.setFormVersion(FormVersion.v1_1.getVersion());
if (pdDoc.getDevelopmentProposal().getApplicantOrganization() != null) {
rrBudget.setDUNSID(pdDoc.getDevelopmentProposal()
.getApplicantOrganization().getOrganization()
.getDunsNumber());
rrBudget.setOrganizationName(pdDoc.getDevelopmentProposal()
.getApplicantOrganization().getOrganization()
.getOrganizationName());
}
rrBudget.setBudgetType(BudgetTypeDataType.PROJECT);
List<BudgetPeriodDto> budgetperiodList;
BudgetSummaryDto budgetSummary = null;
try {
validateBudgetForForm(pdDoc);
budgetperiodList = s2sBudgetCalculatorService.getBudgetPeriods(pdDoc);
budgetSummary = s2sBudgetCalculatorService.getBudgetInfo(pdDoc,budgetperiodList);
} catch (S2SException e) {
LOG.error(e.getMessage(), e);
return rrBudgetDocument;
}
rrBudget.setBudgetSummary(getBudgetSummary(budgetSummary));
for (BudgetPeriodDto budgetPeriodData : budgetperiodList) {
setBudgetYearDataType(rrBudget,budgetPeriodData);
}
AttachedFileDataType attachedFileDataType = AttachedFileDataType.Factory.newInstance();
for (NarrativeContract narrative : pdDoc.getDevelopmentProposal().getNarratives()) {
if (narrative.getNarrativeType().getCode() != null
&& Integer.parseInt(narrative.getNarrativeType().getCode()) == 132) {
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType != null) {
break;
}
}
}
rrBudget.setBudgetJustificationAttachment(attachedFileDataType);
rrBudgetDocument.setRRBudget10(rrBudget);
return rrBudgetDocument;
} | java | {
"resource": ""
} |
q16864 | RRBudget10V1_1Generator.getIndirectCosts | train | private IndirectCosts getIndirectCosts(BudgetPeriodDto periodInfo) {
IndirectCosts indirectCosts = null;
if (periodInfo != null
&& periodInfo.getIndirectCosts() != null
&& periodInfo.getIndirectCosts().getIndirectCostDetails() != null) {
List<IndirectCosts.IndirectCost> indirectCostList = new ArrayList<>();
int IndirectCostCount = 0;
for (IndirectCostDetailsDto indirectCostDetails : periodInfo
.getIndirectCosts().getIndirectCostDetails()) {
IndirectCosts.IndirectCost indirectCost = IndirectCosts.IndirectCost.Factory
.newInstance();
if (indirectCostDetails.getBase() != null) {
indirectCost.setBase(indirectCostDetails.getBase()
.bigDecimalValue());
}
indirectCost.setCostType(indirectCostDetails.getCostType());
if (indirectCostDetails.getFunds() != null) {
indirectCost.setFundRequested(indirectCostDetails
.getFunds().bigDecimalValue());
}
if (indirectCostDetails.getRate() != null) {
indirectCost.setRate(indirectCostDetails.getRate()
.bigDecimalValue());
}
indirectCostList.add(indirectCost);
IndirectCostCount++;
if (IndirectCostCount == ARRAY_LIMIT_IN_SCHEMA) {
LOG
.warn("Stopping iteration over indirect cost details because array limit in schema is only 4");
break;
}
}
if (IndirectCostCount > 0) {
indirectCosts = IndirectCosts.Factory.newInstance();
IndirectCosts.IndirectCost indirectCostArray[] = new IndirectCosts.IndirectCost[0];
indirectCosts.setIndirectCostArray(indirectCostList
.toArray(indirectCostArray));
if (periodInfo.getIndirectCosts().getTotalIndirectCosts() != null) {
indirectCosts.setTotalIndirectCosts(periodInfo
.getIndirectCosts().getTotalIndirectCosts()
.bigDecimalValue());
}
}
}
return indirectCosts;
} | java | {
"resource": ""
} |
q16865 | RRBudget10V1_1Generator.setOthersForOtherDirectCosts | train | private void setOthersForOtherDirectCosts(OtherDirectCosts otherDirectCosts, BudgetPeriodDto periodInfo) {
if (periodInfo != null && periodInfo.getOtherDirectCosts() != null) {
for (OtherDirectCostInfoDto otherDirectCostInfo : periodInfo.getOtherDirectCosts()) {
gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherDirectCosts.Other other = otherDirectCosts.addNewOther();
if (otherDirectCostInfo.getOtherCosts() != null
&& otherDirectCostInfo.getOtherCosts().size() > 0) {
other
.setCost(new BigDecimal(otherDirectCostInfo
.getOtherCosts().get(0).get(
CostConstants.KEY_COST)));
}
other.setDescription(OTHERCOST_DESCRIPTION);
}
}
} | java | {
"resource": ""
} |
q16866 | RRBudget10V1_1Generator.getPostDocAssociates | train | private PostDocAssociates getPostDocAssociates(
OtherPersonnelDto otherPersonnel) {
PostDocAssociates postDocAssociates = PostDocAssociates.Factory
.newInstance();
if (otherPersonnel != null) {
postDocAssociates.setNumberOfPersonnel(otherPersonnel
.getNumberPersonnel());
postDocAssociates.setProjectRole(otherPersonnel.getRole());
CompensationDto sectBCompType = otherPersonnel.getCompensation();
postDocAssociates.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
postDocAssociates.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
postDocAssociates.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
postDocAssociates.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
postDocAssociates.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
postDocAssociates.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());
}
return postDocAssociates;
} | java | {
"resource": ""
} |
q16867 | RRBudget10V1_1Generator.getGraduateStudents | train | private GraduateStudents getGraduateStudents(
OtherPersonnelDto otherPersonnel) {
GraduateStudents graduate = GraduateStudents.Factory.newInstance();
if (otherPersonnel != null) {
graduate.setNumberOfPersonnel(otherPersonnel.getNumberPersonnel());
graduate.setProjectRole(otherPersonnel.getRole());
CompensationDto sectBCompType = otherPersonnel.getCompensation();
graduate.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
graduate.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
graduate.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
graduate.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
graduate.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
graduate.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());
}
return graduate;
} | java | {
"resource": ""
} |
q16868 | RRBudget10V1_1Generator.getUndergraduateStudents | train | private UndergraduateStudents getUndergraduateStudents(
OtherPersonnelDto otherPersonnel) {
UndergraduateStudents undergraduate = UndergraduateStudents.Factory
.newInstance();
if (otherPersonnel != null) {
undergraduate.setNumberOfPersonnel(otherPersonnel
.getNumberPersonnel());
undergraduate.setProjectRole(otherPersonnel.getRole());
CompensationDto sectBCompType = otherPersonnel.getCompensation();
undergraduate.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
undergraduate.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
undergraduate.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
undergraduate.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
undergraduate.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
undergraduate.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());
}
return undergraduate;
} | java | {
"resource": ""
} |
q16869 | RRBudget10V1_1Generator.getSecretarialClerical | train | private SecretarialClerical getSecretarialClerical(
OtherPersonnelDto otherPersonnel) {
SecretarialClerical secretarialClerical = SecretarialClerical.Factory
.newInstance();
if (otherPersonnel != null) {
secretarialClerical.setNumberOfPersonnel(otherPersonnel
.getNumberPersonnel());
secretarialClerical.setProjectRole(otherPersonnel.getRole());
CompensationDto sectBCompType = otherPersonnel.getCompensation();
secretarialClerical.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
secretarialClerical.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
secretarialClerical.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
secretarialClerical.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
secretarialClerical.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
secretarialClerical.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());
}
return secretarialClerical;
} | java | {
"resource": ""
} |
q16870 | DirectoryIterator.listFiles | train | private List<File> listFiles(File file, List<File> files) {
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
files.add(child);
listFiles(child, files);
}
}
return files;
} | java | {
"resource": ""
} |
q16871 | CommandUtil.associateCommand | train | public static void associateCommand(String commandName, BaseUIComponent component, IAction action) {
getCommand(commandName, true).bind(component, action);
} | java | {
"resource": ""
} |
q16872 | CommandUtil.dissociateCommand | train | public static void dissociateCommand(String commandName, BaseUIComponent component) {
Command command = getCommand(commandName, false);
if (command != null) {
command.unbind(component);
}
} | java | {
"resource": ""
} |
q16873 | CommandUtil.dissociateAll | train | public static void dissociateAll(BaseUIComponent component) {
for (Command command : CommandRegistry.getInstance()) {
command.unbind(component);
}
} | java | {
"resource": ""
} |
q16874 | CommandUtil.getCommand | train | public static Command getCommand(String commandName, boolean forceCreate) {
return CommandRegistry.getInstance().get(commandName, forceCreate);
} | java | {
"resource": ""
} |
q16875 | CommandUtil.addShortcut | train | private static void addShortcut(StringBuilder sb, Set<String> shortcuts) {
if (sb.length() > 0) {
String shortcut = validateShortcut(sb.toString());
if (shortcut != null) {
shortcuts.add(shortcut);
}
sb.delete(0, sb.length());
}
} | java | {
"resource": ""
} |
q16876 | HelpSearchService.resolveIndexDirectoryPath | train | private File resolveIndexDirectoryPath() throws IOException {
if (StringUtils.isEmpty(indexDirectoryPath)) {
indexDirectoryPath = System.getProperty("java.io.tmpdir") + appContext.getApplicationName();
}
File dir = new File(indexDirectoryPath, getClass().getPackage().getName());
if (!dir.exists() && !dir.mkdirs()) {
throw new IOException("Failed to create help search index directory.");
}
log.info("Help search index located at " + dir);
return dir;
} | java | {
"resource": ""
} |
q16877 | HelpSearchService.indexHelpModule | train | @Override
public void indexHelpModule(HelpModule helpModule) {
try {
if (indexTracker.isSame(helpModule)) {
return;
}
unindexHelpModule(helpModule);
log.info("Indexing help module " + helpModule.getLocalizedId());
int i = helpModule.getUrl().lastIndexOf('/');
String pattern = "classpath:" + helpModule.getUrl().substring(0, i + 1) + "*.htm*";
for (Resource resource : appContext.getResources(pattern)) {
indexDocument(helpModule, resource);
}
writer.commit();
indexTracker.add(helpModule);
} catch (Exception e) {
throw MiscUtil.toUnchecked(e);
}
} | java | {
"resource": ""
} |
q16878 | HelpSearchService.unindexHelpModule | train | @Override
public void unindexHelpModule(HelpModule helpModule) {
try {
log.info("Removing index for help module " + helpModule.getLocalizedId());
Term term = new Term("module", helpModule.getLocalizedId());
writer.deleteDocuments(term);
writer.commit();
indexTracker.remove(helpModule);
} catch (IOException e) {
MiscUtil.toUnchecked(e);
}
} | java | {
"resource": ""
} |
q16879 | HelpSearchService.indexDocument | train | private void indexDocument(HelpModule helpModule, Resource resource) throws Exception {
String title = getTitle(resource);
try (InputStream is = resource.getInputStream()) {
Document document = new Document();
document.add(new TextField("module", helpModule.getLocalizedId(), Store.YES));
document.add(new TextField("source", helpModule.getTitle(), Store.YES));
document.add(new TextField("title", title, Store.YES));
document.add(new TextField("url", resource.getURL().toString(), Store.YES));
document.add(new TextField("content", tika.parseToString(is), Store.NO));
writer.addDocument(document);
}
} | java | {
"resource": ""
} |
q16880 | HelpSearchService.getTitle | train | private String getTitle(Resource resource) {
String title = null;
try (InputStream is = resource.getInputStream()) {
Iterator<String> iter = IOUtils.lineIterator(is, "UTF-8");
while (iter.hasNext()) {
String line = iter.next().trim();
String lower = line.toLowerCase();
int i = lower.indexOf("<title>");
if (i > -1) {
i += 7;
int j = lower.indexOf("</title>", i);
title = line.substring(i, j == -1 ? line.length() : j).trim();
title = title.replace("_no", "").replace('_', ' ');
break;
}
}
} catch (Exception e) {
throw MiscUtil.toUnchecked(e);
}
return title;
} | java | {
"resource": ""
} |
q16881 | HelpSearchService.search | train | @Override
public void search(String words, Collection<IHelpSet> helpSets, IHelpSearchListener listener) {
try {
if (queryBuilder == null) {
initQueryBuilder();
}
Query searchForWords = queryBuilder.createBooleanQuery("content", words, Occur.MUST);
Query searchForModules = queryBuilder.createBooleanQuery("module", StrUtil.fromList(helpSets, " "));
BooleanQuery query = new BooleanQuery();
query.add(searchForModules, Occur.MUST);
query.add(searchForWords, Occur.MUST);
TopDocs docs = indexSearcher.search(query, 9999);
List<HelpSearchHit> hits = new ArrayList<>(docs.totalHits);
for (ScoreDoc sdoc : docs.scoreDocs) {
Document doc = indexSearcher.doc(sdoc.doc);
String source = doc.get("source");
String title = doc.get("title");
String url = doc.get("url");
HelpTopic topic = new HelpTopic(new URL(url), title, source);
HelpSearchHit hit = new HelpSearchHit(topic, sdoc.score);
hits.add(hit);
}
listener.onSearchComplete(hits);
} catch (Exception e) {
MiscUtil.toUnchecked(e);
}
} | java | {
"resource": ""
} |
q16882 | HelpSearchService.init | train | public void init() throws IOException {
File path = resolveIndexDirectoryPath();
indexTracker = new IndexTracker(path);
indexDirectory = FSDirectory.open(path);
tika = new Tika(null, new HtmlParser());
Analyzer analyzer = new StandardAnalyzer();
IndexWriterConfig config = new IndexWriterConfig(Version.LATEST, analyzer);
writer = new IndexWriter(indexDirectory, config);
} | java | {
"resource": ""
} |
q16883 | HelpSearchService.initQueryBuilder | train | private synchronized void initQueryBuilder() throws IOException {
if (queryBuilder == null) {
indexReader = DirectoryReader.open(indexDirectory);
indexSearcher = new IndexSearcher(indexReader);
queryBuilder = new QueryBuilder(writer.getAnalyzer());
}
} | java | {
"resource": ""
} |
q16884 | AlertContainer.render | train | public static AlertContainer render(BaseComponent parent, BaseComponent child) {
AlertContainer container = new AlertContainer(child);
parent.addChild(container, 0);
return container;
} | java | {
"resource": ""
} |
q16885 | AlertContainer.doAction | train | @Override
public void doAction(Action action) {
BaseComponent parent = getParent();
switch (action) {
case REMOVE:
ActionListener.unbindActionListeners(this, actionListeners);
detach();
break;
case HIDE:
case COLLAPSE:
setVisible(false);
break;
case SHOW:
case EXPAND:
setVisible(true);
break;
case TOP:
parent.addChild(this, 0);
break;
}
if (parent != null) {
EventUtil.post(MainController.ALERT_ACTION_EVENT, parent, action);
}
} | java | {
"resource": ""
} |
q16886 | MessageConsumer.assertSubscriptions | train | public void assertSubscriptions() {
for (String channel : subscribers.keySet()) {
try {
subscribers.put(channel, null);
subscribe(channel);
} catch (Throwable e) {
break;
}
}
} | java | {
"resource": ""
} |
q16887 | MessageConsumer.removeSubscriptions | train | public void removeSubscriptions() {
for (TopicSubscriber subscriber : subscribers.values()) {
try {
subscriber.close();
} catch (Throwable e) {
log.debug("Error closing subscriber", e);//is level appropriate - previously hidden exception -afranken
}
}
subscribers.clear();
} | java | {
"resource": ""
} |
q16888 | PluginResourceButton.getCaption | train | public String getCaption() {
return caption != null && caption.toLowerCase().startsWith("label:") ? StrUtil.getLabel(caption.substring(6))
: caption;
} | java | {
"resource": ""
} |
q16889 | LayoutNode.createDOMNode | train | public Element createDOMNode(Element parent) {
Element domNode = parent.getOwnerDocument().createElement(tagName);
LayoutUtil.copyAttributes(attributes, domNode);
parent.appendChild(domNode);
return domNode;
} | java | {
"resource": ""
} |
q16890 | TempFolderHandler.reset | train | public void reset() throws IOException {
if (t1==null || t2==null) {
throw new IllegalStateException("Cannot reset after close.");
}
if (!isEmpty(getOutput())) {
toggle = !toggle;
// reset the new output
PathTools.deleteRecursive(getOutput(), false);
} else {
throw new IOException("Cannot swap to an empty folder.");
}
} | java | {
"resource": ""
} |
q16891 | TempFolderHandler.close | train | public void close() throws IOException {
if (t1==null || t2==null) {
return;
}
try {
if (!isEmpty(getOutput())) {
Optional<? extends IOException> ex = output.apply(getOutput());
if (ex.isPresent()) {
throw ex.get();
}
} else if (!isEmpty(getInput())) {
Optional<? extends IOException> ex = output.apply(getInput());
if (ex.isPresent()) {
throw ex.get();
}
} else {
throw new IOException("Corrupted state.");
}
} finally {
PathTools.deleteRecursive(t1);
PathTools.deleteRecursive(t2);
t1 = null;
t2 = null;
}
} | java | {
"resource": ""
} |
q16892 | CWFAuthenticationDetails.setDetail | train | public void setDetail(String name, Object value) {
if (value == null) {
details.remove(name);
} else {
details.put(name, value);
}
if (log.isDebugEnabled()) {
if (value == null) {
log.debug("Detail removed: " + name);
} else {
log.debug("Detail added: " + name + " = " + value);
}
}
} | java | {
"resource": ""
} |
q16893 | CWFAuthenticationDetails.getDetail | train | public Object getDetail(String name) {
return name == null ? null : details.get(name);
} | java | {
"resource": ""
} |
q16894 | GlobalEventDispatcher.init | train | public void init() {
IUser user = SecurityUtil.getAuthenticatedUser();
publisherInfo.setUserId(user == null ? null : user.getLogicalId());
publisherInfo.setUserName(user == null ? "" : user.getFullName());
publisherInfo.setAppName(getAppName());
publisherInfo.setConsumerId(consumer.getNodeId());
publisherInfo.setProducerId(producer.getNodeId());
publisherInfo.setSessionId(sessionId);
localEventDispatcher.setGlobalEventDispatcher(this);
pingEventHandler = new PingEventHandler((IEventManager) localEventDispatcher, publisherInfo);
pingEventHandler.init();
} | java | {
"resource": ""
} |
q16895 | GlobalEventDispatcher.fireRemoteEvent | train | @Override
public void fireRemoteEvent(String eventName, Serializable eventData, Recipient... recipients) {
Message message = new EventMessage(eventName, eventData);
producer.publish(EventUtil.getChannelName(eventName), message, recipients);
} | java | {
"resource": ""
} |
q16896 | GlobalEventDispatcher.getAppName | train | protected String getAppName() {
if (appName == null && FrameworkUtil.isInitialized()) {
setAppName(FrameworkUtil.getAppName());
}
return appName;
} | java | {
"resource": ""
} |
q16897 | HelpUtil.getViewerMode | train | public static HelpViewerMode getViewerMode(Page page) {
return page == null || !page.hasAttribute(EMBEDDED_ATTRIB) ? defaultMode
: (HelpViewerMode) page.getAttribute(EMBEDDED_ATTRIB);
} | java | {
"resource": ""
} |
q16898 | HelpUtil.setViewerMode | train | public static void setViewerMode(Page page, HelpViewerMode mode) {
if (getViewerMode(page) != mode) {
removeViewer(page, true);
}
page.setAttribute(EMBEDDED_ATTRIB, mode);
} | java | {
"resource": ""
} |
q16899 | HelpUtil.getViewer | train | public static IHelpViewer getViewer(boolean forceCreate) {
Page page = getPage();
IHelpViewer viewer = (IHelpViewer) page.getAttribute(VIEWER_ATTRIB);
return viewer != null ? viewer : forceCreate ? createViewer(page) : null;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.