id
int32 0
165k
| 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
|
---|---|---|---|---|---|---|---|---|---|---|---|
158,200 |
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/util/CmsStylesheetLoader.java
|
CmsStylesheetLoader.loadWithTimeout
|
public void loadWithTimeout(int timeout) {
for (String stylesheet : m_stylesheets) {
boolean alreadyLoaded = checkStylesheet(stylesheet);
if (alreadyLoaded) {
m_loadCounter += 1;
} else {
appendStylesheet(stylesheet, m_jsCallback);
}
}
checkAllLoaded();
if (timeout > 0) {
Timer timer = new Timer() {
@SuppressWarnings("synthetic-access")
@Override
public void run() {
callCallback();
}
};
timer.schedule(timeout);
}
}
|
java
|
public void loadWithTimeout(int timeout) {
for (String stylesheet : m_stylesheets) {
boolean alreadyLoaded = checkStylesheet(stylesheet);
if (alreadyLoaded) {
m_loadCounter += 1;
} else {
appendStylesheet(stylesheet, m_jsCallback);
}
}
checkAllLoaded();
if (timeout > 0) {
Timer timer = new Timer() {
@SuppressWarnings("synthetic-access")
@Override
public void run() {
callCallback();
}
};
timer.schedule(timeout);
}
}
|
[
"public",
"void",
"loadWithTimeout",
"(",
"int",
"timeout",
")",
"{",
"for",
"(",
"String",
"stylesheet",
":",
"m_stylesheets",
")",
"{",
"boolean",
"alreadyLoaded",
"=",
"checkStylesheet",
"(",
"stylesheet",
")",
";",
"if",
"(",
"alreadyLoaded",
")",
"{",
"m_loadCounter",
"+=",
"1",
";",
"}",
"else",
"{",
"appendStylesheet",
"(",
"stylesheet",
",",
"m_jsCallback",
")",
";",
"}",
"}",
"checkAllLoaded",
"(",
")",
";",
"if",
"(",
"timeout",
">",
"0",
")",
"{",
"Timer",
"timer",
"=",
"new",
"Timer",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"callCallback",
"(",
")",
";",
"}",
"}",
";",
"timer",
".",
"schedule",
"(",
"timeout",
")",
";",
"}",
"}"
] |
Starts the loading process and creates a timer that sets of the callback after a given tiime if it hasn't already been triggered.
@param timeout number of milliseconds after which the callback should be called if it hasn't already been
|
[
"Starts",
"the",
"loading",
"process",
"and",
"creates",
"a",
"timer",
"that",
"sets",
"of",
"the",
"callback",
"after",
"a",
"given",
"tiime",
"if",
"it",
"hasn",
"t",
"already",
"been",
"triggered",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsStylesheetLoader.java#L93-L117
|
158,201 |
alkacon/opencms-core
|
src/org/opencms/search/solr/CmsSolrIndex.java
|
CmsSolrIndex.hasPermissions
|
protected boolean hasPermissions(CmsObject cms, CmsSolrDocument doc, CmsResourceFilter filter) {
return null != (filter == null ? getResource(cms, doc) : getResource(cms, doc, filter));
}
|
java
|
protected boolean hasPermissions(CmsObject cms, CmsSolrDocument doc, CmsResourceFilter filter) {
return null != (filter == null ? getResource(cms, doc) : getResource(cms, doc, filter));
}
|
[
"protected",
"boolean",
"hasPermissions",
"(",
"CmsObject",
"cms",
",",
"CmsSolrDocument",
"doc",
",",
"CmsResourceFilter",
"filter",
")",
"{",
"return",
"null",
"!=",
"(",
"filter",
"==",
"null",
"?",
"getResource",
"(",
"cms",
",",
"doc",
")",
":",
"getResource",
"(",
"cms",
",",
"doc",
",",
"filter",
")",
")",
";",
"}"
] |
Check, if the current user has permissions on the document's resource.
@param cms the context
@param doc the solr document (from the search result)
@param filter the resource filter to use for checking permissions
@return <code>true</code> iff the resource mirrored by the search result can be read by the current user.
|
[
"Check",
"if",
"the",
"current",
"user",
"has",
"permissions",
"on",
"the",
"document",
"s",
"resource",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L1491-L1494
|
158,202 |
alkacon/opencms-core
|
src/org/opencms/search/solr/CmsSolrIndex.java
|
CmsSolrIndex.isDebug
|
private boolean isDebug(CmsObject cms, CmsSolrQuery query) {
String[] debugSecretValues = query.remove(REQUEST_PARAM_DEBUG_SECRET);
String debugSecret = (debugSecretValues == null) || (debugSecretValues.length < 1)
? null
: debugSecretValues[0];
if ((null != debugSecret) && !debugSecret.trim().isEmpty() && (null != m_handlerDebugSecretFile)) {
try {
CmsFile secretFile = cms.readFile(m_handlerDebugSecretFile);
String secret = new String(secretFile.getContents(), CmsFileUtil.getEncoding(cms, secretFile));
return secret.trim().equals(debugSecret.trim());
} catch (Exception e) {
LOG.info(
"Failed to read secret file for index \""
+ getName()
+ "\" at path \""
+ m_handlerDebugSecretFile
+ "\".");
}
}
return false;
}
|
java
|
private boolean isDebug(CmsObject cms, CmsSolrQuery query) {
String[] debugSecretValues = query.remove(REQUEST_PARAM_DEBUG_SECRET);
String debugSecret = (debugSecretValues == null) || (debugSecretValues.length < 1)
? null
: debugSecretValues[0];
if ((null != debugSecret) && !debugSecret.trim().isEmpty() && (null != m_handlerDebugSecretFile)) {
try {
CmsFile secretFile = cms.readFile(m_handlerDebugSecretFile);
String secret = new String(secretFile.getContents(), CmsFileUtil.getEncoding(cms, secretFile));
return secret.trim().equals(debugSecret.trim());
} catch (Exception e) {
LOG.info(
"Failed to read secret file for index \""
+ getName()
+ "\" at path \""
+ m_handlerDebugSecretFile
+ "\".");
}
}
return false;
}
|
[
"private",
"boolean",
"isDebug",
"(",
"CmsObject",
"cms",
",",
"CmsSolrQuery",
"query",
")",
"{",
"String",
"[",
"]",
"debugSecretValues",
"=",
"query",
".",
"remove",
"(",
"REQUEST_PARAM_DEBUG_SECRET",
")",
";",
"String",
"debugSecret",
"=",
"(",
"debugSecretValues",
"==",
"null",
")",
"||",
"(",
"debugSecretValues",
".",
"length",
"<",
"1",
")",
"?",
"null",
":",
"debugSecretValues",
"[",
"0",
"]",
";",
"if",
"(",
"(",
"null",
"!=",
"debugSecret",
")",
"&&",
"!",
"debugSecret",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"(",
"null",
"!=",
"m_handlerDebugSecretFile",
")",
")",
"{",
"try",
"{",
"CmsFile",
"secretFile",
"=",
"cms",
".",
"readFile",
"(",
"m_handlerDebugSecretFile",
")",
";",
"String",
"secret",
"=",
"new",
"String",
"(",
"secretFile",
".",
"getContents",
"(",
")",
",",
"CmsFileUtil",
".",
"getEncoding",
"(",
"cms",
",",
"secretFile",
")",
")",
";",
"return",
"secret",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"debugSecret",
".",
"trim",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Failed to read secret file for index \\\"\"",
"+",
"getName",
"(",
")",
"+",
"\"\\\" at path \\\"\"",
"+",
"m_handlerDebugSecretFile",
"+",
"\"\\\".\"",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks if the query should be executed using the debug mode where the security restrictions do not apply.
@param cms the current context.
@param query the query to execute.
@return a flag, indicating, if the query should be performed in debug mode.
|
[
"Checks",
"if",
"the",
"query",
"should",
"be",
"executed",
"using",
"the",
"debug",
"mode",
"where",
"the",
"security",
"restrictions",
"do",
"not",
"apply",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L1595-L1616
|
158,203 |
alkacon/opencms-core
|
src/org/opencms/search/solr/CmsSolrIndex.java
|
CmsSolrIndex.throwExceptionIfSafetyRestrictionsAreViolated
|
private void throwExceptionIfSafetyRestrictionsAreViolated(CmsObject cms, CmsSolrQuery query, boolean isSpell)
throws CmsSearchException {
if (!isDebug(cms, query)) {
if (isSpell) {
if (m_handlerSpellDisabled) {
throw new CmsSearchException(Messages.get().container(Messages.GUI_HANDLER_REQUEST_NOT_ALLOWED_0));
}
} else {
if (m_handlerSelectDisabled) {
throw new CmsSearchException(Messages.get().container(Messages.GUI_HANDLER_REQUEST_NOT_ALLOWED_0));
}
int start = null != query.getStart() ? query.getStart().intValue() : 0;
int rows = null != query.getRows() ? query.getRows().intValue() : CmsSolrQuery.DEFAULT_ROWS.intValue();
if ((m_handlerMaxAllowedResultsAtAll >= 0) && ((rows + start) > m_handlerMaxAllowedResultsAtAll)) {
throw new CmsSearchException(
Messages.get().container(
Messages.GUI_HANDLER_TOO_MANY_RESULTS_REQUESTED_AT_ALL_2,
Integer.valueOf(m_handlerMaxAllowedResultsAtAll),
Integer.valueOf(rows + start)));
}
if ((m_handlerMaxAllowedResultsPerPage >= 0) && (rows > m_handlerMaxAllowedResultsPerPage)) {
throw new CmsSearchException(
Messages.get().container(
Messages.GUI_HANDLER_TOO_MANY_RESULTS_REQUESTED_PER_PAGE_2,
Integer.valueOf(m_handlerMaxAllowedResultsPerPage),
Integer.valueOf(rows)));
}
if ((null != m_handlerAllowedFields) && (Stream.of(m_handlerAllowedFields).anyMatch(x -> true))) {
if (query.getFields().equals(CmsSolrQuery.ALL_RETURN_FIELDS)) {
query.setFields(m_handlerAllowedFields);
} else {
for (String requestedField : query.getFields().split(",")) {
if (Stream.of(m_handlerAllowedFields).noneMatch(
allowedField -> allowedField.equals(requestedField))) {
throw new CmsSearchException(
Messages.get().container(
Messages.GUI_HANDLER_REQUESTED_FIELD_NOT_ALLOWED_2,
requestedField,
Stream.of(m_handlerAllowedFields).reduce("", (a, b) -> a + "," + b)));
}
}
}
}
}
}
}
|
java
|
private void throwExceptionIfSafetyRestrictionsAreViolated(CmsObject cms, CmsSolrQuery query, boolean isSpell)
throws CmsSearchException {
if (!isDebug(cms, query)) {
if (isSpell) {
if (m_handlerSpellDisabled) {
throw new CmsSearchException(Messages.get().container(Messages.GUI_HANDLER_REQUEST_NOT_ALLOWED_0));
}
} else {
if (m_handlerSelectDisabled) {
throw new CmsSearchException(Messages.get().container(Messages.GUI_HANDLER_REQUEST_NOT_ALLOWED_0));
}
int start = null != query.getStart() ? query.getStart().intValue() : 0;
int rows = null != query.getRows() ? query.getRows().intValue() : CmsSolrQuery.DEFAULT_ROWS.intValue();
if ((m_handlerMaxAllowedResultsAtAll >= 0) && ((rows + start) > m_handlerMaxAllowedResultsAtAll)) {
throw new CmsSearchException(
Messages.get().container(
Messages.GUI_HANDLER_TOO_MANY_RESULTS_REQUESTED_AT_ALL_2,
Integer.valueOf(m_handlerMaxAllowedResultsAtAll),
Integer.valueOf(rows + start)));
}
if ((m_handlerMaxAllowedResultsPerPage >= 0) && (rows > m_handlerMaxAllowedResultsPerPage)) {
throw new CmsSearchException(
Messages.get().container(
Messages.GUI_HANDLER_TOO_MANY_RESULTS_REQUESTED_PER_PAGE_2,
Integer.valueOf(m_handlerMaxAllowedResultsPerPage),
Integer.valueOf(rows)));
}
if ((null != m_handlerAllowedFields) && (Stream.of(m_handlerAllowedFields).anyMatch(x -> true))) {
if (query.getFields().equals(CmsSolrQuery.ALL_RETURN_FIELDS)) {
query.setFields(m_handlerAllowedFields);
} else {
for (String requestedField : query.getFields().split(",")) {
if (Stream.of(m_handlerAllowedFields).noneMatch(
allowedField -> allowedField.equals(requestedField))) {
throw new CmsSearchException(
Messages.get().container(
Messages.GUI_HANDLER_REQUESTED_FIELD_NOT_ALLOWED_2,
requestedField,
Stream.of(m_handlerAllowedFields).reduce("", (a, b) -> a + "," + b)));
}
}
}
}
}
}
}
|
[
"private",
"void",
"throwExceptionIfSafetyRestrictionsAreViolated",
"(",
"CmsObject",
"cms",
",",
"CmsSolrQuery",
"query",
",",
"boolean",
"isSpell",
")",
"throws",
"CmsSearchException",
"{",
"if",
"(",
"!",
"isDebug",
"(",
"cms",
",",
"query",
")",
")",
"{",
"if",
"(",
"isSpell",
")",
"{",
"if",
"(",
"m_handlerSpellDisabled",
")",
"{",
"throw",
"new",
"CmsSearchException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"GUI_HANDLER_REQUEST_NOT_ALLOWED_0",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"m_handlerSelectDisabled",
")",
"{",
"throw",
"new",
"CmsSearchException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"GUI_HANDLER_REQUEST_NOT_ALLOWED_0",
")",
")",
";",
"}",
"int",
"start",
"=",
"null",
"!=",
"query",
".",
"getStart",
"(",
")",
"?",
"query",
".",
"getStart",
"(",
")",
".",
"intValue",
"(",
")",
":",
"0",
";",
"int",
"rows",
"=",
"null",
"!=",
"query",
".",
"getRows",
"(",
")",
"?",
"query",
".",
"getRows",
"(",
")",
".",
"intValue",
"(",
")",
":",
"CmsSolrQuery",
".",
"DEFAULT_ROWS",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"(",
"m_handlerMaxAllowedResultsAtAll",
">=",
"0",
")",
"&&",
"(",
"(",
"rows",
"+",
"start",
")",
">",
"m_handlerMaxAllowedResultsAtAll",
")",
")",
"{",
"throw",
"new",
"CmsSearchException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"GUI_HANDLER_TOO_MANY_RESULTS_REQUESTED_AT_ALL_2",
",",
"Integer",
".",
"valueOf",
"(",
"m_handlerMaxAllowedResultsAtAll",
")",
",",
"Integer",
".",
"valueOf",
"(",
"rows",
"+",
"start",
")",
")",
")",
";",
"}",
"if",
"(",
"(",
"m_handlerMaxAllowedResultsPerPage",
">=",
"0",
")",
"&&",
"(",
"rows",
">",
"m_handlerMaxAllowedResultsPerPage",
")",
")",
"{",
"throw",
"new",
"CmsSearchException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"GUI_HANDLER_TOO_MANY_RESULTS_REQUESTED_PER_PAGE_2",
",",
"Integer",
".",
"valueOf",
"(",
"m_handlerMaxAllowedResultsPerPage",
")",
",",
"Integer",
".",
"valueOf",
"(",
"rows",
")",
")",
")",
";",
"}",
"if",
"(",
"(",
"null",
"!=",
"m_handlerAllowedFields",
")",
"&&",
"(",
"Stream",
".",
"of",
"(",
"m_handlerAllowedFields",
")",
".",
"anyMatch",
"(",
"x",
"->",
"true",
")",
")",
")",
"{",
"if",
"(",
"query",
".",
"getFields",
"(",
")",
".",
"equals",
"(",
"CmsSolrQuery",
".",
"ALL_RETURN_FIELDS",
")",
")",
"{",
"query",
".",
"setFields",
"(",
"m_handlerAllowedFields",
")",
";",
"}",
"else",
"{",
"for",
"(",
"String",
"requestedField",
":",
"query",
".",
"getFields",
"(",
")",
".",
"split",
"(",
"\",\"",
")",
")",
"{",
"if",
"(",
"Stream",
".",
"of",
"(",
"m_handlerAllowedFields",
")",
".",
"noneMatch",
"(",
"allowedField",
"->",
"allowedField",
".",
"equals",
"(",
"requestedField",
")",
")",
")",
"{",
"throw",
"new",
"CmsSearchException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"GUI_HANDLER_REQUESTED_FIELD_NOT_ALLOWED_2",
",",
"requestedField",
",",
"Stream",
".",
"of",
"(",
"m_handlerAllowedFields",
")",
".",
"reduce",
"(",
"\"\"",
",",
"(",
"a",
",",
"b",
")",
"->",
"a",
"+",
"\",\"",
"+",
"b",
")",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}"
] |
Throws an exception if the request can for security reasons not be performed.
Security restrictions can be set via parameters of the index.
@param cms the current context.
@param query the query.
@param isSpell flag, indicating if the spellcheck handler is requested.
@throws CmsSearchException thrown if the query cannot be executed due to security reasons.
|
[
"Throws",
"an",
"exception",
"if",
"the",
"request",
"can",
"for",
"security",
"reasons",
"not",
"be",
"performed",
".",
"Security",
"restrictions",
"can",
"be",
"set",
"via",
"parameters",
"of",
"the",
"index",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L1627-L1673
|
158,204 |
alkacon/opencms-core
|
src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java
|
CmsCloneModuleThread.alterPrefix
|
private String alterPrefix(String word, String oldPrefix, String newPrefix) {
if (word.startsWith(oldPrefix)) {
return word.replaceFirst(oldPrefix, newPrefix);
}
return (newPrefix + word);
}
|
java
|
private String alterPrefix(String word, String oldPrefix, String newPrefix) {
if (word.startsWith(oldPrefix)) {
return word.replaceFirst(oldPrefix, newPrefix);
}
return (newPrefix + word);
}
|
[
"private",
"String",
"alterPrefix",
"(",
"String",
"word",
",",
"String",
"oldPrefix",
",",
"String",
"newPrefix",
")",
"{",
"if",
"(",
"word",
".",
"startsWith",
"(",
"oldPrefix",
")",
")",
"{",
"return",
"word",
".",
"replaceFirst",
"(",
"oldPrefix",
",",
"newPrefix",
")",
";",
"}",
"return",
"(",
"newPrefix",
"+",
"word",
")",
";",
"}"
] |
Manipulates a string by cutting of a prefix, if present, and adding a new prefix.
@param word the string to be manipulated
@param oldPrefix the old prefix that should be replaced
@param newPrefix the new prefix that is added
@return the manipulated string
|
[
"Manipulates",
"a",
"string",
"by",
"cutting",
"of",
"a",
"prefix",
"if",
"present",
"and",
"adding",
"a",
"new",
"prefix",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java#L477-L483
|
158,205 |
alkacon/opencms-core
|
src-setup/org/opencms/setup/ui/CmsSetupStep02ComponentCheck.java
|
CmsSetupStep02ComponentCheck.updateColor
|
public void updateColor(TestColor color) {
switch (color) {
case green:
m_forwardButton.setEnabled(true);
m_confirmCheckbox.setVisible(false);
m_status.setValue(STATUS_GREEN);
break;
case yellow:
m_forwardButton.setEnabled(false);
m_confirmCheckbox.setVisible(true);
m_status.setValue(STATUS_YELLOW);
break;
case red:
m_forwardButton.setEnabled(false);
m_confirmCheckbox.setVisible(true);
m_status.setValue(STATUS_RED);
break;
default:
break;
}
}
|
java
|
public void updateColor(TestColor color) {
switch (color) {
case green:
m_forwardButton.setEnabled(true);
m_confirmCheckbox.setVisible(false);
m_status.setValue(STATUS_GREEN);
break;
case yellow:
m_forwardButton.setEnabled(false);
m_confirmCheckbox.setVisible(true);
m_status.setValue(STATUS_YELLOW);
break;
case red:
m_forwardButton.setEnabled(false);
m_confirmCheckbox.setVisible(true);
m_status.setValue(STATUS_RED);
break;
default:
break;
}
}
|
[
"public",
"void",
"updateColor",
"(",
"TestColor",
"color",
")",
"{",
"switch",
"(",
"color",
")",
"{",
"case",
"green",
":",
"m_forwardButton",
".",
"setEnabled",
"(",
"true",
")",
";",
"m_confirmCheckbox",
".",
"setVisible",
"(",
"false",
")",
";",
"m_status",
".",
"setValue",
"(",
"STATUS_GREEN",
")",
";",
"break",
";",
"case",
"yellow",
":",
"m_forwardButton",
".",
"setEnabled",
"(",
"false",
")",
";",
"m_confirmCheckbox",
".",
"setVisible",
"(",
"true",
")",
";",
"m_status",
".",
"setValue",
"(",
"STATUS_YELLOW",
")",
";",
"break",
";",
"case",
"red",
":",
"m_forwardButton",
".",
"setEnabled",
"(",
"false",
")",
";",
"m_confirmCheckbox",
".",
"setVisible",
"(",
"true",
")",
";",
"m_status",
".",
"setValue",
"(",
"STATUS_RED",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}"
] |
Sets test status.
|
[
"Sets",
"test",
"status",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsSetupStep02ComponentCheck.java#L121-L142
|
158,206 |
alkacon/opencms-core
|
src/org/opencms/relations/CmsCategoryService.java
|
CmsCategoryService.copyCategories
|
public void copyCategories(CmsObject cms, CmsResource fromResource, String toResourceSitePath) throws CmsException {
List<CmsCategory> categories = readResourceCategories(cms, fromResource);
for (CmsCategory category : categories) {
addResourceToCategory(cms, toResourceSitePath, category);
}
}
|
java
|
public void copyCategories(CmsObject cms, CmsResource fromResource, String toResourceSitePath) throws CmsException {
List<CmsCategory> categories = readResourceCategories(cms, fromResource);
for (CmsCategory category : categories) {
addResourceToCategory(cms, toResourceSitePath, category);
}
}
|
[
"public",
"void",
"copyCategories",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"fromResource",
",",
"String",
"toResourceSitePath",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsCategory",
">",
"categories",
"=",
"readResourceCategories",
"(",
"cms",
",",
"fromResource",
")",
";",
"for",
"(",
"CmsCategory",
"category",
":",
"categories",
")",
"{",
"addResourceToCategory",
"(",
"cms",
",",
"toResourceSitePath",
",",
"category",
")",
";",
"}",
"}"
] |
Adds all categories from one resource to another, skipping categories that are not available for the resource copied to.
The resource where categories are copied to has to be locked.
@param cms the CmsObject used for reading and writing.
@param fromResource the resource to copy the categories from.
@param toResourceSitePath the full site path of the resource to copy the categories to.
@throws CmsException thrown if copying the resources fails.
|
[
"Adds",
"all",
"categories",
"from",
"one",
"resource",
"to",
"another",
"skipping",
"categories",
"that",
"are",
"not",
"available",
"for",
"the",
"resource",
"copied",
"to",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L167-L173
|
158,207 |
alkacon/opencms-core
|
src/org/opencms/jsp/CmsJspTagBundle.java
|
CmsJspTagBundle.getLocale
|
static Locale getLocale(PageContext pageContext, String name) {
Locale loc = null;
Object obj = javax.servlet.jsp.jstl.core.Config.find(pageContext, name);
if (obj != null) {
if (obj instanceof Locale) {
loc = (Locale)obj;
} else {
loc = SetLocaleSupport.parseLocale((String)obj);
}
}
return loc;
}
|
java
|
static Locale getLocale(PageContext pageContext, String name) {
Locale loc = null;
Object obj = javax.servlet.jsp.jstl.core.Config.find(pageContext, name);
if (obj != null) {
if (obj instanceof Locale) {
loc = (Locale)obj;
} else {
loc = SetLocaleSupport.parseLocale((String)obj);
}
}
return loc;
}
|
[
"static",
"Locale",
"getLocale",
"(",
"PageContext",
"pageContext",
",",
"String",
"name",
")",
"{",
"Locale",
"loc",
"=",
"null",
";",
"Object",
"obj",
"=",
"javax",
".",
"servlet",
".",
"jsp",
".",
"jstl",
".",
"core",
".",
"Config",
".",
"find",
"(",
"pageContext",
",",
"name",
")",
";",
"if",
"(",
"obj",
"!=",
"null",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Locale",
")",
"{",
"loc",
"=",
"(",
"Locale",
")",
"obj",
";",
"}",
"else",
"{",
"loc",
"=",
"SetLocaleSupport",
".",
"parseLocale",
"(",
"(",
"String",
")",
"obj",
")",
";",
"}",
"}",
"return",
"loc",
";",
"}"
] |
Returns the locale specified by the named scoped attribute or context
configuration parameter.
<p> The named scoped attribute is searched in the page, request,
session (if valid), and application scope(s) (in this order). If no such
attribute exists in any of the scopes, the locale is taken from the
named context configuration parameter.
@param pageContext the page in which to search for the named scoped
attribute or context configuration parameter
@param name the name of the scoped attribute or context configuration
parameter
@return the locale specified by the named scoped attribute or context
configuration parameter, or <tt>null</tt> if no scoped attribute or
configuration parameter with the given name exists
|
[
"Returns",
"the",
"locale",
"specified",
"by",
"the",
"named",
"scoped",
"attribute",
"or",
"context",
"configuration",
"parameter",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagBundle.java#L135-L149
|
158,208 |
alkacon/opencms-core
|
src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java
|
CmsDefaultLinkSubstitutionHandler.generateCacheKey
|
protected String generateCacheKey(
CmsObject cms,
String targetSiteRoot,
String detailPagePart,
String absoluteLink) {
return cms.getRequestContext().getSiteRoot() + ":" + targetSiteRoot + ":" + detailPagePart + absoluteLink;
}
|
java
|
protected String generateCacheKey(
CmsObject cms,
String targetSiteRoot,
String detailPagePart,
String absoluteLink) {
return cms.getRequestContext().getSiteRoot() + ":" + targetSiteRoot + ":" + detailPagePart + absoluteLink;
}
|
[
"protected",
"String",
"generateCacheKey",
"(",
"CmsObject",
"cms",
",",
"String",
"targetSiteRoot",
",",
"String",
"detailPagePart",
",",
"String",
"absoluteLink",
")",
"{",
"return",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getSiteRoot",
"(",
")",
"+",
"\":\"",
"+",
"targetSiteRoot",
"+",
"\":\"",
"+",
"detailPagePart",
"+",
"absoluteLink",
";",
"}"
] |
Generates the cache key for Online links.
@param cms the current CmsObject
@param targetSiteRoot the target site root
@param detailPagePart the detail page part
@param absoluteLink the absolute (site-relative) link to the resource
@return the cache key
|
[
"Generates",
"the",
"cache",
"key",
"for",
"Online",
"links",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java#L443-L450
|
158,209 |
alkacon/opencms-core
|
src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java
|
CmsDefaultLinkSubstitutionHandler.isSecureLink
|
protected boolean isSecureLink(CmsObject cms, String vfsName, CmsSite targetSite, boolean secureRequest) {
return OpenCms.getStaticExportManager().isSecureLink(cms, vfsName, targetSite.getSiteRoot(), secureRequest);
}
|
java
|
protected boolean isSecureLink(CmsObject cms, String vfsName, CmsSite targetSite, boolean secureRequest) {
return OpenCms.getStaticExportManager().isSecureLink(cms, vfsName, targetSite.getSiteRoot(), secureRequest);
}
|
[
"protected",
"boolean",
"isSecureLink",
"(",
"CmsObject",
"cms",
",",
"String",
"vfsName",
",",
"CmsSite",
"targetSite",
",",
"boolean",
"secureRequest",
")",
"{",
"return",
"OpenCms",
".",
"getStaticExportManager",
"(",
")",
".",
"isSecureLink",
"(",
"cms",
",",
"vfsName",
",",
"targetSite",
".",
"getSiteRoot",
"(",
")",
",",
"secureRequest",
")",
";",
"}"
] |
Checks if the link target is a secure link.<p
@param cms the current CMS context
@param vfsName the path of the link target
@param targetSite the target site containing the detail page
@param secureRequest true if the currently running request is secure
@return true if the link should be a secure link
|
[
"Checks",
"if",
"the",
"link",
"target",
"is",
"a",
"secure",
"link",
".",
"<p"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java#L692-L695
|
158,210 |
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java
|
CmsColor.MIN
|
private float MIN(float first, float second, float third) {
float min = Integer.MAX_VALUE;
if (first < min) {
min = first;
}
if (second < min) {
min = second;
}
if (third < min) {
min = third;
}
return min;
}
|
java
|
private float MIN(float first, float second, float third) {
float min = Integer.MAX_VALUE;
if (first < min) {
min = first;
}
if (second < min) {
min = second;
}
if (third < min) {
min = third;
}
return min;
}
|
[
"private",
"float",
"MIN",
"(",
"float",
"first",
",",
"float",
"second",
",",
"float",
"third",
")",
"{",
"float",
"min",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"if",
"(",
"first",
"<",
"min",
")",
"{",
"min",
"=",
"first",
";",
"}",
"if",
"(",
"second",
"<",
"min",
")",
"{",
"min",
"=",
"second",
";",
"}",
"if",
"(",
"third",
"<",
"min",
")",
"{",
"min",
"=",
"third",
";",
"}",
"return",
"min",
";",
"}"
] |
Calculates the smallest value between the three inputs.
@param first value
@param second value
@param third value
@return the smallest value between the three inputs
|
[
"Calculates",
"the",
"smallest",
"value",
"between",
"the",
"three",
"inputs",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java#L281-L294
|
158,211 |
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java
|
CmsColor.setHex
|
private void setHex() {
String hRed = Integer.toHexString(getRed());
String hGreen = Integer.toHexString(getGreen());
String hBlue = Integer.toHexString(getBlue());
if (hRed.length() == 0) {
hRed = "00";
}
if (hRed.length() == 1) {
hRed = "0" + hRed;
}
if (hGreen.length() == 0) {
hGreen = "00";
}
if (hGreen.length() == 1) {
hGreen = "0" + hGreen;
}
if (hBlue.length() == 0) {
hBlue = "00";
}
if (hBlue.length() == 1) {
hBlue = "0" + hBlue;
}
m_hex = hRed + hGreen + hBlue;
}
|
java
|
private void setHex() {
String hRed = Integer.toHexString(getRed());
String hGreen = Integer.toHexString(getGreen());
String hBlue = Integer.toHexString(getBlue());
if (hRed.length() == 0) {
hRed = "00";
}
if (hRed.length() == 1) {
hRed = "0" + hRed;
}
if (hGreen.length() == 0) {
hGreen = "00";
}
if (hGreen.length() == 1) {
hGreen = "0" + hGreen;
}
if (hBlue.length() == 0) {
hBlue = "00";
}
if (hBlue.length() == 1) {
hBlue = "0" + hBlue;
}
m_hex = hRed + hGreen + hBlue;
}
|
[
"private",
"void",
"setHex",
"(",
")",
"{",
"String",
"hRed",
"=",
"Integer",
".",
"toHexString",
"(",
"getRed",
"(",
")",
")",
";",
"String",
"hGreen",
"=",
"Integer",
".",
"toHexString",
"(",
"getGreen",
"(",
")",
")",
";",
"String",
"hBlue",
"=",
"Integer",
".",
"toHexString",
"(",
"getBlue",
"(",
")",
")",
";",
"if",
"(",
"hRed",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"hRed",
"=",
"\"00\"",
";",
"}",
"if",
"(",
"hRed",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"hRed",
"=",
"\"0\"",
"+",
"hRed",
";",
"}",
"if",
"(",
"hGreen",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"hGreen",
"=",
"\"00\"",
";",
"}",
"if",
"(",
"hGreen",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"hGreen",
"=",
"\"0\"",
"+",
"hGreen",
";",
"}",
"if",
"(",
"hBlue",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"hBlue",
"=",
"\"00\"",
";",
"}",
"if",
"(",
"hBlue",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"hBlue",
"=",
"\"0\"",
"+",
"hBlue",
";",
"}",
"m_hex",
"=",
"hRed",
"+",
"hGreen",
"+",
"hBlue",
";",
"}"
] |
Converts from RGB to Hexadecimal notation.
|
[
"Converts",
"from",
"RGB",
"to",
"Hexadecimal",
"notation",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java#L346-L372
|
158,212 |
alkacon/opencms-core
|
src/org/opencms/ade/contenteditor/CmsSerialDateService.java
|
CmsSerialDateService.formatDate
|
private String formatDate(Date date) {
if (null == m_dateFormat) {
m_dateFormat = DateFormat.getDateInstance(
0,
OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()));
}
return m_dateFormat.format(date);
}
|
java
|
private String formatDate(Date date) {
if (null == m_dateFormat) {
m_dateFormat = DateFormat.getDateInstance(
0,
OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()));
}
return m_dateFormat.format(date);
}
|
[
"private",
"String",
"formatDate",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"null",
"==",
"m_dateFormat",
")",
"{",
"m_dateFormat",
"=",
"DateFormat",
".",
"getDateInstance",
"(",
"0",
",",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getWorkplaceLocale",
"(",
"getCmsObject",
"(",
")",
")",
")",
";",
"}",
"return",
"m_dateFormat",
".",
"format",
"(",
"date",
")",
";",
"}"
] |
Format the date for the status messages.
@param date the date to format.
@return the formatted date.
|
[
"Format",
"the",
"date",
"for",
"the",
"status",
"messages",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsSerialDateService.java#L126-L134
|
158,213 |
alkacon/opencms-core
|
src/org/opencms/jsp/CmsJspTagEdit.java
|
CmsJspTagEdit.createResource
|
public static String createResource(
CmsObject cmsObject,
String newLink,
Locale locale,
String sitePath,
String modelFileName,
String mode,
String postCreateHandler) {
String[] newLinkParts = newLink.split("\\|");
String rootPath = newLinkParts[1];
String typeName = newLinkParts[2];
CmsFile modelFile = null;
if (StringUtils.equalsIgnoreCase(mode, CmsEditorConstants.MODE_COPY)) {
try {
modelFile = cmsObject.readFile(sitePath);
} catch (CmsException e) {
LOG.warn(
"The resource at path" + sitePath + "could not be read. Thus it can not be used as model file.",
e);
}
}
CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(cmsObject, rootPath);
CmsResourceTypeConfig typeConfig = adeConfig.getResourceType(typeName);
CmsResource newElement = null;
try {
CmsObject cmsClone = cmsObject;
if ((locale != null) && !cmsObject.getRequestContext().getLocale().equals(locale)) {
// in case the content locale does not match the request context locale, use a clone cms with the appropriate locale
cmsClone = OpenCms.initCmsObject(cmsObject);
cmsClone.getRequestContext().setLocale(locale);
}
newElement = typeConfig.createNewElement(cmsClone, modelFile, rootPath);
CmsPair<String, String> handlerParameter = I_CmsCollectorPostCreateHandler.splitClassAndConfig(
postCreateHandler);
I_CmsCollectorPostCreateHandler handler = A_CmsResourceCollector.getPostCreateHandler(
handlerParameter.getFirst());
handler.onCreate(cmsClone, cmsClone.readFile(newElement), modelFile != null, handlerParameter.getSecond());
} catch (CmsException e) {
LOG.error("Could not create resource.", e);
}
return newElement == null ? null : cmsObject.getSitePath(newElement);
}
|
java
|
public static String createResource(
CmsObject cmsObject,
String newLink,
Locale locale,
String sitePath,
String modelFileName,
String mode,
String postCreateHandler) {
String[] newLinkParts = newLink.split("\\|");
String rootPath = newLinkParts[1];
String typeName = newLinkParts[2];
CmsFile modelFile = null;
if (StringUtils.equalsIgnoreCase(mode, CmsEditorConstants.MODE_COPY)) {
try {
modelFile = cmsObject.readFile(sitePath);
} catch (CmsException e) {
LOG.warn(
"The resource at path" + sitePath + "could not be read. Thus it can not be used as model file.",
e);
}
}
CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(cmsObject, rootPath);
CmsResourceTypeConfig typeConfig = adeConfig.getResourceType(typeName);
CmsResource newElement = null;
try {
CmsObject cmsClone = cmsObject;
if ((locale != null) && !cmsObject.getRequestContext().getLocale().equals(locale)) {
// in case the content locale does not match the request context locale, use a clone cms with the appropriate locale
cmsClone = OpenCms.initCmsObject(cmsObject);
cmsClone.getRequestContext().setLocale(locale);
}
newElement = typeConfig.createNewElement(cmsClone, modelFile, rootPath);
CmsPair<String, String> handlerParameter = I_CmsCollectorPostCreateHandler.splitClassAndConfig(
postCreateHandler);
I_CmsCollectorPostCreateHandler handler = A_CmsResourceCollector.getPostCreateHandler(
handlerParameter.getFirst());
handler.onCreate(cmsClone, cmsClone.readFile(newElement), modelFile != null, handlerParameter.getSecond());
} catch (CmsException e) {
LOG.error("Could not create resource.", e);
}
return newElement == null ? null : cmsObject.getSitePath(newElement);
}
|
[
"public",
"static",
"String",
"createResource",
"(",
"CmsObject",
"cmsObject",
",",
"String",
"newLink",
",",
"Locale",
"locale",
",",
"String",
"sitePath",
",",
"String",
"modelFileName",
",",
"String",
"mode",
",",
"String",
"postCreateHandler",
")",
"{",
"String",
"[",
"]",
"newLinkParts",
"=",
"newLink",
".",
"split",
"(",
"\"\\\\|\"",
")",
";",
"String",
"rootPath",
"=",
"newLinkParts",
"[",
"1",
"]",
";",
"String",
"typeName",
"=",
"newLinkParts",
"[",
"2",
"]",
";",
"CmsFile",
"modelFile",
"=",
"null",
";",
"if",
"(",
"StringUtils",
".",
"equalsIgnoreCase",
"(",
"mode",
",",
"CmsEditorConstants",
".",
"MODE_COPY",
")",
")",
"{",
"try",
"{",
"modelFile",
"=",
"cmsObject",
".",
"readFile",
"(",
"sitePath",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"The resource at path\"",
"+",
"sitePath",
"+",
"\"could not be read. Thus it can not be used as model file.\"",
",",
"e",
")",
";",
"}",
"}",
"CmsADEConfigData",
"adeConfig",
"=",
"OpenCms",
".",
"getADEManager",
"(",
")",
".",
"lookupConfiguration",
"(",
"cmsObject",
",",
"rootPath",
")",
";",
"CmsResourceTypeConfig",
"typeConfig",
"=",
"adeConfig",
".",
"getResourceType",
"(",
"typeName",
")",
";",
"CmsResource",
"newElement",
"=",
"null",
";",
"try",
"{",
"CmsObject",
"cmsClone",
"=",
"cmsObject",
";",
"if",
"(",
"(",
"locale",
"!=",
"null",
")",
"&&",
"!",
"cmsObject",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",
"(",
")",
".",
"equals",
"(",
"locale",
")",
")",
"{",
"// in case the content locale does not match the request context locale, use a clone cms with the appropriate locale",
"cmsClone",
"=",
"OpenCms",
".",
"initCmsObject",
"(",
"cmsObject",
")",
";",
"cmsClone",
".",
"getRequestContext",
"(",
")",
".",
"setLocale",
"(",
"locale",
")",
";",
"}",
"newElement",
"=",
"typeConfig",
".",
"createNewElement",
"(",
"cmsClone",
",",
"modelFile",
",",
"rootPath",
")",
";",
"CmsPair",
"<",
"String",
",",
"String",
">",
"handlerParameter",
"=",
"I_CmsCollectorPostCreateHandler",
".",
"splitClassAndConfig",
"(",
"postCreateHandler",
")",
";",
"I_CmsCollectorPostCreateHandler",
"handler",
"=",
"A_CmsResourceCollector",
".",
"getPostCreateHandler",
"(",
"handlerParameter",
".",
"getFirst",
"(",
")",
")",
";",
"handler",
".",
"onCreate",
"(",
"cmsClone",
",",
"cmsClone",
".",
"readFile",
"(",
"newElement",
")",
",",
"modelFile",
"!=",
"null",
",",
"handlerParameter",
".",
"getSecond",
"(",
")",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not create resource.\"",
",",
"e",
")",
";",
"}",
"return",
"newElement",
"==",
"null",
"?",
"null",
":",
"cmsObject",
".",
"getSitePath",
"(",
"newElement",
")",
";",
"}"
] |
Creates a new resource.
@param cmsObject The CmsObject of the current request context.
@param newLink A string, specifying where which new content should be created.
@param locale The locale for which the
@param sitePath site path of the currently edited content.
@param modelFileName not used.
@param mode optional creation mode
@param postCreateHandler optional class name of an {@link I_CmsCollectorPostCreateHandler} which is invoked after the content has been created.
The fully qualified class name can be followed by a "|" symbol and a handler specific configuration string.
@return The site-path of the newly created resource.
|
[
"Creates",
"a",
"new",
"resource",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagEdit.java#L104-L146
|
158,214 |
alkacon/opencms-core
|
src/org/opencms/i18n/CmsResourceBundleLoader.java
|
CmsResourceBundleLoader.tryBundle
|
private static I_CmsResourceBundle tryBundle(String localizedName) {
I_CmsResourceBundle result = null;
try {
String resourceName = localizedName.replace('.', '/') + ".properties";
URL url = CmsResourceBundleLoader.class.getClassLoader().getResource(resourceName);
I_CmsResourceBundle additionalBundle = m_permanentCache.get(localizedName);
if (additionalBundle != null) {
result = additionalBundle.getClone();
} else if (url != null) {
// the resource was found on the file system
InputStream is = null;
String path = CmsFileUtil.normalizePath(url);
File file = new File(path);
try {
// try to load the resource bundle from a file, NOT with the resource loader first
// this is important since using #getResourceAsStream() may return cached results,
// for example Tomcat by default does cache all resources loaded by the class loader
// this means a changed resource bundle file is not loaded
is = new FileInputStream(file);
} catch (IOException ex) {
// this will happen if the resource is contained for example in a .jar file
is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);
} catch (AccessControlException acex) {
// fixed bug #1550
// this will happen if the resource is contained for example in a .jar file
// and security manager is turned on.
is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);
}
if (is != null) {
result = new CmsPropertyResourceBundle(is);
}
}
} catch (IOException ex) {
// can't localized these message since this may lead to a chicken-egg problem
MissingResourceException mre = new MissingResourceException(
"Failed to load bundle '" + localizedName + "'",
localizedName,
"");
mre.initCause(ex);
throw mre;
}
return result;
}
|
java
|
private static I_CmsResourceBundle tryBundle(String localizedName) {
I_CmsResourceBundle result = null;
try {
String resourceName = localizedName.replace('.', '/') + ".properties";
URL url = CmsResourceBundleLoader.class.getClassLoader().getResource(resourceName);
I_CmsResourceBundle additionalBundle = m_permanentCache.get(localizedName);
if (additionalBundle != null) {
result = additionalBundle.getClone();
} else if (url != null) {
// the resource was found on the file system
InputStream is = null;
String path = CmsFileUtil.normalizePath(url);
File file = new File(path);
try {
// try to load the resource bundle from a file, NOT with the resource loader first
// this is important since using #getResourceAsStream() may return cached results,
// for example Tomcat by default does cache all resources loaded by the class loader
// this means a changed resource bundle file is not loaded
is = new FileInputStream(file);
} catch (IOException ex) {
// this will happen if the resource is contained for example in a .jar file
is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);
} catch (AccessControlException acex) {
// fixed bug #1550
// this will happen if the resource is contained for example in a .jar file
// and security manager is turned on.
is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);
}
if (is != null) {
result = new CmsPropertyResourceBundle(is);
}
}
} catch (IOException ex) {
// can't localized these message since this may lead to a chicken-egg problem
MissingResourceException mre = new MissingResourceException(
"Failed to load bundle '" + localizedName + "'",
localizedName,
"");
mre.initCause(ex);
throw mre;
}
return result;
}
|
[
"private",
"static",
"I_CmsResourceBundle",
"tryBundle",
"(",
"String",
"localizedName",
")",
"{",
"I_CmsResourceBundle",
"result",
"=",
"null",
";",
"try",
"{",
"String",
"resourceName",
"=",
"localizedName",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".properties\"",
";",
"URL",
"url",
"=",
"CmsResourceBundleLoader",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"resourceName",
")",
";",
"I_CmsResourceBundle",
"additionalBundle",
"=",
"m_permanentCache",
".",
"get",
"(",
"localizedName",
")",
";",
"if",
"(",
"additionalBundle",
"!=",
"null",
")",
"{",
"result",
"=",
"additionalBundle",
".",
"getClone",
"(",
")",
";",
"}",
"else",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"// the resource was found on the file system",
"InputStream",
"is",
"=",
"null",
";",
"String",
"path",
"=",
"CmsFileUtil",
".",
"normalizePath",
"(",
"url",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"try",
"{",
"// try to load the resource bundle from a file, NOT with the resource loader first",
"// this is important since using #getResourceAsStream() may return cached results,",
"// for example Tomcat by default does cache all resources loaded by the class loader",
"// this means a changed resource bundle file is not loaded",
"is",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// this will happen if the resource is contained for example in a .jar file",
"is",
"=",
"CmsResourceBundleLoader",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"resourceName",
")",
";",
"}",
"catch",
"(",
"AccessControlException",
"acex",
")",
"{",
"// fixed bug #1550",
"// this will happen if the resource is contained for example in a .jar file",
"// and security manager is turned on.",
"is",
"=",
"CmsResourceBundleLoader",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"resourceName",
")",
";",
"}",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"result",
"=",
"new",
"CmsPropertyResourceBundle",
"(",
"is",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// can't localized these message since this may lead to a chicken-egg problem",
"MissingResourceException",
"mre",
"=",
"new",
"MissingResourceException",
"(",
"\"Failed to load bundle '\"",
"+",
"localizedName",
"+",
"\"'\"",
",",
"localizedName",
",",
"\"\"",
")",
";",
"mre",
".",
"initCause",
"(",
"ex",
")",
";",
"throw",
"mre",
";",
"}",
"return",
"result",
";",
"}"
] |
Tries to load a property file with the specified name.
@param localizedName the name
@return the resource bundle if it was loaded, otherwise the backup
|
[
"Tries",
"to",
"load",
"a",
"property",
"file",
"with",
"the",
"specified",
"name",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsResourceBundleLoader.java#L365-L412
|
158,215 |
alkacon/opencms-core
|
src/org/opencms/i18n/CmsResourceBundleLoader.java
|
CmsResourceBundleLoader.tryBundle
|
private static ResourceBundle tryBundle(String baseName, Locale locale, boolean wantBase) {
I_CmsResourceBundle first = null; // The most specialized bundle.
I_CmsResourceBundle last = null; // The least specialized bundle.
List<String> bundleNames = CmsLocaleManager.getLocaleVariants(baseName, locale, true, true);
for (String bundleName : bundleNames) {
// break if we would try the base bundle, but we do not want it directly
if (bundleName.equals(baseName) && !wantBase && (first == null)) {
break;
}
I_CmsResourceBundle foundBundle = tryBundle(bundleName);
if (foundBundle != null) {
if (first == null) {
first = foundBundle;
}
if (last != null) {
last.setParent((ResourceBundle)foundBundle);
}
foundBundle.setLocale(locale);
last = foundBundle;
}
}
return (ResourceBundle)first;
}
|
java
|
private static ResourceBundle tryBundle(String baseName, Locale locale, boolean wantBase) {
I_CmsResourceBundle first = null; // The most specialized bundle.
I_CmsResourceBundle last = null; // The least specialized bundle.
List<String> bundleNames = CmsLocaleManager.getLocaleVariants(baseName, locale, true, true);
for (String bundleName : bundleNames) {
// break if we would try the base bundle, but we do not want it directly
if (bundleName.equals(baseName) && !wantBase && (first == null)) {
break;
}
I_CmsResourceBundle foundBundle = tryBundle(bundleName);
if (foundBundle != null) {
if (first == null) {
first = foundBundle;
}
if (last != null) {
last.setParent((ResourceBundle)foundBundle);
}
foundBundle.setLocale(locale);
last = foundBundle;
}
}
return (ResourceBundle)first;
}
|
[
"private",
"static",
"ResourceBundle",
"tryBundle",
"(",
"String",
"baseName",
",",
"Locale",
"locale",
",",
"boolean",
"wantBase",
")",
"{",
"I_CmsResourceBundle",
"first",
"=",
"null",
";",
"// The most specialized bundle.",
"I_CmsResourceBundle",
"last",
"=",
"null",
";",
"// The least specialized bundle.",
"List",
"<",
"String",
">",
"bundleNames",
"=",
"CmsLocaleManager",
".",
"getLocaleVariants",
"(",
"baseName",
",",
"locale",
",",
"true",
",",
"true",
")",
";",
"for",
"(",
"String",
"bundleName",
":",
"bundleNames",
")",
"{",
"// break if we would try the base bundle, but we do not want it directly",
"if",
"(",
"bundleName",
".",
"equals",
"(",
"baseName",
")",
"&&",
"!",
"wantBase",
"&&",
"(",
"first",
"==",
"null",
")",
")",
"{",
"break",
";",
"}",
"I_CmsResourceBundle",
"foundBundle",
"=",
"tryBundle",
"(",
"bundleName",
")",
";",
"if",
"(",
"foundBundle",
"!=",
"null",
")",
"{",
"if",
"(",
"first",
"==",
"null",
")",
"{",
"first",
"=",
"foundBundle",
";",
"}",
"if",
"(",
"last",
"!=",
"null",
")",
"{",
"last",
".",
"setParent",
"(",
"(",
"ResourceBundle",
")",
"foundBundle",
")",
";",
"}",
"foundBundle",
".",
"setLocale",
"(",
"locale",
")",
";",
"last",
"=",
"foundBundle",
";",
"}",
"}",
"return",
"(",
"ResourceBundle",
")",
"first",
";",
"}"
] |
Tries to load a the bundle for a given locale, also loads the backup
locales with the same language.
@param baseName the raw bundle name, without locale qualifiers
@param locale the locale
@param wantBase whether a resource bundle made only from the base name
(with no locale information attached) should be returned.
@return the resource bundle if it was loaded, otherwise the backup
|
[
"Tries",
"to",
"load",
"a",
"the",
"bundle",
"for",
"a",
"given",
"locale",
"also",
"loads",
"the",
"backup",
"locales",
"with",
"the",
"same",
"language",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsResourceBundleLoader.java#L424-L450
|
158,216 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.validateWithMessage
|
public CmsMessageContainer validateWithMessage() {
if (m_parsingFailed) {
return Messages.get().container(Messages.ERR_SERIALDATE_INVALID_VALUE_0);
}
if (!isStartSet()) {
return Messages.get().container(Messages.ERR_SERIALDATE_START_MISSING_0);
}
if (!isEndValid()) {
return Messages.get().container(Messages.ERR_SERIALDATE_END_BEFORE_START_0);
}
String key = validatePattern();
if (null != key) {
return Messages.get().container(key);
}
key = validateDuration();
if (null != key) {
return Messages.get().container(key);
}
if (hasTooManyEvents()) {
return Messages.get().container(
Messages.ERR_SERIALDATE_TOO_MANY_EVENTS_1,
Integer.valueOf(CmsSerialDateUtil.getMaxEvents()));
}
return null;
}
|
java
|
public CmsMessageContainer validateWithMessage() {
if (m_parsingFailed) {
return Messages.get().container(Messages.ERR_SERIALDATE_INVALID_VALUE_0);
}
if (!isStartSet()) {
return Messages.get().container(Messages.ERR_SERIALDATE_START_MISSING_0);
}
if (!isEndValid()) {
return Messages.get().container(Messages.ERR_SERIALDATE_END_BEFORE_START_0);
}
String key = validatePattern();
if (null != key) {
return Messages.get().container(key);
}
key = validateDuration();
if (null != key) {
return Messages.get().container(key);
}
if (hasTooManyEvents()) {
return Messages.get().container(
Messages.ERR_SERIALDATE_TOO_MANY_EVENTS_1,
Integer.valueOf(CmsSerialDateUtil.getMaxEvents()));
}
return null;
}
|
[
"public",
"CmsMessageContainer",
"validateWithMessage",
"(",
")",
"{",
"if",
"(",
"m_parsingFailed",
")",
"{",
"return",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_SERIALDATE_INVALID_VALUE_0",
")",
";",
"}",
"if",
"(",
"!",
"isStartSet",
"(",
")",
")",
"{",
"return",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_SERIALDATE_START_MISSING_0",
")",
";",
"}",
"if",
"(",
"!",
"isEndValid",
"(",
")",
")",
"{",
"return",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_SERIALDATE_END_BEFORE_START_0",
")",
";",
"}",
"String",
"key",
"=",
"validatePattern",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"key",
")",
"{",
"return",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"key",
")",
";",
"}",
"key",
"=",
"validateDuration",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"key",
")",
"{",
"return",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"key",
")",
";",
"}",
"if",
"(",
"hasTooManyEvents",
"(",
")",
")",
"{",
"return",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_SERIALDATE_TOO_MANY_EVENTS_1",
",",
"Integer",
".",
"valueOf",
"(",
"CmsSerialDateUtil",
".",
"getMaxEvents",
"(",
")",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Validates the wrapped value and returns a localized error message in case of invalid values.
@return <code>null</code> if the value is valid, a suitable localized error message otherwise.
|
[
"Validates",
"the",
"wrapped",
"value",
"and",
"returns",
"a",
"localized",
"error",
"message",
"in",
"case",
"of",
"invalid",
"values",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L158-L183
|
158,217 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.datesToJson
|
private JSONArray datesToJson(Collection<Date> individualDates) {
if (null != individualDates) {
JSONArray result = new JSONArray();
for (Date d : individualDates) {
result.put(dateToJson(d));
}
return result;
}
return null;
}
|
java
|
private JSONArray datesToJson(Collection<Date> individualDates) {
if (null != individualDates) {
JSONArray result = new JSONArray();
for (Date d : individualDates) {
result.put(dateToJson(d));
}
return result;
}
return null;
}
|
[
"private",
"JSONArray",
"datesToJson",
"(",
"Collection",
"<",
"Date",
">",
"individualDates",
")",
"{",
"if",
"(",
"null",
"!=",
"individualDates",
")",
"{",
"JSONArray",
"result",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"Date",
"d",
":",
"individualDates",
")",
"{",
"result",
".",
"put",
"(",
"dateToJson",
"(",
"d",
")",
")",
";",
"}",
"return",
"result",
";",
"}",
"return",
"null",
";",
"}"
] |
Converts a list of dates to a Json array with the long representation of the dates as strings.
@param individualDates the list to convert.
@return Json array with long values of dates as string
|
[
"Converts",
"a",
"list",
"of",
"dates",
"to",
"a",
"Json",
"array",
"with",
"the",
"long",
"representation",
"of",
"the",
"dates",
"as",
"strings",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L190-L200
|
158,218 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readOptionalArray
|
private JSONArray readOptionalArray(JSONObject json, String key) {
try {
return json.getJSONArray(key);
} catch (JSONException e) {
LOG.debug("Reading optional JSON array failed. Default to provided default value.", e);
}
return null;
}
|
java
|
private JSONArray readOptionalArray(JSONObject json, String key) {
try {
return json.getJSONArray(key);
} catch (JSONException e) {
LOG.debug("Reading optional JSON array failed. Default to provided default value.", e);
}
return null;
}
|
[
"private",
"JSONArray",
"readOptionalArray",
"(",
"JSONObject",
"json",
",",
"String",
"key",
")",
"{",
"try",
"{",
"return",
"json",
".",
"getJSONArray",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Reading optional JSON array failed. Default to provided default value.\"",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Read an optional JSON array.
@param json the JSON Object that has the array as element
@param key the key for the array in the provided JSON object
@return the array or null if reading the array fails.
|
[
"Read",
"an",
"optional",
"JSON",
"array",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L301-L309
|
158,219 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readOptionalBoolean
|
private Boolean readOptionalBoolean(JSONObject json, String key) {
try {
return Boolean.valueOf(json.getBoolean(key));
} catch (JSONException e) {
LOG.debug("Reading optional JSON boolean failed. Default to provided default value.", e);
}
return null;
}
|
java
|
private Boolean readOptionalBoolean(JSONObject json, String key) {
try {
return Boolean.valueOf(json.getBoolean(key));
} catch (JSONException e) {
LOG.debug("Reading optional JSON boolean failed. Default to provided default value.", e);
}
return null;
}
|
[
"private",
"Boolean",
"readOptionalBoolean",
"(",
"JSONObject",
"json",
",",
"String",
"key",
")",
"{",
"try",
"{",
"return",
"Boolean",
".",
"valueOf",
"(",
"json",
".",
"getBoolean",
"(",
"key",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Reading optional JSON boolean failed. Default to provided default value.\"",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Read an optional boolean value form a JSON Object.
@param json the JSON object to read from.
@param key the key for the boolean value in the provided JSON object.
@return the boolean or null if reading the boolean fails.
|
[
"Read",
"an",
"optional",
"boolean",
"value",
"form",
"a",
"JSON",
"Object",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L317-L325
|
158,220 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readOptionalString
|
private String readOptionalString(JSONObject json, String key, String defaultValue) {
try {
String str = json.getString(key);
if (str != null) {
return str;
}
} catch (JSONException e) {
LOG.debug("Reading optional JSON string failed. Default to provided default value.", e);
}
return defaultValue;
}
|
java
|
private String readOptionalString(JSONObject json, String key, String defaultValue) {
try {
String str = json.getString(key);
if (str != null) {
return str;
}
} catch (JSONException e) {
LOG.debug("Reading optional JSON string failed. Default to provided default value.", e);
}
return defaultValue;
}
|
[
"private",
"String",
"readOptionalString",
"(",
"JSONObject",
"json",
",",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"try",
"{",
"String",
"str",
"=",
"json",
".",
"getString",
"(",
"key",
")",
";",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"return",
"str",
";",
"}",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Reading optional JSON string failed. Default to provided default value.\"",
",",
"e",
")",
";",
"}",
"return",
"defaultValue",
";",
"}"
] |
Read an optional string value form a JSON Object.
@param json the JSON object to read from.
@param key the key for the string value in the provided JSON object.
@param defaultValue the default value, to be returned if the string can not be read from the JSON object.
@return the string or the default value if reading the string fails.
|
[
"Read",
"an",
"optional",
"string",
"value",
"form",
"a",
"JSON",
"Object",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L385-L397
|
158,221 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readPattern
|
private void readPattern(JSONObject patternJson) {
setPatternType(readPatternType(patternJson));
setInterval(readOptionalInt(patternJson, JsonKey.PATTERN_INTERVAL));
setWeekDays(readWeekDays(patternJson));
setDayOfMonth(readOptionalInt(patternJson, JsonKey.PATTERN_DAY_OF_MONTH));
setEveryWorkingDay(readOptionalBoolean(patternJson, JsonKey.PATTERN_EVERYWORKINGDAY));
setWeeksOfMonth(readWeeksOfMonth(patternJson));
setIndividualDates(readDates(readOptionalArray(patternJson, JsonKey.PATTERN_DATES)));
setMonth(readOptionalMonth(patternJson, JsonKey.PATTERN_MONTH));
}
|
java
|
private void readPattern(JSONObject patternJson) {
setPatternType(readPatternType(patternJson));
setInterval(readOptionalInt(patternJson, JsonKey.PATTERN_INTERVAL));
setWeekDays(readWeekDays(patternJson));
setDayOfMonth(readOptionalInt(patternJson, JsonKey.PATTERN_DAY_OF_MONTH));
setEveryWorkingDay(readOptionalBoolean(patternJson, JsonKey.PATTERN_EVERYWORKINGDAY));
setWeeksOfMonth(readWeeksOfMonth(patternJson));
setIndividualDates(readDates(readOptionalArray(patternJson, JsonKey.PATTERN_DATES)));
setMonth(readOptionalMonth(patternJson, JsonKey.PATTERN_MONTH));
}
|
[
"private",
"void",
"readPattern",
"(",
"JSONObject",
"patternJson",
")",
"{",
"setPatternType",
"(",
"readPatternType",
"(",
"patternJson",
")",
")",
";",
"setInterval",
"(",
"readOptionalInt",
"(",
"patternJson",
",",
"JsonKey",
".",
"PATTERN_INTERVAL",
")",
")",
";",
"setWeekDays",
"(",
"readWeekDays",
"(",
"patternJson",
")",
")",
";",
"setDayOfMonth",
"(",
"readOptionalInt",
"(",
"patternJson",
",",
"JsonKey",
".",
"PATTERN_DAY_OF_MONTH",
")",
")",
";",
"setEveryWorkingDay",
"(",
"readOptionalBoolean",
"(",
"patternJson",
",",
"JsonKey",
".",
"PATTERN_EVERYWORKINGDAY",
")",
")",
";",
"setWeeksOfMonth",
"(",
"readWeeksOfMonth",
"(",
"patternJson",
")",
")",
";",
"setIndividualDates",
"(",
"readDates",
"(",
"readOptionalArray",
"(",
"patternJson",
",",
"JsonKey",
".",
"PATTERN_DATES",
")",
")",
")",
";",
"setMonth",
"(",
"readOptionalMonth",
"(",
"patternJson",
",",
"JsonKey",
".",
"PATTERN_MONTH",
")",
")",
";",
"}"
] |
Read pattern information from the provided JSON object.
@param patternJson the JSON object containing the pattern information.
|
[
"Read",
"pattern",
"information",
"from",
"the",
"provided",
"JSON",
"object",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L423-L434
|
158,222 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.toJsonStringArray
|
private JSONArray toJsonStringArray(Collection<? extends Object> collection) {
if (null != collection) {
JSONArray array = new JSONArray();
for (Object o : collection) {
array.put("" + o);
}
return array;
} else {
return null;
}
}
|
java
|
private JSONArray toJsonStringArray(Collection<? extends Object> collection) {
if (null != collection) {
JSONArray array = new JSONArray();
for (Object o : collection) {
array.put("" + o);
}
return array;
} else {
return null;
}
}
|
[
"private",
"JSONArray",
"toJsonStringArray",
"(",
"Collection",
"<",
"?",
"extends",
"Object",
">",
"collection",
")",
"{",
"if",
"(",
"null",
"!=",
"collection",
")",
"{",
"JSONArray",
"array",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"collection",
")",
"{",
"array",
".",
"put",
"(",
"\"\"",
"+",
"o",
")",
";",
"}",
"return",
"array",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Convert a collection of objects to a JSON array with the string representations of that objects.
@param collection the collection of objects.
@return the JSON array with the string representations.
|
[
"Convert",
"a",
"collection",
"of",
"objects",
"to",
"a",
"JSON",
"array",
"with",
"the",
"string",
"representations",
"of",
"that",
"objects",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L513-L524
|
158,223 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.validateDuration
|
private String validateDuration() {
if (!isValidEndTypeForPattern()) {
return Messages.ERR_SERIALDATE_INVALID_END_TYPE_FOR_PATTERN_0;
}
switch (getEndType()) {
case DATE:
return (getStart().getTime() < (getSeriesEndDate().getTime() + DAY_IN_MILLIS))
? null
: Messages.ERR_SERIALDATE_SERIES_END_BEFORE_START_0;
case TIMES:
return getOccurrences() > 0 ? null : Messages.ERR_SERIALDATE_INVALID_OCCURRENCES_0;
default:
return null;
}
}
|
java
|
private String validateDuration() {
if (!isValidEndTypeForPattern()) {
return Messages.ERR_SERIALDATE_INVALID_END_TYPE_FOR_PATTERN_0;
}
switch (getEndType()) {
case DATE:
return (getStart().getTime() < (getSeriesEndDate().getTime() + DAY_IN_MILLIS))
? null
: Messages.ERR_SERIALDATE_SERIES_END_BEFORE_START_0;
case TIMES:
return getOccurrences() > 0 ? null : Messages.ERR_SERIALDATE_INVALID_OCCURRENCES_0;
default:
return null;
}
}
|
[
"private",
"String",
"validateDuration",
"(",
")",
"{",
"if",
"(",
"!",
"isValidEndTypeForPattern",
"(",
")",
")",
"{",
"return",
"Messages",
".",
"ERR_SERIALDATE_INVALID_END_TYPE_FOR_PATTERN_0",
";",
"}",
"switch",
"(",
"getEndType",
"(",
")",
")",
"{",
"case",
"DATE",
":",
"return",
"(",
"getStart",
"(",
")",
".",
"getTime",
"(",
")",
"<",
"(",
"getSeriesEndDate",
"(",
")",
".",
"getTime",
"(",
")",
"+",
"DAY_IN_MILLIS",
")",
")",
"?",
"null",
":",
"Messages",
".",
"ERR_SERIALDATE_SERIES_END_BEFORE_START_0",
";",
"case",
"TIMES",
":",
"return",
"getOccurrences",
"(",
")",
">",
"0",
"?",
"null",
":",
"Messages",
".",
"ERR_SERIALDATE_INVALID_OCCURRENCES_0",
";",
"default",
":",
"return",
"null",
";",
"}",
"}"
] |
Checks if the provided duration information is valid.
@return <code>null</code> if the information is valid, the key of the suitable error message otherwise.
|
[
"Checks",
"if",
"the",
"provided",
"duration",
"information",
"is",
"valid",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L539-L555
|
158,224 |
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.validatePattern
|
private String validatePattern() {
String error = null;
switch (getPatternType()) {
case DAILY:
error = isEveryWorkingDay() ? null : validateInterval();
break;
case WEEKLY:
error = validateInterval();
if (null == error) {
error = validateWeekDaySet();
}
break;
case MONTHLY:
error = validateInterval();
if (null == error) {
error = validateMonthSet();
if (null == error) {
error = isWeekDaySet() ? validateWeekOfMonthSet() : validateDayOfMonth();
}
}
break;
case YEARLY:
error = isWeekDaySet() ? validateWeekOfMonthSet() : validateDayOfMonth();
break;
case INDIVIDUAL:
case NONE:
default:
}
return error;
}
|
java
|
private String validatePattern() {
String error = null;
switch (getPatternType()) {
case DAILY:
error = isEveryWorkingDay() ? null : validateInterval();
break;
case WEEKLY:
error = validateInterval();
if (null == error) {
error = validateWeekDaySet();
}
break;
case MONTHLY:
error = validateInterval();
if (null == error) {
error = validateMonthSet();
if (null == error) {
error = isWeekDaySet() ? validateWeekOfMonthSet() : validateDayOfMonth();
}
}
break;
case YEARLY:
error = isWeekDaySet() ? validateWeekOfMonthSet() : validateDayOfMonth();
break;
case INDIVIDUAL:
case NONE:
default:
}
return error;
}
|
[
"private",
"String",
"validatePattern",
"(",
")",
"{",
"String",
"error",
"=",
"null",
";",
"switch",
"(",
"getPatternType",
"(",
")",
")",
"{",
"case",
"DAILY",
":",
"error",
"=",
"isEveryWorkingDay",
"(",
")",
"?",
"null",
":",
"validateInterval",
"(",
")",
";",
"break",
";",
"case",
"WEEKLY",
":",
"error",
"=",
"validateInterval",
"(",
")",
";",
"if",
"(",
"null",
"==",
"error",
")",
"{",
"error",
"=",
"validateWeekDaySet",
"(",
")",
";",
"}",
"break",
";",
"case",
"MONTHLY",
":",
"error",
"=",
"validateInterval",
"(",
")",
";",
"if",
"(",
"null",
"==",
"error",
")",
"{",
"error",
"=",
"validateMonthSet",
"(",
")",
";",
"if",
"(",
"null",
"==",
"error",
")",
"{",
"error",
"=",
"isWeekDaySet",
"(",
")",
"?",
"validateWeekOfMonthSet",
"(",
")",
":",
"validateDayOfMonth",
"(",
")",
";",
"}",
"}",
"break",
";",
"case",
"YEARLY",
":",
"error",
"=",
"isWeekDaySet",
"(",
")",
"?",
"validateWeekOfMonthSet",
"(",
")",
":",
"validateDayOfMonth",
"(",
")",
";",
"break",
";",
"case",
"INDIVIDUAL",
":",
"case",
"NONE",
":",
"default",
":",
"}",
"return",
"error",
";",
"}"
] |
Check, if all values used for calculating the series for a specific pattern are valid.
@return <code>null</code> if the pattern is valid, a suitable error message otherwise.
|
[
"Check",
"if",
"all",
"values",
"used",
"for",
"calculating",
"the",
"series",
"for",
"a",
"specific",
"pattern",
"are",
"valid",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L579-L609
|
158,225 |
alkacon/opencms-core
|
src/org/opencms/db/CmsDbPoolV11.java
|
CmsDbPoolV11.createHikariConfig
|
public static HikariConfig createHikariConfig(CmsParameterConfiguration config, String key) {
Map<String, String> poolMap = Maps.newHashMap();
for (Map.Entry<String, String> entry : config.entrySet()) {
String suffix = getPropertyRelativeSuffix(KEY_DATABASE_POOL + "." + key, entry.getKey());
if ((suffix != null) && !CmsStringUtil.isEmptyOrWhitespaceOnly(entry.getValue())) {
String value = entry.getValue().trim();
poolMap.put(suffix, value);
}
}
// these are for backwards compatibility , all other properties not of the form db.pool.poolname.v11..... are ignored
String jdbcUrl = poolMap.get(KEY_JDBC_URL);
String params = poolMap.get(KEY_JDBC_URL_PARAMS);
String driver = poolMap.get(KEY_JDBC_DRIVER);
String user = poolMap.get(KEY_USERNAME);
String password = poolMap.get(KEY_PASSWORD);
String poolName = OPENCMS_URL_PREFIX + key;
if ((params != null) && (jdbcUrl != null)) {
jdbcUrl += params;
}
Properties hikariProps = new Properties();
if (jdbcUrl != null) {
hikariProps.put("jdbcUrl", jdbcUrl);
}
if (driver != null) {
hikariProps.put("driverClassName", driver);
}
if (user != null) {
user = OpenCms.getCredentialsResolver().resolveCredential(I_CmsCredentialsResolver.DB_USER, user);
hikariProps.put("username", user);
}
if (password != null) {
password = OpenCms.getCredentialsResolver().resolveCredential(
I_CmsCredentialsResolver.DB_PASSWORD,
password);
hikariProps.put("password", password);
}
hikariProps.put("maximumPoolSize", "30");
// Properties of the form db.pool.poolname.v11.<foo> are directly passed to HikariCP as <foo>
for (Map.Entry<String, String> entry : poolMap.entrySet()) {
String suffix = getPropertyRelativeSuffix("v11", entry.getKey());
if (suffix != null) {
hikariProps.put(suffix, entry.getValue());
}
}
String configuredTestQuery = (String)(hikariProps.get("connectionTestQuery"));
String testQueryForDriver = testQueries.get(driver);
if ((testQueryForDriver != null) && CmsStringUtil.isEmptyOrWhitespaceOnly(configuredTestQuery)) {
hikariProps.put("connectionTestQuery", testQueryForDriver);
}
hikariProps.put("registerMbeans", "true");
HikariConfig result = new HikariConfig(hikariProps);
result.setPoolName(poolName.replace(":", "_"));
return result;
}
|
java
|
public static HikariConfig createHikariConfig(CmsParameterConfiguration config, String key) {
Map<String, String> poolMap = Maps.newHashMap();
for (Map.Entry<String, String> entry : config.entrySet()) {
String suffix = getPropertyRelativeSuffix(KEY_DATABASE_POOL + "." + key, entry.getKey());
if ((suffix != null) && !CmsStringUtil.isEmptyOrWhitespaceOnly(entry.getValue())) {
String value = entry.getValue().trim();
poolMap.put(suffix, value);
}
}
// these are for backwards compatibility , all other properties not of the form db.pool.poolname.v11..... are ignored
String jdbcUrl = poolMap.get(KEY_JDBC_URL);
String params = poolMap.get(KEY_JDBC_URL_PARAMS);
String driver = poolMap.get(KEY_JDBC_DRIVER);
String user = poolMap.get(KEY_USERNAME);
String password = poolMap.get(KEY_PASSWORD);
String poolName = OPENCMS_URL_PREFIX + key;
if ((params != null) && (jdbcUrl != null)) {
jdbcUrl += params;
}
Properties hikariProps = new Properties();
if (jdbcUrl != null) {
hikariProps.put("jdbcUrl", jdbcUrl);
}
if (driver != null) {
hikariProps.put("driverClassName", driver);
}
if (user != null) {
user = OpenCms.getCredentialsResolver().resolveCredential(I_CmsCredentialsResolver.DB_USER, user);
hikariProps.put("username", user);
}
if (password != null) {
password = OpenCms.getCredentialsResolver().resolveCredential(
I_CmsCredentialsResolver.DB_PASSWORD,
password);
hikariProps.put("password", password);
}
hikariProps.put("maximumPoolSize", "30");
// Properties of the form db.pool.poolname.v11.<foo> are directly passed to HikariCP as <foo>
for (Map.Entry<String, String> entry : poolMap.entrySet()) {
String suffix = getPropertyRelativeSuffix("v11", entry.getKey());
if (suffix != null) {
hikariProps.put(suffix, entry.getValue());
}
}
String configuredTestQuery = (String)(hikariProps.get("connectionTestQuery"));
String testQueryForDriver = testQueries.get(driver);
if ((testQueryForDriver != null) && CmsStringUtil.isEmptyOrWhitespaceOnly(configuredTestQuery)) {
hikariProps.put("connectionTestQuery", testQueryForDriver);
}
hikariProps.put("registerMbeans", "true");
HikariConfig result = new HikariConfig(hikariProps);
result.setPoolName(poolName.replace(":", "_"));
return result;
}
|
[
"public",
"static",
"HikariConfig",
"createHikariConfig",
"(",
"CmsParameterConfiguration",
"config",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"poolMap",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"config",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"suffix",
"=",
"getPropertyRelativeSuffix",
"(",
"KEY_DATABASE_POOL",
"+",
"\".\"",
"+",
"key",
",",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"(",
"suffix",
"!=",
"null",
")",
"&&",
"!",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
")",
"{",
"String",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
".",
"trim",
"(",
")",
";",
"poolMap",
".",
"put",
"(",
"suffix",
",",
"value",
")",
";",
"}",
"}",
"// these are for backwards compatibility , all other properties not of the form db.pool.poolname.v11..... are ignored",
"String",
"jdbcUrl",
"=",
"poolMap",
".",
"get",
"(",
"KEY_JDBC_URL",
")",
";",
"String",
"params",
"=",
"poolMap",
".",
"get",
"(",
"KEY_JDBC_URL_PARAMS",
")",
";",
"String",
"driver",
"=",
"poolMap",
".",
"get",
"(",
"KEY_JDBC_DRIVER",
")",
";",
"String",
"user",
"=",
"poolMap",
".",
"get",
"(",
"KEY_USERNAME",
")",
";",
"String",
"password",
"=",
"poolMap",
".",
"get",
"(",
"KEY_PASSWORD",
")",
";",
"String",
"poolName",
"=",
"OPENCMS_URL_PREFIX",
"+",
"key",
";",
"if",
"(",
"(",
"params",
"!=",
"null",
")",
"&&",
"(",
"jdbcUrl",
"!=",
"null",
")",
")",
"{",
"jdbcUrl",
"+=",
"params",
";",
"}",
"Properties",
"hikariProps",
"=",
"new",
"Properties",
"(",
")",
";",
"if",
"(",
"jdbcUrl",
"!=",
"null",
")",
"{",
"hikariProps",
".",
"put",
"(",
"\"jdbcUrl\"",
",",
"jdbcUrl",
")",
";",
"}",
"if",
"(",
"driver",
"!=",
"null",
")",
"{",
"hikariProps",
".",
"put",
"(",
"\"driverClassName\"",
",",
"driver",
")",
";",
"}",
"if",
"(",
"user",
"!=",
"null",
")",
"{",
"user",
"=",
"OpenCms",
".",
"getCredentialsResolver",
"(",
")",
".",
"resolveCredential",
"(",
"I_CmsCredentialsResolver",
".",
"DB_USER",
",",
"user",
")",
";",
"hikariProps",
".",
"put",
"(",
"\"username\"",
",",
"user",
")",
";",
"}",
"if",
"(",
"password",
"!=",
"null",
")",
"{",
"password",
"=",
"OpenCms",
".",
"getCredentialsResolver",
"(",
")",
".",
"resolveCredential",
"(",
"I_CmsCredentialsResolver",
".",
"DB_PASSWORD",
",",
"password",
")",
";",
"hikariProps",
".",
"put",
"(",
"\"password\"",
",",
"password",
")",
";",
"}",
"hikariProps",
".",
"put",
"(",
"\"maximumPoolSize\"",
",",
"\"30\"",
")",
";",
"// Properties of the form db.pool.poolname.v11.<foo> are directly passed to HikariCP as <foo>",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"poolMap",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"suffix",
"=",
"getPropertyRelativeSuffix",
"(",
"\"v11\"",
",",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"suffix",
"!=",
"null",
")",
"{",
"hikariProps",
".",
"put",
"(",
"suffix",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"String",
"configuredTestQuery",
"=",
"(",
"String",
")",
"(",
"hikariProps",
".",
"get",
"(",
"\"connectionTestQuery\"",
")",
")",
";",
"String",
"testQueryForDriver",
"=",
"testQueries",
".",
"get",
"(",
"driver",
")",
";",
"if",
"(",
"(",
"testQueryForDriver",
"!=",
"null",
")",
"&&",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"configuredTestQuery",
")",
")",
"{",
"hikariProps",
".",
"put",
"(",
"\"connectionTestQuery\"",
",",
"testQueryForDriver",
")",
";",
"}",
"hikariProps",
".",
"put",
"(",
"\"registerMbeans\"",
",",
"\"true\"",
")",
";",
"HikariConfig",
"result",
"=",
"new",
"HikariConfig",
"(",
"hikariProps",
")",
";",
"result",
".",
"setPoolName",
"(",
"poolName",
".",
"replace",
"(",
"\":\"",
",",
"\"_\"",
")",
")",
";",
"return",
"result",
";",
"}"
] |
Creates the HikariCP configuration based on the configuration of a pool defined in opencms.properties.
@param config the configuration object with the properties
@param key the pool name (without the opencms prefix)
@return the HikariCP configuration for the pool
|
[
"Creates",
"the",
"HikariCP",
"configuration",
"based",
"on",
"the",
"configuration",
"of",
"a",
"pool",
"defined",
"in",
"opencms",
".",
"properties",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDbPoolV11.java#L183-L245
|
158,226 |
alkacon/opencms-core
|
src/org/opencms/ugc/CmsUgcSession.java
|
CmsUgcSession.unmarshalXmlContent
|
private CmsXmlContent unmarshalXmlContent(CmsFile file) throws CmsXmlException {
CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
content.setAutoCorrectionEnabled(true);
content.correctXmlStructure(m_cms);
return content;
}
|
java
|
private CmsXmlContent unmarshalXmlContent(CmsFile file) throws CmsXmlException {
CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
content.setAutoCorrectionEnabled(true);
content.correctXmlStructure(m_cms);
return content;
}
|
[
"private",
"CmsXmlContent",
"unmarshalXmlContent",
"(",
"CmsFile",
"file",
")",
"throws",
"CmsXmlException",
"{",
"CmsXmlContent",
"content",
"=",
"CmsXmlContentFactory",
".",
"unmarshal",
"(",
"m_cms",
",",
"file",
")",
";",
"content",
".",
"setAutoCorrectionEnabled",
"(",
"true",
")",
";",
"content",
".",
"correctXmlStructure",
"(",
"m_cms",
")",
";",
"return",
"content",
";",
"}"
] |
Unmarshal the XML content with auto-correction.
@param file the file that contains the XML
@return the XML read from the file
@throws CmsXmlException thrown if the XML can't be read.
|
[
"Unmarshal",
"the",
"XML",
"content",
"with",
"auto",
"-",
"correction",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L828-L835
|
158,227 |
alkacon/opencms-core
|
src/org/opencms/importexport/A_CmsImport.java
|
A_CmsImport.getImportAccessControlEntry
|
protected CmsAccessControlEntry getImportAccessControlEntry(
CmsResource res,
String id,
String allowed,
String denied,
String flags) {
return new CmsAccessControlEntry(
res.getResourceId(),
new CmsUUID(id),
Integer.parseInt(allowed),
Integer.parseInt(denied),
Integer.parseInt(flags));
}
|
java
|
protected CmsAccessControlEntry getImportAccessControlEntry(
CmsResource res,
String id,
String allowed,
String denied,
String flags) {
return new CmsAccessControlEntry(
res.getResourceId(),
new CmsUUID(id),
Integer.parseInt(allowed),
Integer.parseInt(denied),
Integer.parseInt(flags));
}
|
[
"protected",
"CmsAccessControlEntry",
"getImportAccessControlEntry",
"(",
"CmsResource",
"res",
",",
"String",
"id",
",",
"String",
"allowed",
",",
"String",
"denied",
",",
"String",
"flags",
")",
"{",
"return",
"new",
"CmsAccessControlEntry",
"(",
"res",
".",
"getResourceId",
"(",
")",
",",
"new",
"CmsUUID",
"(",
"id",
")",
",",
"Integer",
".",
"parseInt",
"(",
"allowed",
")",
",",
"Integer",
".",
"parseInt",
"(",
"denied",
")",
",",
"Integer",
".",
"parseInt",
"(",
"flags",
")",
")",
";",
"}"
] |
Creates a new access control entry and stores it for later write out.
@param res the resource
@param id the id of the principal
@param allowed the allowed permissions
@param denied the denied permissions
@param flags the flags
@return the created ACE
|
[
"Creates",
"a",
"new",
"access",
"control",
"entry",
"and",
"stores",
"it",
"for",
"later",
"write",
"out",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/A_CmsImport.java#L606-L619
|
158,228 |
alkacon/opencms-core
|
src/org/opencms/workplace/Messages.java
|
Messages.getStateKey
|
public static String getStateKey(CmsResourceState state) {
StringBuffer sb = new StringBuffer(STATE_PREFIX);
sb.append(state);
sb.append(STATE_POSTFIX);
return sb.toString();
}
|
java
|
public static String getStateKey(CmsResourceState state) {
StringBuffer sb = new StringBuffer(STATE_PREFIX);
sb.append(state);
sb.append(STATE_POSTFIX);
return sb.toString();
}
|
[
"public",
"static",
"String",
"getStateKey",
"(",
"CmsResourceState",
"state",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"STATE_PREFIX",
")",
";",
"sb",
".",
"append",
"(",
"state",
")",
";",
"sb",
".",
"append",
"(",
"STATE_POSTFIX",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Create constant name.
@param state STATE_UNCHANGED, STATE_CHANGED, STATE_NEW or STATE_DELETED.
@return cconstanname as String
|
[
"Create",
"constant",
"name",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/Messages.java#L520-L527
|
158,229 |
alkacon/opencms-core
|
src/org/opencms/ui/components/CmsAppViewLayout.java
|
CmsAppViewLayout.createPublishButton
|
public static Button createPublishButton(final I_CmsUpdateListener<String> updateListener) {
Button publishButton = CmsToolBar.createButton(
FontOpenCms.PUBLISH,
CmsVaadinUtils.getMessageText(Messages.GUI_PUBLISH_BUTTON_TITLE_0));
if (CmsAppWorkplaceUi.isOnlineProject()) {
// disable publishing in online project
publishButton.setEnabled(false);
publishButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0));
}
publishButton.addClickListener(new ClickListener() {
/** Serial version id. */
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
CmsAppWorkplaceUi.get().disableGlobalShortcuts();
CmsGwtDialogExtension extension = new CmsGwtDialogExtension(A_CmsUI.get(), updateListener);
extension.openPublishDialog();
}
});
return publishButton;
}
|
java
|
public static Button createPublishButton(final I_CmsUpdateListener<String> updateListener) {
Button publishButton = CmsToolBar.createButton(
FontOpenCms.PUBLISH,
CmsVaadinUtils.getMessageText(Messages.GUI_PUBLISH_BUTTON_TITLE_0));
if (CmsAppWorkplaceUi.isOnlineProject()) {
// disable publishing in online project
publishButton.setEnabled(false);
publishButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0));
}
publishButton.addClickListener(new ClickListener() {
/** Serial version id. */
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
CmsAppWorkplaceUi.get().disableGlobalShortcuts();
CmsGwtDialogExtension extension = new CmsGwtDialogExtension(A_CmsUI.get(), updateListener);
extension.openPublishDialog();
}
});
return publishButton;
}
|
[
"public",
"static",
"Button",
"createPublishButton",
"(",
"final",
"I_CmsUpdateListener",
"<",
"String",
">",
"updateListener",
")",
"{",
"Button",
"publishButton",
"=",
"CmsToolBar",
".",
"createButton",
"(",
"FontOpenCms",
".",
"PUBLISH",
",",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_PUBLISH_BUTTON_TITLE_0",
")",
")",
";",
"if",
"(",
"CmsAppWorkplaceUi",
".",
"isOnlineProject",
"(",
")",
")",
"{",
"// disable publishing in online project",
"publishButton",
".",
"setEnabled",
"(",
"false",
")",
";",
"publishButton",
".",
"setDescription",
"(",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0",
")",
")",
";",
"}",
"publishButton",
".",
"addClickListener",
"(",
"new",
"ClickListener",
"(",
")",
"{",
"/** Serial version id. */",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"public",
"void",
"buttonClick",
"(",
"ClickEvent",
"event",
")",
"{",
"CmsAppWorkplaceUi",
".",
"get",
"(",
")",
".",
"disableGlobalShortcuts",
"(",
")",
";",
"CmsGwtDialogExtension",
"extension",
"=",
"new",
"CmsGwtDialogExtension",
"(",
"A_CmsUI",
".",
"get",
"(",
")",
",",
"updateListener",
")",
";",
"extension",
".",
"openPublishDialog",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"publishButton",
";",
"}"
] |
Creates the publish button.
@param updateListener the update listener
@return the publish button
|
[
"Creates",
"the",
"publish",
"button",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsAppViewLayout.java#L96-L119
|
158,230 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.getFilters
|
Map<Object, Object> getFilters() {
Map<Object, Object> result = new HashMap<Object, Object>(4);
result.put(TableProperty.KEY, m_table.getFilterFieldValue(TableProperty.KEY));
result.put(TableProperty.DEFAULT, m_table.getFilterFieldValue(TableProperty.DEFAULT));
result.put(TableProperty.DESCRIPTION, m_table.getFilterFieldValue(TableProperty.DESCRIPTION));
result.put(TableProperty.TRANSLATION, m_table.getFilterFieldValue(TableProperty.TRANSLATION));
return result;
}
|
java
|
Map<Object, Object> getFilters() {
Map<Object, Object> result = new HashMap<Object, Object>(4);
result.put(TableProperty.KEY, m_table.getFilterFieldValue(TableProperty.KEY));
result.put(TableProperty.DEFAULT, m_table.getFilterFieldValue(TableProperty.DEFAULT));
result.put(TableProperty.DESCRIPTION, m_table.getFilterFieldValue(TableProperty.DESCRIPTION));
result.put(TableProperty.TRANSLATION, m_table.getFilterFieldValue(TableProperty.TRANSLATION));
return result;
}
|
[
"Map",
"<",
"Object",
",",
"Object",
">",
"getFilters",
"(",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"result",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"(",
"4",
")",
";",
"result",
".",
"put",
"(",
"TableProperty",
".",
"KEY",
",",
"m_table",
".",
"getFilterFieldValue",
"(",
"TableProperty",
".",
"KEY",
")",
")",
";",
"result",
".",
"put",
"(",
"TableProperty",
".",
"DEFAULT",
",",
"m_table",
".",
"getFilterFieldValue",
"(",
"TableProperty",
".",
"DEFAULT",
")",
")",
";",
"result",
".",
"put",
"(",
"TableProperty",
".",
"DESCRIPTION",
",",
"m_table",
".",
"getFilterFieldValue",
"(",
"TableProperty",
".",
"DESCRIPTION",
")",
")",
";",
"result",
".",
"put",
"(",
"TableProperty",
".",
"TRANSLATION",
",",
"m_table",
".",
"getFilterFieldValue",
"(",
"TableProperty",
".",
"TRANSLATION",
")",
")",
";",
"return",
"result",
";",
"}"
] |
Returns the currently set filters in a map column -> filter.
@return the currently set filters in a map column -> filter.
|
[
"Returns",
"the",
"currently",
"set",
"filters",
"in",
"a",
"map",
"column",
"-",
">",
"filter",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L492-L500
|
158,231 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.saveAction
|
void saveAction() {
Map<Object, Object> filters = getFilters();
m_table.clearFilters();
try {
m_model.save();
disableSaveButtons();
} catch (CmsException e) {
LOG.error(m_messages.key(Messages.ERR_SAVING_CHANGES_0), e);
CmsErrorDialog.showErrorDialog(m_messages.key(Messages.ERR_SAVING_CHANGES_0), e);
}
setFilters(filters);
}
|
java
|
void saveAction() {
Map<Object, Object> filters = getFilters();
m_table.clearFilters();
try {
m_model.save();
disableSaveButtons();
} catch (CmsException e) {
LOG.error(m_messages.key(Messages.ERR_SAVING_CHANGES_0), e);
CmsErrorDialog.showErrorDialog(m_messages.key(Messages.ERR_SAVING_CHANGES_0), e);
}
setFilters(filters);
}
|
[
"void",
"saveAction",
"(",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"filters",
"=",
"getFilters",
"(",
")",
";",
"m_table",
".",
"clearFilters",
"(",
")",
";",
"try",
"{",
"m_model",
".",
"save",
"(",
")",
";",
"disableSaveButtons",
"(",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"ERR_SAVING_CHANGES_0",
")",
",",
"e",
")",
";",
"CmsErrorDialog",
".",
"showErrorDialog",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"ERR_SAVING_CHANGES_0",
")",
",",
"e",
")",
";",
"}",
"setFilters",
"(",
"filters",
")",
";",
"}"
] |
Save the changes.
|
[
"Save",
"the",
"changes",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L518-L535
|
158,232 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.setFilters
|
void setFilters(Map<Object, Object> filters) {
for (Object column : filters.keySet()) {
Object filterValue = filters.get(column);
if ((filterValue != null) && !filterValue.toString().isEmpty() && !m_table.isColumnCollapsed(column)) {
m_table.setFilterFieldValue(column, filterValue);
}
}
}
|
java
|
void setFilters(Map<Object, Object> filters) {
for (Object column : filters.keySet()) {
Object filterValue = filters.get(column);
if ((filterValue != null) && !filterValue.toString().isEmpty() && !m_table.isColumnCollapsed(column)) {
m_table.setFilterFieldValue(column, filterValue);
}
}
}
|
[
"void",
"setFilters",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"filters",
")",
"{",
"for",
"(",
"Object",
"column",
":",
"filters",
".",
"keySet",
"(",
")",
")",
"{",
"Object",
"filterValue",
"=",
"filters",
".",
"get",
"(",
"column",
")",
";",
"if",
"(",
"(",
"filterValue",
"!=",
"null",
")",
"&&",
"!",
"filterValue",
".",
"toString",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"m_table",
".",
"isColumnCollapsed",
"(",
"column",
")",
")",
"{",
"m_table",
".",
"setFilterFieldValue",
"(",
"column",
",",
"filterValue",
")",
";",
"}",
"}",
"}"
] |
Sets the provided filters.
@param filters a map "column id -> filter".
|
[
"Sets",
"the",
"provided",
"filters",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L571-L579
|
158,233 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.adjustOptionsColumn
|
private void adjustOptionsColumn(
CmsMessageBundleEditorTypes.EditMode oldMode,
CmsMessageBundleEditorTypes.EditMode newMode) {
if (m_model.isShowOptionsColumn(oldMode) != m_model.isShowOptionsColumn(newMode)) {
m_table.removeGeneratedColumn(TableProperty.OPTIONS);
if (m_model.isShowOptionsColumn(newMode)) {
// Don't know why exactly setting the filter field invisible is necessary here,
// it should be already set invisible - but apparently not setting it invisible again
// will result in the field being visible.
m_table.setFilterFieldVisible(TableProperty.OPTIONS, false);
m_table.addGeneratedColumn(TableProperty.OPTIONS, m_optionsColumn);
}
}
}
|
java
|
private void adjustOptionsColumn(
CmsMessageBundleEditorTypes.EditMode oldMode,
CmsMessageBundleEditorTypes.EditMode newMode) {
if (m_model.isShowOptionsColumn(oldMode) != m_model.isShowOptionsColumn(newMode)) {
m_table.removeGeneratedColumn(TableProperty.OPTIONS);
if (m_model.isShowOptionsColumn(newMode)) {
// Don't know why exactly setting the filter field invisible is necessary here,
// it should be already set invisible - but apparently not setting it invisible again
// will result in the field being visible.
m_table.setFilterFieldVisible(TableProperty.OPTIONS, false);
m_table.addGeneratedColumn(TableProperty.OPTIONS, m_optionsColumn);
}
}
}
|
[
"private",
"void",
"adjustOptionsColumn",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
"oldMode",
",",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
"newMode",
")",
"{",
"if",
"(",
"m_model",
".",
"isShowOptionsColumn",
"(",
"oldMode",
")",
"!=",
"m_model",
".",
"isShowOptionsColumn",
"(",
"newMode",
")",
")",
"{",
"m_table",
".",
"removeGeneratedColumn",
"(",
"TableProperty",
".",
"OPTIONS",
")",
";",
"if",
"(",
"m_model",
".",
"isShowOptionsColumn",
"(",
"newMode",
")",
")",
"{",
"// Don't know why exactly setting the filter field invisible is necessary here,",
"// it should be already set invisible - but apparently not setting it invisible again",
"// will result in the field being visible.",
"m_table",
".",
"setFilterFieldVisible",
"(",
"TableProperty",
".",
"OPTIONS",
",",
"false",
")",
";",
"m_table",
".",
"addGeneratedColumn",
"(",
"TableProperty",
".",
"OPTIONS",
",",
"m_optionsColumn",
")",
";",
"}",
"}",
"}"
] |
Show or hide the options column dependent on the provided edit mode.
@param oldMode the old edit mode
@param newMode the edit mode for which the options column's visibility should be adjusted.
|
[
"Show",
"or",
"hide",
"the",
"options",
"column",
"dependent",
"on",
"the",
"provided",
"edit",
"mode",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L596-L610
|
158,234 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.adjustVisibleColumns
|
private void adjustVisibleColumns() {
if (m_table.isColumnCollapsingAllowed()) {
if ((m_model.hasDefaultValues()) || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
m_table.setColumnCollapsed(TableProperty.DEFAULT, false);
} else {
m_table.setColumnCollapsed(TableProperty.DEFAULT, true);
}
if (((m_model.getEditMode().equals(EditMode.MASTER) || m_model.hasDescriptionValues()))
|| m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
m_table.setColumnCollapsed(TableProperty.DESCRIPTION, false);
} else {
m_table.setColumnCollapsed(TableProperty.DESCRIPTION, true);
}
}
}
|
java
|
private void adjustVisibleColumns() {
if (m_table.isColumnCollapsingAllowed()) {
if ((m_model.hasDefaultValues()) || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
m_table.setColumnCollapsed(TableProperty.DEFAULT, false);
} else {
m_table.setColumnCollapsed(TableProperty.DEFAULT, true);
}
if (((m_model.getEditMode().equals(EditMode.MASTER) || m_model.hasDescriptionValues()))
|| m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
m_table.setColumnCollapsed(TableProperty.DESCRIPTION, false);
} else {
m_table.setColumnCollapsed(TableProperty.DESCRIPTION, true);
}
}
}
|
[
"private",
"void",
"adjustVisibleColumns",
"(",
")",
"{",
"if",
"(",
"m_table",
".",
"isColumnCollapsingAllowed",
"(",
")",
")",
"{",
"if",
"(",
"(",
"m_model",
".",
"hasDefaultValues",
"(",
")",
")",
"||",
"m_model",
".",
"getBundleType",
"(",
")",
".",
"equals",
"(",
"BundleType",
".",
"DESCRIPTOR",
")",
")",
"{",
"m_table",
".",
"setColumnCollapsed",
"(",
"TableProperty",
".",
"DEFAULT",
",",
"false",
")",
";",
"}",
"else",
"{",
"m_table",
".",
"setColumnCollapsed",
"(",
"TableProperty",
".",
"DEFAULT",
",",
"true",
")",
";",
"}",
"if",
"(",
"(",
"(",
"m_model",
".",
"getEditMode",
"(",
")",
".",
"equals",
"(",
"EditMode",
".",
"MASTER",
")",
"||",
"m_model",
".",
"hasDescriptionValues",
"(",
")",
")",
")",
"||",
"m_model",
".",
"getBundleType",
"(",
")",
".",
"equals",
"(",
"BundleType",
".",
"DESCRIPTOR",
")",
")",
"{",
"m_table",
".",
"setColumnCollapsed",
"(",
"TableProperty",
".",
"DESCRIPTION",
",",
"false",
")",
";",
"}",
"else",
"{",
"m_table",
".",
"setColumnCollapsed",
"(",
"TableProperty",
".",
"DESCRIPTION",
",",
"true",
")",
";",
"}",
"}",
"}"
] |
Adjust the visible columns.
|
[
"Adjust",
"the",
"visible",
"columns",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L615-L631
|
158,235 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.cleanUpAction
|
private void cleanUpAction() {
try {
m_model.deleteDescriptorIfNecessary();
} catch (CmsException e) {
LOG.error(m_messages.key(Messages.ERR_DELETING_DESCRIPTOR_0), e);
}
// unlock resource
m_model.unlock();
}
|
java
|
private void cleanUpAction() {
try {
m_model.deleteDescriptorIfNecessary();
} catch (CmsException e) {
LOG.error(m_messages.key(Messages.ERR_DELETING_DESCRIPTOR_0), e);
}
// unlock resource
m_model.unlock();
}
|
[
"private",
"void",
"cleanUpAction",
"(",
")",
"{",
"try",
"{",
"m_model",
".",
"deleteDescriptorIfNecessary",
"(",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"ERR_DELETING_DESCRIPTOR_0",
")",
",",
"e",
")",
";",
"}",
"// unlock resource",
"m_model",
".",
"unlock",
"(",
")",
";",
"}"
] |
Unlock all edited resources.
|
[
"Unlock",
"all",
"edited",
"resources",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L636-L645
|
158,236 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.createAddDescriptorButton
|
@SuppressWarnings("serial")
private Component createAddDescriptorButton() {
Button addDescriptorButton = CmsToolBar.createButton(
FontOpenCms.COPY_LOCALE,
m_messages.key(Messages.GUI_ADD_DESCRIPTOR_0));
addDescriptorButton.setDisableOnClick(true);
addDescriptorButton.addClickListener(new ClickListener() {
@SuppressWarnings("synthetic-access")
public void buttonClick(ClickEvent event) {
Map<Object, Object> filters = getFilters();
m_table.clearFilters();
if (!m_model.addDescriptor()) {
CmsVaadinUtils.showAlert(
m_messages.key(Messages.ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_0),
m_messages.key(Messages.ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_DESCRIPTION_0),
null);
} else {
IndexedContainer newContainer = null;
try {
newContainer = m_model.getContainerForCurrentLocale();
m_table.setContainerDataSource(newContainer);
initFieldFactories();
initStyleGenerators();
setEditMode(EditMode.MASTER);
m_table.setColumnCollapsingAllowed(true);
adjustVisibleColumns();
m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys());
m_options.setEditMode(m_model.getEditMode());
} catch (IOException | CmsException e) {
// Can never appear here, since container is created by addDescriptor already.
LOG.error(e.getLocalizedMessage(), e);
}
}
setFilters(filters);
}
});
return addDescriptorButton;
}
|
java
|
@SuppressWarnings("serial")
private Component createAddDescriptorButton() {
Button addDescriptorButton = CmsToolBar.createButton(
FontOpenCms.COPY_LOCALE,
m_messages.key(Messages.GUI_ADD_DESCRIPTOR_0));
addDescriptorButton.setDisableOnClick(true);
addDescriptorButton.addClickListener(new ClickListener() {
@SuppressWarnings("synthetic-access")
public void buttonClick(ClickEvent event) {
Map<Object, Object> filters = getFilters();
m_table.clearFilters();
if (!m_model.addDescriptor()) {
CmsVaadinUtils.showAlert(
m_messages.key(Messages.ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_0),
m_messages.key(Messages.ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_DESCRIPTION_0),
null);
} else {
IndexedContainer newContainer = null;
try {
newContainer = m_model.getContainerForCurrentLocale();
m_table.setContainerDataSource(newContainer);
initFieldFactories();
initStyleGenerators();
setEditMode(EditMode.MASTER);
m_table.setColumnCollapsingAllowed(true);
adjustVisibleColumns();
m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys());
m_options.setEditMode(m_model.getEditMode());
} catch (IOException | CmsException e) {
// Can never appear here, since container is created by addDescriptor already.
LOG.error(e.getLocalizedMessage(), e);
}
}
setFilters(filters);
}
});
return addDescriptorButton;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"serial\"",
")",
"private",
"Component",
"createAddDescriptorButton",
"(",
")",
"{",
"Button",
"addDescriptorButton",
"=",
"CmsToolBar",
".",
"createButton",
"(",
"FontOpenCms",
".",
"COPY_LOCALE",
",",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_ADD_DESCRIPTOR_0",
")",
")",
";",
"addDescriptorButton",
".",
"setDisableOnClick",
"(",
"true",
")",
";",
"addDescriptorButton",
".",
"addClickListener",
"(",
"new",
"ClickListener",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"public",
"void",
"buttonClick",
"(",
"ClickEvent",
"event",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"filters",
"=",
"getFilters",
"(",
")",
";",
"m_table",
".",
"clearFilters",
"(",
")",
";",
"if",
"(",
"!",
"m_model",
".",
"addDescriptor",
"(",
")",
")",
"{",
"CmsVaadinUtils",
".",
"showAlert",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_0",
")",
",",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_DESCRIPTION_0",
")",
",",
"null",
")",
";",
"}",
"else",
"{",
"IndexedContainer",
"newContainer",
"=",
"null",
";",
"try",
"{",
"newContainer",
"=",
"m_model",
".",
"getContainerForCurrentLocale",
"(",
")",
";",
"m_table",
".",
"setContainerDataSource",
"(",
"newContainer",
")",
";",
"initFieldFactories",
"(",
")",
";",
"initStyleGenerators",
"(",
")",
";",
"setEditMode",
"(",
"EditMode",
".",
"MASTER",
")",
";",
"m_table",
".",
"setColumnCollapsingAllowed",
"(",
"true",
")",
";",
"adjustVisibleColumns",
"(",
")",
";",
"m_options",
".",
"updateShownOptions",
"(",
"m_model",
".",
"hasMasterMode",
"(",
")",
",",
"m_model",
".",
"canAddKeys",
"(",
")",
")",
";",
"m_options",
".",
"setEditMode",
"(",
"m_model",
".",
"getEditMode",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"|",
"CmsException",
"e",
")",
"{",
"// Can never appear here, since container is created by addDescriptor already.",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"setFilters",
"(",
"filters",
")",
";",
"}",
"}",
")",
";",
"return",
"addDescriptorButton",
";",
"}"
] |
Returns a button component. On click, it triggers adding a bundle descriptor.
@return a button for adding a descriptor to a bundle.
|
[
"Returns",
"a",
"button",
"component",
".",
"On",
"click",
"it",
"triggers",
"adding",
"a",
"bundle",
"descriptor",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L651-L693
|
158,237 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.createCloseButton
|
@SuppressWarnings("serial")
private Component createCloseButton() {
Button closeBtn = CmsToolBar.createButton(
FontOpenCms.CIRCLE_INV_CANCEL,
m_messages.key(Messages.GUI_BUTTON_CANCEL_0));
closeBtn.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
closeAction();
}
});
return closeBtn;
}
|
java
|
@SuppressWarnings("serial")
private Component createCloseButton() {
Button closeBtn = CmsToolBar.createButton(
FontOpenCms.CIRCLE_INV_CANCEL,
m_messages.key(Messages.GUI_BUTTON_CANCEL_0));
closeBtn.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
closeAction();
}
});
return closeBtn;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"serial\"",
")",
"private",
"Component",
"createCloseButton",
"(",
")",
"{",
"Button",
"closeBtn",
"=",
"CmsToolBar",
".",
"createButton",
"(",
"FontOpenCms",
".",
"CIRCLE_INV_CANCEL",
",",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_BUTTON_CANCEL_0",
")",
")",
";",
"closeBtn",
".",
"addClickListener",
"(",
"new",
"ClickListener",
"(",
")",
"{",
"public",
"void",
"buttonClick",
"(",
"ClickEvent",
"event",
")",
"{",
"closeAction",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"closeBtn",
";",
"}"
] |
Create the close button UI Component.
@return the close button.
|
[
"Create",
"the",
"close",
"button",
"UI",
"Component",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L699-L714
|
158,238 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.createConvertToPropertyBundleButton
|
private Component createConvertToPropertyBundleButton() {
Button addDescriptorButton = CmsToolBar.createButton(
FontOpenCms.SETTINGS,
m_messages.key(Messages.GUI_CONVERT_TO_PROPERTY_BUNDLE_0));
addDescriptorButton.setDisableOnClick(true);
addDescriptorButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
try {
m_model.saveAsPropertyBundle();
Notification.show("Conversion successful.");
} catch (CmsException | IOException e) {
CmsVaadinUtils.showAlert("Conversion failed", e.getLocalizedMessage(), null);
}
}
});
addDescriptorButton.setDisableOnClick(true);
return addDescriptorButton;
}
|
java
|
private Component createConvertToPropertyBundleButton() {
Button addDescriptorButton = CmsToolBar.createButton(
FontOpenCms.SETTINGS,
m_messages.key(Messages.GUI_CONVERT_TO_PROPERTY_BUNDLE_0));
addDescriptorButton.setDisableOnClick(true);
addDescriptorButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
try {
m_model.saveAsPropertyBundle();
Notification.show("Conversion successful.");
} catch (CmsException | IOException e) {
CmsVaadinUtils.showAlert("Conversion failed", e.getLocalizedMessage(), null);
}
}
});
addDescriptorButton.setDisableOnClick(true);
return addDescriptorButton;
}
|
[
"private",
"Component",
"createConvertToPropertyBundleButton",
"(",
")",
"{",
"Button",
"addDescriptorButton",
"=",
"CmsToolBar",
".",
"createButton",
"(",
"FontOpenCms",
".",
"SETTINGS",
",",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_CONVERT_TO_PROPERTY_BUNDLE_0",
")",
")",
";",
"addDescriptorButton",
".",
"setDisableOnClick",
"(",
"true",
")",
";",
"addDescriptorButton",
".",
"addClickListener",
"(",
"new",
"ClickListener",
"(",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"public",
"void",
"buttonClick",
"(",
"ClickEvent",
"event",
")",
"{",
"try",
"{",
"m_model",
".",
"saveAsPropertyBundle",
"(",
")",
";",
"Notification",
".",
"show",
"(",
"\"Conversion successful.\"",
")",
";",
"}",
"catch",
"(",
"CmsException",
"|",
"IOException",
"e",
")",
"{",
"CmsVaadinUtils",
".",
"showAlert",
"(",
"\"Conversion failed\"",
",",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"null",
")",
";",
"}",
"}",
"}",
")",
";",
"addDescriptorButton",
".",
"setDisableOnClick",
"(",
"true",
")",
";",
"return",
"addDescriptorButton",
";",
"}"
] |
Creates the button for converting an XML bundle in a property bundle.
@return the created button.
|
[
"Creates",
"the",
"button",
"for",
"converting",
"an",
"XML",
"bundle",
"in",
"a",
"property",
"bundle",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L720-L744
|
158,239 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.createMainComponent
|
private Component createMainComponent() throws IOException, CmsException {
VerticalLayout mainComponent = new VerticalLayout();
mainComponent.setSizeFull();
mainComponent.addStyleName("o-message-bundle-editor");
m_table = createTable();
Panel navigator = new Panel();
navigator.setSizeFull();
navigator.setContent(m_table);
navigator.addActionHandler(new CmsMessageBundleEditorTypes.TableKeyboardHandler(m_table));
navigator.addStyleName("v-panel-borderless");
mainComponent.addComponent(m_options.getOptionsComponent());
mainComponent.addComponent(navigator);
mainComponent.setExpandRatio(navigator, 1f);
m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys());
return mainComponent;
}
|
java
|
private Component createMainComponent() throws IOException, CmsException {
VerticalLayout mainComponent = new VerticalLayout();
mainComponent.setSizeFull();
mainComponent.addStyleName("o-message-bundle-editor");
m_table = createTable();
Panel navigator = new Panel();
navigator.setSizeFull();
navigator.setContent(m_table);
navigator.addActionHandler(new CmsMessageBundleEditorTypes.TableKeyboardHandler(m_table));
navigator.addStyleName("v-panel-borderless");
mainComponent.addComponent(m_options.getOptionsComponent());
mainComponent.addComponent(navigator);
mainComponent.setExpandRatio(navigator, 1f);
m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys());
return mainComponent;
}
|
[
"private",
"Component",
"createMainComponent",
"(",
")",
"throws",
"IOException",
",",
"CmsException",
"{",
"VerticalLayout",
"mainComponent",
"=",
"new",
"VerticalLayout",
"(",
")",
";",
"mainComponent",
".",
"setSizeFull",
"(",
")",
";",
"mainComponent",
".",
"addStyleName",
"(",
"\"o-message-bundle-editor\"",
")",
";",
"m_table",
"=",
"createTable",
"(",
")",
";",
"Panel",
"navigator",
"=",
"new",
"Panel",
"(",
")",
";",
"navigator",
".",
"setSizeFull",
"(",
")",
";",
"navigator",
".",
"setContent",
"(",
"m_table",
")",
";",
"navigator",
".",
"addActionHandler",
"(",
"new",
"CmsMessageBundleEditorTypes",
".",
"TableKeyboardHandler",
"(",
"m_table",
")",
")",
";",
"navigator",
".",
"addStyleName",
"(",
"\"v-panel-borderless\"",
")",
";",
"mainComponent",
".",
"addComponent",
"(",
"m_options",
".",
"getOptionsComponent",
"(",
")",
")",
";",
"mainComponent",
".",
"addComponent",
"(",
"navigator",
")",
";",
"mainComponent",
".",
"setExpandRatio",
"(",
"navigator",
",",
"1f",
")",
";",
"m_options",
".",
"updateShownOptions",
"(",
"m_model",
".",
"hasMasterMode",
"(",
")",
",",
"m_model",
".",
"canAddKeys",
"(",
")",
")",
";",
"return",
"mainComponent",
";",
"}"
] |
Creates the main component of the editor with all sub-components.
@return the completely filled main component of the editor.
@throws IOException thrown if setting the table's content data source fails.
@throws CmsException thrown if setting the table's content data source fails.
|
[
"Creates",
"the",
"main",
"component",
"of",
"the",
"editor",
"with",
"all",
"sub",
"-",
"components",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L752-L769
|
158,240 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.createSaveExitButton
|
@SuppressWarnings("serial")
private Button createSaveExitButton() {
Button saveExitBtn = CmsToolBar.createButton(
FontOpenCms.SAVE_EXIT,
m_messages.key(Messages.GUI_BUTTON_SAVE_AND_EXIT_0));
saveExitBtn.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
saveAction();
closeAction();
}
});
saveExitBtn.setEnabled(false);
return saveExitBtn;
}
|
java
|
@SuppressWarnings("serial")
private Button createSaveExitButton() {
Button saveExitBtn = CmsToolBar.createButton(
FontOpenCms.SAVE_EXIT,
m_messages.key(Messages.GUI_BUTTON_SAVE_AND_EXIT_0));
saveExitBtn.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
saveAction();
closeAction();
}
});
saveExitBtn.setEnabled(false);
return saveExitBtn;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"serial\"",
")",
"private",
"Button",
"createSaveExitButton",
"(",
")",
"{",
"Button",
"saveExitBtn",
"=",
"CmsToolBar",
".",
"createButton",
"(",
"FontOpenCms",
".",
"SAVE_EXIT",
",",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_BUTTON_SAVE_AND_EXIT_0",
")",
")",
";",
"saveExitBtn",
".",
"addClickListener",
"(",
"new",
"ClickListener",
"(",
")",
"{",
"public",
"void",
"buttonClick",
"(",
"ClickEvent",
"event",
")",
"{",
"saveAction",
"(",
")",
";",
"closeAction",
"(",
")",
";",
"}",
"}",
")",
";",
"saveExitBtn",
".",
"setEnabled",
"(",
"false",
")",
";",
"return",
"saveExitBtn",
";",
"}"
] |
Creates the save and exit button UI Component.
@return the save and exit button.
|
[
"Creates",
"the",
"save",
"and",
"exit",
"button",
"UI",
"Component",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L811-L828
|
158,241 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.fillToolBar
|
private void fillToolBar(final I_CmsAppUIContext context) {
context.setAppTitle(m_messages.key(Messages.GUI_APP_TITLE_0));
// create components
Component publishBtn = createPublishButton();
m_saveBtn = createSaveButton();
m_saveExitBtn = createSaveExitButton();
Component closeBtn = createCloseButton();
context.enableDefaultToolbarButtons(false);
context.addToolbarButtonRight(closeBtn);
context.addToolbarButton(publishBtn);
context.addToolbarButton(m_saveExitBtn);
context.addToolbarButton(m_saveBtn);
Component addDescriptorBtn = createAddDescriptorButton();
if (m_model.hasDescriptor() || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
addDescriptorBtn.setEnabled(false);
}
context.addToolbarButton(addDescriptorBtn);
if (m_model.getBundleType().equals(BundleType.XML)) {
Component convertToPropertyBundleBtn = createConvertToPropertyBundleButton();
context.addToolbarButton(convertToPropertyBundleBtn);
}
}
|
java
|
private void fillToolBar(final I_CmsAppUIContext context) {
context.setAppTitle(m_messages.key(Messages.GUI_APP_TITLE_0));
// create components
Component publishBtn = createPublishButton();
m_saveBtn = createSaveButton();
m_saveExitBtn = createSaveExitButton();
Component closeBtn = createCloseButton();
context.enableDefaultToolbarButtons(false);
context.addToolbarButtonRight(closeBtn);
context.addToolbarButton(publishBtn);
context.addToolbarButton(m_saveExitBtn);
context.addToolbarButton(m_saveBtn);
Component addDescriptorBtn = createAddDescriptorButton();
if (m_model.hasDescriptor() || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
addDescriptorBtn.setEnabled(false);
}
context.addToolbarButton(addDescriptorBtn);
if (m_model.getBundleType().equals(BundleType.XML)) {
Component convertToPropertyBundleBtn = createConvertToPropertyBundleButton();
context.addToolbarButton(convertToPropertyBundleBtn);
}
}
|
[
"private",
"void",
"fillToolBar",
"(",
"final",
"I_CmsAppUIContext",
"context",
")",
"{",
"context",
".",
"setAppTitle",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_APP_TITLE_0",
")",
")",
";",
"// create components",
"Component",
"publishBtn",
"=",
"createPublishButton",
"(",
")",
";",
"m_saveBtn",
"=",
"createSaveButton",
"(",
")",
";",
"m_saveExitBtn",
"=",
"createSaveExitButton",
"(",
")",
";",
"Component",
"closeBtn",
"=",
"createCloseButton",
"(",
")",
";",
"context",
".",
"enableDefaultToolbarButtons",
"(",
"false",
")",
";",
"context",
".",
"addToolbarButtonRight",
"(",
"closeBtn",
")",
";",
"context",
".",
"addToolbarButton",
"(",
"publishBtn",
")",
";",
"context",
".",
"addToolbarButton",
"(",
"m_saveExitBtn",
")",
";",
"context",
".",
"addToolbarButton",
"(",
"m_saveBtn",
")",
";",
"Component",
"addDescriptorBtn",
"=",
"createAddDescriptorButton",
"(",
")",
";",
"if",
"(",
"m_model",
".",
"hasDescriptor",
"(",
")",
"||",
"m_model",
".",
"getBundleType",
"(",
")",
".",
"equals",
"(",
"BundleType",
".",
"DESCRIPTOR",
")",
")",
"{",
"addDescriptorBtn",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"context",
".",
"addToolbarButton",
"(",
"addDescriptorBtn",
")",
";",
"if",
"(",
"m_model",
".",
"getBundleType",
"(",
")",
".",
"equals",
"(",
"BundleType",
".",
"XML",
")",
")",
"{",
"Component",
"convertToPropertyBundleBtn",
"=",
"createConvertToPropertyBundleButton",
"(",
")",
";",
"context",
".",
"addToolbarButton",
"(",
"convertToPropertyBundleBtn",
")",
";",
"}",
"}"
] |
Adds Editor specific UI components to the toolbar.
@param context The context that provides access to the toolbar.
|
[
"Adds",
"Editor",
"specific",
"UI",
"components",
"to",
"the",
"toolbar",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L925-L950
|
158,242 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.handleChange
|
private void handleChange(Object propertyId) {
if (!m_saveBtn.isEnabled()) {
m_saveBtn.setEnabled(true);
m_saveExitBtn.setEnabled(true);
}
m_model.handleChange(propertyId);
}
|
java
|
private void handleChange(Object propertyId) {
if (!m_saveBtn.isEnabled()) {
m_saveBtn.setEnabled(true);
m_saveExitBtn.setEnabled(true);
}
m_model.handleChange(propertyId);
}
|
[
"private",
"void",
"handleChange",
"(",
"Object",
"propertyId",
")",
"{",
"if",
"(",
"!",
"m_saveBtn",
".",
"isEnabled",
"(",
")",
")",
"{",
"m_saveBtn",
".",
"setEnabled",
"(",
"true",
")",
";",
"m_saveExitBtn",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"m_model",
".",
"handleChange",
"(",
"propertyId",
")",
";",
"}"
] |
Handle a value change.
@param propertyId the column in which the value has changed.
|
[
"Handle",
"a",
"value",
"change",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L965-L973
|
158,243 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.initFieldFactories
|
private void initFieldFactories() {
if (m_model.hasMasterMode()) {
TranslateTableFieldFactory masterFieldFactory = new CmsMessageBundleEditorTypes.TranslateTableFieldFactory(
m_table,
m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.MASTER));
masterFieldFactory.registerKeyChangeListener(this);
m_fieldFactories.put(CmsMessageBundleEditorTypes.EditMode.MASTER, masterFieldFactory);
}
TranslateTableFieldFactory defaultFieldFactory = new CmsMessageBundleEditorTypes.TranslateTableFieldFactory(
m_table,
m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.DEFAULT));
defaultFieldFactory.registerKeyChangeListener(this);
m_fieldFactories.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, defaultFieldFactory);
}
|
java
|
private void initFieldFactories() {
if (m_model.hasMasterMode()) {
TranslateTableFieldFactory masterFieldFactory = new CmsMessageBundleEditorTypes.TranslateTableFieldFactory(
m_table,
m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.MASTER));
masterFieldFactory.registerKeyChangeListener(this);
m_fieldFactories.put(CmsMessageBundleEditorTypes.EditMode.MASTER, masterFieldFactory);
}
TranslateTableFieldFactory defaultFieldFactory = new CmsMessageBundleEditorTypes.TranslateTableFieldFactory(
m_table,
m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.DEFAULT));
defaultFieldFactory.registerKeyChangeListener(this);
m_fieldFactories.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, defaultFieldFactory);
}
|
[
"private",
"void",
"initFieldFactories",
"(",
")",
"{",
"if",
"(",
"m_model",
".",
"hasMasterMode",
"(",
")",
")",
"{",
"TranslateTableFieldFactory",
"masterFieldFactory",
"=",
"new",
"CmsMessageBundleEditorTypes",
".",
"TranslateTableFieldFactory",
"(",
"m_table",
",",
"m_model",
".",
"getEditableColumns",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
".",
"MASTER",
")",
")",
";",
"masterFieldFactory",
".",
"registerKeyChangeListener",
"(",
"this",
")",
";",
"m_fieldFactories",
".",
"put",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
".",
"MASTER",
",",
"masterFieldFactory",
")",
";",
"}",
"TranslateTableFieldFactory",
"defaultFieldFactory",
"=",
"new",
"CmsMessageBundleEditorTypes",
".",
"TranslateTableFieldFactory",
"(",
"m_table",
",",
"m_model",
".",
"getEditableColumns",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
".",
"DEFAULT",
")",
")",
";",
"defaultFieldFactory",
".",
"registerKeyChangeListener",
"(",
"this",
")",
";",
"m_fieldFactories",
".",
"put",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
".",
"DEFAULT",
",",
"defaultFieldFactory",
")",
";",
"}"
] |
Initialize the field factories for the messages table.
|
[
"Initialize",
"the",
"field",
"factories",
"for",
"the",
"messages",
"table",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L978-L993
|
158,244 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.initStyleGenerators
|
private void initStyleGenerators() {
if (m_model.hasMasterMode()) {
m_styleGenerators.put(
CmsMessageBundleEditorTypes.EditMode.MASTER,
new CmsMessageBundleEditorTypes.TranslateTableCellStyleGenerator(
m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.MASTER)));
}
m_styleGenerators.put(
CmsMessageBundleEditorTypes.EditMode.DEFAULT,
new CmsMessageBundleEditorTypes.TranslateTableCellStyleGenerator(
m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.DEFAULT)));
}
|
java
|
private void initStyleGenerators() {
if (m_model.hasMasterMode()) {
m_styleGenerators.put(
CmsMessageBundleEditorTypes.EditMode.MASTER,
new CmsMessageBundleEditorTypes.TranslateTableCellStyleGenerator(
m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.MASTER)));
}
m_styleGenerators.put(
CmsMessageBundleEditorTypes.EditMode.DEFAULT,
new CmsMessageBundleEditorTypes.TranslateTableCellStyleGenerator(
m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.DEFAULT)));
}
|
[
"private",
"void",
"initStyleGenerators",
"(",
")",
"{",
"if",
"(",
"m_model",
".",
"hasMasterMode",
"(",
")",
")",
"{",
"m_styleGenerators",
".",
"put",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
".",
"MASTER",
",",
"new",
"CmsMessageBundleEditorTypes",
".",
"TranslateTableCellStyleGenerator",
"(",
"m_model",
".",
"getEditableColumns",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
".",
"MASTER",
")",
")",
")",
";",
"}",
"m_styleGenerators",
".",
"put",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
".",
"DEFAULT",
",",
"new",
"CmsMessageBundleEditorTypes",
".",
"TranslateTableCellStyleGenerator",
"(",
"m_model",
".",
"getEditableColumns",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
".",
"DEFAULT",
")",
")",
")",
";",
"}"
] |
Initialize the style generators for the messages table.
|
[
"Initialize",
"the",
"style",
"generators",
"for",
"the",
"messages",
"table",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L998-L1011
|
158,245 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java
|
CmsMessageBundleEditor.keyAlreadyExists
|
private boolean keyAlreadyExists(String newKey) {
Collection<?> itemIds = m_table.getItemIds();
for (Object itemId : itemIds) {
if (m_table.getItem(itemId).getItemProperty(TableProperty.KEY).getValue().equals(newKey)) {
return true;
}
}
return false;
}
|
java
|
private boolean keyAlreadyExists(String newKey) {
Collection<?> itemIds = m_table.getItemIds();
for (Object itemId : itemIds) {
if (m_table.getItem(itemId).getItemProperty(TableProperty.KEY).getValue().equals(newKey)) {
return true;
}
}
return false;
}
|
[
"private",
"boolean",
"keyAlreadyExists",
"(",
"String",
"newKey",
")",
"{",
"Collection",
"<",
"?",
">",
"itemIds",
"=",
"m_table",
".",
"getItemIds",
"(",
")",
";",
"for",
"(",
"Object",
"itemId",
":",
"itemIds",
")",
"{",
"if",
"(",
"m_table",
".",
"getItem",
"(",
"itemId",
")",
".",
"getItemProperty",
"(",
"TableProperty",
".",
"KEY",
")",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"newKey",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks if a key already exists.
@param newKey the key to check for.
@return <code>true</code> if the key already exists, <code>false</code> otherwise.
|
[
"Checks",
"if",
"a",
"key",
"already",
"exists",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditor.java#L1018-L1027
|
158,246 |
alkacon/opencms-core
|
src-gwt/org/opencms/ugc/client/CmsUgcWrapper.java
|
CmsUgcWrapper.uploadFields
|
public void uploadFields(
final Set<String> fields,
final Function<Map<String, String>, Void> filenameCallback,
final I_CmsErrorCallback errorCallback) {
disableAllFileFieldsExcept(fields);
final String id = CmsJsUtils.generateRandomId();
updateFormAction(id);
// Using an array here because we can only store the handler registration after it has been created , but
final HandlerRegistration[] registration = {null};
registration[0] = addSubmitCompleteHandler(new SubmitCompleteHandler() {
@SuppressWarnings("synthetic-access")
public void onSubmitComplete(SubmitCompleteEvent event) {
enableAllFileFields();
registration[0].removeHandler();
CmsUUID sessionId = m_formSession.internalGetSessionId();
RequestBuilder requestBuilder = CmsXmlContentUgcApi.SERVICE.uploadFiles(
sessionId,
fields,
id,
new AsyncCallback<Map<String, String>>() {
public void onFailure(Throwable caught) {
m_formSession.getContentFormApi().handleError(caught, errorCallback);
}
public void onSuccess(Map<String, String> fileNames) {
filenameCallback.apply(fileNames);
}
});
m_formSession.getContentFormApi().getRpcHelper().executeRpc(requestBuilder);
m_formSession.getContentFormApi().getRequestCounter().decrement();
}
});
m_formSession.getContentFormApi().getRequestCounter().increment();
submit();
}
|
java
|
public void uploadFields(
final Set<String> fields,
final Function<Map<String, String>, Void> filenameCallback,
final I_CmsErrorCallback errorCallback) {
disableAllFileFieldsExcept(fields);
final String id = CmsJsUtils.generateRandomId();
updateFormAction(id);
// Using an array here because we can only store the handler registration after it has been created , but
final HandlerRegistration[] registration = {null};
registration[0] = addSubmitCompleteHandler(new SubmitCompleteHandler() {
@SuppressWarnings("synthetic-access")
public void onSubmitComplete(SubmitCompleteEvent event) {
enableAllFileFields();
registration[0].removeHandler();
CmsUUID sessionId = m_formSession.internalGetSessionId();
RequestBuilder requestBuilder = CmsXmlContentUgcApi.SERVICE.uploadFiles(
sessionId,
fields,
id,
new AsyncCallback<Map<String, String>>() {
public void onFailure(Throwable caught) {
m_formSession.getContentFormApi().handleError(caught, errorCallback);
}
public void onSuccess(Map<String, String> fileNames) {
filenameCallback.apply(fileNames);
}
});
m_formSession.getContentFormApi().getRpcHelper().executeRpc(requestBuilder);
m_formSession.getContentFormApi().getRequestCounter().decrement();
}
});
m_formSession.getContentFormApi().getRequestCounter().increment();
submit();
}
|
[
"public",
"void",
"uploadFields",
"(",
"final",
"Set",
"<",
"String",
">",
"fields",
",",
"final",
"Function",
"<",
"Map",
"<",
"String",
",",
"String",
">",
",",
"Void",
">",
"filenameCallback",
",",
"final",
"I_CmsErrorCallback",
"errorCallback",
")",
"{",
"disableAllFileFieldsExcept",
"(",
"fields",
")",
";",
"final",
"String",
"id",
"=",
"CmsJsUtils",
".",
"generateRandomId",
"(",
")",
";",
"updateFormAction",
"(",
"id",
")",
";",
"// Using an array here because we can only store the handler registration after it has been created , but",
"final",
"HandlerRegistration",
"[",
"]",
"registration",
"=",
"{",
"null",
"}",
";",
"registration",
"[",
"0",
"]",
"=",
"addSubmitCompleteHandler",
"(",
"new",
"SubmitCompleteHandler",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"public",
"void",
"onSubmitComplete",
"(",
"SubmitCompleteEvent",
"event",
")",
"{",
"enableAllFileFields",
"(",
")",
";",
"registration",
"[",
"0",
"]",
".",
"removeHandler",
"(",
")",
";",
"CmsUUID",
"sessionId",
"=",
"m_formSession",
".",
"internalGetSessionId",
"(",
")",
";",
"RequestBuilder",
"requestBuilder",
"=",
"CmsXmlContentUgcApi",
".",
"SERVICE",
".",
"uploadFiles",
"(",
"sessionId",
",",
"fields",
",",
"id",
",",
"new",
"AsyncCallback",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
")",
"{",
"public",
"void",
"onFailure",
"(",
"Throwable",
"caught",
")",
"{",
"m_formSession",
".",
"getContentFormApi",
"(",
")",
".",
"handleError",
"(",
"caught",
",",
"errorCallback",
")",
";",
"}",
"public",
"void",
"onSuccess",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"fileNames",
")",
"{",
"filenameCallback",
".",
"apply",
"(",
"fileNames",
")",
";",
"}",
"}",
")",
";",
"m_formSession",
".",
"getContentFormApi",
"(",
")",
".",
"getRpcHelper",
"(",
")",
".",
"executeRpc",
"(",
"requestBuilder",
")",
";",
"m_formSession",
".",
"getContentFormApi",
"(",
")",
".",
"getRequestCounter",
"(",
")",
".",
"decrement",
"(",
")",
";",
"}",
"}",
")",
";",
"m_formSession",
".",
"getContentFormApi",
"(",
")",
".",
"getRequestCounter",
"(",
")",
".",
"increment",
"(",
")",
";",
"submit",
"(",
")",
";",
"}"
] |
Uploads files from the given file input fields.<p<
@param fields the set of names of fields containing the files to upload
@param filenameCallback the callback to call with the resulting map from field names to file paths
@param errorCallback the callback to call with an error message
|
[
"Uploads",
"files",
"from",
"the",
"given",
"file",
"input",
"fields",
".",
"<p<"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ugc/client/CmsUgcWrapper.java#L99-L141
|
158,247 |
alkacon/opencms-core
|
src/org/opencms/jsp/util/CmsJspElFunctions.java
|
CmsJspElFunctions.convertResource
|
public static CmsJspResourceWrapper convertResource(CmsObject cms, Object input) throws CmsException {
CmsJspResourceWrapper result;
if (input instanceof CmsResource) {
result = CmsJspResourceWrapper.wrap(cms, (CmsResource)input);
} else {
result = CmsJspResourceWrapper.wrap(cms, convertRawResource(cms, input));
}
return result;
}
|
java
|
public static CmsJspResourceWrapper convertResource(CmsObject cms, Object input) throws CmsException {
CmsJspResourceWrapper result;
if (input instanceof CmsResource) {
result = CmsJspResourceWrapper.wrap(cms, (CmsResource)input);
} else {
result = CmsJspResourceWrapper.wrap(cms, convertRawResource(cms, input));
}
return result;
}
|
[
"public",
"static",
"CmsJspResourceWrapper",
"convertResource",
"(",
"CmsObject",
"cms",
",",
"Object",
"input",
")",
"throws",
"CmsException",
"{",
"CmsJspResourceWrapper",
"result",
";",
"if",
"(",
"input",
"instanceof",
"CmsResource",
")",
"{",
"result",
"=",
"CmsJspResourceWrapper",
".",
"wrap",
"(",
"cms",
",",
"(",
"CmsResource",
")",
"input",
")",
";",
"}",
"else",
"{",
"result",
"=",
"CmsJspResourceWrapper",
".",
"wrap",
"(",
"cms",
",",
"convertRawResource",
"(",
"cms",
",",
"input",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns a resource wrapper created from the input.
The wrapped result of {@link #convertRawResource(CmsObject, Object)} is returned.
@param cms the current OpenCms user context
@param input the input to create a resource from
@return a resource wrapper created from the given Object
@throws CmsException in case of errors accessing the OpenCms VFS for reading the resource
|
[
"Returns",
"a",
"resource",
"wrapper",
"created",
"from",
"the",
"input",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspElFunctions.java#L365-L374
|
158,248 |
alkacon/opencms-core
|
src/org/opencms/jsp/util/CmsJspElFunctions.java
|
CmsJspElFunctions.convertResourceList
|
public static List<CmsJspResourceWrapper> convertResourceList(CmsObject cms, List<CmsResource> list) {
List<CmsJspResourceWrapper> result = new ArrayList<CmsJspResourceWrapper>(list.size());
for (CmsResource res : list) {
result.add(CmsJspResourceWrapper.wrap(cms, res));
}
return result;
}
|
java
|
public static List<CmsJspResourceWrapper> convertResourceList(CmsObject cms, List<CmsResource> list) {
List<CmsJspResourceWrapper> result = new ArrayList<CmsJspResourceWrapper>(list.size());
for (CmsResource res : list) {
result.add(CmsJspResourceWrapper.wrap(cms, res));
}
return result;
}
|
[
"public",
"static",
"List",
"<",
"CmsJspResourceWrapper",
">",
"convertResourceList",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"CmsResource",
">",
"list",
")",
"{",
"List",
"<",
"CmsJspResourceWrapper",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsJspResourceWrapper",
">",
"(",
"list",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"CmsResource",
"res",
":",
"list",
")",
"{",
"result",
".",
"add",
"(",
"CmsJspResourceWrapper",
".",
"wrap",
"(",
"cms",
",",
"res",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns a list of resource wrappers created from the input list of resources.
@param cms the current OpenCms user context
@param list the list to create the resource wrapper list from
@return the list of wrapped resources.
|
[
"Returns",
"a",
"list",
"of",
"resource",
"wrappers",
"created",
"from",
"the",
"input",
"list",
"of",
"resources",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspElFunctions.java#L384-L391
|
158,249 |
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/CmsSearchConfigurationPagination.java
|
CmsSearchConfigurationPagination.create
|
public static I_CmsSearchConfigurationPagination create(
String pageParam,
List<Integer> pageSizes,
Integer pageNavLength) {
return (pageParam != null) || (pageSizes != null) || (pageNavLength != null)
? new CmsSearchConfigurationPagination(pageParam, pageSizes, pageNavLength)
: null;
}
|
java
|
public static I_CmsSearchConfigurationPagination create(
String pageParam,
List<Integer> pageSizes,
Integer pageNavLength) {
return (pageParam != null) || (pageSizes != null) || (pageNavLength != null)
? new CmsSearchConfigurationPagination(pageParam, pageSizes, pageNavLength)
: null;
}
|
[
"public",
"static",
"I_CmsSearchConfigurationPagination",
"create",
"(",
"String",
"pageParam",
",",
"List",
"<",
"Integer",
">",
"pageSizes",
",",
"Integer",
"pageNavLength",
")",
"{",
"return",
"(",
"pageParam",
"!=",
"null",
")",
"||",
"(",
"pageSizes",
"!=",
"null",
")",
"||",
"(",
"pageNavLength",
"!=",
"null",
")",
"?",
"new",
"CmsSearchConfigurationPagination",
"(",
"pageParam",
",",
"pageSizes",
",",
"pageNavLength",
")",
":",
"null",
";",
"}"
] |
Creates a new pagination configuration if at least one of the provided parameters is not null.
Otherwise returns null.
@param pageParam The request parameter used to send the current page number.
@param pageSizes The page sizes for the first pages. The last provided size is the size of all following pages.
@param pageNavLength The length of the "Google"-like page navigation. Should be an odd number.
@return the pagination configuration, or <code>null</code> if none of the provided parameters is not null.
|
[
"Creates",
"a",
"new",
"pagination",
"configuration",
"if",
"at",
"least",
"one",
"of",
"the",
"provided",
"parameters",
"is",
"not",
"null",
".",
"Otherwise",
"returns",
"null",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/CmsSearchConfigurationPagination.java#L98-L107
|
158,250 |
alkacon/opencms-core
|
src/org/opencms/search/CmsSearchUtil.java
|
CmsSearchUtil.getDateCreatedTimeRangeFilterQuery
|
public static String getDateCreatedTimeRangeFilterQuery(String searchField, long startTime, long endTime) {
String sStartTime = null;
String sEndTime = null;
// Convert startTime to ISO 8601 format
if ((startTime > Long.MIN_VALUE) && (startTime < Long.MAX_VALUE)) {
sStartTime = CmsSearchUtil.getDateAsIso8601(new Date(startTime));
}
// Convert endTime to ISO 8601 format
if ((endTime > Long.MIN_VALUE) && (endTime < Long.MAX_VALUE)) {
sEndTime = CmsSearchUtil.getDateAsIso8601(new Date(endTime));
}
// Build Solr range string
final String rangeString = CmsSearchUtil.getSolrRangeString(sStartTime, sEndTime);
// Build Solr filter string
return String.format("%s:%s", searchField, rangeString);
}
|
java
|
public static String getDateCreatedTimeRangeFilterQuery(String searchField, long startTime, long endTime) {
String sStartTime = null;
String sEndTime = null;
// Convert startTime to ISO 8601 format
if ((startTime > Long.MIN_VALUE) && (startTime < Long.MAX_VALUE)) {
sStartTime = CmsSearchUtil.getDateAsIso8601(new Date(startTime));
}
// Convert endTime to ISO 8601 format
if ((endTime > Long.MIN_VALUE) && (endTime < Long.MAX_VALUE)) {
sEndTime = CmsSearchUtil.getDateAsIso8601(new Date(endTime));
}
// Build Solr range string
final String rangeString = CmsSearchUtil.getSolrRangeString(sStartTime, sEndTime);
// Build Solr filter string
return String.format("%s:%s", searchField, rangeString);
}
|
[
"public",
"static",
"String",
"getDateCreatedTimeRangeFilterQuery",
"(",
"String",
"searchField",
",",
"long",
"startTime",
",",
"long",
"endTime",
")",
"{",
"String",
"sStartTime",
"=",
"null",
";",
"String",
"sEndTime",
"=",
"null",
";",
"// Convert startTime to ISO 8601 format",
"if",
"(",
"(",
"startTime",
">",
"Long",
".",
"MIN_VALUE",
")",
"&&",
"(",
"startTime",
"<",
"Long",
".",
"MAX_VALUE",
")",
")",
"{",
"sStartTime",
"=",
"CmsSearchUtil",
".",
"getDateAsIso8601",
"(",
"new",
"Date",
"(",
"startTime",
")",
")",
";",
"}",
"// Convert endTime to ISO 8601 format",
"if",
"(",
"(",
"endTime",
">",
"Long",
".",
"MIN_VALUE",
")",
"&&",
"(",
"endTime",
"<",
"Long",
".",
"MAX_VALUE",
")",
")",
"{",
"sEndTime",
"=",
"CmsSearchUtil",
".",
"getDateAsIso8601",
"(",
"new",
"Date",
"(",
"endTime",
")",
")",
";",
"}",
"// Build Solr range string",
"final",
"String",
"rangeString",
"=",
"CmsSearchUtil",
".",
"getSolrRangeString",
"(",
"sStartTime",
",",
"sEndTime",
")",
";",
"// Build Solr filter string",
"return",
"String",
".",
"format",
"(",
"\"%s:%s\"",
",",
"searchField",
",",
"rangeString",
")",
";",
"}"
] |
Returns a time interval as Solr compatible query string.
@param searchField the field to search for.
@param startTime the lower limit of the interval.
@param endTime the upper limit of the interval.
@return Solr compatible query string.
|
[
"Returns",
"a",
"time",
"interval",
"as",
"Solr",
"compatible",
"query",
"string",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchUtil.java#L209-L229
|
158,251 |
alkacon/opencms-core
|
src/org/opencms/search/CmsSearchUtil.java
|
CmsSearchUtil.getSolrRangeString
|
public static String getSolrRangeString(String from, String to) {
// If a parameter is not initialized, use the asterisk '*' operator
if (CmsStringUtil.isEmptyOrWhitespaceOnly(from)) {
from = "*";
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(to)) {
to = "*";
}
return String.format("[%s TO %s]", from, to);
}
|
java
|
public static String getSolrRangeString(String from, String to) {
// If a parameter is not initialized, use the asterisk '*' operator
if (CmsStringUtil.isEmptyOrWhitespaceOnly(from)) {
from = "*";
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(to)) {
to = "*";
}
return String.format("[%s TO %s]", from, to);
}
|
[
"public",
"static",
"String",
"getSolrRangeString",
"(",
"String",
"from",
",",
"String",
"to",
")",
"{",
"// If a parameter is not initialized, use the asterisk '*' operator",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"from",
")",
")",
"{",
"from",
"=",
"\"*\"",
";",
"}",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"to",
")",
")",
"{",
"to",
"=",
"\"*\"",
";",
"}",
"return",
"String",
".",
"format",
"(",
"\"[%s TO %s]\"",
",",
"from",
",",
"to",
")",
";",
"}"
] |
Returns a string that represents a valid Solr query range.
@param from Lower bound of the query range.
@param to Upper bound of the query range.
@return String that represents a Solr query range.
|
[
"Returns",
"a",
"string",
"that",
"represents",
"a",
"valid",
"Solr",
"query",
"range",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchUtil.java#L277-L289
|
158,252 |
alkacon/opencms-core
|
src/org/opencms/search/CmsSearchUtil.java
|
CmsSearchUtil.toContentStreams
|
public static Collection<ContentStream> toContentStreams(final String str, final String contentType) {
if (str == null) {
return null;
}
ArrayList<ContentStream> streams = new ArrayList<>(1);
ContentStreamBase ccc = new ContentStreamBase.StringStream(str);
ccc.setContentType(contentType);
streams.add(ccc);
return streams;
}
|
java
|
public static Collection<ContentStream> toContentStreams(final String str, final String contentType) {
if (str == null) {
return null;
}
ArrayList<ContentStream> streams = new ArrayList<>(1);
ContentStreamBase ccc = new ContentStreamBase.StringStream(str);
ccc.setContentType(contentType);
streams.add(ccc);
return streams;
}
|
[
"public",
"static",
"Collection",
"<",
"ContentStream",
">",
"toContentStreams",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"contentType",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ArrayList",
"<",
"ContentStream",
">",
"streams",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
")",
";",
"ContentStreamBase",
"ccc",
"=",
"new",
"ContentStreamBase",
".",
"StringStream",
"(",
"str",
")",
";",
"ccc",
".",
"setContentType",
"(",
"contentType",
")",
";",
"streams",
".",
"add",
"(",
"ccc",
")",
";",
"return",
"streams",
";",
"}"
] |
Take a string and make it an iterable ContentStream
|
[
"Take",
"a",
"string",
"and",
"make",
"it",
"an",
"iterable",
"ContentStream"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchUtil.java#L390-L401
|
158,253 |
alkacon/opencms-core
|
src/org/opencms/jsp/search/result/CmsSearchStateParameters.java
|
CmsSearchStateParameters.paramMapToString
|
public static String paramMapToString(final Map<String, String[]> parameters) {
final StringBuffer result = new StringBuffer();
for (final String key : parameters.keySet()) {
String[] values = parameters.get(key);
if (null == values) {
result.append(key).append('&');
} else {
for (final String value : parameters.get(key)) {
result.append(key).append('=').append(CmsEncoder.encode(value)).append('&');
}
}
}
// remove last '&'
if (result.length() > 0) {
result.setLength(result.length() - 1);
}
return result.toString();
}
|
java
|
public static String paramMapToString(final Map<String, String[]> parameters) {
final StringBuffer result = new StringBuffer();
for (final String key : parameters.keySet()) {
String[] values = parameters.get(key);
if (null == values) {
result.append(key).append('&');
} else {
for (final String value : parameters.get(key)) {
result.append(key).append('=').append(CmsEncoder.encode(value)).append('&');
}
}
}
// remove last '&'
if (result.length() > 0) {
result.setLength(result.length() - 1);
}
return result.toString();
}
|
[
"public",
"static",
"String",
"paramMapToString",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parameters",
")",
"{",
"final",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"final",
"String",
"key",
":",
"parameters",
".",
"keySet",
"(",
")",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"parameters",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"null",
"==",
"values",
")",
"{",
"result",
".",
"append",
"(",
"key",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"for",
"(",
"final",
"String",
"value",
":",
"parameters",
".",
"get",
"(",
"key",
")",
")",
"{",
"result",
".",
"append",
"(",
"key",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"CmsEncoder",
".",
"encode",
"(",
"value",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}",
"}",
"// remove last '&'",
"if",
"(",
"result",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"result",
".",
"setLength",
"(",
"result",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Converts a parameter map to the parameter string.
@param parameters the parameter map.
@return the parameter string.
|
[
"Converts",
"a",
"parameter",
"map",
"to",
"the",
"parameter",
"string",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/result/CmsSearchStateParameters.java#L91-L109
|
158,254 |
alkacon/opencms-core
|
src/org/opencms/jsp/search/result/CmsSearchStateParameters.java
|
CmsSearchStateParameters.getFacetParamKey
|
String getFacetParamKey(String facet) {
I_CmsSearchControllerFacetField fieldFacet = m_result.getController().getFieldFacets().getFieldFacetController().get(
facet);
if (fieldFacet != null) {
return fieldFacet.getConfig().getParamKey();
}
I_CmsSearchControllerFacetRange rangeFacet = m_result.getController().getRangeFacets().getRangeFacetController().get(
facet);
if (rangeFacet != null) {
return rangeFacet.getConfig().getParamKey();
}
I_CmsSearchControllerFacetQuery queryFacet = m_result.getController().getQueryFacet();
if ((queryFacet != null) && queryFacet.getConfig().getName().equals(facet)) {
return queryFacet.getConfig().getParamKey();
}
// Facet did not exist
LOG.warn(Messages.get().getBundle().key(Messages.LOG_FACET_NOT_CONFIGURED_1, facet), new Throwable());
return null;
}
|
java
|
String getFacetParamKey(String facet) {
I_CmsSearchControllerFacetField fieldFacet = m_result.getController().getFieldFacets().getFieldFacetController().get(
facet);
if (fieldFacet != null) {
return fieldFacet.getConfig().getParamKey();
}
I_CmsSearchControllerFacetRange rangeFacet = m_result.getController().getRangeFacets().getRangeFacetController().get(
facet);
if (rangeFacet != null) {
return rangeFacet.getConfig().getParamKey();
}
I_CmsSearchControllerFacetQuery queryFacet = m_result.getController().getQueryFacet();
if ((queryFacet != null) && queryFacet.getConfig().getName().equals(facet)) {
return queryFacet.getConfig().getParamKey();
}
// Facet did not exist
LOG.warn(Messages.get().getBundle().key(Messages.LOG_FACET_NOT_CONFIGURED_1, facet), new Throwable());
return null;
}
|
[
"String",
"getFacetParamKey",
"(",
"String",
"facet",
")",
"{",
"I_CmsSearchControllerFacetField",
"fieldFacet",
"=",
"m_result",
".",
"getController",
"(",
")",
".",
"getFieldFacets",
"(",
")",
".",
"getFieldFacetController",
"(",
")",
".",
"get",
"(",
"facet",
")",
";",
"if",
"(",
"fieldFacet",
"!=",
"null",
")",
"{",
"return",
"fieldFacet",
".",
"getConfig",
"(",
")",
".",
"getParamKey",
"(",
")",
";",
"}",
"I_CmsSearchControllerFacetRange",
"rangeFacet",
"=",
"m_result",
".",
"getController",
"(",
")",
".",
"getRangeFacets",
"(",
")",
".",
"getRangeFacetController",
"(",
")",
".",
"get",
"(",
"facet",
")",
";",
"if",
"(",
"rangeFacet",
"!=",
"null",
")",
"{",
"return",
"rangeFacet",
".",
"getConfig",
"(",
")",
".",
"getParamKey",
"(",
")",
";",
"}",
"I_CmsSearchControllerFacetQuery",
"queryFacet",
"=",
"m_result",
".",
"getController",
"(",
")",
".",
"getQueryFacet",
"(",
")",
";",
"if",
"(",
"(",
"queryFacet",
"!=",
"null",
")",
"&&",
"queryFacet",
".",
"getConfig",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"facet",
")",
")",
"{",
"return",
"queryFacet",
".",
"getConfig",
"(",
")",
".",
"getParamKey",
"(",
")",
";",
"}",
"// Facet did not exist",
"LOG",
".",
"warn",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"LOG_FACET_NOT_CONFIGURED_1",
",",
"facet",
")",
",",
"new",
"Throwable",
"(",
")",
")",
";",
"return",
"null",
";",
"}"
] |
Returns the parameter key of the facet with the given name.
@param facet the facet's name.
@return the parameter key for the facet.
|
[
"Returns",
"the",
"parameter",
"key",
"of",
"the",
"facet",
"with",
"the",
"given",
"name",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/result/CmsSearchStateParameters.java#L407-L428
|
158,255 |
alkacon/opencms-core
|
src/org/opencms/ui/CmsVaadinUtils.java
|
CmsVaadinUtils.closeWindow
|
public static void closeWindow(Component component) {
Window window = getWindow(component);
if (window != null) {
window.close();
}
}
|
java
|
public static void closeWindow(Component component) {
Window window = getWindow(component);
if (window != null) {
window.close();
}
}
|
[
"public",
"static",
"void",
"closeWindow",
"(",
"Component",
"component",
")",
"{",
"Window",
"window",
"=",
"getWindow",
"(",
"component",
")",
";",
"if",
"(",
"window",
"!=",
"null",
")",
"{",
"window",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Closes the window containing the given component.
@param component a component
|
[
"Closes",
"the",
"window",
"containing",
"the",
"given",
"component",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L294-L300
|
158,256 |
alkacon/opencms-core
|
src/org/opencms/ui/CmsVaadinUtils.java
|
CmsVaadinUtils.defaultHandleContextMenuForMultiselect
|
@SuppressWarnings("unchecked")
public static <T> void defaultHandleContextMenuForMultiselect(
Table table,
CmsContextMenu menu,
ItemClickEvent event,
List<I_CmsSimpleContextMenuEntry<Collection<T>>> entries) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
if (event.getButton().equals(MouseButton.RIGHT)) {
Collection<T> oldValue = ((Collection<T>)table.getValue());
if (oldValue.isEmpty() || !oldValue.contains(event.getItemId())) {
table.setValue(new HashSet<Object>(Arrays.asList(event.getItemId())));
}
Collection<T> selection = (Collection<T>)table.getValue();
menu.setEntries(entries, selection);
menu.openForTable(event, table);
}
}
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> void defaultHandleContextMenuForMultiselect(
Table table,
CmsContextMenu menu,
ItemClickEvent event,
List<I_CmsSimpleContextMenuEntry<Collection<T>>> entries) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
if (event.getButton().equals(MouseButton.RIGHT)) {
Collection<T> oldValue = ((Collection<T>)table.getValue());
if (oldValue.isEmpty() || !oldValue.contains(event.getItemId())) {
table.setValue(new HashSet<Object>(Arrays.asList(event.getItemId())));
}
Collection<T> selection = (Collection<T>)table.getValue();
menu.setEntries(entries, selection);
menu.openForTable(event, table);
}
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"void",
"defaultHandleContextMenuForMultiselect",
"(",
"Table",
"table",
",",
"CmsContextMenu",
"menu",
",",
"ItemClickEvent",
"event",
",",
"List",
"<",
"I_CmsSimpleContextMenuEntry",
"<",
"Collection",
"<",
"T",
">",
">",
">",
"entries",
")",
"{",
"if",
"(",
"!",
"event",
".",
"isCtrlKey",
"(",
")",
"&&",
"!",
"event",
".",
"isShiftKey",
"(",
")",
")",
"{",
"if",
"(",
"event",
".",
"getButton",
"(",
")",
".",
"equals",
"(",
"MouseButton",
".",
"RIGHT",
")",
")",
"{",
"Collection",
"<",
"T",
">",
"oldValue",
"=",
"(",
"(",
"Collection",
"<",
"T",
">",
")",
"table",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"oldValue",
".",
"isEmpty",
"(",
")",
"||",
"!",
"oldValue",
".",
"contains",
"(",
"event",
".",
"getItemId",
"(",
")",
")",
")",
"{",
"table",
".",
"setValue",
"(",
"new",
"HashSet",
"<",
"Object",
">",
"(",
"Arrays",
".",
"asList",
"(",
"event",
".",
"getItemId",
"(",
")",
")",
")",
")",
";",
"}",
"Collection",
"<",
"T",
">",
"selection",
"=",
"(",
"Collection",
"<",
"T",
">",
")",
"table",
".",
"getValue",
"(",
")",
";",
"menu",
".",
"setEntries",
"(",
"entries",
",",
"selection",
")",
";",
"menu",
".",
"openForTable",
"(",
"event",
",",
"table",
")",
";",
"}",
"}",
"}"
] |
Simple context menu handler for multi-select tables.
@param table the table
@param menu the table's context menu
@param event the click event
@param entries the context menu entries
|
[
"Simple",
"context",
"menu",
"handler",
"for",
"multi",
"-",
"select",
"tables",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L331-L350
|
158,257 |
alkacon/opencms-core
|
src/org/opencms/ui/CmsVaadinUtils.java
|
CmsVaadinUtils.getGroupsOfUser
|
public static IndexedContainer getGroupsOfUser(
CmsObject cms,
CmsUser user,
String caption,
String iconProp,
String ou,
String propStatus,
Function<CmsGroup, CmsCssIcon> iconProvider) {
IndexedContainer container = new IndexedContainer();
container.addContainerProperty(caption, String.class, "");
container.addContainerProperty(ou, String.class, "");
container.addContainerProperty(propStatus, Boolean.class, new Boolean(true));
if (iconProvider != null) {
container.addContainerProperty(iconProp, CmsCssIcon.class, null);
}
try {
for (CmsGroup group : cms.getGroupsOfUser(user.getName(), true)) {
Item item = container.addItem(group);
item.getItemProperty(caption).setValue(group.getSimpleName());
item.getItemProperty(ou).setValue(group.getOuFqn());
if (iconProvider != null) {
item.getItemProperty(iconProp).setValue(iconProvider.apply(group));
}
}
} catch (CmsException e) {
LOG.error("Unable to read groups from user", e);
}
return container;
}
|
java
|
public static IndexedContainer getGroupsOfUser(
CmsObject cms,
CmsUser user,
String caption,
String iconProp,
String ou,
String propStatus,
Function<CmsGroup, CmsCssIcon> iconProvider) {
IndexedContainer container = new IndexedContainer();
container.addContainerProperty(caption, String.class, "");
container.addContainerProperty(ou, String.class, "");
container.addContainerProperty(propStatus, Boolean.class, new Boolean(true));
if (iconProvider != null) {
container.addContainerProperty(iconProp, CmsCssIcon.class, null);
}
try {
for (CmsGroup group : cms.getGroupsOfUser(user.getName(), true)) {
Item item = container.addItem(group);
item.getItemProperty(caption).setValue(group.getSimpleName());
item.getItemProperty(ou).setValue(group.getOuFqn());
if (iconProvider != null) {
item.getItemProperty(iconProp).setValue(iconProvider.apply(group));
}
}
} catch (CmsException e) {
LOG.error("Unable to read groups from user", e);
}
return container;
}
|
[
"public",
"static",
"IndexedContainer",
"getGroupsOfUser",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
",",
"String",
"caption",
",",
"String",
"iconProp",
",",
"String",
"ou",
",",
"String",
"propStatus",
",",
"Function",
"<",
"CmsGroup",
",",
"CmsCssIcon",
">",
"iconProvider",
")",
"{",
"IndexedContainer",
"container",
"=",
"new",
"IndexedContainer",
"(",
")",
";",
"container",
".",
"addContainerProperty",
"(",
"caption",
",",
"String",
".",
"class",
",",
"\"\"",
")",
";",
"container",
".",
"addContainerProperty",
"(",
"ou",
",",
"String",
".",
"class",
",",
"\"\"",
")",
";",
"container",
".",
"addContainerProperty",
"(",
"propStatus",
",",
"Boolean",
".",
"class",
",",
"new",
"Boolean",
"(",
"true",
")",
")",
";",
"if",
"(",
"iconProvider",
"!=",
"null",
")",
"{",
"container",
".",
"addContainerProperty",
"(",
"iconProp",
",",
"CmsCssIcon",
".",
"class",
",",
"null",
")",
";",
"}",
"try",
"{",
"for",
"(",
"CmsGroup",
"group",
":",
"cms",
".",
"getGroupsOfUser",
"(",
"user",
".",
"getName",
"(",
")",
",",
"true",
")",
")",
"{",
"Item",
"item",
"=",
"container",
".",
"addItem",
"(",
"group",
")",
";",
"item",
".",
"getItemProperty",
"(",
"caption",
")",
".",
"setValue",
"(",
"group",
".",
"getSimpleName",
"(",
")",
")",
";",
"item",
".",
"getItemProperty",
"(",
"ou",
")",
".",
"setValue",
"(",
"group",
".",
"getOuFqn",
"(",
")",
")",
";",
"if",
"(",
"iconProvider",
"!=",
"null",
")",
"{",
"item",
".",
"getItemProperty",
"(",
"iconProp",
")",
".",
"setValue",
"(",
"iconProvider",
".",
"apply",
"(",
"group",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Unable to read groups from user\"",
",",
"e",
")",
";",
"}",
"return",
"container",
";",
"}"
] |
Gets container with alls groups of a certain user.
@param cms cmsobject
@param user to find groups for
@param caption caption property
@param iconProp property
@param ou ou
@param propStatus status property
@param iconProvider the icon provider
@return Indexed Container
|
[
"Gets",
"container",
"with",
"alls",
"groups",
"of",
"a",
"certain",
"user",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L543-L572
|
158,258 |
alkacon/opencms-core
|
src/org/opencms/ui/CmsVaadinUtils.java
|
CmsVaadinUtils.getPrincipalContainer
|
public static IndexedContainer getPrincipalContainer(
CmsObject cms,
List<? extends I_CmsPrincipal> list,
String captionID,
String descID,
String iconID,
String ouID,
String icon,
List<FontIcon> iconList) {
IndexedContainer res = new IndexedContainer();
res.addContainerProperty(captionID, String.class, "");
res.addContainerProperty(ouID, String.class, "");
res.addContainerProperty(iconID, FontIcon.class, new CmsCssIcon(icon));
if (descID != null) {
res.addContainerProperty(descID, String.class, "");
}
for (I_CmsPrincipal group : list) {
Item item = res.addItem(group);
item.getItemProperty(captionID).setValue(group.getSimpleName());
item.getItemProperty(ouID).setValue(group.getOuFqn());
if (descID != null) {
item.getItemProperty(descID).setValue(group.getDescription(A_CmsUI.get().getLocale()));
}
}
for (int i = 0; i < iconList.size(); i++) {
res.getItem(res.getIdByIndex(i)).getItemProperty(iconID).setValue(iconList.get(i));
}
return res;
}
|
java
|
public static IndexedContainer getPrincipalContainer(
CmsObject cms,
List<? extends I_CmsPrincipal> list,
String captionID,
String descID,
String iconID,
String ouID,
String icon,
List<FontIcon> iconList) {
IndexedContainer res = new IndexedContainer();
res.addContainerProperty(captionID, String.class, "");
res.addContainerProperty(ouID, String.class, "");
res.addContainerProperty(iconID, FontIcon.class, new CmsCssIcon(icon));
if (descID != null) {
res.addContainerProperty(descID, String.class, "");
}
for (I_CmsPrincipal group : list) {
Item item = res.addItem(group);
item.getItemProperty(captionID).setValue(group.getSimpleName());
item.getItemProperty(ouID).setValue(group.getOuFqn());
if (descID != null) {
item.getItemProperty(descID).setValue(group.getDescription(A_CmsUI.get().getLocale()));
}
}
for (int i = 0; i < iconList.size(); i++) {
res.getItem(res.getIdByIndex(i)).getItemProperty(iconID).setValue(iconList.get(i));
}
return res;
}
|
[
"public",
"static",
"IndexedContainer",
"getPrincipalContainer",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"?",
"extends",
"I_CmsPrincipal",
">",
"list",
",",
"String",
"captionID",
",",
"String",
"descID",
",",
"String",
"iconID",
",",
"String",
"ouID",
",",
"String",
"icon",
",",
"List",
"<",
"FontIcon",
">",
"iconList",
")",
"{",
"IndexedContainer",
"res",
"=",
"new",
"IndexedContainer",
"(",
")",
";",
"res",
".",
"addContainerProperty",
"(",
"captionID",
",",
"String",
".",
"class",
",",
"\"\"",
")",
";",
"res",
".",
"addContainerProperty",
"(",
"ouID",
",",
"String",
".",
"class",
",",
"\"\"",
")",
";",
"res",
".",
"addContainerProperty",
"(",
"iconID",
",",
"FontIcon",
".",
"class",
",",
"new",
"CmsCssIcon",
"(",
"icon",
")",
")",
";",
"if",
"(",
"descID",
"!=",
"null",
")",
"{",
"res",
".",
"addContainerProperty",
"(",
"descID",
",",
"String",
".",
"class",
",",
"\"\"",
")",
";",
"}",
"for",
"(",
"I_CmsPrincipal",
"group",
":",
"list",
")",
"{",
"Item",
"item",
"=",
"res",
".",
"addItem",
"(",
"group",
")",
";",
"item",
".",
"getItemProperty",
"(",
"captionID",
")",
".",
"setValue",
"(",
"group",
".",
"getSimpleName",
"(",
")",
")",
";",
"item",
".",
"getItemProperty",
"(",
"ouID",
")",
".",
"setValue",
"(",
"group",
".",
"getOuFqn",
"(",
")",
")",
";",
"if",
"(",
"descID",
"!=",
"null",
")",
"{",
"item",
".",
"getItemProperty",
"(",
"descID",
")",
".",
"setValue",
"(",
"group",
".",
"getDescription",
"(",
"A_CmsUI",
".",
"get",
"(",
")",
".",
"getLocale",
"(",
")",
")",
")",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iconList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"res",
".",
"getItem",
"(",
"res",
".",
"getIdByIndex",
"(",
"i",
")",
")",
".",
"getItemProperty",
"(",
"iconID",
")",
".",
"setValue",
"(",
"iconList",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"return",
"res",
";",
"}"
] |
Get container for principal.
@param cms cmsobject
@param list of principals
@param captionID caption id
@param descID description id
@param iconID icon id
@param ouID ou id
@param icon icon
@param iconList iconlist
@return indexedcontainer
|
[
"Get",
"container",
"for",
"principal",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L740-L774
|
158,259 |
alkacon/opencms-core
|
src/org/opencms/ui/CmsVaadinUtils.java
|
CmsVaadinUtils.setFilterBoxStyle
|
public static void setFilterBoxStyle(TextField searchBox) {
searchBox.setIcon(FontOpenCms.FILTER);
searchBox.setPlaceholder(
org.opencms.ui.apps.Messages.get().getBundle(UI.getCurrent().getLocale()).key(
org.opencms.ui.apps.Messages.GUI_EXPLORER_FILTER_0));
searchBox.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
}
|
java
|
public static void setFilterBoxStyle(TextField searchBox) {
searchBox.setIcon(FontOpenCms.FILTER);
searchBox.setPlaceholder(
org.opencms.ui.apps.Messages.get().getBundle(UI.getCurrent().getLocale()).key(
org.opencms.ui.apps.Messages.GUI_EXPLORER_FILTER_0));
searchBox.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
}
|
[
"public",
"static",
"void",
"setFilterBoxStyle",
"(",
"TextField",
"searchBox",
")",
"{",
"searchBox",
".",
"setIcon",
"(",
"FontOpenCms",
".",
"FILTER",
")",
";",
"searchBox",
".",
"setPlaceholder",
"(",
"org",
".",
"opencms",
".",
"ui",
".",
"apps",
".",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
"UI",
".",
"getCurrent",
"(",
")",
".",
"getLocale",
"(",
")",
")",
".",
"key",
"(",
"org",
".",
"opencms",
".",
"ui",
".",
"apps",
".",
"Messages",
".",
"GUI_EXPLORER_FILTER_0",
")",
")",
";",
"searchBox",
".",
"addStyleName",
"(",
"ValoTheme",
".",
"TEXTFIELD_INLINE_ICON",
")",
";",
"}"
] |
Configures a text field to look like a filter box for a table.
@param searchBox the text field to configure
|
[
"Configures",
"a",
"text",
"field",
"to",
"look",
"like",
"a",
"filter",
"box",
"for",
"a",
"table",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1125-L1133
|
158,260 |
alkacon/opencms-core
|
src/org/opencms/importexport/CmsImportHelper.java
|
CmsImportHelper.getZipEntry
|
protected ZipEntry getZipEntry(String filename) throws ZipException {
// yes
ZipEntry entry = getZipFile().getEntry(filename);
// path to file might be relative, too
if ((entry == null) && filename.startsWith("/")) {
entry = m_zipFile.getEntry(filename.substring(1));
}
if (entry == null) {
throw new ZipException(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_FILE_NOT_FOUND_IN_ZIP_1, filename));
}
return entry;
}
|
java
|
protected ZipEntry getZipEntry(String filename) throws ZipException {
// yes
ZipEntry entry = getZipFile().getEntry(filename);
// path to file might be relative, too
if ((entry == null) && filename.startsWith("/")) {
entry = m_zipFile.getEntry(filename.substring(1));
}
if (entry == null) {
throw new ZipException(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_FILE_NOT_FOUND_IN_ZIP_1, filename));
}
return entry;
}
|
[
"protected",
"ZipEntry",
"getZipEntry",
"(",
"String",
"filename",
")",
"throws",
"ZipException",
"{",
"// yes",
"ZipEntry",
"entry",
"=",
"getZipFile",
"(",
")",
".",
"getEntry",
"(",
"filename",
")",
";",
"// path to file might be relative, too",
"if",
"(",
"(",
"entry",
"==",
"null",
")",
"&&",
"filename",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"entry",
"=",
"m_zipFile",
".",
"getEntry",
"(",
"filename",
".",
"substring",
"(",
"1",
")",
")",
";",
"}",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"throw",
"new",
"ZipException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"LOG_IMPORTEXPORT_FILE_NOT_FOUND_IN_ZIP_1",
",",
"filename",
")",
")",
";",
"}",
"return",
"entry",
";",
"}"
] |
Returns the zip entry for a file in the archive.
@param filename the file name
@return the zip entry for the file with the provided name
@throws ZipException thrown if the file is not in the zip archive
|
[
"Returns",
"the",
"zip",
"entry",
"for",
"a",
"file",
"in",
"the",
"archive",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportHelper.java#L336-L349
|
158,261 |
alkacon/opencms-core
|
src/org/opencms/notification/A_CmsNotification.java
|
A_CmsNotification.appenHtmlFooter
|
protected void appenHtmlFooter(StringBuffer buffer) {
if (m_configuredFooter != null) {
buffer.append(m_configuredFooter);
} else {
buffer.append(" </body>\r\n" + "</html>");
}
}
|
java
|
protected void appenHtmlFooter(StringBuffer buffer) {
if (m_configuredFooter != null) {
buffer.append(m_configuredFooter);
} else {
buffer.append(" </body>\r\n" + "</html>");
}
}
|
[
"protected",
"void",
"appenHtmlFooter",
"(",
"StringBuffer",
"buffer",
")",
"{",
"if",
"(",
"m_configuredFooter",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"m_configuredFooter",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"\" </body>\\r\\n\"",
"+",
"\"</html>\"",
")",
";",
"}",
"}"
] |
Append the html-code to finish a html mail message to the given buffer.
@param buffer The StringBuffer to add the html code to.
|
[
"Append",
"the",
"html",
"-",
"code",
"to",
"finish",
"a",
"html",
"mail",
"message",
"to",
"the",
"given",
"buffer",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/notification/A_CmsNotification.java#L305-L312
|
158,262 |
alkacon/opencms-core
|
src/org/opencms/ui/apps/modules/CmsModuleApp.java
|
CmsModuleApp.openReport
|
public void openReport(String newState, A_CmsReportThread thread, String label) {
setReport(newState, thread);
m_labels.put(thread, label);
openSubView(newState, true);
}
|
java
|
public void openReport(String newState, A_CmsReportThread thread, String label) {
setReport(newState, thread);
m_labels.put(thread, label);
openSubView(newState, true);
}
|
[
"public",
"void",
"openReport",
"(",
"String",
"newState",
",",
"A_CmsReportThread",
"thread",
",",
"String",
"label",
")",
"{",
"setReport",
"(",
"newState",
",",
"thread",
")",
";",
"m_labels",
".",
"put",
"(",
"thread",
",",
"label",
")",
";",
"openSubView",
"(",
"newState",
",",
"true",
")",
";",
"}"
] |
Changes to a new sub-view and stores a report to be displayed by that subview.<p<
@param newState the new state
@param thread the report thread which should be displayed in the sub view
@param label the label to display for the report
|
[
"Changes",
"to",
"a",
"new",
"sub",
"-",
"view",
"and",
"stores",
"a",
"report",
"to",
"be",
"displayed",
"by",
"that",
"subview",
".",
"<p<"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/modules/CmsModuleApp.java#L667-L672
|
158,263 |
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteEntry.java
|
CmsFavoriteEntry.readId
|
public static CmsUUID readId(JSONObject obj, String key) {
String strValue = obj.optString(key);
if (!CmsUUID.isValidUUID(strValue)) {
return null;
}
return new CmsUUID(strValue);
}
|
java
|
public static CmsUUID readId(JSONObject obj, String key) {
String strValue = obj.optString(key);
if (!CmsUUID.isValidUUID(strValue)) {
return null;
}
return new CmsUUID(strValue);
}
|
[
"public",
"static",
"CmsUUID",
"readId",
"(",
"JSONObject",
"obj",
",",
"String",
"key",
")",
"{",
"String",
"strValue",
"=",
"obj",
".",
"optString",
"(",
"key",
")",
";",
"if",
"(",
"!",
"CmsUUID",
".",
"isValidUUID",
"(",
"strValue",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"CmsUUID",
"(",
"strValue",
")",
";",
"}"
] |
Reads a UUID from a JSON object.
Returns null if the JSON value for the given key is not present or not a valid UUID
@param obj the JSON object
@param key the JSON key
@return the UUID
|
[
"Reads",
"a",
"UUID",
"from",
"a",
"JSON",
"object",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L157-L164
|
158,264 |
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteEntry.java
|
CmsFavoriteEntry.setSiteRoot
|
public void setSiteRoot(String siteRoot) {
if (siteRoot != null) {
siteRoot = siteRoot.replaceFirst("/$", "");
}
m_siteRoot = siteRoot;
}
|
java
|
public void setSiteRoot(String siteRoot) {
if (siteRoot != null) {
siteRoot = siteRoot.replaceFirst("/$", "");
}
m_siteRoot = siteRoot;
}
|
[
"public",
"void",
"setSiteRoot",
"(",
"String",
"siteRoot",
")",
"{",
"if",
"(",
"siteRoot",
"!=",
"null",
")",
"{",
"siteRoot",
"=",
"siteRoot",
".",
"replaceFirst",
"(",
"\"/$\"",
",",
"\"\"",
")",
";",
"}",
"m_siteRoot",
"=",
"siteRoot",
";",
"}"
] |
Sets the site root.
@param siteRoot the site root
|
[
"Sets",
"the",
"site",
"root",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L241-L247
|
158,265 |
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteEntry.java
|
CmsFavoriteEntry.toJson
|
public JSONObject toJson() throws JSONException {
JSONObject result = new JSONObject();
if (m_detailId != null) {
result.put(JSON_DETAIL, "" + m_detailId);
}
if (m_siteRoot != null) {
result.put(JSON_SITEROOT, m_siteRoot);
}
if (m_structureId != null) {
result.put(JSON_STRUCTUREID, "" + m_structureId);
}
if (m_projectId != null) {
result.put(JSON_PROJECT, "" + m_projectId);
}
if (m_type != null) {
result.put(JSON_TYPE, "" + m_type.getJsonId());
}
return result;
}
|
java
|
public JSONObject toJson() throws JSONException {
JSONObject result = new JSONObject();
if (m_detailId != null) {
result.put(JSON_DETAIL, "" + m_detailId);
}
if (m_siteRoot != null) {
result.put(JSON_SITEROOT, m_siteRoot);
}
if (m_structureId != null) {
result.put(JSON_STRUCTUREID, "" + m_structureId);
}
if (m_projectId != null) {
result.put(JSON_PROJECT, "" + m_projectId);
}
if (m_type != null) {
result.put(JSON_TYPE, "" + m_type.getJsonId());
}
return result;
}
|
[
"public",
"JSONObject",
"toJson",
"(",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"result",
"=",
"new",
"JSONObject",
"(",
")",
";",
"if",
"(",
"m_detailId",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"JSON_DETAIL",
",",
"\"\"",
"+",
"m_detailId",
")",
";",
"}",
"if",
"(",
"m_siteRoot",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"JSON_SITEROOT",
",",
"m_siteRoot",
")",
";",
"}",
"if",
"(",
"m_structureId",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"JSON_STRUCTUREID",
",",
"\"\"",
"+",
"m_structureId",
")",
";",
"}",
"if",
"(",
"m_projectId",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"JSON_PROJECT",
",",
"\"\"",
"+",
"m_projectId",
")",
";",
"}",
"if",
"(",
"m_type",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"JSON_TYPE",
",",
"\"\"",
"+",
"m_type",
".",
"getJsonId",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Converts this object to JSON.
@return the JSON representation
@throws JSONException if JSON operations fail
|
[
"Converts",
"this",
"object",
"to",
"JSON",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L275-L294
|
158,266 |
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteEntry.java
|
CmsFavoriteEntry.updateContextAndGetFavoriteUrl
|
public String updateContextAndGetFavoriteUrl(CmsObject cms) throws CmsException {
CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION;
CmsProject project = null;
switch (getType()) {
case explorerFolder:
CmsResource folder = cms.readResource(getStructureId(), filter);
project = cms.readProject(getProjectId());
cms.getRequestContext().setSiteRoot(getSiteRoot());
cms.getRequestContext().setCurrentProject(project);
String explorerLink = CmsVaadinUtils.getWorkplaceLink()
+ "#!"
+ CmsFileExplorerConfiguration.APP_ID
+ "/"
+ getProjectId()
+ "!!"
+ getSiteRoot()
+ "!!"
+ cms.getSitePath(folder);
return explorerLink;
case page:
project = cms.readProject(getProjectId());
CmsResource target = cms.readResource(getStructureId(), filter);
CmsResource detailContent = null;
String link = null;
cms.getRequestContext().setCurrentProject(project);
cms.getRequestContext().setSiteRoot(getSiteRoot());
if (getDetailId() != null) {
detailContent = cms.readResource(getDetailId());
link = OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
cms.getSitePath(detailContent),
cms.getSitePath(target),
false);
} else {
link = OpenCms.getLinkManager().substituteLink(cms, target);
}
return link;
default:
return null;
}
}
|
java
|
public String updateContextAndGetFavoriteUrl(CmsObject cms) throws CmsException {
CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION;
CmsProject project = null;
switch (getType()) {
case explorerFolder:
CmsResource folder = cms.readResource(getStructureId(), filter);
project = cms.readProject(getProjectId());
cms.getRequestContext().setSiteRoot(getSiteRoot());
cms.getRequestContext().setCurrentProject(project);
String explorerLink = CmsVaadinUtils.getWorkplaceLink()
+ "#!"
+ CmsFileExplorerConfiguration.APP_ID
+ "/"
+ getProjectId()
+ "!!"
+ getSiteRoot()
+ "!!"
+ cms.getSitePath(folder);
return explorerLink;
case page:
project = cms.readProject(getProjectId());
CmsResource target = cms.readResource(getStructureId(), filter);
CmsResource detailContent = null;
String link = null;
cms.getRequestContext().setCurrentProject(project);
cms.getRequestContext().setSiteRoot(getSiteRoot());
if (getDetailId() != null) {
detailContent = cms.readResource(getDetailId());
link = OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
cms.getSitePath(detailContent),
cms.getSitePath(target),
false);
} else {
link = OpenCms.getLinkManager().substituteLink(cms, target);
}
return link;
default:
return null;
}
}
|
[
"public",
"String",
"updateContextAndGetFavoriteUrl",
"(",
"CmsObject",
"cms",
")",
"throws",
"CmsException",
"{",
"CmsResourceFilter",
"filter",
"=",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
";",
"CmsProject",
"project",
"=",
"null",
";",
"switch",
"(",
"getType",
"(",
")",
")",
"{",
"case",
"explorerFolder",
":",
"CmsResource",
"folder",
"=",
"cms",
".",
"readResource",
"(",
"getStructureId",
"(",
")",
",",
"filter",
")",
";",
"project",
"=",
"cms",
".",
"readProject",
"(",
"getProjectId",
"(",
")",
")",
";",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setSiteRoot",
"(",
"getSiteRoot",
"(",
")",
")",
";",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setCurrentProject",
"(",
"project",
")",
";",
"String",
"explorerLink",
"=",
"CmsVaadinUtils",
".",
"getWorkplaceLink",
"(",
")",
"+",
"\"#!\"",
"+",
"CmsFileExplorerConfiguration",
".",
"APP_ID",
"+",
"\"/\"",
"+",
"getProjectId",
"(",
")",
"+",
"\"!!\"",
"+",
"getSiteRoot",
"(",
")",
"+",
"\"!!\"",
"+",
"cms",
".",
"getSitePath",
"(",
"folder",
")",
";",
"return",
"explorerLink",
";",
"case",
"page",
":",
"project",
"=",
"cms",
".",
"readProject",
"(",
"getProjectId",
"(",
")",
")",
";",
"CmsResource",
"target",
"=",
"cms",
".",
"readResource",
"(",
"getStructureId",
"(",
")",
",",
"filter",
")",
";",
"CmsResource",
"detailContent",
"=",
"null",
";",
"String",
"link",
"=",
"null",
";",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setCurrentProject",
"(",
"project",
")",
";",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setSiteRoot",
"(",
"getSiteRoot",
"(",
")",
")",
";",
"if",
"(",
"getDetailId",
"(",
")",
"!=",
"null",
")",
"{",
"detailContent",
"=",
"cms",
".",
"readResource",
"(",
"getDetailId",
"(",
")",
")",
";",
"link",
"=",
"OpenCms",
".",
"getLinkManager",
"(",
")",
".",
"substituteLinkForUnknownTarget",
"(",
"cms",
",",
"cms",
".",
"getSitePath",
"(",
"detailContent",
")",
",",
"cms",
".",
"getSitePath",
"(",
"target",
")",
",",
"false",
")",
";",
"}",
"else",
"{",
"link",
"=",
"OpenCms",
".",
"getLinkManager",
"(",
")",
".",
"substituteLink",
"(",
"cms",
",",
"target",
")",
";",
"}",
"return",
"link",
";",
"default",
":",
"return",
"null",
";",
"}",
"}"
] |
Prepares the CmsObject for jumping to this favorite location, and returns the appropriate URL.
@param cms the CmsObject to initialize for jumping to the favorite
@return the link for the favorite location
@throws CmsException if something goes wrong
|
[
"Prepares",
"the",
"CmsObject",
"for",
"jumping",
"to",
"this",
"favorite",
"location",
"and",
"returns",
"the",
"appropriate",
"URL",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L304-L345
|
158,267 |
alkacon/opencms-core
|
src/org/opencms/ui/components/CmsToolBar.java
|
CmsToolBar.openFavoriteDialog
|
public static void openFavoriteDialog(CmsFileExplorer explorer) {
try {
CmsExplorerFavoriteContext context = new CmsExplorerFavoriteContext(A_CmsUI.getCmsObject(), explorer);
CmsFavoriteDialog dialog = new CmsFavoriteDialog(context, new CmsFavoriteDAO(A_CmsUI.getCmsObject()));
Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
window.setContent(dialog);
window.setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_FAVORITES_DIALOG_TITLE_0));
A_CmsUI.get().addWindow(window);
window.center();
} catch (CmsException e) {
CmsErrorDialog.showErrorDialog(e);
}
}
|
java
|
public static void openFavoriteDialog(CmsFileExplorer explorer) {
try {
CmsExplorerFavoriteContext context = new CmsExplorerFavoriteContext(A_CmsUI.getCmsObject(), explorer);
CmsFavoriteDialog dialog = new CmsFavoriteDialog(context, new CmsFavoriteDAO(A_CmsUI.getCmsObject()));
Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
window.setContent(dialog);
window.setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_FAVORITES_DIALOG_TITLE_0));
A_CmsUI.get().addWindow(window);
window.center();
} catch (CmsException e) {
CmsErrorDialog.showErrorDialog(e);
}
}
|
[
"public",
"static",
"void",
"openFavoriteDialog",
"(",
"CmsFileExplorer",
"explorer",
")",
"{",
"try",
"{",
"CmsExplorerFavoriteContext",
"context",
"=",
"new",
"CmsExplorerFavoriteContext",
"(",
"A_CmsUI",
".",
"getCmsObject",
"(",
")",
",",
"explorer",
")",
";",
"CmsFavoriteDialog",
"dialog",
"=",
"new",
"CmsFavoriteDialog",
"(",
"context",
",",
"new",
"CmsFavoriteDAO",
"(",
"A_CmsUI",
".",
"getCmsObject",
"(",
")",
")",
")",
";",
"Window",
"window",
"=",
"CmsBasicDialog",
".",
"prepareWindow",
"(",
"DialogWidth",
".",
"max",
")",
";",
"window",
".",
"setContent",
"(",
"dialog",
")",
";",
"window",
".",
"setCaption",
"(",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"org",
".",
"opencms",
".",
"ui",
".",
"Messages",
".",
"GUI_FAVORITES_DIALOG_TITLE_0",
")",
")",
";",
"A_CmsUI",
".",
"get",
"(",
")",
".",
"addWindow",
"(",
"window",
")",
";",
"window",
".",
"center",
"(",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"CmsErrorDialog",
".",
"showErrorDialog",
"(",
"e",
")",
";",
"}",
"}"
] |
Opens the favorite dialog.
@param explorer the explorer instance (null if not currently in explorer)
|
[
"Opens",
"the",
"favorite",
"dialog",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsToolBar.java#L294-L307
|
158,268 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java
|
CmsMessageBundleEditorTypes.getDescriptor
|
public static CmsResource getDescriptor(CmsObject cms, String basename) {
CmsSolrQuery query = new CmsSolrQuery();
query.setResourceTypes(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString());
query.setFilterQueries("filename:\"" + basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX + "\"");
query.add("fl", "path");
CmsSolrResultList results;
try {
boolean isOnlineProject = cms.getRequestContext().getCurrentProject().isOnlineProject();
String indexName = isOnlineProject
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
: CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE;
results = OpenCms.getSearchManager().getIndexSolr(indexName).search(cms, query, true, null, true, null);
} catch (CmsSearchException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_SEARCH_ERROR_0), e);
return null;
}
switch (results.size()) {
case 0:
return null;
case 1:
return results.get(0);
default:
String files = "";
for (CmsResource res : results) {
files += " " + res.getRootPath();
}
LOG.warn(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_NOT_UNIQUE_1, files));
return results.get(0);
}
}
|
java
|
public static CmsResource getDescriptor(CmsObject cms, String basename) {
CmsSolrQuery query = new CmsSolrQuery();
query.setResourceTypes(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString());
query.setFilterQueries("filename:\"" + basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX + "\"");
query.add("fl", "path");
CmsSolrResultList results;
try {
boolean isOnlineProject = cms.getRequestContext().getCurrentProject().isOnlineProject();
String indexName = isOnlineProject
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
: CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE;
results = OpenCms.getSearchManager().getIndexSolr(indexName).search(cms, query, true, null, true, null);
} catch (CmsSearchException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_SEARCH_ERROR_0), e);
return null;
}
switch (results.size()) {
case 0:
return null;
case 1:
return results.get(0);
default:
String files = "";
for (CmsResource res : results) {
files += " " + res.getRootPath();
}
LOG.warn(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_NOT_UNIQUE_1, files));
return results.get(0);
}
}
|
[
"public",
"static",
"CmsResource",
"getDescriptor",
"(",
"CmsObject",
"cms",
",",
"String",
"basename",
")",
"{",
"CmsSolrQuery",
"query",
"=",
"new",
"CmsSolrQuery",
"(",
")",
";",
"query",
".",
"setResourceTypes",
"(",
"CmsMessageBundleEditorTypes",
".",
"BundleType",
".",
"DESCRIPTOR",
".",
"toString",
"(",
")",
")",
";",
"query",
".",
"setFilterQueries",
"(",
"\"filename:\\\"\"",
"+",
"basename",
"+",
"CmsMessageBundleEditorTypes",
".",
"Descriptor",
".",
"POSTFIX",
"+",
"\"\\\"\"",
")",
";",
"query",
".",
"add",
"(",
"\"fl\"",
",",
"\"path\"",
")",
";",
"CmsSolrResultList",
"results",
";",
"try",
"{",
"boolean",
"isOnlineProject",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentProject",
"(",
")",
".",
"isOnlineProject",
"(",
")",
";",
"String",
"indexName",
"=",
"isOnlineProject",
"?",
"CmsSolrIndex",
".",
"DEFAULT_INDEX_NAME_ONLINE",
":",
"CmsSolrIndex",
".",
"DEFAULT_INDEX_NAME_OFFLINE",
";",
"results",
"=",
"OpenCms",
".",
"getSearchManager",
"(",
")",
".",
"getIndexSolr",
"(",
"indexName",
")",
".",
"search",
"(",
"cms",
",",
"query",
",",
"true",
",",
"null",
",",
"true",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CmsSearchException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"ERR_BUNDLE_DESCRIPTOR_SEARCH_ERROR_0",
")",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"switch",
"(",
"results",
".",
"size",
"(",
")",
")",
"{",
"case",
"0",
":",
"return",
"null",
";",
"case",
"1",
":",
"return",
"results",
".",
"get",
"(",
"0",
")",
";",
"default",
":",
"String",
"files",
"=",
"\"\"",
";",
"for",
"(",
"CmsResource",
"res",
":",
"results",
")",
"{",
"files",
"+=",
"\" \"",
"+",
"res",
".",
"getRootPath",
"(",
")",
";",
"}",
"LOG",
".",
"warn",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"ERR_BUNDLE_DESCRIPTOR_NOT_UNIQUE_1",
",",
"files",
")",
")",
";",
"return",
"results",
".",
"get",
"(",
"0",
")",
";",
"}",
"}"
] |
Returns the bundle descriptor for the bundle with the provided base name.
@param cms {@link CmsObject} used for searching.
@param basename the bundle base name, for which the descriptor is searched.
@return the bundle descriptor, or <code>null</code> if it does not exist or searching fails.
|
[
"Returns",
"the",
"bundle",
"descriptor",
"for",
"the",
"bundle",
"with",
"the",
"provided",
"base",
"name",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java#L976-L1007
|
158,269 |
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java
|
CmsMessageBundleEditorTypes.showWarning
|
static void showWarning(final String caption, final String description) {
Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true);
warning.setDelayMsec(-1);
warning.show(UI.getCurrent().getPage());
}
|
java
|
static void showWarning(final String caption, final String description) {
Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true);
warning.setDelayMsec(-1);
warning.show(UI.getCurrent().getPage());
}
|
[
"static",
"void",
"showWarning",
"(",
"final",
"String",
"caption",
",",
"final",
"String",
"description",
")",
"{",
"Notification",
"warning",
"=",
"new",
"Notification",
"(",
"caption",
",",
"description",
",",
"Type",
".",
"WARNING_MESSAGE",
",",
"true",
")",
";",
"warning",
".",
"setDelayMsec",
"(",
"-",
"1",
")",
";",
"warning",
".",
"show",
"(",
"UI",
".",
"getCurrent",
"(",
")",
".",
"getPage",
"(",
")",
")",
";",
"}"
] |
Displays a localized warning.
@param caption the caption of the warning.
@param description the description of the warning.
|
[
"Displays",
"a",
"localized",
"warning",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java#L1014-L1020
|
158,270 |
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/input/datebox/CmsDateBox.java
|
CmsDateBox.setDateOnly
|
public void setDateOnly(boolean dateOnly) {
if (m_dateOnly != dateOnly) {
m_dateOnly = dateOnly;
if (m_dateOnly) {
m_time.removeFromParent();
m_am.removeFromParent();
m_pm.removeFromParent();
} else {
m_timeField.add(m_time);
m_timeField.add(m_am);
m_timeField.add(m_pm);
}
}
}
|
java
|
public void setDateOnly(boolean dateOnly) {
if (m_dateOnly != dateOnly) {
m_dateOnly = dateOnly;
if (m_dateOnly) {
m_time.removeFromParent();
m_am.removeFromParent();
m_pm.removeFromParent();
} else {
m_timeField.add(m_time);
m_timeField.add(m_am);
m_timeField.add(m_pm);
}
}
}
|
[
"public",
"void",
"setDateOnly",
"(",
"boolean",
"dateOnly",
")",
"{",
"if",
"(",
"m_dateOnly",
"!=",
"dateOnly",
")",
"{",
"m_dateOnly",
"=",
"dateOnly",
";",
"if",
"(",
"m_dateOnly",
")",
"{",
"m_time",
".",
"removeFromParent",
"(",
")",
";",
"m_am",
".",
"removeFromParent",
"(",
")",
";",
"m_pm",
".",
"removeFromParent",
"(",
")",
";",
"}",
"else",
"{",
"m_timeField",
".",
"add",
"(",
"m_time",
")",
";",
"m_timeField",
".",
"add",
"(",
"m_am",
")",
";",
"m_timeField",
".",
"add",
"(",
"m_pm",
")",
";",
"}",
"}",
"}"
] |
Sets the value if the date only should be shown.
@param dateOnly if the date only should be shown
|
[
"Sets",
"the",
"value",
"if",
"the",
"date",
"only",
"should",
"be",
"shown",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/datebox/CmsDateBox.java#L558-L572
|
158,271 |
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualView.java
|
CmsPatternPanelIndividualView.addButtonClick
|
@UiHandler("m_addButton")
void addButtonClick(ClickEvent e) {
if (null != m_newDate.getValue()) {
m_dateList.addDate(m_newDate.getValue());
m_newDate.setValue(null);
if (handleChange()) {
m_controller.setDates(m_dateList.getDates());
}
}
}
|
java
|
@UiHandler("m_addButton")
void addButtonClick(ClickEvent e) {
if (null != m_newDate.getValue()) {
m_dateList.addDate(m_newDate.getValue());
m_newDate.setValue(null);
if (handleChange()) {
m_controller.setDates(m_dateList.getDates());
}
}
}
|
[
"@",
"UiHandler",
"(",
"\"m_addButton\"",
")",
"void",
"addButtonClick",
"(",
"ClickEvent",
"e",
")",
"{",
"if",
"(",
"null",
"!=",
"m_newDate",
".",
"getValue",
"(",
")",
")",
"{",
"m_dateList",
".",
"addDate",
"(",
"m_newDate",
".",
"getValue",
"(",
")",
")",
";",
"m_newDate",
".",
"setValue",
"(",
"null",
")",
";",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setDates",
"(",
"m_dateList",
".",
"getDates",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Handle click on "Add" button.
@param e the click event.
|
[
"Handle",
"click",
"on",
"Add",
"button",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualView.java#L120-L130
|
158,272 |
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualView.java
|
CmsPatternPanelIndividualView.dateListValueChange
|
@UiHandler("m_dateList")
void dateListValueChange(ValueChangeEvent<SortedSet<Date>> event) {
if (handleChange()) {
m_controller.setDates(event.getValue());
}
}
|
java
|
@UiHandler("m_dateList")
void dateListValueChange(ValueChangeEvent<SortedSet<Date>> event) {
if (handleChange()) {
m_controller.setDates(event.getValue());
}
}
|
[
"@",
"UiHandler",
"(",
"\"m_dateList\"",
")",
"void",
"dateListValueChange",
"(",
"ValueChangeEvent",
"<",
"SortedSet",
"<",
"Date",
">",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setDates",
"(",
"event",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] |
Handle value change event on the individual dates list.
@param event the change event.
|
[
"Handle",
"value",
"change",
"event",
"on",
"the",
"individual",
"dates",
"list",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualView.java#L136-L142
|
158,273 |
alkacon/opencms-core
|
src/org/opencms/configuration/CmsParameterConfiguration.java
|
CmsParameterConfiguration.remove
|
@Override
public String remove(Object key) {
String result = m_configurationStrings.remove(key);
m_configurationObjects.remove(key);
return result;
}
|
java
|
@Override
public String remove(Object key) {
String result = m_configurationStrings.remove(key);
m_configurationObjects.remove(key);
return result;
}
|
[
"@",
"Override",
"public",
"String",
"remove",
"(",
"Object",
"key",
")",
"{",
"String",
"result",
"=",
"m_configurationStrings",
".",
"remove",
"(",
"key",
")",
";",
"m_configurationObjects",
".",
"remove",
"(",
"key",
")",
";",
"return",
"result",
";",
"}"
] |
Removes a parameter from this configuration.
@param key the parameter to remove
|
[
"Removes",
"a",
"parameter",
"from",
"this",
"configuration",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsParameterConfiguration.java#L799-L805
|
158,274 |
alkacon/opencms-core
|
src/org/opencms/main/OpenCmsServlet.java
|
OpenCmsServlet.loadCustomErrorPage
|
private boolean loadCustomErrorPage(
CmsObject cms,
HttpServletRequest req,
HttpServletResponse res,
String rootPath) {
try {
// get the site of the error page resource
CmsSite errorSite = OpenCms.getSiteManager().getSiteForRootPath(rootPath);
cms.getRequestContext().setSiteRoot(errorSite.getSiteRoot());
String relPath = cms.getRequestContext().removeSiteRoot(rootPath);
if (cms.existsResource(relPath)) {
cms.getRequestContext().setUri(relPath);
OpenCms.getResourceManager().loadResource(cms, cms.readResource(relPath), req, res);
return true;
} else {
return false;
}
} catch (Throwable e) {
// something went wrong log the exception and return false
LOG.error(e.getMessage(), e);
return false;
}
}
|
java
|
private boolean loadCustomErrorPage(
CmsObject cms,
HttpServletRequest req,
HttpServletResponse res,
String rootPath) {
try {
// get the site of the error page resource
CmsSite errorSite = OpenCms.getSiteManager().getSiteForRootPath(rootPath);
cms.getRequestContext().setSiteRoot(errorSite.getSiteRoot());
String relPath = cms.getRequestContext().removeSiteRoot(rootPath);
if (cms.existsResource(relPath)) {
cms.getRequestContext().setUri(relPath);
OpenCms.getResourceManager().loadResource(cms, cms.readResource(relPath), req, res);
return true;
} else {
return false;
}
} catch (Throwable e) {
// something went wrong log the exception and return false
LOG.error(e.getMessage(), e);
return false;
}
}
|
[
"private",
"boolean",
"loadCustomErrorPage",
"(",
"CmsObject",
"cms",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"String",
"rootPath",
")",
"{",
"try",
"{",
"// get the site of the error page resource",
"CmsSite",
"errorSite",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"getSiteForRootPath",
"(",
"rootPath",
")",
";",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setSiteRoot",
"(",
"errorSite",
".",
"getSiteRoot",
"(",
")",
")",
";",
"String",
"relPath",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"removeSiteRoot",
"(",
"rootPath",
")",
";",
"if",
"(",
"cms",
".",
"existsResource",
"(",
"relPath",
")",
")",
"{",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setUri",
"(",
"relPath",
")",
";",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"loadResource",
"(",
"cms",
",",
"cms",
".",
"readResource",
"(",
"relPath",
")",
",",
"req",
",",
"res",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"// something went wrong log the exception and return false",
"LOG",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Tries to load the custom error page at the given rootPath.
@param cms {@link CmsObject} used for reading the resource (site root and uri get adjusted!)
@param req the current request
@param res the current response
@param rootPath the VFS root path to the error page resource
@return a flag, indicating if the error page could be loaded
|
[
"Tries",
"to",
"load",
"the",
"custom",
"error",
"page",
"at",
"the",
"given",
"rootPath",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsServlet.java#L364-L388
|
158,275 |
alkacon/opencms-core
|
src/org/opencms/main/OpenCmsServlet.java
|
OpenCmsServlet.tryCustomErrorPage
|
private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) {
String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot();
CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);
if (site != null) {
// store current site root and URI
String currentSiteRoot = cms.getRequestContext().getSiteRoot();
String currentUri = cms.getRequestContext().getUri();
try {
if (site.getErrorPage() != null) {
String rootPath = site.getErrorPage();
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
}
String rootPath = CmsStringUtil.joinPaths(siteRoot, "/.errorpages/handle" + errorCode + ".html");
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
} finally {
cms.getRequestContext().setSiteRoot(currentSiteRoot);
cms.getRequestContext().setUri(currentUri);
}
}
return false;
}
|
java
|
private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) {
String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot();
CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);
if (site != null) {
// store current site root and URI
String currentSiteRoot = cms.getRequestContext().getSiteRoot();
String currentUri = cms.getRequestContext().getUri();
try {
if (site.getErrorPage() != null) {
String rootPath = site.getErrorPage();
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
}
String rootPath = CmsStringUtil.joinPaths(siteRoot, "/.errorpages/handle" + errorCode + ".html");
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
} finally {
cms.getRequestContext().setSiteRoot(currentSiteRoot);
cms.getRequestContext().setUri(currentUri);
}
}
return false;
}
|
[
"private",
"boolean",
"tryCustomErrorPage",
"(",
"CmsObject",
"cms",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"int",
"errorCode",
")",
"{",
"String",
"siteRoot",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"matchRequest",
"(",
"req",
")",
".",
"getSiteRoot",
"(",
")",
";",
"CmsSite",
"site",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"getSiteForSiteRoot",
"(",
"siteRoot",
")",
";",
"if",
"(",
"site",
"!=",
"null",
")",
"{",
"// store current site root and URI",
"String",
"currentSiteRoot",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getSiteRoot",
"(",
")",
";",
"String",
"currentUri",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getUri",
"(",
")",
";",
"try",
"{",
"if",
"(",
"site",
".",
"getErrorPage",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"rootPath",
"=",
"site",
".",
"getErrorPage",
"(",
")",
";",
"if",
"(",
"loadCustomErrorPage",
"(",
"cms",
",",
"req",
",",
"res",
",",
"rootPath",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"String",
"rootPath",
"=",
"CmsStringUtil",
".",
"joinPaths",
"(",
"siteRoot",
",",
"\"/.errorpages/handle\"",
"+",
"errorCode",
"+",
"\".html\"",
")",
";",
"if",
"(",
"loadCustomErrorPage",
"(",
"cms",
",",
"req",
",",
"res",
",",
"rootPath",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"finally",
"{",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setSiteRoot",
"(",
"currentSiteRoot",
")",
";",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setUri",
"(",
"currentUri",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Tries to load a site specific error page. If
@param cms {@link CmsObject} used for reading the resource (site root and uri get adjusted!)
@param req the current request
@param res the current response
@param errorCode the error code to display
@return a flag, indicating if the custom error page could be loaded.
|
[
"Tries",
"to",
"load",
"a",
"site",
"specific",
"error",
"page",
".",
"If"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsServlet.java#L398-L423
|
158,276 |
alkacon/opencms-core
|
src/org/opencms/ade/galleries/CmsGalleryService.java
|
CmsGalleryService.buildVfsEntryBeanForQuickSearch
|
private CmsVfsEntryBean buildVfsEntryBeanForQuickSearch(
CmsResource resource,
Multimap<CmsResource, CmsResource> childMap,
Set<CmsResource> filterMatches,
Set<String> parentPaths,
boolean isRoot)
throws CmsException {
CmsObject cms = getCmsObject();
String title = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue();
boolean isMatch = filterMatches.contains(resource);
List<CmsVfsEntryBean> childBeans = Lists.newArrayList();
Collection<CmsResource> children = childMap.get(resource);
if (!children.isEmpty()) {
for (CmsResource child : children) {
CmsVfsEntryBean childBean = buildVfsEntryBeanForQuickSearch(
child,
childMap,
filterMatches,
parentPaths,
false);
childBeans.add(childBean);
}
} else if (filterMatches.contains(resource)) {
if (parentPaths.contains(resource.getRootPath())) {
childBeans = null;
}
// otherwise childBeans remains an empty list
}
String rootPath = resource.getRootPath();
CmsVfsEntryBean result = new CmsVfsEntryBean(
rootPath,
resource.getStructureId(),
title,
CmsIconUtil.getIconClasses(CmsIconUtil.getDisplayType(cms, resource), resource.getName(), true),
isRoot,
isEditable(cms, resource),
childBeans,
isMatch);
String siteRoot = null;
if (OpenCms.getSiteManager().startsWithShared(rootPath)) {
siteRoot = OpenCms.getSiteManager().getSharedFolder();
} else {
String tempSiteRoot = OpenCms.getSiteManager().getSiteRoot(rootPath);
if (tempSiteRoot != null) {
siteRoot = tempSiteRoot;
} else {
siteRoot = "";
}
}
result.setSiteRoot(siteRoot);
return result;
}
|
java
|
private CmsVfsEntryBean buildVfsEntryBeanForQuickSearch(
CmsResource resource,
Multimap<CmsResource, CmsResource> childMap,
Set<CmsResource> filterMatches,
Set<String> parentPaths,
boolean isRoot)
throws CmsException {
CmsObject cms = getCmsObject();
String title = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue();
boolean isMatch = filterMatches.contains(resource);
List<CmsVfsEntryBean> childBeans = Lists.newArrayList();
Collection<CmsResource> children = childMap.get(resource);
if (!children.isEmpty()) {
for (CmsResource child : children) {
CmsVfsEntryBean childBean = buildVfsEntryBeanForQuickSearch(
child,
childMap,
filterMatches,
parentPaths,
false);
childBeans.add(childBean);
}
} else if (filterMatches.contains(resource)) {
if (parentPaths.contains(resource.getRootPath())) {
childBeans = null;
}
// otherwise childBeans remains an empty list
}
String rootPath = resource.getRootPath();
CmsVfsEntryBean result = new CmsVfsEntryBean(
rootPath,
resource.getStructureId(),
title,
CmsIconUtil.getIconClasses(CmsIconUtil.getDisplayType(cms, resource), resource.getName(), true),
isRoot,
isEditable(cms, resource),
childBeans,
isMatch);
String siteRoot = null;
if (OpenCms.getSiteManager().startsWithShared(rootPath)) {
siteRoot = OpenCms.getSiteManager().getSharedFolder();
} else {
String tempSiteRoot = OpenCms.getSiteManager().getSiteRoot(rootPath);
if (tempSiteRoot != null) {
siteRoot = tempSiteRoot;
} else {
siteRoot = "";
}
}
result.setSiteRoot(siteRoot);
return result;
}
|
[
"private",
"CmsVfsEntryBean",
"buildVfsEntryBeanForQuickSearch",
"(",
"CmsResource",
"resource",
",",
"Multimap",
"<",
"CmsResource",
",",
"CmsResource",
">",
"childMap",
",",
"Set",
"<",
"CmsResource",
">",
"filterMatches",
",",
"Set",
"<",
"String",
">",
"parentPaths",
",",
"boolean",
"isRoot",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cms",
"=",
"getCmsObject",
"(",
")",
";",
"String",
"title",
"=",
"cms",
".",
"readPropertyObject",
"(",
"resource",
",",
"CmsPropertyDefinition",
".",
"PROPERTY_TITLE",
",",
"false",
")",
".",
"getValue",
"(",
")",
";",
"boolean",
"isMatch",
"=",
"filterMatches",
".",
"contains",
"(",
"resource",
")",
";",
"List",
"<",
"CmsVfsEntryBean",
">",
"childBeans",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"Collection",
"<",
"CmsResource",
">",
"children",
"=",
"childMap",
".",
"get",
"(",
"resource",
")",
";",
"if",
"(",
"!",
"children",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"CmsResource",
"child",
":",
"children",
")",
"{",
"CmsVfsEntryBean",
"childBean",
"=",
"buildVfsEntryBeanForQuickSearch",
"(",
"child",
",",
"childMap",
",",
"filterMatches",
",",
"parentPaths",
",",
"false",
")",
";",
"childBeans",
".",
"add",
"(",
"childBean",
")",
";",
"}",
"}",
"else",
"if",
"(",
"filterMatches",
".",
"contains",
"(",
"resource",
")",
")",
"{",
"if",
"(",
"parentPaths",
".",
"contains",
"(",
"resource",
".",
"getRootPath",
"(",
")",
")",
")",
"{",
"childBeans",
"=",
"null",
";",
"}",
"// otherwise childBeans remains an empty list",
"}",
"String",
"rootPath",
"=",
"resource",
".",
"getRootPath",
"(",
")",
";",
"CmsVfsEntryBean",
"result",
"=",
"new",
"CmsVfsEntryBean",
"(",
"rootPath",
",",
"resource",
".",
"getStructureId",
"(",
")",
",",
"title",
",",
"CmsIconUtil",
".",
"getIconClasses",
"(",
"CmsIconUtil",
".",
"getDisplayType",
"(",
"cms",
",",
"resource",
")",
",",
"resource",
".",
"getName",
"(",
")",
",",
"true",
")",
",",
"isRoot",
",",
"isEditable",
"(",
"cms",
",",
"resource",
")",
",",
"childBeans",
",",
"isMatch",
")",
";",
"String",
"siteRoot",
"=",
"null",
";",
"if",
"(",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"startsWithShared",
"(",
"rootPath",
")",
")",
"{",
"siteRoot",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"getSharedFolder",
"(",
")",
";",
"}",
"else",
"{",
"String",
"tempSiteRoot",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"getSiteRoot",
"(",
"rootPath",
")",
";",
"if",
"(",
"tempSiteRoot",
"!=",
"null",
")",
"{",
"siteRoot",
"=",
"tempSiteRoot",
";",
"}",
"else",
"{",
"siteRoot",
"=",
"\"\"",
";",
"}",
"}",
"result",
".",
"setSiteRoot",
"(",
"siteRoot",
")",
";",
"return",
"result",
";",
"}"
] |
Recursively builds the VFS entry bean for the quick filtering function in the folder tab.<p<
@param resource the resource
@param childMap map from parent to child resources
@param filterMatches the resources matching the filter
@param parentPaths root paths of resources which are not leaves
@param isRoot true if this the root node
@return the VFS entry bean for the client
@throws CmsException if something goes wrong
|
[
"Recursively",
"builds",
"the",
"VFS",
"entry",
"bean",
"for",
"the",
"quick",
"filtering",
"function",
"in",
"the",
"folder",
"tab",
".",
"<p<"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L1875-L1929
|
158,277 |
alkacon/opencms-core
|
src/org/opencms/loader/CmsJspLoader.java
|
CmsJspLoader.doPurge
|
protected void doPurge(Runnable afterPurgeAction) {
if (LOG.isInfoEnabled()) {
LOG.info(
org.opencms.flex.Messages.get().getBundle().key(
org.opencms.flex.Messages.LOG_FLEXCACHE_WILL_PURGE_JSP_REPOSITORY_0));
}
File d;
d = new File(getJspRepository() + CmsFlexCache.REPOSITORY_ONLINE + File.separator);
CmsFileUtil.purgeDirectory(d);
d = new File(getJspRepository() + CmsFlexCache.REPOSITORY_OFFLINE + File.separator);
CmsFileUtil.purgeDirectory(d);
if (afterPurgeAction != null) {
afterPurgeAction.run();
}
if (LOG.isInfoEnabled()) {
LOG.info(
org.opencms.flex.Messages.get().getBundle().key(
org.opencms.flex.Messages.LOG_FLEXCACHE_PURGED_JSP_REPOSITORY_0));
}
}
|
java
|
protected void doPurge(Runnable afterPurgeAction) {
if (LOG.isInfoEnabled()) {
LOG.info(
org.opencms.flex.Messages.get().getBundle().key(
org.opencms.flex.Messages.LOG_FLEXCACHE_WILL_PURGE_JSP_REPOSITORY_0));
}
File d;
d = new File(getJspRepository() + CmsFlexCache.REPOSITORY_ONLINE + File.separator);
CmsFileUtil.purgeDirectory(d);
d = new File(getJspRepository() + CmsFlexCache.REPOSITORY_OFFLINE + File.separator);
CmsFileUtil.purgeDirectory(d);
if (afterPurgeAction != null) {
afterPurgeAction.run();
}
if (LOG.isInfoEnabled()) {
LOG.info(
org.opencms.flex.Messages.get().getBundle().key(
org.opencms.flex.Messages.LOG_FLEXCACHE_PURGED_JSP_REPOSITORY_0));
}
}
|
[
"protected",
"void",
"doPurge",
"(",
"Runnable",
"afterPurgeAction",
")",
"{",
"if",
"(",
"LOG",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"org",
".",
"opencms",
".",
"flex",
".",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"org",
".",
"opencms",
".",
"flex",
".",
"Messages",
".",
"LOG_FLEXCACHE_WILL_PURGE_JSP_REPOSITORY_0",
")",
")",
";",
"}",
"File",
"d",
";",
"d",
"=",
"new",
"File",
"(",
"getJspRepository",
"(",
")",
"+",
"CmsFlexCache",
".",
"REPOSITORY_ONLINE",
"+",
"File",
".",
"separator",
")",
";",
"CmsFileUtil",
".",
"purgeDirectory",
"(",
"d",
")",
";",
"d",
"=",
"new",
"File",
"(",
"getJspRepository",
"(",
")",
"+",
"CmsFlexCache",
".",
"REPOSITORY_OFFLINE",
"+",
"File",
".",
"separator",
")",
";",
"CmsFileUtil",
".",
"purgeDirectory",
"(",
"d",
")",
";",
"if",
"(",
"afterPurgeAction",
"!=",
"null",
")",
"{",
"afterPurgeAction",
".",
"run",
"(",
")",
";",
"}",
"if",
"(",
"LOG",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"org",
".",
"opencms",
".",
"flex",
".",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"org",
".",
"opencms",
".",
"flex",
".",
"Messages",
".",
"LOG_FLEXCACHE_PURGED_JSP_REPOSITORY_0",
")",
")",
";",
"}",
"}"
] |
Purges the JSP repository.<p<
@param afterPurgeAction the action to execute after purging
|
[
"Purges",
"the",
"JSP",
"repository",
".",
"<p<"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L1079-L1103
|
158,278 |
alkacon/opencms-core
|
src/org/opencms/rmi/CmsRemoteShellClient.java
|
CmsRemoteShellClient.wrongUsage
|
private void wrongUsage() {
String usage = "Usage: java -cp $PATH_TO_OPENCMS_JAR org.opencms.rmi.CmsRemoteShellClient\n"
+ " -script=[path to script] (optional) \n"
+ " -registryPort=[port of RMI registry] (optional, default is "
+ CmsRemoteShellConstants.DEFAULT_PORT
+ ")\n"
+ " -additional=[additional commands class name] (optional)";
System.out.println(usage);
System.exit(1);
}
|
java
|
private void wrongUsage() {
String usage = "Usage: java -cp $PATH_TO_OPENCMS_JAR org.opencms.rmi.CmsRemoteShellClient\n"
+ " -script=[path to script] (optional) \n"
+ " -registryPort=[port of RMI registry] (optional, default is "
+ CmsRemoteShellConstants.DEFAULT_PORT
+ ")\n"
+ " -additional=[additional commands class name] (optional)";
System.out.println(usage);
System.exit(1);
}
|
[
"private",
"void",
"wrongUsage",
"(",
")",
"{",
"String",
"usage",
"=",
"\"Usage: java -cp $PATH_TO_OPENCMS_JAR org.opencms.rmi.CmsRemoteShellClient\\n\"",
"+",
"\" -script=[path to script] (optional) \\n\"",
"+",
"\" -registryPort=[port of RMI registry] (optional, default is \"",
"+",
"CmsRemoteShellConstants",
".",
"DEFAULT_PORT",
"+",
"\")\\n\"",
"+",
"\" -additional=[additional commands class name] (optional)\"",
";",
"System",
".",
"out",
".",
"println",
"(",
"usage",
")",
";",
"System",
".",
"exit",
"(",
"1",
")",
";",
"}"
] |
Displays text which shows the valid command line parameters, and then exits.
|
[
"Displays",
"text",
"which",
"shows",
"the",
"valid",
"command",
"line",
"parameters",
"and",
"then",
"exits",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/rmi/CmsRemoteShellClient.java#L325-L335
|
158,279 |
alkacon/opencms-core
|
src/org/opencms/jsp/CmsJspTagSearch.java
|
CmsJspTagSearch.setAddContentInfo
|
public void setAddContentInfo(final Boolean doAddInfo) {
if ((null != doAddInfo) && doAddInfo.booleanValue() && (null != m_addContentInfoForEntries)) {
m_addContentInfoForEntries = Integer.valueOf(DEFAULT_CONTENTINFO_ROWS);
}
}
|
java
|
public void setAddContentInfo(final Boolean doAddInfo) {
if ((null != doAddInfo) && doAddInfo.booleanValue() && (null != m_addContentInfoForEntries)) {
m_addContentInfoForEntries = Integer.valueOf(DEFAULT_CONTENTINFO_ROWS);
}
}
|
[
"public",
"void",
"setAddContentInfo",
"(",
"final",
"Boolean",
"doAddInfo",
")",
"{",
"if",
"(",
"(",
"null",
"!=",
"doAddInfo",
")",
"&&",
"doAddInfo",
".",
"booleanValue",
"(",
")",
"&&",
"(",
"null",
"!=",
"m_addContentInfoForEntries",
")",
")",
"{",
"m_addContentInfoForEntries",
"=",
"Integer",
".",
"valueOf",
"(",
"DEFAULT_CONTENTINFO_ROWS",
")",
";",
"}",
"}"
] |
Setter for "addContentInfo", indicating if content information should be added.
@param doAddInfo The value of the "addContentInfo" attribute of the tag
|
[
"Setter",
"for",
"addContentInfo",
"indicating",
"if",
"content",
"information",
"should",
"be",
"added",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagSearch.java#L261-L266
|
158,280 |
alkacon/opencms-core
|
src/org/opencms/jsp/CmsJspTagSearch.java
|
CmsJspTagSearch.setFileFormat
|
public void setFileFormat(String fileFormat) {
if (fileFormat.toUpperCase().equals(FileFormat.JSON.toString())) {
m_fileFormat = FileFormat.JSON;
}
}
|
java
|
public void setFileFormat(String fileFormat) {
if (fileFormat.toUpperCase().equals(FileFormat.JSON.toString())) {
m_fileFormat = FileFormat.JSON;
}
}
|
[
"public",
"void",
"setFileFormat",
"(",
"String",
"fileFormat",
")",
"{",
"if",
"(",
"fileFormat",
".",
"toUpperCase",
"(",
")",
".",
"equals",
"(",
"FileFormat",
".",
"JSON",
".",
"toString",
"(",
")",
")",
")",
"{",
"m_fileFormat",
"=",
"FileFormat",
".",
"JSON",
";",
"}",
"}"
] |
Setter for the file format.
@param fileFormat File format the configuration file is in.
|
[
"Setter",
"for",
"the",
"file",
"format",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagSearch.java#L297-L302
|
158,281 |
alkacon/opencms-core
|
src/org/opencms/jsp/CmsJspTagSearch.java
|
CmsJspTagSearch.addContentInfo
|
private void addContentInfo() {
if (!m_cms.getRequestContext().getCurrentProject().isOnlineProject()
&& (null == m_searchController.getCommon().getConfig().getSolrIndex())
&& (null != m_addContentInfoForEntries)) {
CmsSolrQuery query = new CmsSolrQuery();
m_searchController.addQueryParts(query, m_cms);
query.setStart(Integer.valueOf(0));
query.setRows(m_addContentInfoForEntries);
CmsContentLoadCollectorInfo info = new CmsContentLoadCollectorInfo();
info.setCollectorClass(this.getClass().getName());
info.setCollectorParams(query.getQuery());
info.setId((new CmsUUID()).getStringValue());
if (CmsJspTagEditable.getDirectEditProvider(pageContext) != null) {
try {
CmsJspTagEditable.getDirectEditProvider(pageContext).insertDirectEditListMetadata(
pageContext,
info);
} catch (JspException e) {
LOG.error("Could not write content info.", e);
}
}
}
}
|
java
|
private void addContentInfo() {
if (!m_cms.getRequestContext().getCurrentProject().isOnlineProject()
&& (null == m_searchController.getCommon().getConfig().getSolrIndex())
&& (null != m_addContentInfoForEntries)) {
CmsSolrQuery query = new CmsSolrQuery();
m_searchController.addQueryParts(query, m_cms);
query.setStart(Integer.valueOf(0));
query.setRows(m_addContentInfoForEntries);
CmsContentLoadCollectorInfo info = new CmsContentLoadCollectorInfo();
info.setCollectorClass(this.getClass().getName());
info.setCollectorParams(query.getQuery());
info.setId((new CmsUUID()).getStringValue());
if (CmsJspTagEditable.getDirectEditProvider(pageContext) != null) {
try {
CmsJspTagEditable.getDirectEditProvider(pageContext).insertDirectEditListMetadata(
pageContext,
info);
} catch (JspException e) {
LOG.error("Could not write content info.", e);
}
}
}
}
|
[
"private",
"void",
"addContentInfo",
"(",
")",
"{",
"if",
"(",
"!",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentProject",
"(",
")",
".",
"isOnlineProject",
"(",
")",
"&&",
"(",
"null",
"==",
"m_searchController",
".",
"getCommon",
"(",
")",
".",
"getConfig",
"(",
")",
".",
"getSolrIndex",
"(",
")",
")",
"&&",
"(",
"null",
"!=",
"m_addContentInfoForEntries",
")",
")",
"{",
"CmsSolrQuery",
"query",
"=",
"new",
"CmsSolrQuery",
"(",
")",
";",
"m_searchController",
".",
"addQueryParts",
"(",
"query",
",",
"m_cms",
")",
";",
"query",
".",
"setStart",
"(",
"Integer",
".",
"valueOf",
"(",
"0",
")",
")",
";",
"query",
".",
"setRows",
"(",
"m_addContentInfoForEntries",
")",
";",
"CmsContentLoadCollectorInfo",
"info",
"=",
"new",
"CmsContentLoadCollectorInfo",
"(",
")",
";",
"info",
".",
"setCollectorClass",
"(",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"info",
".",
"setCollectorParams",
"(",
"query",
".",
"getQuery",
"(",
")",
")",
";",
"info",
".",
"setId",
"(",
"(",
"new",
"CmsUUID",
"(",
")",
")",
".",
"getStringValue",
"(",
")",
")",
";",
"if",
"(",
"CmsJspTagEditable",
".",
"getDirectEditProvider",
"(",
"pageContext",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"CmsJspTagEditable",
".",
"getDirectEditProvider",
"(",
"pageContext",
")",
".",
"insertDirectEditListMetadata",
"(",
"pageContext",
",",
"info",
")",
";",
"}",
"catch",
"(",
"JspException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not write content info.\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}"
] |
Adds the content info for the collected resources used in the "This page" publish dialog.
|
[
"Adds",
"the",
"content",
"info",
"for",
"the",
"collected",
"resources",
"used",
"in",
"the",
"This",
"page",
"publish",
"dialog",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagSearch.java#L369-L392
|
158,282 |
alkacon/opencms-core
|
src/org/opencms/jsp/CmsJspTagSearch.java
|
CmsJspTagSearch.getSearchResults
|
private I_CmsSearchResultWrapper getSearchResults() {
// The second parameter is just ignored - so it does not matter
m_searchController.updateFromRequestParameters(pageContext.getRequest().getParameterMap(), false);
I_CmsSearchControllerCommon common = m_searchController.getCommon();
// Do not search for empty query, if configured
if (common.getState().getQuery().isEmpty()
&& (!common.getConfig().getIgnoreQueryParam() && !common.getConfig().getSearchForEmptyQueryParam())) {
return new CmsSearchResultWrapper(m_searchController, null, null, m_cms, null);
}
Map<String, String[]> queryParams = null;
boolean isEditMode = CmsJspTagEditable.isEditableRequest(pageContext.getRequest());
if (isEditMode) {
String params = "";
if (common.getConfig().getIgnoreReleaseDate()) {
params += "&fq=released:[* TO *]";
}
if (common.getConfig().getIgnoreExpirationDate()) {
params += "&fq=expired:[* TO *]";
}
if (!params.isEmpty()) {
queryParams = CmsRequestUtil.createParameterMap(params.substring(1));
}
}
CmsSolrQuery query = new CmsSolrQuery(null, queryParams);
m_searchController.addQueryParts(query, m_cms);
try {
// use "complicated" constructor to allow more than 50 results -> set ignoreMaxResults to true
// also set resource filter to allow for returning unreleased/expired resources if necessary.
CmsSolrResultList solrResultList = m_index.search(
m_cms,
query.clone(), // use a clone of the query, since the search function manipulates the query (removes highlighting parts), but we want to keep the original one.
true,
isEditMode ? CmsResourceFilter.IGNORE_EXPIRATION : null);
return new CmsSearchResultWrapper(m_searchController, solrResultList, query, m_cms, null);
} catch (CmsSearchException e) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_TAG_SEARCH_SEARCH_FAILED_0), e);
return new CmsSearchResultWrapper(m_searchController, null, query, m_cms, e);
}
}
|
java
|
private I_CmsSearchResultWrapper getSearchResults() {
// The second parameter is just ignored - so it does not matter
m_searchController.updateFromRequestParameters(pageContext.getRequest().getParameterMap(), false);
I_CmsSearchControllerCommon common = m_searchController.getCommon();
// Do not search for empty query, if configured
if (common.getState().getQuery().isEmpty()
&& (!common.getConfig().getIgnoreQueryParam() && !common.getConfig().getSearchForEmptyQueryParam())) {
return new CmsSearchResultWrapper(m_searchController, null, null, m_cms, null);
}
Map<String, String[]> queryParams = null;
boolean isEditMode = CmsJspTagEditable.isEditableRequest(pageContext.getRequest());
if (isEditMode) {
String params = "";
if (common.getConfig().getIgnoreReleaseDate()) {
params += "&fq=released:[* TO *]";
}
if (common.getConfig().getIgnoreExpirationDate()) {
params += "&fq=expired:[* TO *]";
}
if (!params.isEmpty()) {
queryParams = CmsRequestUtil.createParameterMap(params.substring(1));
}
}
CmsSolrQuery query = new CmsSolrQuery(null, queryParams);
m_searchController.addQueryParts(query, m_cms);
try {
// use "complicated" constructor to allow more than 50 results -> set ignoreMaxResults to true
// also set resource filter to allow for returning unreleased/expired resources if necessary.
CmsSolrResultList solrResultList = m_index.search(
m_cms,
query.clone(), // use a clone of the query, since the search function manipulates the query (removes highlighting parts), but we want to keep the original one.
true,
isEditMode ? CmsResourceFilter.IGNORE_EXPIRATION : null);
return new CmsSearchResultWrapper(m_searchController, solrResultList, query, m_cms, null);
} catch (CmsSearchException e) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_TAG_SEARCH_SEARCH_FAILED_0), e);
return new CmsSearchResultWrapper(m_searchController, null, query, m_cms, e);
}
}
|
[
"private",
"I_CmsSearchResultWrapper",
"getSearchResults",
"(",
")",
"{",
"// The second parameter is just ignored - so it does not matter",
"m_searchController",
".",
"updateFromRequestParameters",
"(",
"pageContext",
".",
"getRequest",
"(",
")",
".",
"getParameterMap",
"(",
")",
",",
"false",
")",
";",
"I_CmsSearchControllerCommon",
"common",
"=",
"m_searchController",
".",
"getCommon",
"(",
")",
";",
"// Do not search for empty query, if configured",
"if",
"(",
"common",
".",
"getState",
"(",
")",
".",
"getQuery",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"(",
"!",
"common",
".",
"getConfig",
"(",
")",
".",
"getIgnoreQueryParam",
"(",
")",
"&&",
"!",
"common",
".",
"getConfig",
"(",
")",
".",
"getSearchForEmptyQueryParam",
"(",
")",
")",
")",
"{",
"return",
"new",
"CmsSearchResultWrapper",
"(",
"m_searchController",
",",
"null",
",",
"null",
",",
"m_cms",
",",
"null",
")",
";",
"}",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"queryParams",
"=",
"null",
";",
"boolean",
"isEditMode",
"=",
"CmsJspTagEditable",
".",
"isEditableRequest",
"(",
"pageContext",
".",
"getRequest",
"(",
")",
")",
";",
"if",
"(",
"isEditMode",
")",
"{",
"String",
"params",
"=",
"\"\"",
";",
"if",
"(",
"common",
".",
"getConfig",
"(",
")",
".",
"getIgnoreReleaseDate",
"(",
")",
")",
"{",
"params",
"+=",
"\"&fq=released:[* TO *]\"",
";",
"}",
"if",
"(",
"common",
".",
"getConfig",
"(",
")",
".",
"getIgnoreExpirationDate",
"(",
")",
")",
"{",
"params",
"+=",
"\"&fq=expired:[* TO *]\"",
";",
"}",
"if",
"(",
"!",
"params",
".",
"isEmpty",
"(",
")",
")",
"{",
"queryParams",
"=",
"CmsRequestUtil",
".",
"createParameterMap",
"(",
"params",
".",
"substring",
"(",
"1",
")",
")",
";",
"}",
"}",
"CmsSolrQuery",
"query",
"=",
"new",
"CmsSolrQuery",
"(",
"null",
",",
"queryParams",
")",
";",
"m_searchController",
".",
"addQueryParts",
"(",
"query",
",",
"m_cms",
")",
";",
"try",
"{",
"// use \"complicated\" constructor to allow more than 50 results -> set ignoreMaxResults to true",
"// also set resource filter to allow for returning unreleased/expired resources if necessary.",
"CmsSolrResultList",
"solrResultList",
"=",
"m_index",
".",
"search",
"(",
"m_cms",
",",
"query",
".",
"clone",
"(",
")",
",",
"// use a clone of the query, since the search function manipulates the query (removes highlighting parts), but we want to keep the original one.",
"true",
",",
"isEditMode",
"?",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
":",
"null",
")",
";",
"return",
"new",
"CmsSearchResultWrapper",
"(",
"m_searchController",
",",
"solrResultList",
",",
"query",
",",
"m_cms",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CmsSearchException",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"LOG_TAG_SEARCH_SEARCH_FAILED_0",
")",
",",
"e",
")",
";",
"return",
"new",
"CmsSearchResultWrapper",
"(",
"m_searchController",
",",
"null",
",",
"query",
",",
"m_cms",
",",
"e",
")",
";",
"}",
"}"
] |
Here the search query is composed and executed.
The result is wrapped in an easily usable form.
It is exposed to the JSP via the tag's "var" attribute.
@return The result object exposed via the tag's attribute "var".
|
[
"Here",
"the",
"search",
"query",
"is",
"composed",
"and",
"executed",
".",
"The",
"result",
"is",
"wrapped",
"in",
"an",
"easily",
"usable",
"form",
".",
"It",
"is",
"exposed",
"to",
"the",
"JSP",
"via",
"the",
"tag",
"s",
"var",
"attribute",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagSearch.java#L399-L438
|
158,283 |
alkacon/opencms-core
|
src/org/opencms/jsp/util/CmsJspDateSeriesBean.java
|
CmsJspDateSeriesBean.toDate
|
public Date toDate(Object date) {
Date d = null;
if (null != date) {
if (date instanceof Date) {
d = (Date)date;
} else if (date instanceof Long) {
d = new Date(((Long)date).longValue());
} else {
try {
long l = Long.parseLong(date.toString());
d = new Date(l);
} catch (Exception e) {
// do nothing, just let d remain null
}
}
}
return d;
}
|
java
|
public Date toDate(Object date) {
Date d = null;
if (null != date) {
if (date instanceof Date) {
d = (Date)date;
} else if (date instanceof Long) {
d = new Date(((Long)date).longValue());
} else {
try {
long l = Long.parseLong(date.toString());
d = new Date(l);
} catch (Exception e) {
// do nothing, just let d remain null
}
}
}
return d;
}
|
[
"public",
"Date",
"toDate",
"(",
"Object",
"date",
")",
"{",
"Date",
"d",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"date",
")",
"{",
"if",
"(",
"date",
"instanceof",
"Date",
")",
"{",
"d",
"=",
"(",
"Date",
")",
"date",
";",
"}",
"else",
"if",
"(",
"date",
"instanceof",
"Long",
")",
"{",
"d",
"=",
"new",
"Date",
"(",
"(",
"(",
"Long",
")",
"date",
")",
".",
"longValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"try",
"{",
"long",
"l",
"=",
"Long",
".",
"parseLong",
"(",
"date",
".",
"toString",
"(",
")",
")",
";",
"d",
"=",
"new",
"Date",
"(",
"l",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// do nothing, just let d remain null",
"}",
"}",
"}",
"return",
"d",
";",
"}"
] |
Converts the provided object to a date, if possible.
@param date the date.
@return the date as {@link java.util.Date}
|
[
"Converts",
"the",
"provided",
"object",
"to",
"a",
"date",
"if",
"possible",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspDateSeriesBean.java#L422-L440
|
158,284 |
alkacon/opencms-core
|
src/org/opencms/jlan/CmsJlanThreadManager.java
|
CmsJlanThreadManager.stop
|
public synchronized void stop() {
if (m_thread != null) {
long timeBeforeShutdownWasCalled = System.currentTimeMillis();
JLANServer.shutdownServer(new String[] {});
while (m_thread.isAlive()
&& ((System.currentTimeMillis() - timeBeforeShutdownWasCalled) < MAX_SHUTDOWN_WAIT_MILLIS)) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// ignore
}
}
}
}
|
java
|
public synchronized void stop() {
if (m_thread != null) {
long timeBeforeShutdownWasCalled = System.currentTimeMillis();
JLANServer.shutdownServer(new String[] {});
while (m_thread.isAlive()
&& ((System.currentTimeMillis() - timeBeforeShutdownWasCalled) < MAX_SHUTDOWN_WAIT_MILLIS)) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// ignore
}
}
}
}
|
[
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"m_thread",
"!=",
"null",
")",
"{",
"long",
"timeBeforeShutdownWasCalled",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"JLANServer",
".",
"shutdownServer",
"(",
"new",
"String",
"[",
"]",
"{",
"}",
")",
";",
"while",
"(",
"m_thread",
".",
"isAlive",
"(",
")",
"&&",
"(",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"timeBeforeShutdownWasCalled",
")",
"<",
"MAX_SHUTDOWN_WAIT_MILLIS",
")",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"500",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// ignore\r",
"}",
"}",
"}",
"}"
] |
Tries to stop the JLAN server and return after it is stopped, but will also return if the thread hasn't stopped after MAX_SHUTDOWN_WAIT_MILLIS.
|
[
"Tries",
"to",
"stop",
"the",
"JLAN",
"server",
"and",
"return",
"after",
"it",
"is",
"stopped",
"but",
"will",
"also",
"return",
"if",
"the",
"thread",
"hasn",
"t",
"stopped",
"after",
"MAX_SHUTDOWN_WAIT_MILLIS",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jlan/CmsJlanThreadManager.java#L112-L127
|
158,285 |
alkacon/opencms-core
|
src-setup/org/opencms/setup/CmsUpdateInfo.java
|
CmsUpdateInfo.needToSetCategoryFolder
|
public boolean needToSetCategoryFolder() {
if (m_adeModuleVersion == null) {
return true;
}
CmsModuleVersion categoryFolderUpdateVersion = new CmsModuleVersion("9.0.0");
return (m_adeModuleVersion.compareTo(categoryFolderUpdateVersion) == -1);
}
|
java
|
public boolean needToSetCategoryFolder() {
if (m_adeModuleVersion == null) {
return true;
}
CmsModuleVersion categoryFolderUpdateVersion = new CmsModuleVersion("9.0.0");
return (m_adeModuleVersion.compareTo(categoryFolderUpdateVersion) == -1);
}
|
[
"public",
"boolean",
"needToSetCategoryFolder",
"(",
")",
"{",
"if",
"(",
"m_adeModuleVersion",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"CmsModuleVersion",
"categoryFolderUpdateVersion",
"=",
"new",
"CmsModuleVersion",
"(",
"\"9.0.0\"",
")",
";",
"return",
"(",
"m_adeModuleVersion",
".",
"compareTo",
"(",
"categoryFolderUpdateVersion",
")",
"==",
"-",
"1",
")",
";",
"}"
] |
Checks if the categoryfolder setting needs to be updated.
@return true if the categoryfolder setting needs to be updated
|
[
"Checks",
"if",
"the",
"categoryfolder",
"setting",
"needs",
"to",
"be",
"updated",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsUpdateInfo.java#L58-L65
|
158,286 |
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelWeeklyController.java
|
CmsPatternPanelWeeklyController.setWeekDays
|
public void setWeekDays(SortedSet<WeekDay> weekDays) {
final SortedSet<WeekDay> newWeekDays = null == weekDays ? new TreeSet<WeekDay>() : weekDays;
SortedSet<WeekDay> currentWeekDays = m_model.getWeekDays();
if (!currentWeekDays.equals(newWeekDays)) {
conditionallyRemoveExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekDays(newWeekDays);
onValueChange();
}
}, !newWeekDays.containsAll(m_model.getWeekDays()));
}
}
|
java
|
public void setWeekDays(SortedSet<WeekDay> weekDays) {
final SortedSet<WeekDay> newWeekDays = null == weekDays ? new TreeSet<WeekDay>() : weekDays;
SortedSet<WeekDay> currentWeekDays = m_model.getWeekDays();
if (!currentWeekDays.equals(newWeekDays)) {
conditionallyRemoveExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekDays(newWeekDays);
onValueChange();
}
}, !newWeekDays.containsAll(m_model.getWeekDays()));
}
}
|
[
"public",
"void",
"setWeekDays",
"(",
"SortedSet",
"<",
"WeekDay",
">",
"weekDays",
")",
"{",
"final",
"SortedSet",
"<",
"WeekDay",
">",
"newWeekDays",
"=",
"null",
"==",
"weekDays",
"?",
"new",
"TreeSet",
"<",
"WeekDay",
">",
"(",
")",
":",
"weekDays",
";",
"SortedSet",
"<",
"WeekDay",
">",
"currentWeekDays",
"=",
"m_model",
".",
"getWeekDays",
"(",
")",
";",
"if",
"(",
"!",
"currentWeekDays",
".",
"equals",
"(",
"newWeekDays",
")",
")",
"{",
"conditionallyRemoveExceptionsOnChange",
"(",
"new",
"Command",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
")",
"{",
"m_model",
".",
"setWeekDays",
"(",
"newWeekDays",
")",
";",
"onValueChange",
"(",
")",
";",
"}",
"}",
",",
"!",
"newWeekDays",
".",
"containsAll",
"(",
"m_model",
".",
"getWeekDays",
"(",
")",
")",
")",
";",
"}",
"}"
] |
Set the weekdays at which the event should take place.
@param weekDays the weekdays at which the event should take place.
|
[
"Set",
"the",
"weekdays",
"at",
"which",
"the",
"event",
"should",
"take",
"place",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelWeeklyController.java#L66-L80
|
158,287 |
alkacon/opencms-core
|
src/org/opencms/ui/apps/user/CmsUserEditDialog.java
|
CmsUserEditDialog.switchTab
|
protected void switchTab() {
Component tab = m_tab.getSelectedTab();
int pos = m_tab.getTabPosition(m_tab.getTab(tab));
if (m_isWebOU) {
if (pos == 0) {
pos = 1;
}
}
m_tab.setSelectedTab(pos + 1);
}
|
java
|
protected void switchTab() {
Component tab = m_tab.getSelectedTab();
int pos = m_tab.getTabPosition(m_tab.getTab(tab));
if (m_isWebOU) {
if (pos == 0) {
pos = 1;
}
}
m_tab.setSelectedTab(pos + 1);
}
|
[
"protected",
"void",
"switchTab",
"(",
")",
"{",
"Component",
"tab",
"=",
"m_tab",
".",
"getSelectedTab",
"(",
")",
";",
"int",
"pos",
"=",
"m_tab",
".",
"getTabPosition",
"(",
"m_tab",
".",
"getTab",
"(",
"tab",
")",
")",
";",
"if",
"(",
"m_isWebOU",
")",
"{",
"if",
"(",
"pos",
"==",
"0",
")",
"{",
"pos",
"=",
"1",
";",
"}",
"}",
"m_tab",
".",
"setSelectedTab",
"(",
"pos",
"+",
"1",
")",
";",
"}"
] |
Switches to the next tab.
|
[
"Switches",
"to",
"the",
"next",
"tab",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserEditDialog.java#L836-L846
|
158,288 |
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java
|
CmsListItemWidget.onEditTitleTextBox
|
protected void onEditTitleTextBox(TextBox box) {
if (m_titleEditHandler != null) {
m_titleEditHandler.handleEdit(m_title, box);
return;
}
String text = box.getText();
box.removeFromParent();
m_title.setText(text);
m_title.setVisible(true);
}
|
java
|
protected void onEditTitleTextBox(TextBox box) {
if (m_titleEditHandler != null) {
m_titleEditHandler.handleEdit(m_title, box);
return;
}
String text = box.getText();
box.removeFromParent();
m_title.setText(text);
m_title.setVisible(true);
}
|
[
"protected",
"void",
"onEditTitleTextBox",
"(",
"TextBox",
"box",
")",
"{",
"if",
"(",
"m_titleEditHandler",
"!=",
"null",
")",
"{",
"m_titleEditHandler",
".",
"handleEdit",
"(",
"m_title",
",",
"box",
")",
";",
"return",
";",
"}",
"String",
"text",
"=",
"box",
".",
"getText",
"(",
")",
";",
"box",
".",
"removeFromParent",
"(",
")",
";",
"m_title",
".",
"setText",
"(",
"text",
")",
";",
"m_title",
".",
"setVisible",
"(",
"true",
")",
";",
"}"
] |
Internal method which is called when the user has finished editing the title.
@param box the text box which has been edited
|
[
"Internal",
"method",
"which",
"is",
"called",
"when",
"the",
"user",
"has",
"finished",
"editing",
"the",
"title",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java#L1163-L1175
|
158,289 |
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java
|
CmsPatternPanelMonthlyController.setPatternScheme
|
public void setPatternScheme(final boolean isByWeekDay, final boolean fireChange) {
if (isByWeekDay ^ (null != m_model.getWeekDay())) {
removeExceptionsOnChange(new Command() {
public void execute() {
if (isByWeekDay) {
m_model.setWeekOfMonth(getPatternDefaultValues().getWeekOfMonth());
m_model.setWeekDay(getPatternDefaultValues().getWeekDay());
} else {
m_model.clearWeekDays();
m_model.clearWeeksOfMonth();
m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());
}
m_model.setInterval(getPatternDefaultValues().getInterval());
if (fireChange) {
onValueChange();
}
}
});
}
}
|
java
|
public void setPatternScheme(final boolean isByWeekDay, final boolean fireChange) {
if (isByWeekDay ^ (null != m_model.getWeekDay())) {
removeExceptionsOnChange(new Command() {
public void execute() {
if (isByWeekDay) {
m_model.setWeekOfMonth(getPatternDefaultValues().getWeekOfMonth());
m_model.setWeekDay(getPatternDefaultValues().getWeekDay());
} else {
m_model.clearWeekDays();
m_model.clearWeeksOfMonth();
m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());
}
m_model.setInterval(getPatternDefaultValues().getInterval());
if (fireChange) {
onValueChange();
}
}
});
}
}
|
[
"public",
"void",
"setPatternScheme",
"(",
"final",
"boolean",
"isByWeekDay",
",",
"final",
"boolean",
"fireChange",
")",
"{",
"if",
"(",
"isByWeekDay",
"^",
"(",
"null",
"!=",
"m_model",
".",
"getWeekDay",
"(",
")",
")",
")",
"{",
"removeExceptionsOnChange",
"(",
"new",
"Command",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
")",
"{",
"if",
"(",
"isByWeekDay",
")",
"{",
"m_model",
".",
"setWeekOfMonth",
"(",
"getPatternDefaultValues",
"(",
")",
".",
"getWeekOfMonth",
"(",
")",
")",
";",
"m_model",
".",
"setWeekDay",
"(",
"getPatternDefaultValues",
"(",
")",
".",
"getWeekDay",
"(",
")",
")",
";",
"}",
"else",
"{",
"m_model",
".",
"clearWeekDays",
"(",
")",
";",
"m_model",
".",
"clearWeeksOfMonth",
"(",
")",
";",
"m_model",
".",
"setDayOfMonth",
"(",
"getPatternDefaultValues",
"(",
")",
".",
"getDayOfMonth",
"(",
")",
")",
";",
"}",
"m_model",
".",
"setInterval",
"(",
"getPatternDefaultValues",
"(",
")",
".",
"getInterval",
"(",
")",
")",
";",
"if",
"(",
"fireChange",
")",
"{",
"onValueChange",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"}"
] |
Set the pattern scheme to either "by weekday" or "by day of month".
@param isByWeekDay flag, indicating if the pattern "by weekday" should be set.
@param fireChange flag, indicating if a value change event should be fired.
|
[
"Set",
"the",
"pattern",
"scheme",
"to",
"either",
"by",
"weekday",
"or",
"by",
"day",
"of",
"month",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java#L65-L88
|
158,290 |
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java
|
CmsPatternPanelMonthlyController.setWeekDay
|
public void setWeekDay(String dayString) {
final WeekDay day = WeekDay.valueOf(dayString);
if (m_model.getWeekDay() != day) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekDay(day);
onValueChange();
}
});
}
}
|
java
|
public void setWeekDay(String dayString) {
final WeekDay day = WeekDay.valueOf(dayString);
if (m_model.getWeekDay() != day) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekDay(day);
onValueChange();
}
});
}
}
|
[
"public",
"void",
"setWeekDay",
"(",
"String",
"dayString",
")",
"{",
"final",
"WeekDay",
"day",
"=",
"WeekDay",
".",
"valueOf",
"(",
"dayString",
")",
";",
"if",
"(",
"m_model",
".",
"getWeekDay",
"(",
")",
"!=",
"day",
")",
"{",
"removeExceptionsOnChange",
"(",
"new",
"Command",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
")",
"{",
"m_model",
".",
"setWeekDay",
"(",
"day",
")",
";",
"onValueChange",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Set the week day the event should take place.
@param dayString the day as string.
|
[
"Set",
"the",
"week",
"day",
"the",
"event",
"should",
"take",
"place",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java#L94-L108
|
158,291 |
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java
|
CmsPatternPanelMonthlyController.weeksChange
|
public void weeksChange(String week, Boolean value) {
final WeekOfMonth changedWeek = WeekOfMonth.valueOf(week);
boolean newValue = (null != value) && value.booleanValue();
boolean currentValue = m_model.getWeeksOfMonth().contains(changedWeek);
if (newValue != currentValue) {
if (newValue) {
setPatternScheme(true, false);
m_model.addWeekOfMonth(changedWeek);
onValueChange();
} else {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.removeWeekOfMonth(changedWeek);
onValueChange();
}
});
}
}
}
|
java
|
public void weeksChange(String week, Boolean value) {
final WeekOfMonth changedWeek = WeekOfMonth.valueOf(week);
boolean newValue = (null != value) && value.booleanValue();
boolean currentValue = m_model.getWeeksOfMonth().contains(changedWeek);
if (newValue != currentValue) {
if (newValue) {
setPatternScheme(true, false);
m_model.addWeekOfMonth(changedWeek);
onValueChange();
} else {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.removeWeekOfMonth(changedWeek);
onValueChange();
}
});
}
}
}
|
[
"public",
"void",
"weeksChange",
"(",
"String",
"week",
",",
"Boolean",
"value",
")",
"{",
"final",
"WeekOfMonth",
"changedWeek",
"=",
"WeekOfMonth",
".",
"valueOf",
"(",
"week",
")",
";",
"boolean",
"newValue",
"=",
"(",
"null",
"!=",
"value",
")",
"&&",
"value",
".",
"booleanValue",
"(",
")",
";",
"boolean",
"currentValue",
"=",
"m_model",
".",
"getWeeksOfMonth",
"(",
")",
".",
"contains",
"(",
"changedWeek",
")",
";",
"if",
"(",
"newValue",
"!=",
"currentValue",
")",
"{",
"if",
"(",
"newValue",
")",
"{",
"setPatternScheme",
"(",
"true",
",",
"false",
")",
";",
"m_model",
".",
"addWeekOfMonth",
"(",
"changedWeek",
")",
";",
"onValueChange",
"(",
")",
";",
"}",
"else",
"{",
"removeExceptionsOnChange",
"(",
"new",
"Command",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
")",
"{",
"m_model",
".",
"removeWeekOfMonth",
"(",
"changedWeek",
")",
";",
"onValueChange",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"}"
] |
Handle a change in the weeks of month.
@param week the changed weeks checkbox's internal value.
@param value the new value of the changed checkbox.
|
[
"Handle",
"a",
"change",
"in",
"the",
"weeks",
"of",
"month",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java#L115-L136
|
158,292 |
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java
|
CmsAliasList.validateAliases
|
public void validateAliases(
final CmsUUID uuid,
final Map<String, String> aliasPaths,
final AsyncCallback<Map<String, String>> callback) {
CmsRpcAction<Map<String, String>> action = new CmsRpcAction<Map<String, String>>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(200, true);
CmsCoreProvider.getVfsService().validateAliases(uuid, aliasPaths, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(Map<String, String> result) {
stop(false);
callback.onSuccess(result);
}
};
action.execute();
}
|
java
|
public void validateAliases(
final CmsUUID uuid,
final Map<String, String> aliasPaths,
final AsyncCallback<Map<String, String>> callback) {
CmsRpcAction<Map<String, String>> action = new CmsRpcAction<Map<String, String>>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(200, true);
CmsCoreProvider.getVfsService().validateAliases(uuid, aliasPaths, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(Map<String, String> result) {
stop(false);
callback.onSuccess(result);
}
};
action.execute();
}
|
[
"public",
"void",
"validateAliases",
"(",
"final",
"CmsUUID",
"uuid",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"aliasPaths",
",",
"final",
"AsyncCallback",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"callback",
")",
"{",
"CmsRpcAction",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"action",
"=",
"new",
"CmsRpcAction",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
")",
"{",
"/**\r\n * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()\r\n */",
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"{",
"start",
"(",
"200",
",",
"true",
")",
";",
"CmsCoreProvider",
".",
"getVfsService",
"(",
")",
".",
"validateAliases",
"(",
"uuid",
",",
"aliasPaths",
",",
"this",
")",
";",
"}",
"/**\r\n * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)\r\n */",
"@",
"Override",
"protected",
"void",
"onResponse",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"result",
")",
"{",
"stop",
"(",
"false",
")",
";",
"callback",
".",
"onSuccess",
"(",
"result",
")",
";",
"}",
"}",
";",
"action",
".",
"execute",
"(",
")",
";",
"}"
] |
Validates aliases.
@param uuid The structure id for which the aliases should be valid
@param aliasPaths a map from id strings to alias paths
@param callback the callback which should be called with the validation results
|
[
"Validates",
"aliases",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java#L423-L452
|
158,293 |
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/A_CmsPatternPanelController.java
|
A_CmsPatternPanelController.setDayOfMonth
|
void setDayOfMonth(String day) {
final int i = CmsSerialDateUtil.toIntWithDefault(day, -1);
if (m_model.getDayOfMonth() != i) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setDayOfMonth(i);
onValueChange();
}
});
}
}
|
java
|
void setDayOfMonth(String day) {
final int i = CmsSerialDateUtil.toIntWithDefault(day, -1);
if (m_model.getDayOfMonth() != i) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setDayOfMonth(i);
onValueChange();
}
});
}
}
|
[
"void",
"setDayOfMonth",
"(",
"String",
"day",
")",
"{",
"final",
"int",
"i",
"=",
"CmsSerialDateUtil",
".",
"toIntWithDefault",
"(",
"day",
",",
"-",
"1",
")",
";",
"if",
"(",
"m_model",
".",
"getDayOfMonth",
"(",
")",
"!=",
"i",
")",
"{",
"removeExceptionsOnChange",
"(",
"new",
"Command",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
")",
"{",
"m_model",
".",
"setDayOfMonth",
"(",
"i",
")",
";",
"onValueChange",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Sets the day of the month.
@param day the day to set.
|
[
"Sets",
"the",
"day",
"of",
"the",
"month",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/A_CmsPatternPanelController.java#L99-L112
|
158,294 |
alkacon/opencms-core
|
src/org/opencms/ui/report/CmsStreamReportWidget.java
|
CmsStreamReportWidget.convertOutputToHtml
|
private String convertOutputToHtml(String content) {
if (content.length() == 0) {
return "";
}
StringBuilder buffer = new StringBuilder();
for (String line : content.split("\n")) {
buffer.append(CmsEncoder.escapeXml(line) + "<br>");
}
return buffer.toString();
}
|
java
|
private String convertOutputToHtml(String content) {
if (content.length() == 0) {
return "";
}
StringBuilder buffer = new StringBuilder();
for (String line : content.split("\n")) {
buffer.append(CmsEncoder.escapeXml(line) + "<br>");
}
return buffer.toString();
}
|
[
"private",
"String",
"convertOutputToHtml",
"(",
"String",
"content",
")",
"{",
"if",
"(",
"content",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"line",
":",
"content",
".",
"split",
"(",
"\"\\n\"",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"CmsEncoder",
".",
"escapeXml",
"(",
"line",
")",
"+",
"\"<br>\"",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] |
Converts the text stream data to HTML form.
@param content the content to convert
@return the HTML version of the content
|
[
"Converts",
"the",
"text",
"stream",
"data",
"to",
"HTML",
"form",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/report/CmsStreamReportWidget.java#L166-L176
|
158,295 |
alkacon/opencms-core
|
src/org/opencms/ui/report/CmsStreamReportWidget.java
|
CmsStreamReportWidget.writeToDelegate
|
private void writeToDelegate(byte[] data) {
if (m_delegateStream != null) {
try {
m_delegateStream.write(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
|
java
|
private void writeToDelegate(byte[] data) {
if (m_delegateStream != null) {
try {
m_delegateStream.write(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
|
[
"private",
"void",
"writeToDelegate",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"m_delegateStream",
"!=",
"null",
")",
"{",
"try",
"{",
"m_delegateStream",
".",
"write",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"}"
] |
Writes data to delegate stream if it has been set.
@param data the data to write
|
[
"Writes",
"data",
"to",
"delegate",
"stream",
"if",
"it",
"has",
"been",
"set",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/report/CmsStreamReportWidget.java#L183-L192
|
158,296 |
alkacon/opencms-core
|
src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java
|
CmsUserInfoDialog.getStatusForItem
|
public static String getStatusForItem(Long lastActivity) {
if (lastActivity.longValue() < CmsSessionsTable.INACTIVE_LIMIT) {
return CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_COLS_STATUS_ACTIVE_0);
}
return CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_COLS_STATUS_INACTIVE_0);
}
|
java
|
public static String getStatusForItem(Long lastActivity) {
if (lastActivity.longValue() < CmsSessionsTable.INACTIVE_LIMIT) {
return CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_COLS_STATUS_ACTIVE_0);
}
return CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_COLS_STATUS_INACTIVE_0);
}
|
[
"public",
"static",
"String",
"getStatusForItem",
"(",
"Long",
"lastActivity",
")",
"{",
"if",
"(",
"lastActivity",
".",
"longValue",
"(",
")",
"<",
"CmsSessionsTable",
".",
"INACTIVE_LIMIT",
")",
"{",
"return",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_MESSAGES_BROADCAST_COLS_STATUS_ACTIVE_0",
")",
";",
"}",
"return",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_MESSAGES_BROADCAST_COLS_STATUS_INACTIVE_0",
")",
";",
"}"
] |
Gets the status text from given session.
@param lastActivity miliseconds since last activity
@return status string
|
[
"Gets",
"the",
"status",
"text",
"from",
"given",
"session",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java#L136-L142
|
158,297 |
alkacon/opencms-core
|
src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java
|
CmsUserInfoDialog.showUserInfo
|
public static void showUserInfo(CmsSessionInfo session) {
final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
CmsUserInfoDialog dialog = new CmsUserInfoDialog(session, new Runnable() {
public void run() {
window.close();
}
});
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_SHOW_USER_0));
window.setContent(dialog);
A_CmsUI.get().addWindow(window);
}
|
java
|
public static void showUserInfo(CmsSessionInfo session) {
final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
CmsUserInfoDialog dialog = new CmsUserInfoDialog(session, new Runnable() {
public void run() {
window.close();
}
});
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_SHOW_USER_0));
window.setContent(dialog);
A_CmsUI.get().addWindow(window);
}
|
[
"public",
"static",
"void",
"showUserInfo",
"(",
"CmsSessionInfo",
"session",
")",
"{",
"final",
"Window",
"window",
"=",
"CmsBasicDialog",
".",
"prepareWindow",
"(",
"DialogWidth",
".",
"wide",
")",
";",
"CmsUserInfoDialog",
"dialog",
"=",
"new",
"CmsUserInfoDialog",
"(",
"session",
",",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"window",
".",
"close",
"(",
")",
";",
"}",
"}",
")",
";",
"window",
".",
"setCaption",
"(",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_MESSAGES_SHOW_USER_0",
")",
")",
";",
"window",
".",
"setContent",
"(",
"dialog",
")",
";",
"A_CmsUI",
".",
"get",
"(",
")",
".",
"addWindow",
"(",
"window",
")",
";",
"}"
] |
Shows a dialog with user information for given session.
@param session to show information for
|
[
"Shows",
"a",
"dialog",
"with",
"user",
"information",
"for",
"given",
"session",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java#L163-L177
|
158,298 |
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsSliderMap.java
|
CmsSliderMap.onBrowserEvent
|
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEUP:
Event.releaseCapture(m_slider.getElement());
m_capturedMouse = false;
break;
case Event.ONMOUSEDOWN:
Event.setCapture(m_slider.getElement());
m_capturedMouse = true;
//$FALL-THROUGH$
case Event.ONMOUSEMOVE:
if (m_capturedMouse) {
event.preventDefault();
float x = ((event.getClientX() - (m_colorUnderlay.getAbsoluteLeft())) + Window.getScrollLeft());
float y = ((event.getClientY() - (m_colorUnderlay.getAbsoluteTop())) + Window.getScrollTop());
if (m_parent != null) {
m_parent.onMapSelected(x, y);
}
setSliderPosition(x, y);
}
//$FALL-THROUGH$
default:
}
}
|
java
|
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEUP:
Event.releaseCapture(m_slider.getElement());
m_capturedMouse = false;
break;
case Event.ONMOUSEDOWN:
Event.setCapture(m_slider.getElement());
m_capturedMouse = true;
//$FALL-THROUGH$
case Event.ONMOUSEMOVE:
if (m_capturedMouse) {
event.preventDefault();
float x = ((event.getClientX() - (m_colorUnderlay.getAbsoluteLeft())) + Window.getScrollLeft());
float y = ((event.getClientY() - (m_colorUnderlay.getAbsoluteTop())) + Window.getScrollTop());
if (m_parent != null) {
m_parent.onMapSelected(x, y);
}
setSliderPosition(x, y);
}
//$FALL-THROUGH$
default:
}
}
|
[
"@",
"Override",
"public",
"void",
"onBrowserEvent",
"(",
"Event",
"event",
")",
"{",
"super",
".",
"onBrowserEvent",
"(",
"event",
")",
";",
"switch",
"(",
"DOM",
".",
"eventGetType",
"(",
"event",
")",
")",
"{",
"case",
"Event",
".",
"ONMOUSEUP",
":",
"Event",
".",
"releaseCapture",
"(",
"m_slider",
".",
"getElement",
"(",
")",
")",
";",
"m_capturedMouse",
"=",
"false",
";",
"break",
";",
"case",
"Event",
".",
"ONMOUSEDOWN",
":",
"Event",
".",
"setCapture",
"(",
"m_slider",
".",
"getElement",
"(",
")",
")",
";",
"m_capturedMouse",
"=",
"true",
";",
"//$FALL-THROUGH$\r",
"case",
"Event",
".",
"ONMOUSEMOVE",
":",
"if",
"(",
"m_capturedMouse",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"float",
"x",
"=",
"(",
"(",
"event",
".",
"getClientX",
"(",
")",
"-",
"(",
"m_colorUnderlay",
".",
"getAbsoluteLeft",
"(",
")",
")",
")",
"+",
"Window",
".",
"getScrollLeft",
"(",
")",
")",
";",
"float",
"y",
"=",
"(",
"(",
"event",
".",
"getClientY",
"(",
")",
"-",
"(",
"m_colorUnderlay",
".",
"getAbsoluteTop",
"(",
")",
")",
")",
"+",
"Window",
".",
"getScrollTop",
"(",
")",
")",
";",
"if",
"(",
"m_parent",
"!=",
"null",
")",
"{",
"m_parent",
".",
"onMapSelected",
"(",
"x",
",",
"y",
")",
";",
"}",
"setSliderPosition",
"(",
"x",
",",
"y",
")",
";",
"}",
"//$FALL-THROUGH$\r",
"default",
":",
"}",
"}"
] |
Fired whenever a browser event is received.
@param event Event to process
|
[
"Fired",
"whenever",
"a",
"browser",
"event",
"is",
"received",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsSliderMap.java#L108-L138
|
158,299 |
alkacon/opencms-core
|
src/org/opencms/ui/apps/user/CmsOuTree.java
|
CmsOuTree.addChildrenForGroupsNode
|
private void addChildrenForGroupsNode(I_CmsOuTreeType type, String ouItem) {
try {
// Cut of type-specific prefix from ouItem with substring()
List<CmsGroup> groups = m_app.readGroupsForOu(m_cms, ouItem.substring(1), type, false);
for (CmsGroup group : groups) {
Pair<String, CmsUUID> key = Pair.of(type.getId(), group.getId());
Item groupItem = m_treeContainer.addItem(key);
if (groupItem == null) {
groupItem = getItem(key);
}
groupItem.getItemProperty(PROP_SID).setValue(group.getId());
groupItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(group, CmsOuTreeType.GROUP));
groupItem.getItemProperty(PROP_TYPE).setValue(type);
setChildrenAllowed(key, false);
m_treeContainer.setParent(key, ouItem);
}
} catch (CmsException e) {
LOG.error("Can not read group", e);
}
}
|
java
|
private void addChildrenForGroupsNode(I_CmsOuTreeType type, String ouItem) {
try {
// Cut of type-specific prefix from ouItem with substring()
List<CmsGroup> groups = m_app.readGroupsForOu(m_cms, ouItem.substring(1), type, false);
for (CmsGroup group : groups) {
Pair<String, CmsUUID> key = Pair.of(type.getId(), group.getId());
Item groupItem = m_treeContainer.addItem(key);
if (groupItem == null) {
groupItem = getItem(key);
}
groupItem.getItemProperty(PROP_SID).setValue(group.getId());
groupItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(group, CmsOuTreeType.GROUP));
groupItem.getItemProperty(PROP_TYPE).setValue(type);
setChildrenAllowed(key, false);
m_treeContainer.setParent(key, ouItem);
}
} catch (CmsException e) {
LOG.error("Can not read group", e);
}
}
|
[
"private",
"void",
"addChildrenForGroupsNode",
"(",
"I_CmsOuTreeType",
"type",
",",
"String",
"ouItem",
")",
"{",
"try",
"{",
"// Cut of type-specific prefix from ouItem with substring()",
"List",
"<",
"CmsGroup",
">",
"groups",
"=",
"m_app",
".",
"readGroupsForOu",
"(",
"m_cms",
",",
"ouItem",
".",
"substring",
"(",
"1",
")",
",",
"type",
",",
"false",
")",
";",
"for",
"(",
"CmsGroup",
"group",
":",
"groups",
")",
"{",
"Pair",
"<",
"String",
",",
"CmsUUID",
">",
"key",
"=",
"Pair",
".",
"of",
"(",
"type",
".",
"getId",
"(",
")",
",",
"group",
".",
"getId",
"(",
")",
")",
";",
"Item",
"groupItem",
"=",
"m_treeContainer",
".",
"addItem",
"(",
"key",
")",
";",
"if",
"(",
"groupItem",
"==",
"null",
")",
"{",
"groupItem",
"=",
"getItem",
"(",
"key",
")",
";",
"}",
"groupItem",
".",
"getItemProperty",
"(",
"PROP_SID",
")",
".",
"setValue",
"(",
"group",
".",
"getId",
"(",
")",
")",
";",
"groupItem",
".",
"getItemProperty",
"(",
"PROP_NAME",
")",
".",
"setValue",
"(",
"getIconCaptionHTML",
"(",
"group",
",",
"CmsOuTreeType",
".",
"GROUP",
")",
")",
";",
"groupItem",
".",
"getItemProperty",
"(",
"PROP_TYPE",
")",
".",
"setValue",
"(",
"type",
")",
";",
"setChildrenAllowed",
"(",
"key",
",",
"false",
")",
";",
"m_treeContainer",
".",
"setParent",
"(",
"key",
",",
"ouItem",
")",
";",
"}",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Can not read group\"",
",",
"e",
")",
";",
"}",
"}"
] |
Add groups for given group parent item.
@param type the tree type
@param ouItem group parent item
|
[
"Add",
"groups",
"for",
"given",
"group",
"parent",
"item",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsOuTree.java#L257-L277
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.