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,100
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDialog.java
|
CmsFavoriteDialog.doSave
|
protected void doSave() {
List<CmsFavoriteEntry> entries = getEntries();
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
}
|
java
|
protected void doSave() {
List<CmsFavoriteEntry> entries = getEntries();
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
}
|
[
"protected",
"void",
"doSave",
"(",
")",
"{",
"List",
"<",
"CmsFavoriteEntry",
">",
"entries",
"=",
"getEntries",
"(",
")",
";",
"try",
"{",
"m_favDao",
".",
"saveFavorites",
"(",
"entries",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"CmsErrorDialog",
".",
"showErrorDialog",
"(",
"e",
")",
";",
"}",
"}"
] |
Saves the list of currently displayed favorites.
|
[
"Saves",
"the",
"list",
"of",
"currently",
"displayed",
"favorites",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L273-L281
|
158,101
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDialog.java
|
CmsFavoriteDialog.getEntries
|
List<CmsFavoriteEntry> getEntries() {
List<CmsFavoriteEntry> result = new ArrayList<>();
for (I_CmsEditableGroupRow row : m_group.getRows()) {
CmsFavoriteEntry entry = ((CmsFavInfo)row).getEntry();
result.add(entry);
}
return result;
}
|
java
|
List<CmsFavoriteEntry> getEntries() {
List<CmsFavoriteEntry> result = new ArrayList<>();
for (I_CmsEditableGroupRow row : m_group.getRows()) {
CmsFavoriteEntry entry = ((CmsFavInfo)row).getEntry();
result.add(entry);
}
return result;
}
|
[
"List",
"<",
"CmsFavoriteEntry",
">",
"getEntries",
"(",
")",
"{",
"List",
"<",
"CmsFavoriteEntry",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"I_CmsEditableGroupRow",
"row",
":",
"m_group",
".",
"getRows",
"(",
")",
")",
"{",
"CmsFavoriteEntry",
"entry",
"=",
"(",
"(",
"CmsFavInfo",
")",
"row",
")",
".",
"getEntry",
"(",
")",
";",
"result",
".",
"add",
"(",
"entry",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Gets the favorite entries corresponding to the currently displayed favorite widgets.
@return the list of favorite entries
|
[
"Gets",
"the",
"favorite",
"entries",
"corresponding",
"to",
"the",
"currently",
"displayed",
"favorite",
"widgets",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L296-L304
|
158,102
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDialog.java
|
CmsFavoriteDialog.createFavInfo
|
private CmsFavInfo createFavInfo(CmsFavoriteEntry entry) throws CmsException {
String title = "";
String subtitle = "";
CmsFavInfo result = new CmsFavInfo(entry);
CmsObject cms = A_CmsUI.getCmsObject();
String project = getProject(cms, entry);
String site = getSite(cms, entry);
try {
CmsUUID idToLoad = entry.getDetailId() != null ? entry.getDetailId() : entry.getStructureId();
CmsResource resource = cms.readResource(idToLoad, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible());
CmsResourceUtil resutil = new CmsResourceUtil(cms, resource);
switch (entry.getType()) {
case explorerFolder:
title = CmsStringUtil.isEmpty(resutil.getTitle())
? CmsResource.getName(resource.getRootPath())
: resutil.getTitle();
break;
case page:
title = resutil.getTitle();
break;
}
subtitle = resource.getRootPath();
CmsResourceIcon icon = result.getResourceIcon();
icon.initContent(resutil, CmsResource.STATE_UNCHANGED, false, false);
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
result.getTopLine().setValue(title);
result.getBottomLine().setValue(subtitle);
result.getProjectLabel().setValue(project);
result.getSiteLabel().setValue(site);
return result;
}
|
java
|
private CmsFavInfo createFavInfo(CmsFavoriteEntry entry) throws CmsException {
String title = "";
String subtitle = "";
CmsFavInfo result = new CmsFavInfo(entry);
CmsObject cms = A_CmsUI.getCmsObject();
String project = getProject(cms, entry);
String site = getSite(cms, entry);
try {
CmsUUID idToLoad = entry.getDetailId() != null ? entry.getDetailId() : entry.getStructureId();
CmsResource resource = cms.readResource(idToLoad, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible());
CmsResourceUtil resutil = new CmsResourceUtil(cms, resource);
switch (entry.getType()) {
case explorerFolder:
title = CmsStringUtil.isEmpty(resutil.getTitle())
? CmsResource.getName(resource.getRootPath())
: resutil.getTitle();
break;
case page:
title = resutil.getTitle();
break;
}
subtitle = resource.getRootPath();
CmsResourceIcon icon = result.getResourceIcon();
icon.initContent(resutil, CmsResource.STATE_UNCHANGED, false, false);
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
result.getTopLine().setValue(title);
result.getBottomLine().setValue(subtitle);
result.getProjectLabel().setValue(project);
result.getSiteLabel().setValue(site);
return result;
}
|
[
"private",
"CmsFavInfo",
"createFavInfo",
"(",
"CmsFavoriteEntry",
"entry",
")",
"throws",
"CmsException",
"{",
"String",
"title",
"=",
"\"\"",
";",
"String",
"subtitle",
"=",
"\"\"",
";",
"CmsFavInfo",
"result",
"=",
"new",
"CmsFavInfo",
"(",
"entry",
")",
";",
"CmsObject",
"cms",
"=",
"A_CmsUI",
".",
"getCmsObject",
"(",
")",
";",
"String",
"project",
"=",
"getProject",
"(",
"cms",
",",
"entry",
")",
";",
"String",
"site",
"=",
"getSite",
"(",
"cms",
",",
"entry",
")",
";",
"try",
"{",
"CmsUUID",
"idToLoad",
"=",
"entry",
".",
"getDetailId",
"(",
")",
"!=",
"null",
"?",
"entry",
".",
"getDetailId",
"(",
")",
":",
"entry",
".",
"getStructureId",
"(",
")",
";",
"CmsResource",
"resource",
"=",
"cms",
".",
"readResource",
"(",
"idToLoad",
",",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
".",
"addRequireVisible",
"(",
")",
")",
";",
"CmsResourceUtil",
"resutil",
"=",
"new",
"CmsResourceUtil",
"(",
"cms",
",",
"resource",
")",
";",
"switch",
"(",
"entry",
".",
"getType",
"(",
")",
")",
"{",
"case",
"explorerFolder",
":",
"title",
"=",
"CmsStringUtil",
".",
"isEmpty",
"(",
"resutil",
".",
"getTitle",
"(",
")",
")",
"?",
"CmsResource",
".",
"getName",
"(",
"resource",
".",
"getRootPath",
"(",
")",
")",
":",
"resutil",
".",
"getTitle",
"(",
")",
";",
"break",
";",
"case",
"page",
":",
"title",
"=",
"resutil",
".",
"getTitle",
"(",
")",
";",
"break",
";",
"}",
"subtitle",
"=",
"resource",
".",
"getRootPath",
"(",
")",
";",
"CmsResourceIcon",
"icon",
"=",
"result",
".",
"getResourceIcon",
"(",
")",
";",
"icon",
".",
"initContent",
"(",
"resutil",
",",
"CmsResource",
".",
"STATE_UNCHANGED",
",",
"false",
",",
"false",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"result",
".",
"getTopLine",
"(",
")",
".",
"setValue",
"(",
"title",
")",
";",
"result",
".",
"getBottomLine",
"(",
")",
".",
"setValue",
"(",
"subtitle",
")",
";",
"result",
".",
"getProjectLabel",
"(",
")",
".",
"setValue",
"(",
"project",
")",
";",
"result",
".",
"getSiteLabel",
"(",
")",
".",
"setValue",
"(",
"site",
")",
";",
"return",
"result",
";",
"}"
] |
Creates a favorite widget for a favorite entry.
@param entry the favorite entry
@return the favorite widget
@throws CmsException if something goes wrong
|
[
"Creates",
"a",
"favorite",
"widget",
"for",
"a",
"favorite",
"entry",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L314-L349
|
158,103
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDialog.java
|
CmsFavoriteDialog.getEntry
|
private CmsFavoriteEntry getEntry(Component row) {
if (row instanceof CmsFavInfo) {
return ((CmsFavInfo)row).getEntry();
}
return null;
}
|
java
|
private CmsFavoriteEntry getEntry(Component row) {
if (row instanceof CmsFavInfo) {
return ((CmsFavInfo)row).getEntry();
}
return null;
}
|
[
"private",
"CmsFavoriteEntry",
"getEntry",
"(",
"Component",
"row",
")",
"{",
"if",
"(",
"row",
"instanceof",
"CmsFavInfo",
")",
"{",
"return",
"(",
"(",
"CmsFavInfo",
")",
"row",
")",
".",
"getEntry",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Gets the favorite entry for a given row.
@param row the widget used to display the favorite
@return the favorite entry for the widget
|
[
"Gets",
"the",
"favorite",
"entry",
"for",
"a",
"given",
"row",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L357-L366
|
158,104
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDialog.java
|
CmsFavoriteDialog.getProject
|
private String getProject(CmsObject cms, CmsFavoriteEntry entry) throws CmsException {
String result = m_projectLabels.get(entry.getProjectId());
if (result == null) {
result = cms.readProject(entry.getProjectId()).getName();
m_projectLabels.put(entry.getProjectId(), result);
}
return result;
}
|
java
|
private String getProject(CmsObject cms, CmsFavoriteEntry entry) throws CmsException {
String result = m_projectLabels.get(entry.getProjectId());
if (result == null) {
result = cms.readProject(entry.getProjectId()).getName();
m_projectLabels.put(entry.getProjectId(), result);
}
return result;
}
|
[
"private",
"String",
"getProject",
"(",
"CmsObject",
"cms",
",",
"CmsFavoriteEntry",
"entry",
")",
"throws",
"CmsException",
"{",
"String",
"result",
"=",
"m_projectLabels",
".",
"get",
"(",
"entry",
".",
"getProjectId",
"(",
")",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"cms",
".",
"readProject",
"(",
"entry",
".",
"getProjectId",
"(",
")",
")",
".",
"getName",
"(",
")",
";",
"m_projectLabels",
".",
"put",
"(",
"entry",
".",
"getProjectId",
"(",
")",
",",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Gets the project name for a favorite entry.
@param cms the CMS context
@param entry the favorite entry
@return the project name for the favorite entry
@throws CmsException if something goes wrong
|
[
"Gets",
"the",
"project",
"name",
"for",
"a",
"favorite",
"entry",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L376-L384
|
158,105
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDialog.java
|
CmsFavoriteDialog.getSite
|
private String getSite(CmsObject cms, CmsFavoriteEntry entry) {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(entry.getSiteRoot());
Item item = m_sitesContainer.getItem(entry.getSiteRoot());
if (item != null) {
return (String)(item.getItemProperty("caption").getValue());
}
String result = entry.getSiteRoot();
if (site != null) {
if (!CmsStringUtil.isEmpty(site.getTitle())) {
result = site.getTitle();
}
}
return result;
}
|
java
|
private String getSite(CmsObject cms, CmsFavoriteEntry entry) {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(entry.getSiteRoot());
Item item = m_sitesContainer.getItem(entry.getSiteRoot());
if (item != null) {
return (String)(item.getItemProperty("caption").getValue());
}
String result = entry.getSiteRoot();
if (site != null) {
if (!CmsStringUtil.isEmpty(site.getTitle())) {
result = site.getTitle();
}
}
return result;
}
|
[
"private",
"String",
"getSite",
"(",
"CmsObject",
"cms",
",",
"CmsFavoriteEntry",
"entry",
")",
"{",
"CmsSite",
"site",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"getSiteForRootPath",
"(",
"entry",
".",
"getSiteRoot",
"(",
")",
")",
";",
"Item",
"item",
"=",
"m_sitesContainer",
".",
"getItem",
"(",
"entry",
".",
"getSiteRoot",
"(",
")",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"return",
"(",
"String",
")",
"(",
"item",
".",
"getItemProperty",
"(",
"\"caption\"",
")",
".",
"getValue",
"(",
")",
")",
";",
"}",
"String",
"result",
"=",
"entry",
".",
"getSiteRoot",
"(",
")",
";",
"if",
"(",
"site",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"CmsStringUtil",
".",
"isEmpty",
"(",
"site",
".",
"getTitle",
"(",
")",
")",
")",
"{",
"result",
"=",
"site",
".",
"getTitle",
"(",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Gets the site label for the entry.
@param cms the current CMS context
@param entry the entry
@return the site label for the entry
|
[
"Gets",
"the",
"site",
"label",
"for",
"the",
"entry",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L393-L407
|
158,106
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDialog.java
|
CmsFavoriteDialog.onClickAdd
|
private void onClickAdd() {
if (m_currentLocation.isPresent()) {
CmsFavoriteEntry entry = m_currentLocation.get();
List<CmsFavoriteEntry> entries = getEntries();
entries.add(entry);
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
m_context.close();
}
}
|
java
|
private void onClickAdd() {
if (m_currentLocation.isPresent()) {
CmsFavoriteEntry entry = m_currentLocation.get();
List<CmsFavoriteEntry> entries = getEntries();
entries.add(entry);
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
m_context.close();
}
}
|
[
"private",
"void",
"onClickAdd",
"(",
")",
"{",
"if",
"(",
"m_currentLocation",
".",
"isPresent",
"(",
")",
")",
"{",
"CmsFavoriteEntry",
"entry",
"=",
"m_currentLocation",
".",
"get",
"(",
")",
";",
"List",
"<",
"CmsFavoriteEntry",
">",
"entries",
"=",
"getEntries",
"(",
")",
";",
"entries",
".",
"add",
"(",
"entry",
")",
";",
"try",
"{",
"m_favDao",
".",
"saveFavorites",
"(",
"entries",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"CmsErrorDialog",
".",
"showErrorDialog",
"(",
"e",
")",
";",
"}",
"m_context",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
The click handler for the add button.
|
[
"The",
"click",
"handler",
"for",
"the",
"add",
"button",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L412-L425
|
158,107
|
alkacon/opencms-core
|
src/org/opencms/jsp/CmsJspTagNavigation.java
|
CmsJspTagNavigation.setLocale
|
public void setLocale(String locale) {
try {
m_locale = LocaleUtils.toLocale(locale);
} catch (IllegalArgumentException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, "cms:navigation"), e);
m_locale = null;
}
}
|
java
|
public void setLocale(String locale) {
try {
m_locale = LocaleUtils.toLocale(locale);
} catch (IllegalArgumentException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, "cms:navigation"), e);
m_locale = null;
}
}
|
[
"public",
"void",
"setLocale",
"(",
"String",
"locale",
")",
"{",
"try",
"{",
"m_locale",
"=",
"LocaleUtils",
".",
"toLocale",
"(",
"locale",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"ERR_TAG_INVALID_LOCALE_1",
",",
"\"cms:navigation\"",
")",
",",
"e",
")",
";",
"m_locale",
"=",
"null",
";",
"}",
"}"
] |
Sets the locale for which the property should be read.
@param locale the locale for which the property should be read.
|
[
"Sets",
"the",
"locale",
"for",
"which",
"the",
"property",
"should",
"be",
"read",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagNavigation.java#L220-L228
|
158,108
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDAO.java
|
CmsFavoriteDAO.loadFavorites
|
public List<CmsFavoriteEntry> loadFavorites() throws CmsException {
List<CmsFavoriteEntry> result = new ArrayList<>();
try {
CmsUser user = readUser();
String data = (String)user.getAdditionalInfo(ADDINFO_KEY);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(data)) {
return new ArrayList<>();
}
JSONObject json = new JSONObject(data);
JSONArray array = json.getJSONArray(BASE_KEY);
for (int i = 0; i < array.length(); i++) {
JSONObject fav = array.getJSONObject(i);
try {
CmsFavoriteEntry entry = new CmsFavoriteEntry(fav);
if (validate(entry)) {
result.add(entry);
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
} catch (JSONException e) {
LOG.error(e.getLocalizedMessage(), e);
}
return result;
}
|
java
|
public List<CmsFavoriteEntry> loadFavorites() throws CmsException {
List<CmsFavoriteEntry> result = new ArrayList<>();
try {
CmsUser user = readUser();
String data = (String)user.getAdditionalInfo(ADDINFO_KEY);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(data)) {
return new ArrayList<>();
}
JSONObject json = new JSONObject(data);
JSONArray array = json.getJSONArray(BASE_KEY);
for (int i = 0; i < array.length(); i++) {
JSONObject fav = array.getJSONObject(i);
try {
CmsFavoriteEntry entry = new CmsFavoriteEntry(fav);
if (validate(entry)) {
result.add(entry);
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
} catch (JSONException e) {
LOG.error(e.getLocalizedMessage(), e);
}
return result;
}
|
[
"public",
"List",
"<",
"CmsFavoriteEntry",
">",
"loadFavorites",
"(",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsFavoriteEntry",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"CmsUser",
"user",
"=",
"readUser",
"(",
")",
";",
"String",
"data",
"=",
"(",
"String",
")",
"user",
".",
"getAdditionalInfo",
"(",
"ADDINFO_KEY",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"data",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
"data",
")",
";",
"JSONArray",
"array",
"=",
"json",
".",
"getJSONArray",
"(",
"BASE_KEY",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"JSONObject",
"fav",
"=",
"array",
".",
"getJSONObject",
"(",
"i",
")",
";",
"try",
"{",
"CmsFavoriteEntry",
"entry",
"=",
"new",
"CmsFavoriteEntry",
"(",
"fav",
")",
";",
"if",
"(",
"validate",
"(",
"entry",
")",
")",
"{",
"result",
".",
"add",
"(",
"entry",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Loads the favorite list.
@return the list of favorites
@throws CmsException if something goes wrong
|
[
"Loads",
"the",
"favorite",
"list",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDAO.java#L120-L147
|
158,109
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDAO.java
|
CmsFavoriteDAO.saveFavorites
|
public void saveFavorites(List<CmsFavoriteEntry> favorites) throws CmsException {
try {
JSONObject json = new JSONObject();
JSONArray array = new JSONArray();
for (CmsFavoriteEntry entry : favorites) {
array.put(entry.toJson());
}
json.put(BASE_KEY, array);
String data = json.toString();
CmsUser user = readUser();
user.setAdditionalInfo(ADDINFO_KEY, data);
m_cms.writeUser(user);
} catch (JSONException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
|
java
|
public void saveFavorites(List<CmsFavoriteEntry> favorites) throws CmsException {
try {
JSONObject json = new JSONObject();
JSONArray array = new JSONArray();
for (CmsFavoriteEntry entry : favorites) {
array.put(entry.toJson());
}
json.put(BASE_KEY, array);
String data = json.toString();
CmsUser user = readUser();
user.setAdditionalInfo(ADDINFO_KEY, data);
m_cms.writeUser(user);
} catch (JSONException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
|
[
"public",
"void",
"saveFavorites",
"(",
"List",
"<",
"CmsFavoriteEntry",
">",
"favorites",
")",
"throws",
"CmsException",
"{",
"try",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
")",
";",
"JSONArray",
"array",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"CmsFavoriteEntry",
"entry",
":",
"favorites",
")",
"{",
"array",
".",
"put",
"(",
"entry",
".",
"toJson",
"(",
")",
")",
";",
"}",
"json",
".",
"put",
"(",
"BASE_KEY",
",",
"array",
")",
";",
"String",
"data",
"=",
"json",
".",
"toString",
"(",
")",
";",
"CmsUser",
"user",
"=",
"readUser",
"(",
")",
";",
"user",
".",
"setAdditionalInfo",
"(",
"ADDINFO_KEY",
",",
"data",
")",
";",
"m_cms",
".",
"writeUser",
"(",
"user",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Saves the favorites.
@param favorites the list of favorites to save
@throws CmsException if something goes wrong
|
[
"Saves",
"the",
"favorites",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDAO.java#L155-L172
|
158,110
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsFavoriteDAO.java
|
CmsFavoriteDAO.validate
|
private boolean validate(CmsFavoriteEntry entry) {
try {
String siteRoot = entry.getSiteRoot();
if (!m_okSiteRoots.contains(siteRoot)) {
m_rootCms.readResource(siteRoot);
m_okSiteRoots.add(siteRoot);
}
CmsUUID project = entry.getProjectId();
if (!m_okProjects.contains(project)) {
m_cms.readProject(project);
m_okProjects.add(project);
}
for (CmsUUID id : Arrays.asList(entry.getDetailId(), entry.getStructureId())) {
if ((id != null) && !m_okStructureIds.contains(id)) {
m_cms.readResource(id, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible());
m_okStructureIds.add(id);
}
}
return true;
} catch (Exception e) {
LOG.info("Favorite entry validation failed: " + e.getLocalizedMessage(), e);
return false;
}
}
|
java
|
private boolean validate(CmsFavoriteEntry entry) {
try {
String siteRoot = entry.getSiteRoot();
if (!m_okSiteRoots.contains(siteRoot)) {
m_rootCms.readResource(siteRoot);
m_okSiteRoots.add(siteRoot);
}
CmsUUID project = entry.getProjectId();
if (!m_okProjects.contains(project)) {
m_cms.readProject(project);
m_okProjects.add(project);
}
for (CmsUUID id : Arrays.asList(entry.getDetailId(), entry.getStructureId())) {
if ((id != null) && !m_okStructureIds.contains(id)) {
m_cms.readResource(id, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible());
m_okStructureIds.add(id);
}
}
return true;
} catch (Exception e) {
LOG.info("Favorite entry validation failed: " + e.getLocalizedMessage(), e);
return false;
}
}
|
[
"private",
"boolean",
"validate",
"(",
"CmsFavoriteEntry",
"entry",
")",
"{",
"try",
"{",
"String",
"siteRoot",
"=",
"entry",
".",
"getSiteRoot",
"(",
")",
";",
"if",
"(",
"!",
"m_okSiteRoots",
".",
"contains",
"(",
"siteRoot",
")",
")",
"{",
"m_rootCms",
".",
"readResource",
"(",
"siteRoot",
")",
";",
"m_okSiteRoots",
".",
"add",
"(",
"siteRoot",
")",
";",
"}",
"CmsUUID",
"project",
"=",
"entry",
".",
"getProjectId",
"(",
")",
";",
"if",
"(",
"!",
"m_okProjects",
".",
"contains",
"(",
"project",
")",
")",
"{",
"m_cms",
".",
"readProject",
"(",
"project",
")",
";",
"m_okProjects",
".",
"add",
"(",
"project",
")",
";",
"}",
"for",
"(",
"CmsUUID",
"id",
":",
"Arrays",
".",
"asList",
"(",
"entry",
".",
"getDetailId",
"(",
")",
",",
"entry",
".",
"getStructureId",
"(",
")",
")",
")",
"{",
"if",
"(",
"(",
"id",
"!=",
"null",
")",
"&&",
"!",
"m_okStructureIds",
".",
"contains",
"(",
"id",
")",
")",
"{",
"m_cms",
".",
"readResource",
"(",
"id",
",",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
".",
"addRequireVisible",
"(",
")",
")",
";",
"m_okStructureIds",
".",
"add",
"(",
"id",
")",
";",
"}",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Favorite entry validation failed: \"",
"+",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Validates a favorite entry.
<p>If the favorite entry references a resource or project that can't be read, this will return false.
@param entry the favorite entry
@return the
|
[
"Validates",
"a",
"favorite",
"entry",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDAO.java#L188-L214
|
158,111
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.showCurrentDates
|
public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
}
|
java
|
public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
}
|
[
"public",
"void",
"showCurrentDates",
"(",
"Collection",
"<",
"CmsPair",
"<",
"Date",
",",
"Boolean",
">",
">",
"dates",
")",
"{",
"m_overviewList",
".",
"setDatesWithCheckState",
"(",
"dates",
")",
";",
"m_overviewPopup",
".",
"center",
"(",
")",
";",
"}"
] |
Shows the provided list of dates as current dates.
@param dates the current dates to show, accompanied with the information if they are exceptions or not.
|
[
"Shows",
"the",
"provided",
"list",
"of",
"dates",
"as",
"current",
"dates",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L339-L344
|
158,112
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.updateExceptions
|
public void updateExceptions() {
m_exceptionsList.setDates(m_model.getExceptions());
if (m_model.getExceptions().size() > 0) {
m_exceptionsPanel.setVisible(true);
} else {
m_exceptionsPanel.setVisible(false);
}
}
|
java
|
public void updateExceptions() {
m_exceptionsList.setDates(m_model.getExceptions());
if (m_model.getExceptions().size() > 0) {
m_exceptionsPanel.setVisible(true);
} else {
m_exceptionsPanel.setVisible(false);
}
}
|
[
"public",
"void",
"updateExceptions",
"(",
")",
"{",
"m_exceptionsList",
".",
"setDates",
"(",
"m_model",
".",
"getExceptions",
"(",
")",
")",
";",
"if",
"(",
"m_model",
".",
"getExceptions",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"m_exceptionsPanel",
".",
"setVisible",
"(",
"true",
")",
";",
"}",
"else",
"{",
"m_exceptionsPanel",
".",
"setVisible",
"(",
"false",
")",
";",
"}",
"}"
] |
Updates the exceptions panel.
|
[
"Updates",
"the",
"exceptions",
"panel",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L349-L357
|
158,113
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.onCurrentTillEndChange
|
@UiHandler("m_currentTillEndCheckBox")
void onCurrentTillEndChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setCurrentTillEnd(event.getValue());
}
}
|
java
|
@UiHandler("m_currentTillEndCheckBox")
void onCurrentTillEndChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setCurrentTillEnd(event.getValue());
}
}
|
[
"@",
"UiHandler",
"(",
"\"m_currentTillEndCheckBox\"",
")",
"void",
"onCurrentTillEndChange",
"(",
"ValueChangeEvent",
"<",
"Boolean",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setCurrentTillEnd",
"(",
"event",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] |
Handle a "current till end" change event.
@param event the change event.
|
[
"Handle",
"a",
"current",
"till",
"end",
"change",
"event",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L372-L378
|
158,114
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.onEndTimeChange
|
@UiHandler("m_endTime")
void onEndTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setEndTime(event.getDate());
}
}
|
java
|
@UiHandler("m_endTime")
void onEndTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setEndTime(event.getDate());
}
}
|
[
"@",
"UiHandler",
"(",
"\"m_endTime\"",
")",
"void",
"onEndTimeChange",
"(",
"CmsDateBoxEvent",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
"&&",
"!",
"event",
".",
"isUserTyping",
"(",
")",
")",
"{",
"m_controller",
".",
"setEndTime",
"(",
"event",
".",
"getDate",
"(",
")",
")",
";",
"}",
"}"
] |
Handle an end time change.
@param event the change event.
|
[
"Handle",
"an",
"end",
"time",
"change",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L384-L390
|
158,115
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.onEndTypeChange
|
void onEndTypeChange() {
EndType endType = m_model.getEndType();
m_groupDuration.selectButton(getDurationButtonForType(endType));
switch (endType) {
case DATE:
case TIMES:
m_durationPanel.setVisible(true);
m_seriesEndDate.setValue(m_model.getSeriesEndDate());
int occurrences = m_model.getOccurrences();
if (!m_occurrences.isFocused()) {
m_occurrences.setFormValueAsString(occurrences > 0 ? "" + occurrences : "");
}
break;
default:
m_durationPanel.setVisible(false);
break;
}
updateExceptions();
}
|
java
|
void onEndTypeChange() {
EndType endType = m_model.getEndType();
m_groupDuration.selectButton(getDurationButtonForType(endType));
switch (endType) {
case DATE:
case TIMES:
m_durationPanel.setVisible(true);
m_seriesEndDate.setValue(m_model.getSeriesEndDate());
int occurrences = m_model.getOccurrences();
if (!m_occurrences.isFocused()) {
m_occurrences.setFormValueAsString(occurrences > 0 ? "" + occurrences : "");
}
break;
default:
m_durationPanel.setVisible(false);
break;
}
updateExceptions();
}
|
[
"void",
"onEndTypeChange",
"(",
")",
"{",
"EndType",
"endType",
"=",
"m_model",
".",
"getEndType",
"(",
")",
";",
"m_groupDuration",
".",
"selectButton",
"(",
"getDurationButtonForType",
"(",
"endType",
")",
")",
";",
"switch",
"(",
"endType",
")",
"{",
"case",
"DATE",
":",
"case",
"TIMES",
":",
"m_durationPanel",
".",
"setVisible",
"(",
"true",
")",
";",
"m_seriesEndDate",
".",
"setValue",
"(",
"m_model",
".",
"getSeriesEndDate",
"(",
")",
")",
";",
"int",
"occurrences",
"=",
"m_model",
".",
"getOccurrences",
"(",
")",
";",
"if",
"(",
"!",
"m_occurrences",
".",
"isFocused",
"(",
")",
")",
"{",
"m_occurrences",
".",
"setFormValueAsString",
"(",
"occurrences",
">",
"0",
"?",
"\"\"",
"+",
"occurrences",
":",
"\"\"",
")",
";",
"}",
"break",
";",
"default",
":",
"m_durationPanel",
".",
"setVisible",
"(",
"false",
")",
";",
"break",
";",
"}",
"updateExceptions",
"(",
")",
";",
"}"
] |
Called when the end type is changed.
|
[
"Called",
"when",
"the",
"end",
"type",
"is",
"changed",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L395-L414
|
158,116
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.onPatternChange
|
void onPatternChange() {
PatternType patternType = m_model.getPatternType();
boolean isSeries = !patternType.equals(PatternType.NONE);
setSerialOptionsVisible(isSeries);
m_seriesCheckBox.setChecked(isSeries);
if (isSeries) {
m_groupPattern.selectButton(m_patternButtons.get(patternType));
m_controller.getPatternView().onValueChange();
m_patternOptions.setWidget(m_controller.getPatternView());
onEndTypeChange();
}
m_controller.sizeChanged();
}
|
java
|
void onPatternChange() {
PatternType patternType = m_model.getPatternType();
boolean isSeries = !patternType.equals(PatternType.NONE);
setSerialOptionsVisible(isSeries);
m_seriesCheckBox.setChecked(isSeries);
if (isSeries) {
m_groupPattern.selectButton(m_patternButtons.get(patternType));
m_controller.getPatternView().onValueChange();
m_patternOptions.setWidget(m_controller.getPatternView());
onEndTypeChange();
}
m_controller.sizeChanged();
}
|
[
"void",
"onPatternChange",
"(",
")",
"{",
"PatternType",
"patternType",
"=",
"m_model",
".",
"getPatternType",
"(",
")",
";",
"boolean",
"isSeries",
"=",
"!",
"patternType",
".",
"equals",
"(",
"PatternType",
".",
"NONE",
")",
";",
"setSerialOptionsVisible",
"(",
"isSeries",
")",
";",
"m_seriesCheckBox",
".",
"setChecked",
"(",
"isSeries",
")",
";",
"if",
"(",
"isSeries",
")",
"{",
"m_groupPattern",
".",
"selectButton",
"(",
"m_patternButtons",
".",
"get",
"(",
"patternType",
")",
")",
";",
"m_controller",
".",
"getPatternView",
"(",
")",
".",
"onValueChange",
"(",
")",
";",
"m_patternOptions",
".",
"setWidget",
"(",
"m_controller",
".",
"getPatternView",
"(",
")",
")",
";",
"onEndTypeChange",
"(",
")",
";",
"}",
"m_controller",
".",
"sizeChanged",
"(",
")",
";",
"}"
] |
Called when the pattern has changed.
|
[
"Called",
"when",
"the",
"pattern",
"has",
"changed",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L457-L470
|
158,117
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.onSeriesChange
|
@UiHandler("m_seriesCheckBox")
void onSeriesChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setIsSeries(event.getValue());
}
}
|
java
|
@UiHandler("m_seriesCheckBox")
void onSeriesChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setIsSeries(event.getValue());
}
}
|
[
"@",
"UiHandler",
"(",
"\"m_seriesCheckBox\"",
")",
"void",
"onSeriesChange",
"(",
"ValueChangeEvent",
"<",
"Boolean",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setIsSeries",
"(",
"event",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] |
Handle changes of the series check box.
@param event the change event.
|
[
"Handle",
"changes",
"of",
"the",
"series",
"check",
"box",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L476-L482
|
158,118
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.onStartTimeChange
|
@UiHandler("m_startTime")
void onStartTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setStartTime(event.getDate());
}
}
|
java
|
@UiHandler("m_startTime")
void onStartTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setStartTime(event.getDate());
}
}
|
[
"@",
"UiHandler",
"(",
"\"m_startTime\"",
")",
"void",
"onStartTimeChange",
"(",
"CmsDateBoxEvent",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
"&&",
"!",
"event",
".",
"isUserTyping",
"(",
")",
")",
"{",
"m_controller",
".",
"setStartTime",
"(",
"event",
".",
"getDate",
"(",
")",
")",
";",
"}",
"}"
] |
Handle a start time change.
@param event the change event
|
[
"Handle",
"a",
"start",
"time",
"change",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L512-L518
|
158,119
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.onWholeDayChange
|
@UiHandler("m_wholeDayCheckBox")
void onWholeDayChange(ValueChangeEvent<Boolean> event) {
//TODO: Improve - adjust time selections?
if (handleChange()) {
m_controller.setWholeDay(event.getValue());
}
}
|
java
|
@UiHandler("m_wholeDayCheckBox")
void onWholeDayChange(ValueChangeEvent<Boolean> event) {
//TODO: Improve - adjust time selections?
if (handleChange()) {
m_controller.setWholeDay(event.getValue());
}
}
|
[
"@",
"UiHandler",
"(",
"\"m_wholeDayCheckBox\"",
")",
"void",
"onWholeDayChange",
"(",
"ValueChangeEvent",
"<",
"Boolean",
">",
"event",
")",
"{",
"//TODO: Improve - adjust time selections?",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setWholeDay",
"(",
"event",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] |
Handle a whole day change event.
@param event the change event.
|
[
"Handle",
"a",
"whole",
"day",
"change",
"event",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L524-L531
|
158,120
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.createAndAddButton
|
private void createAndAddButton(PatternType pattern, String messageKey) {
CmsRadioButton btn = new CmsRadioButton(pattern.toString(), Messages.get().key(messageKey));
btn.addStyleName(I_CmsWidgetsLayoutBundle.INSTANCE.widgetCss().radioButtonlabel());
btn.setGroup(m_groupPattern);
m_patternButtons.put(pattern, btn);
m_patternRadioButtonsPanel.add(btn);
}
|
java
|
private void createAndAddButton(PatternType pattern, String messageKey) {
CmsRadioButton btn = new CmsRadioButton(pattern.toString(), Messages.get().key(messageKey));
btn.addStyleName(I_CmsWidgetsLayoutBundle.INSTANCE.widgetCss().radioButtonlabel());
btn.setGroup(m_groupPattern);
m_patternButtons.put(pattern, btn);
m_patternRadioButtonsPanel.add(btn);
}
|
[
"private",
"void",
"createAndAddButton",
"(",
"PatternType",
"pattern",
",",
"String",
"messageKey",
")",
"{",
"CmsRadioButton",
"btn",
"=",
"new",
"CmsRadioButton",
"(",
"pattern",
".",
"toString",
"(",
")",
",",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"messageKey",
")",
")",
";",
"btn",
".",
"addStyleName",
"(",
"I_CmsWidgetsLayoutBundle",
".",
"INSTANCE",
".",
"widgetCss",
"(",
")",
".",
"radioButtonlabel",
"(",
")",
")",
";",
"btn",
".",
"setGroup",
"(",
"m_groupPattern",
")",
";",
"m_patternButtons",
".",
"put",
"(",
"pattern",
",",
"btn",
")",
";",
"m_patternRadioButtonsPanel",
".",
"add",
"(",
"btn",
")",
";",
"}"
] |
Creates a pattern choice radio button and adds it where necessary.
@param pattern the pattern that should be chosen by the button.
@param messageKey the message key for the button's label.
|
[
"Creates",
"a",
"pattern",
"choice",
"radio",
"button",
"and",
"adds",
"it",
"where",
"necessary",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L552-L560
|
158,121
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.initDatesPanel
|
private void initDatesPanel() {
m_startLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_STARTTIME_0));
m_startTime.setAllowInvalidValue(true);
m_startTime.setValue(m_model.getStart());
m_endLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_ENDTIME_0));
m_endTime.setAllowInvalidValue(true);
m_endTime.setValue(m_model.getEnd());
m_seriesCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_SERIES_CHECKBOX_0));
m_wholeDayCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_WHOLE_DAY_CHECKBOX_0));
m_currentTillEndCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_0));
m_currentTillEndCheckBox.getButton().setTitle(
Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_HELP_0));
}
|
java
|
private void initDatesPanel() {
m_startLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_STARTTIME_0));
m_startTime.setAllowInvalidValue(true);
m_startTime.setValue(m_model.getStart());
m_endLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_ENDTIME_0));
m_endTime.setAllowInvalidValue(true);
m_endTime.setValue(m_model.getEnd());
m_seriesCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_SERIES_CHECKBOX_0));
m_wholeDayCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_WHOLE_DAY_CHECKBOX_0));
m_currentTillEndCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_0));
m_currentTillEndCheckBox.getButton().setTitle(
Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_HELP_0));
}
|
[
"private",
"void",
"initDatesPanel",
"(",
")",
"{",
"m_startLabel",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_TIME_STARTTIME_0",
")",
")",
";",
"m_startTime",
".",
"setAllowInvalidValue",
"(",
"true",
")",
";",
"m_startTime",
".",
"setValue",
"(",
"m_model",
".",
"getStart",
"(",
")",
")",
";",
"m_endLabel",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_TIME_ENDTIME_0",
")",
")",
";",
"m_endTime",
".",
"setAllowInvalidValue",
"(",
"true",
")",
";",
"m_endTime",
".",
"setValue",
"(",
"m_model",
".",
"getEnd",
"(",
")",
")",
";",
"m_seriesCheckBox",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_SERIES_CHECKBOX_0",
")",
")",
";",
"m_wholeDayCheckBox",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_WHOLE_DAY_CHECKBOX_0",
")",
")",
";",
"m_currentTillEndCheckBox",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_0",
")",
")",
";",
"m_currentTillEndCheckBox",
".",
"getButton",
"(",
")",
".",
"setTitle",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_HELP_0",
")",
")",
";",
"}"
] |
Initialize dates panel elements.
|
[
"Initialize",
"dates",
"panel",
"elements",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L580-L593
|
158,122
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.initDeactivationPanel
|
private void initDeactivationPanel() {
m_deactivationPanel.setVisible(false);
m_deactivationText.setText(Messages.get().key(Messages.GUI_SERIALDATE_DEACTIVE_TEXT_0));
}
|
java
|
private void initDeactivationPanel() {
m_deactivationPanel.setVisible(false);
m_deactivationText.setText(Messages.get().key(Messages.GUI_SERIALDATE_DEACTIVE_TEXT_0));
}
|
[
"private",
"void",
"initDeactivationPanel",
"(",
")",
"{",
"m_deactivationPanel",
".",
"setVisible",
"(",
"false",
")",
";",
"m_deactivationText",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_DEACTIVE_TEXT_0",
")",
")",
";",
"}"
] |
Initialize elements of the panel displayed for the deactivated widget.
|
[
"Initialize",
"elements",
"of",
"the",
"panel",
"displayed",
"for",
"the",
"deactivated",
"widget",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L598-L603
|
158,123
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.initDurationButtonGroup
|
private void initDurationButtonGroup() {
m_groupDuration = new CmsRadioButtonGroup();
m_endsAfterRadioButton = new CmsRadioButton(
EndType.TIMES.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_0));
m_endsAfterRadioButton.setGroup(m_groupDuration);
m_endsAtRadioButton = new CmsRadioButton(
EndType.DATE.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_DATE_0));
m_endsAtRadioButton.setGroup(m_groupDuration);
m_groupDuration.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
if (handleChange()) {
String value = event.getValue();
if (null != value) {
m_controller.setEndType(value);
}
}
}
});
}
|
java
|
private void initDurationButtonGroup() {
m_groupDuration = new CmsRadioButtonGroup();
m_endsAfterRadioButton = new CmsRadioButton(
EndType.TIMES.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_0));
m_endsAfterRadioButton.setGroup(m_groupDuration);
m_endsAtRadioButton = new CmsRadioButton(
EndType.DATE.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_DATE_0));
m_endsAtRadioButton.setGroup(m_groupDuration);
m_groupDuration.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
if (handleChange()) {
String value = event.getValue();
if (null != value) {
m_controller.setEndType(value);
}
}
}
});
}
|
[
"private",
"void",
"initDurationButtonGroup",
"(",
")",
"{",
"m_groupDuration",
"=",
"new",
"CmsRadioButtonGroup",
"(",
")",
";",
"m_endsAfterRadioButton",
"=",
"new",
"CmsRadioButton",
"(",
"EndType",
".",
"TIMES",
".",
"toString",
"(",
")",
",",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_DURATION_ENDTYPE_OCC_0",
")",
")",
";",
"m_endsAfterRadioButton",
".",
"setGroup",
"(",
"m_groupDuration",
")",
";",
"m_endsAtRadioButton",
"=",
"new",
"CmsRadioButton",
"(",
"EndType",
".",
"DATE",
".",
"toString",
"(",
")",
",",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_DURATION_ENDTYPE_DATE_0",
")",
")",
";",
"m_endsAtRadioButton",
".",
"setGroup",
"(",
"m_groupDuration",
")",
";",
"m_groupDuration",
".",
"addValueChangeHandler",
"(",
"new",
"ValueChangeHandler",
"<",
"String",
">",
"(",
")",
"{",
"public",
"void",
"onValueChange",
"(",
"ValueChangeEvent",
"<",
"String",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"String",
"value",
"=",
"event",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"value",
")",
"{",
"m_controller",
".",
"setEndType",
"(",
"value",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"}"
] |
Configure all UI elements in the "ending"-options panel.
|
[
"Configure",
"all",
"UI",
"elements",
"in",
"the",
"ending",
"-",
"options",
"panel",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L608-L633
|
158,124
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.initDurationPanel
|
private void initDurationPanel() {
m_durationPrefixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_PREFIX_0));
m_durationAfterPostfixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_POSTFIX_0));
m_seriesEndDate.setDateOnly(true);
m_seriesEndDate.setAllowInvalidValue(true);
m_seriesEndDate.setValue(m_model.getSeriesEndDate());
m_seriesEndDate.getTextField().addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
if (handleChange()) {
onSeriesEndDateFocus(event);
}
}
});
}
|
java
|
private void initDurationPanel() {
m_durationPrefixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_PREFIX_0));
m_durationAfterPostfixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_POSTFIX_0));
m_seriesEndDate.setDateOnly(true);
m_seriesEndDate.setAllowInvalidValue(true);
m_seriesEndDate.setValue(m_model.getSeriesEndDate());
m_seriesEndDate.getTextField().addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
if (handleChange()) {
onSeriesEndDateFocus(event);
}
}
});
}
|
[
"private",
"void",
"initDurationPanel",
"(",
")",
"{",
"m_durationPrefixLabel",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_DURATION_PREFIX_0",
")",
")",
";",
"m_durationAfterPostfixLabel",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_DURATION_ENDTYPE_OCC_POSTFIX_0",
")",
")",
";",
"m_seriesEndDate",
".",
"setDateOnly",
"(",
"true",
")",
";",
"m_seriesEndDate",
".",
"setAllowInvalidValue",
"(",
"true",
")",
";",
"m_seriesEndDate",
".",
"setValue",
"(",
"m_model",
".",
"getSeriesEndDate",
"(",
")",
")",
";",
"m_seriesEndDate",
".",
"getTextField",
"(",
")",
".",
"addFocusHandler",
"(",
"new",
"FocusHandler",
"(",
")",
"{",
"public",
"void",
"onFocus",
"(",
"FocusEvent",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"onSeriesEndDateFocus",
"(",
"event",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] |
Initialize elements from the duration panel.
|
[
"Initialize",
"elements",
"from",
"the",
"duration",
"panel",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L636-L653
|
158,125
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.initExceptionsPanel
|
private void initExceptionsPanel() {
m_exceptionsPanel.setLegend(Messages.get().key(Messages.GUI_SERIALDATE_PANEL_EXCEPTIONS_0));
m_exceptionsPanel.addCloseHandler(this);
m_exceptionsPanel.setVisible(false);
}
|
java
|
private void initExceptionsPanel() {
m_exceptionsPanel.setLegend(Messages.get().key(Messages.GUI_SERIALDATE_PANEL_EXCEPTIONS_0));
m_exceptionsPanel.addCloseHandler(this);
m_exceptionsPanel.setVisible(false);
}
|
[
"private",
"void",
"initExceptionsPanel",
"(",
")",
"{",
"m_exceptionsPanel",
".",
"setLegend",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_PANEL_EXCEPTIONS_0",
")",
")",
";",
"m_exceptionsPanel",
".",
"addCloseHandler",
"(",
"this",
")",
";",
"m_exceptionsPanel",
".",
"setVisible",
"(",
"false",
")",
";",
"}"
] |
Configure all UI elements in the exceptions panel.
|
[
"Configure",
"all",
"UI",
"elements",
"in",
"the",
"exceptions",
"panel",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L658-L663
|
158,126
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.initManagementPart
|
private void initManagementPart() {
m_manageExceptionsButton.setText(Messages.get().key(Messages.GUI_SERIALDATE_BUTTON_MANAGE_EXCEPTIONS_0));
m_manageExceptionsButton.getElement().getStyle().setFloat(Style.Float.RIGHT);
}
|
java
|
private void initManagementPart() {
m_manageExceptionsButton.setText(Messages.get().key(Messages.GUI_SERIALDATE_BUTTON_MANAGE_EXCEPTIONS_0));
m_manageExceptionsButton.getElement().getStyle().setFloat(Style.Float.RIGHT);
}
|
[
"private",
"void",
"initManagementPart",
"(",
")",
"{",
"m_manageExceptionsButton",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_BUTTON_MANAGE_EXCEPTIONS_0",
")",
")",
";",
"m_manageExceptionsButton",
".",
"getElement",
"(",
")",
".",
"getStyle",
"(",
")",
".",
"setFloat",
"(",
"Style",
".",
"Float",
".",
"RIGHT",
")",
";",
"}"
] |
Initialize the ui elements for the management part.
|
[
"Initialize",
"the",
"ui",
"elements",
"for",
"the",
"management",
"part",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L668-L672
|
158,127
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java
|
CmsSerialDateView.initPatternButtonGroup
|
private void initPatternButtonGroup() {
m_groupPattern = new CmsRadioButtonGroup();
m_patternButtons = new HashMap<>();
createAndAddButton(PatternType.DAILY, Messages.GUI_SERIALDATE_TYPE_DAILY_0);
m_patternButtons.put(PatternType.NONE, m_patternButtons.get(PatternType.DAILY));
createAndAddButton(PatternType.WEEKLY, Messages.GUI_SERIALDATE_TYPE_WEEKLY_0);
createAndAddButton(PatternType.MONTHLY, Messages.GUI_SERIALDATE_TYPE_MONTHLY_0);
createAndAddButton(PatternType.YEARLY, Messages.GUI_SERIALDATE_TYPE_YEARLY_0);
// createAndAddButton(PatternType.INDIVIDUAL, Messages.GUI_SERIALDATE_TYPE_INDIVIDUAL_0);
m_groupPattern.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
if (handleChange()) {
String value = event.getValue();
if (value != null) {
m_controller.setPattern(value);
}
}
}
});
}
|
java
|
private void initPatternButtonGroup() {
m_groupPattern = new CmsRadioButtonGroup();
m_patternButtons = new HashMap<>();
createAndAddButton(PatternType.DAILY, Messages.GUI_SERIALDATE_TYPE_DAILY_0);
m_patternButtons.put(PatternType.NONE, m_patternButtons.get(PatternType.DAILY));
createAndAddButton(PatternType.WEEKLY, Messages.GUI_SERIALDATE_TYPE_WEEKLY_0);
createAndAddButton(PatternType.MONTHLY, Messages.GUI_SERIALDATE_TYPE_MONTHLY_0);
createAndAddButton(PatternType.YEARLY, Messages.GUI_SERIALDATE_TYPE_YEARLY_0);
// createAndAddButton(PatternType.INDIVIDUAL, Messages.GUI_SERIALDATE_TYPE_INDIVIDUAL_0);
m_groupPattern.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
if (handleChange()) {
String value = event.getValue();
if (value != null) {
m_controller.setPattern(value);
}
}
}
});
}
|
[
"private",
"void",
"initPatternButtonGroup",
"(",
")",
"{",
"m_groupPattern",
"=",
"new",
"CmsRadioButtonGroup",
"(",
")",
";",
"m_patternButtons",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"createAndAddButton",
"(",
"PatternType",
".",
"DAILY",
",",
"Messages",
".",
"GUI_SERIALDATE_TYPE_DAILY_0",
")",
";",
"m_patternButtons",
".",
"put",
"(",
"PatternType",
".",
"NONE",
",",
"m_patternButtons",
".",
"get",
"(",
"PatternType",
".",
"DAILY",
")",
")",
";",
"createAndAddButton",
"(",
"PatternType",
".",
"WEEKLY",
",",
"Messages",
".",
"GUI_SERIALDATE_TYPE_WEEKLY_0",
")",
";",
"createAndAddButton",
"(",
"PatternType",
".",
"MONTHLY",
",",
"Messages",
".",
"GUI_SERIALDATE_TYPE_MONTHLY_0",
")",
";",
"createAndAddButton",
"(",
"PatternType",
".",
"YEARLY",
",",
"Messages",
".",
"GUI_SERIALDATE_TYPE_YEARLY_0",
")",
";",
"// createAndAddButton(PatternType.INDIVIDUAL, Messages.GUI_SERIALDATE_TYPE_INDIVIDUAL_0);",
"m_groupPattern",
".",
"addValueChangeHandler",
"(",
"new",
"ValueChangeHandler",
"<",
"String",
">",
"(",
")",
"{",
"public",
"void",
"onValueChange",
"(",
"ValueChangeEvent",
"<",
"String",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"String",
"value",
"=",
"event",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"m_controller",
".",
"setPattern",
"(",
"value",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"}"
] |
Initialize the pattern choice button group.
|
[
"Initialize",
"the",
"pattern",
"choice",
"button",
"group",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L711-L736
|
158,128
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/CmsAppView.java
|
CmsAppView.injectAdditionalStyles
|
private void injectAdditionalStyles() {
try {
Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets();
for (String stylesheet : stylesheets) {
A_CmsUI.get().getPage().addDependency(new Dependency(Type.STYLESHEET, stylesheet));
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
|
java
|
private void injectAdditionalStyles() {
try {
Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets();
for (String stylesheet : stylesheets) {
A_CmsUI.get().getPage().addDependency(new Dependency(Type.STYLESHEET, stylesheet));
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
|
[
"private",
"void",
"injectAdditionalStyles",
"(",
")",
"{",
"try",
"{",
"Collection",
"<",
"String",
">",
"stylesheets",
"=",
"OpenCms",
".",
"getWorkplaceAppManager",
"(",
")",
".",
"getAdditionalStyleSheets",
"(",
")",
";",
"for",
"(",
"String",
"stylesheet",
":",
"stylesheets",
")",
"{",
"A_CmsUI",
".",
"get",
"(",
")",
".",
"getPage",
"(",
")",
".",
"addDependency",
"(",
"new",
"Dependency",
"(",
"Type",
".",
"STYLESHEET",
",",
"stylesheet",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Inject external stylesheets.
|
[
"Inject",
"external",
"stylesheets",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsAppView.java#L396-L406
|
158,129
|
alkacon/opencms-core
|
src/org/opencms/ugc/CmsUgcActionElement.java
|
CmsUgcActionElement.createSessionForResource
|
public String createSessionForResource(String configPath, String fileName) throws CmsUgcException {
CmsUgcSession formSession = CmsUgcSessionFactory.getInstance().createSessionForFile(
getCmsObject(),
getRequest(),
configPath,
fileName);
return "" + formSession.getId();
}
|
java
|
public String createSessionForResource(String configPath, String fileName) throws CmsUgcException {
CmsUgcSession formSession = CmsUgcSessionFactory.getInstance().createSessionForFile(
getCmsObject(),
getRequest(),
configPath,
fileName);
return "" + formSession.getId();
}
|
[
"public",
"String",
"createSessionForResource",
"(",
"String",
"configPath",
",",
"String",
"fileName",
")",
"throws",
"CmsUgcException",
"{",
"CmsUgcSession",
"formSession",
"=",
"CmsUgcSessionFactory",
".",
"getInstance",
"(",
")",
".",
"createSessionForFile",
"(",
"getCmsObject",
"(",
")",
",",
"getRequest",
"(",
")",
",",
"configPath",
",",
"fileName",
")",
";",
"return",
"\"\"",
"+",
"formSession",
".",
"getId",
"(",
")",
";",
"}"
] |
Creates a new form session to edit the file with the given name using the given form configuration.
@param configPath the site path of the form configuration
@param fileName the name (not path) of the XML content to edit
@return the id of the newly created form session
@throws CmsUgcException if something goes wrong
|
[
"Creates",
"a",
"new",
"form",
"session",
"to",
"edit",
"the",
"file",
"with",
"the",
"given",
"name",
"using",
"the",
"given",
"form",
"configuration",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcActionElement.java#L63-L71
|
158,130
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.setValue
|
public final void setValue(String value) {
if ((null == value) || value.isEmpty()) {
setDefaultValue();
} else {
try {
tryToSetParsedValue(value);
} catch (@SuppressWarnings("unused") Exception e) {
CmsDebugLog.consoleLog("Could not set invalid serial date value: " + value);
setDefaultValue();
}
}
notifyOnValueChange();
}
|
java
|
public final void setValue(String value) {
if ((null == value) || value.isEmpty()) {
setDefaultValue();
} else {
try {
tryToSetParsedValue(value);
} catch (@SuppressWarnings("unused") Exception e) {
CmsDebugLog.consoleLog("Could not set invalid serial date value: " + value);
setDefaultValue();
}
}
notifyOnValueChange();
}
|
[
"public",
"final",
"void",
"setValue",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"(",
"null",
"==",
"value",
")",
"||",
"value",
".",
"isEmpty",
"(",
")",
")",
"{",
"setDefaultValue",
"(",
")",
";",
"}",
"else",
"{",
"try",
"{",
"tryToSetParsedValue",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"Exception",
"e",
")",
"{",
"CmsDebugLog",
".",
"consoleLog",
"(",
"\"Could not set invalid serial date value: \"",
"+",
"value",
")",
";",
"setDefaultValue",
"(",
")",
";",
"}",
"}",
"notifyOnValueChange",
"(",
")",
";",
"}"
] |
Set the value as provided.
@param value the serial date value as JSON string.
|
[
"Set",
"the",
"value",
"as",
"provided",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L75-L88
|
158,131
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.datesToJsonArray
|
private JSONValue datesToJsonArray(Collection<Date> dates) {
if (null != dates) {
JSONArray result = new JSONArray();
for (Date d : dates) {
result.set(result.size(), dateToJson(d));
}
return result;
}
return null;
}
|
java
|
private JSONValue datesToJsonArray(Collection<Date> dates) {
if (null != dates) {
JSONArray result = new JSONArray();
for (Date d : dates) {
result.set(result.size(), dateToJson(d));
}
return result;
}
return null;
}
|
[
"private",
"JSONValue",
"datesToJsonArray",
"(",
"Collection",
"<",
"Date",
">",
"dates",
")",
"{",
"if",
"(",
"null",
"!=",
"dates",
")",
"{",
"JSONArray",
"result",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"Date",
"d",
":",
"dates",
")",
"{",
"result",
".",
"set",
"(",
"result",
".",
"size",
"(",
")",
",",
"dateToJson",
"(",
"d",
")",
")",
";",
"}",
"return",
"result",
";",
"}",
"return",
"null",
";",
"}"
] |
Converts a collection of dates to a JSON array with the long representation of the dates as strings.
@param dates the list to convert.
@return JSON array with long values of dates as string
|
[
"Converts",
"a",
"collection",
"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-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L156-L166
|
158,132
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.dateToJson
|
private JSONValue dateToJson(Date d) {
return null != d ? new JSONString(Long.toString(d.getTime())) : null;
}
|
java
|
private JSONValue dateToJson(Date d) {
return null != d ? new JSONString(Long.toString(d.getTime())) : null;
}
|
[
"private",
"JSONValue",
"dateToJson",
"(",
"Date",
"d",
")",
"{",
"return",
"null",
"!=",
"d",
"?",
"new",
"JSONString",
"(",
"Long",
".",
"toString",
"(",
"d",
".",
"getTime",
"(",
")",
")",
")",
":",
"null",
";",
"}"
] |
Convert a date to the String representation we use in the JSON.
@param d the date to convert
@return the String representation we use in the JSON.
|
[
"Convert",
"a",
"date",
"to",
"the",
"String",
"representation",
"we",
"use",
"in",
"the",
"JSON",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L173-L176
|
158,133
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readOptionalBoolean
|
private Boolean readOptionalBoolean(JSONValue val) {
JSONBoolean b = null == val ? null : val.isBoolean();
if (b != null) {
return Boolean.valueOf(b.booleanValue());
}
return null;
}
|
java
|
private Boolean readOptionalBoolean(JSONValue val) {
JSONBoolean b = null == val ? null : val.isBoolean();
if (b != null) {
return Boolean.valueOf(b.booleanValue());
}
return null;
}
|
[
"private",
"Boolean",
"readOptionalBoolean",
"(",
"JSONValue",
"val",
")",
"{",
"JSONBoolean",
"b",
"=",
"null",
"==",
"val",
"?",
"null",
":",
"val",
".",
"isBoolean",
"(",
")",
";",
"if",
"(",
"b",
"!=",
"null",
")",
"{",
"return",
"Boolean",
".",
"valueOf",
"(",
"b",
".",
"booleanValue",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Read an optional boolean value form a JSON value.
@param val the JSON value that should represent the boolean.
@return the boolean from the JSON or null if reading the boolean fails.
|
[
"Read",
"an",
"optional",
"boolean",
"value",
"form",
"a",
"JSON",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L265-L272
|
158,134
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readOptionalDate
|
private Date readOptionalDate(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return new Date(Long.parseLong(str.stringValue()));
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// do nothing - return the default value
}
}
return null;
}
|
java
|
private Date readOptionalDate(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return new Date(Long.parseLong(str.stringValue()));
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// do nothing - return the default value
}
}
return null;
}
|
[
"private",
"Date",
"readOptionalDate",
"(",
"JSONValue",
"val",
")",
"{",
"JSONString",
"str",
"=",
"null",
"==",
"val",
"?",
"null",
":",
"val",
".",
"isString",
"(",
")",
";",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"new",
"Date",
"(",
"Long",
".",
"parseLong",
"(",
"str",
".",
"stringValue",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"NumberFormatException",
"e",
")",
"{",
"// do nothing - return the default value",
"}",
"}",
"return",
"null",
";",
"}"
] |
Read an optional Date value form a JSON value.
@param val the JSON value that should represent the Date as long value in a string.
@return the Date from the JSON or null if reading the date fails.
|
[
"Read",
"an",
"optional",
"Date",
"value",
"form",
"a",
"JSON",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L279-L290
|
158,135
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readOptionalInt
|
private int readOptionalInt(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return Integer.valueOf(str.stringValue()).intValue();
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// Do nothing, return default value
}
}
return 0;
}
|
java
|
private int readOptionalInt(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return Integer.valueOf(str.stringValue()).intValue();
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// Do nothing, return default value
}
}
return 0;
}
|
[
"private",
"int",
"readOptionalInt",
"(",
"JSONValue",
"val",
")",
"{",
"JSONString",
"str",
"=",
"null",
"==",
"val",
"?",
"null",
":",
"val",
".",
"isString",
"(",
")",
";",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"valueOf",
"(",
"str",
".",
"stringValue",
"(",
")",
")",
".",
"intValue",
"(",
")",
";",
"}",
"catch",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"NumberFormatException",
"e",
")",
"{",
"// Do nothing, return default value",
"}",
"}",
"return",
"0",
";",
"}"
] |
Read an optional int value form a JSON value.
@param val the JSON value that should represent the int.
@return the int from the JSON or 0 reading the int fails.
|
[
"Read",
"an",
"optional",
"int",
"value",
"form",
"a",
"JSON",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L297-L308
|
158,136
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readOptionalMonth
|
private Month readOptionalMonth(JSONValue val) {
String str = readOptionalString(val);
if (null != str) {
try {
return Month.valueOf(str);
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
// Do nothing -return the default value
}
}
return null;
}
|
java
|
private Month readOptionalMonth(JSONValue val) {
String str = readOptionalString(val);
if (null != str) {
try {
return Month.valueOf(str);
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
// Do nothing -return the default value
}
}
return null;
}
|
[
"private",
"Month",
"readOptionalMonth",
"(",
"JSONValue",
"val",
")",
"{",
"String",
"str",
"=",
"readOptionalString",
"(",
"val",
")",
";",
"if",
"(",
"null",
"!=",
"str",
")",
"{",
"try",
"{",
"return",
"Month",
".",
"valueOf",
"(",
"str",
")",
";",
"}",
"catch",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"IllegalArgumentException",
"e",
")",
"{",
"// Do nothing -return the default value",
"}",
"}",
"return",
"null",
";",
"}"
] |
Read an optional month value form a JSON value.
@param val the JSON value that should represent the month.
@return the month from the JSON or null if reading the month fails.
|
[
"Read",
"an",
"optional",
"month",
"value",
"form",
"a",
"JSON",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L315-L326
|
158,137
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readOptionalString
|
private String readOptionalString(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
return str.stringValue();
}
return null;
}
|
java
|
private String readOptionalString(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
return str.stringValue();
}
return null;
}
|
[
"private",
"String",
"readOptionalString",
"(",
"JSONValue",
"val",
")",
"{",
"JSONString",
"str",
"=",
"null",
"==",
"val",
"?",
"null",
":",
"val",
".",
"isString",
"(",
")",
";",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"return",
"str",
".",
"stringValue",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Read an optional string value form a JSON value.
@param val the JSON value that should represent the string.
@return the string from the JSON or null if reading the string fails.
|
[
"Read",
"an",
"optional",
"string",
"value",
"form",
"a",
"JSON",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L333-L340
|
158,138
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.readWeekDay
|
private WeekDay readWeekDay(JSONValue val) throws IllegalArgumentException {
String str = readOptionalString(val);
if (null != str) {
return WeekDay.valueOf(str);
}
throw new IllegalArgumentException();
}
|
java
|
private WeekDay readWeekDay(JSONValue val) throws IllegalArgumentException {
String str = readOptionalString(val);
if (null != str) {
return WeekDay.valueOf(str);
}
throw new IllegalArgumentException();
}
|
[
"private",
"WeekDay",
"readWeekDay",
"(",
"JSONValue",
"val",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"str",
"=",
"readOptionalString",
"(",
"val",
")",
";",
"if",
"(",
"null",
"!=",
"str",
")",
"{",
"return",
"WeekDay",
".",
"valueOf",
"(",
"str",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}"
] |
Read a single weekday from the provided JSON value.
@param val the value to read the week day from.
@return the week day read
@throws IllegalArgumentException thrown if the provided JSON value is not the representation of a week day.
|
[
"Read",
"a",
"single",
"weekday",
"from",
"the",
"provided",
"JSON",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L401-L408
|
158,139
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.toJsonStringList
|
private JSONValue toJsonStringList(Collection<? extends Object> list) {
if (null != list) {
JSONArray array = new JSONArray();
for (Object o : list) {
array.set(array.size(), new JSONString(o.toString()));
}
return array;
} else {
return null;
}
}
|
java
|
private JSONValue toJsonStringList(Collection<? extends Object> list) {
if (null != list) {
JSONArray array = new JSONArray();
for (Object o : list) {
array.set(array.size(), new JSONString(o.toString()));
}
return array;
} else {
return null;
}
}
|
[
"private",
"JSONValue",
"toJsonStringList",
"(",
"Collection",
"<",
"?",
"extends",
"Object",
">",
"list",
")",
"{",
"if",
"(",
"null",
"!=",
"list",
")",
"{",
"JSONArray",
"array",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"list",
")",
"{",
"array",
".",
"set",
"(",
"array",
".",
"size",
"(",
")",
",",
"new",
"JSONString",
"(",
"o",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"return",
"array",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Convert a list of objects to a JSON array with the string representations of that objects.
@param list the list of objects.
@return the JSON array with the string representations.
|
[
"Convert",
"a",
"list",
"of",
"objects",
"to",
"a",
"JSON",
"array",
"with",
"the",
"string",
"representations",
"of",
"that",
"objects",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L461-L472
|
158,140
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java
|
CmsSerialDateValue.tryToSetParsedValue
|
private void tryToSetParsedValue(String value) throws Exception {
JSONObject json = JSONParser.parseStrict(value).isObject();
JSONValue val = json.get(JsonKey.START);
setStart(readOptionalDate(val));
val = json.get(JsonKey.END);
setEnd(readOptionalDate(val));
setWholeDay(readOptionalBoolean(json.get(JsonKey.WHOLE_DAY)));
JSONObject patternJson = json.get(JsonKey.PATTERN).isObject();
readPattern(patternJson);
setExceptions(readDates(json.get(JsonKey.EXCEPTIONS)));
setSeriesEndDate(readOptionalDate(json.get(JsonKey.SERIES_ENDDATE)));
setOccurrences(readOptionalInt(json.get(JsonKey.SERIES_OCCURRENCES)));
setDerivedEndType();
setCurrentTillEnd(readOptionalBoolean(json.get(JsonKey.CURRENT_TILL_END)));
setParentSeriesId(readOptionalUUID(json.get(JsonKey.PARENT_SERIES)));
}
|
java
|
private void tryToSetParsedValue(String value) throws Exception {
JSONObject json = JSONParser.parseStrict(value).isObject();
JSONValue val = json.get(JsonKey.START);
setStart(readOptionalDate(val));
val = json.get(JsonKey.END);
setEnd(readOptionalDate(val));
setWholeDay(readOptionalBoolean(json.get(JsonKey.WHOLE_DAY)));
JSONObject patternJson = json.get(JsonKey.PATTERN).isObject();
readPattern(patternJson);
setExceptions(readDates(json.get(JsonKey.EXCEPTIONS)));
setSeriesEndDate(readOptionalDate(json.get(JsonKey.SERIES_ENDDATE)));
setOccurrences(readOptionalInt(json.get(JsonKey.SERIES_OCCURRENCES)));
setDerivedEndType();
setCurrentTillEnd(readOptionalBoolean(json.get(JsonKey.CURRENT_TILL_END)));
setParentSeriesId(readOptionalUUID(json.get(JsonKey.PARENT_SERIES)));
}
|
[
"private",
"void",
"tryToSetParsedValue",
"(",
"String",
"value",
")",
"throws",
"Exception",
"{",
"JSONObject",
"json",
"=",
"JSONParser",
".",
"parseStrict",
"(",
"value",
")",
".",
"isObject",
"(",
")",
";",
"JSONValue",
"val",
"=",
"json",
".",
"get",
"(",
"JsonKey",
".",
"START",
")",
";",
"setStart",
"(",
"readOptionalDate",
"(",
"val",
")",
")",
";",
"val",
"=",
"json",
".",
"get",
"(",
"JsonKey",
".",
"END",
")",
";",
"setEnd",
"(",
"readOptionalDate",
"(",
"val",
")",
")",
";",
"setWholeDay",
"(",
"readOptionalBoolean",
"(",
"json",
".",
"get",
"(",
"JsonKey",
".",
"WHOLE_DAY",
")",
")",
")",
";",
"JSONObject",
"patternJson",
"=",
"json",
".",
"get",
"(",
"JsonKey",
".",
"PATTERN",
")",
".",
"isObject",
"(",
")",
";",
"readPattern",
"(",
"patternJson",
")",
";",
"setExceptions",
"(",
"readDates",
"(",
"json",
".",
"get",
"(",
"JsonKey",
".",
"EXCEPTIONS",
")",
")",
")",
";",
"setSeriesEndDate",
"(",
"readOptionalDate",
"(",
"json",
".",
"get",
"(",
"JsonKey",
".",
"SERIES_ENDDATE",
")",
")",
")",
";",
"setOccurrences",
"(",
"readOptionalInt",
"(",
"json",
".",
"get",
"(",
"JsonKey",
".",
"SERIES_OCCURRENCES",
")",
")",
")",
";",
"setDerivedEndType",
"(",
")",
";",
"setCurrentTillEnd",
"(",
"readOptionalBoolean",
"(",
"json",
".",
"get",
"(",
"JsonKey",
".",
"CURRENT_TILL_END",
")",
")",
")",
";",
"setParentSeriesId",
"(",
"readOptionalUUID",
"(",
"json",
".",
"get",
"(",
"JsonKey",
".",
"PARENT_SERIES",
")",
")",
")",
";",
"}"
] |
Try to set the value from the provided Json string.
@param value the value to set.
@throws Exception thrown if parsing fails.
|
[
"Try",
"to",
"set",
"the",
"value",
"from",
"the",
"provided",
"Json",
"string",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L479-L496
|
158,141
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java
|
CmsJspCategoryAccessBean.getCategories
|
private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {
if ((null != resource) && (null != cms)) {
try {
return CmsCategoryService.getInstance().readResourceCategories(cms, resource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
return new ArrayList<CmsCategory>(0);
}
|
java
|
private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {
if ((null != resource) && (null != cms)) {
try {
return CmsCategoryService.getInstance().readResourceCategories(cms, resource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
return new ArrayList<CmsCategory>(0);
}
|
[
"private",
"static",
"List",
"<",
"CmsCategory",
">",
"getCategories",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"{",
"if",
"(",
"(",
"null",
"!=",
"resource",
")",
"&&",
"(",
"null",
"!=",
"cms",
")",
")",
"{",
"try",
"{",
"return",
"CmsCategoryService",
".",
"getInstance",
"(",
")",
".",
"readResourceCategories",
"(",
"cms",
",",
"resource",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"return",
"new",
"ArrayList",
"<",
"CmsCategory",
">",
"(",
"0",
")",
";",
"}"
] |
Reads the categories for the given resource.
@param cms the {@link CmsObject} used for reading the categories.
@param resource the resource for which the categories should be read.
@return the categories assigned to the given resource.
|
[
"Reads",
"the",
"categories",
"for",
"the",
"given",
"resource",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java#L113-L123
|
158,142
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java
|
CmsJspCategoryAccessBean.getLeafItems
|
public List<CmsCategory> getLeafItems() {
List<CmsCategory> result = new ArrayList<CmsCategory>();
if (m_categories.isEmpty()) {
return result;
}
Iterator<CmsCategory> it = m_categories.iterator();
CmsCategory current = it.next();
while (it.hasNext()) {
CmsCategory next = it.next();
if (!next.getPath().startsWith(current.getPath())) {
result.add(current);
}
current = next;
}
result.add(current);
return result;
}
|
java
|
public List<CmsCategory> getLeafItems() {
List<CmsCategory> result = new ArrayList<CmsCategory>();
if (m_categories.isEmpty()) {
return result;
}
Iterator<CmsCategory> it = m_categories.iterator();
CmsCategory current = it.next();
while (it.hasNext()) {
CmsCategory next = it.next();
if (!next.getPath().startsWith(current.getPath())) {
result.add(current);
}
current = next;
}
result.add(current);
return result;
}
|
[
"public",
"List",
"<",
"CmsCategory",
">",
"getLeafItems",
"(",
")",
"{",
"List",
"<",
"CmsCategory",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsCategory",
">",
"(",
")",
";",
"if",
"(",
"m_categories",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"result",
";",
"}",
"Iterator",
"<",
"CmsCategory",
">",
"it",
"=",
"m_categories",
".",
"iterator",
"(",
")",
";",
"CmsCategory",
"current",
"=",
"it",
".",
"next",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"CmsCategory",
"next",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"next",
".",
"getPath",
"(",
")",
".",
"startsWith",
"(",
"current",
".",
"getPath",
"(",
")",
")",
")",
"{",
"result",
".",
"add",
"(",
"current",
")",
";",
"}",
"current",
"=",
"next",
";",
"}",
"result",
".",
"add",
"(",
"current",
")",
";",
"return",
"result",
";",
"}"
] |
Returns only the leaf categories of the wrapped categories.
The method assumes that categories are ordered in the list, i.e., parents are directly followed by their children.
NOTE: In the complete category tree a leaf of the wrapped tree part may not be a leaf.
@return only the leaf categories of the wrapped categories.
|
[
"Returns",
"only",
"the",
"leaf",
"categories",
"of",
"the",
"wrapped",
"categories",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java#L154-L171
|
158,143
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java
|
CmsJspCategoryAccessBean.getSubCategories
|
public Map<String, CmsJspCategoryAccessBean> getSubCategories() {
if (m_subCategories == null) {
m_subCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {
@SuppressWarnings("synthetic-access")
public Object transform(Object pathPrefix) {
return new CmsJspCategoryAccessBean(m_cms, m_categories, (String)pathPrefix);
}
});
}
return m_subCategories;
}
|
java
|
public Map<String, CmsJspCategoryAccessBean> getSubCategories() {
if (m_subCategories == null) {
m_subCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {
@SuppressWarnings("synthetic-access")
public Object transform(Object pathPrefix) {
return new CmsJspCategoryAccessBean(m_cms, m_categories, (String)pathPrefix);
}
});
}
return m_subCategories;
}
|
[
"public",
"Map",
"<",
"String",
",",
"CmsJspCategoryAccessBean",
">",
"getSubCategories",
"(",
")",
"{",
"if",
"(",
"m_subCategories",
"==",
"null",
")",
"{",
"m_subCategories",
"=",
"CmsCollectionsGenericWrapper",
".",
"createLazyMap",
"(",
"new",
"Transformer",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"public",
"Object",
"transform",
"(",
"Object",
"pathPrefix",
")",
"{",
"return",
"new",
"CmsJspCategoryAccessBean",
"(",
"m_cms",
",",
"m_categories",
",",
"(",
"String",
")",
"pathPrefix",
")",
";",
"}",
"}",
")",
";",
"}",
"return",
"m_subCategories",
";",
"}"
] |
Returns a map from a category path to the wrapper of all the sub-categories of the category with the path given as key.
@return a map from a category path to all sub-categories of the path's category.
|
[
"Returns",
"a",
"map",
"from",
"a",
"category",
"path",
"to",
"the",
"wrapper",
"of",
"all",
"the",
"sub",
"-",
"categories",
"of",
"the",
"category",
"with",
"the",
"path",
"given",
"as",
"key",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java#L178-L192
|
158,144
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java
|
CmsJspCategoryAccessBean.getTopItems
|
public List<CmsCategory> getTopItems() {
List<CmsCategory> categories = new ArrayList<CmsCategory>();
String matcher = Pattern.quote(m_mainCategoryPath) + "[^/]*/";
for (CmsCategory category : m_categories) {
if (category.getPath().matches(matcher)) {
categories.add(category);
}
}
return categories;
}
|
java
|
public List<CmsCategory> getTopItems() {
List<CmsCategory> categories = new ArrayList<CmsCategory>();
String matcher = Pattern.quote(m_mainCategoryPath) + "[^/]*/";
for (CmsCategory category : m_categories) {
if (category.getPath().matches(matcher)) {
categories.add(category);
}
}
return categories;
}
|
[
"public",
"List",
"<",
"CmsCategory",
">",
"getTopItems",
"(",
")",
"{",
"List",
"<",
"CmsCategory",
">",
"categories",
"=",
"new",
"ArrayList",
"<",
"CmsCategory",
">",
"(",
")",
";",
"String",
"matcher",
"=",
"Pattern",
".",
"quote",
"(",
"m_mainCategoryPath",
")",
"+",
"\"[^/]*/\"",
";",
"for",
"(",
"CmsCategory",
"category",
":",
"m_categories",
")",
"{",
"if",
"(",
"category",
".",
"getPath",
"(",
")",
".",
"matches",
"(",
"matcher",
")",
")",
"{",
"categories",
".",
"add",
"(",
"category",
")",
";",
"}",
"}",
"return",
"categories",
";",
"}"
] |
Returns all categories that are direct children of the current main category.
@return all categories that are direct children of the current main category.
|
[
"Returns",
"all",
"categories",
"that",
"are",
"direct",
"children",
"of",
"the",
"current",
"main",
"category",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java#L199-L209
|
158,145
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/CmsJspImageBean.java
|
CmsJspImageBean.addHiDpiImage
|
public void addHiDpiImage(String factor, CmsJspImageBean image) {
if (m_hiDpiImages == null) {
m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer());
}
m_hiDpiImages.put(factor, image);
}
|
java
|
public void addHiDpiImage(String factor, CmsJspImageBean image) {
if (m_hiDpiImages == null) {
m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer());
}
m_hiDpiImages.put(factor, image);
}
|
[
"public",
"void",
"addHiDpiImage",
"(",
"String",
"factor",
",",
"CmsJspImageBean",
"image",
")",
"{",
"if",
"(",
"m_hiDpiImages",
"==",
"null",
")",
"{",
"m_hiDpiImages",
"=",
"CmsCollectionsGenericWrapper",
".",
"createLazyMap",
"(",
"new",
"CmsScaleHiDpiTransformer",
"(",
")",
")",
";",
"}",
"m_hiDpiImages",
".",
"put",
"(",
"factor",
",",
"image",
")",
";",
"}"
] |
adds a CmsJspImageBean as hi-DPI variant to this image
@param factor the variant multiplier, e.g. "2x" (the common retina multiplier)
@param image the image to be used for this variant
|
[
"adds",
"a",
"CmsJspImageBean",
"as",
"hi",
"-",
"DPI",
"variant",
"to",
"this",
"image"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspImageBean.java#L362-L368
|
158,146
|
alkacon/opencms-core
|
src/org/opencms/search/galleries/CmsGallerySearchResult.java
|
CmsGallerySearchResult.getRequiredSolrFields
|
public static final String[] getRequiredSolrFields() {
if (null == m_requiredSolrFields) {
List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales();
m_requiredSolrFields = new String[14 + (locales.size() * 6)];
int count = 0;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_PATH;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_TYPE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_CREATED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_LASTMODIFIED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_EXPIRED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_RELEASED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_SIZE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_STATE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_USER_CREATED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_ID;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_USER_LAST_MODIFIED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_ADDITIONAL_INFO;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_CONTAINER_TYPES;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_RESOURCE_LOCALES;
for (Locale locale : locales) {
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsSearchField.FIELD_TITLE_UNSTORED,
locale.toString()) + "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsPropertyDefinition.PROPERTY_TITLE,
locale.toString()) + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT + "_s";
m_requiredSolrFields[count++] = CmsPropertyDefinition.PROPERTY_TITLE
+ CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT
+ "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsSearchField.FIELD_DESCRIPTION,
locale.toString()) + "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
locale.toString()) + CmsSearchField.FIELD_DYNAMIC_PROPERTIES + "_s";
m_requiredSolrFields[count++] = CmsPropertyDefinition.PROPERTY_DESCRIPTION
+ CmsSearchField.FIELD_DYNAMIC_PROPERTIES
+ "_s";
}
}
return m_requiredSolrFields;
}
|
java
|
public static final String[] getRequiredSolrFields() {
if (null == m_requiredSolrFields) {
List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales();
m_requiredSolrFields = new String[14 + (locales.size() * 6)];
int count = 0;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_PATH;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_TYPE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_CREATED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_LASTMODIFIED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_EXPIRED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_RELEASED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_SIZE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_STATE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_USER_CREATED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_ID;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_USER_LAST_MODIFIED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_ADDITIONAL_INFO;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_CONTAINER_TYPES;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_RESOURCE_LOCALES;
for (Locale locale : locales) {
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsSearchField.FIELD_TITLE_UNSTORED,
locale.toString()) + "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsPropertyDefinition.PROPERTY_TITLE,
locale.toString()) + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT + "_s";
m_requiredSolrFields[count++] = CmsPropertyDefinition.PROPERTY_TITLE
+ CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT
+ "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsSearchField.FIELD_DESCRIPTION,
locale.toString()) + "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
locale.toString()) + CmsSearchField.FIELD_DYNAMIC_PROPERTIES + "_s";
m_requiredSolrFields[count++] = CmsPropertyDefinition.PROPERTY_DESCRIPTION
+ CmsSearchField.FIELD_DYNAMIC_PROPERTIES
+ "_s";
}
}
return m_requiredSolrFields;
}
|
[
"public",
"static",
"final",
"String",
"[",
"]",
"getRequiredSolrFields",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"m_requiredSolrFields",
")",
"{",
"List",
"<",
"Locale",
">",
"locales",
"=",
"OpenCms",
".",
"getLocaleManager",
"(",
")",
".",
"getAvailableLocales",
"(",
")",
";",
"m_requiredSolrFields",
"=",
"new",
"String",
"[",
"14",
"+",
"(",
"locales",
".",
"size",
"(",
")",
"*",
"6",
")",
"]",
";",
"int",
"count",
"=",
"0",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_PATH",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_TYPE",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_DATE_CREATED",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_DATE_LASTMODIFIED",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_DATE_EXPIRED",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_DATE_RELEASED",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_SIZE",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_STATE",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_USER_CREATED",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_ID",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_USER_LAST_MODIFIED",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_ADDITIONAL_INFO",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_CONTAINER_TYPES",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchField",
".",
"FIELD_RESOURCE_LOCALES",
";",
"for",
"(",
"Locale",
"locale",
":",
"locales",
")",
"{",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchFieldConfiguration",
".",
"getLocaleExtendedName",
"(",
"CmsSearchField",
".",
"FIELD_TITLE_UNSTORED",
",",
"locale",
".",
"toString",
"(",
")",
")",
"+",
"\"_s\"",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchFieldConfiguration",
".",
"getLocaleExtendedName",
"(",
"CmsPropertyDefinition",
".",
"PROPERTY_TITLE",
",",
"locale",
".",
"toString",
"(",
")",
")",
"+",
"CmsSearchField",
".",
"FIELD_DYNAMIC_PROPERTIES_DIRECT",
"+",
"\"_s\"",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsPropertyDefinition",
".",
"PROPERTY_TITLE",
"+",
"CmsSearchField",
".",
"FIELD_DYNAMIC_PROPERTIES_DIRECT",
"+",
"\"_s\"",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchFieldConfiguration",
".",
"getLocaleExtendedName",
"(",
"CmsSearchField",
".",
"FIELD_DESCRIPTION",
",",
"locale",
".",
"toString",
"(",
")",
")",
"+",
"\"_s\"",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsSearchFieldConfiguration",
".",
"getLocaleExtendedName",
"(",
"CmsPropertyDefinition",
".",
"PROPERTY_DESCRIPTION",
",",
"locale",
".",
"toString",
"(",
")",
")",
"+",
"CmsSearchField",
".",
"FIELD_DYNAMIC_PROPERTIES",
"+",
"\"_s\"",
";",
"m_requiredSolrFields",
"[",
"count",
"++",
"]",
"=",
"CmsPropertyDefinition",
".",
"PROPERTY_DESCRIPTION",
"+",
"CmsSearchField",
".",
"FIELD_DYNAMIC_PROPERTIES",
"+",
"\"_s\"",
";",
"}",
"}",
"return",
"m_requiredSolrFields",
";",
"}"
] |
Returns the list of Solr fields a search result must have to initialize the gallery search result correctly.
@return the list of Solr fields.
|
[
"Returns",
"the",
"list",
"of",
"Solr",
"fields",
"a",
"search",
"result",
"must",
"have",
"to",
"initialize",
"the",
"gallery",
"search",
"result",
"correctly",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearchResult.java#L297-L339
|
158,147
|
alkacon/opencms-core
|
src/org/opencms/ui/favorites/CmsPageEditorFavoriteContext.java
|
CmsPageEditorFavoriteContext.toUuid
|
private static CmsUUID toUuid(String uuid) {
if ("null".equals(uuid) || CmsStringUtil.isEmpty(uuid)) {
return null;
}
return new CmsUUID(uuid);
}
|
java
|
private static CmsUUID toUuid(String uuid) {
if ("null".equals(uuid) || CmsStringUtil.isEmpty(uuid)) {
return null;
}
return new CmsUUID(uuid);
}
|
[
"private",
"static",
"CmsUUID",
"toUuid",
"(",
"String",
"uuid",
")",
"{",
"if",
"(",
"\"null\"",
".",
"equals",
"(",
"uuid",
")",
"||",
"CmsStringUtil",
".",
"isEmpty",
"(",
"uuid",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"CmsUUID",
"(",
"uuid",
")",
";",
"}"
] |
Converts string to UUID and returns it, or null if the conversion is not possible.
@param uuid the potential UUID string
@return the UUID, or null if conversion is not possible
|
[
"Converts",
"string",
"to",
"UUID",
"and",
"returns",
"it",
"or",
"null",
"if",
"the",
"conversion",
"is",
"not",
"possible",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsPageEditorFavoriteContext.java#L85-L92
|
158,148
|
alkacon/opencms-core
|
src/org/opencms/search/CmsSearchManager.java
|
CmsSearchManager.ensureIndexIsUnlocked
|
private void ensureIndexIsUnlocked(String dataDir) {
Collection<File> lockFiles = new ArrayList<File>(2);
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "index") + "write.lock"));
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "spellcheck")
+ "write.lock"));
for (File lockFile : lockFiles) {
if (lockFile.exists()) {
lockFile.delete();
LOG.warn(
"Forcely unlocking index with data dir \""
+ dataDir
+ "\" by removing file \""
+ lockFile.getAbsolutePath()
+ "\".");
}
}
}
|
java
|
private void ensureIndexIsUnlocked(String dataDir) {
Collection<File> lockFiles = new ArrayList<File>(2);
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "index") + "write.lock"));
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "spellcheck")
+ "write.lock"));
for (File lockFile : lockFiles) {
if (lockFile.exists()) {
lockFile.delete();
LOG.warn(
"Forcely unlocking index with data dir \""
+ dataDir
+ "\" by removing file \""
+ lockFile.getAbsolutePath()
+ "\".");
}
}
}
|
[
"private",
"void",
"ensureIndexIsUnlocked",
"(",
"String",
"dataDir",
")",
"{",
"Collection",
"<",
"File",
">",
"lockFiles",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
"2",
")",
";",
"lockFiles",
".",
"add",
"(",
"new",
"File",
"(",
"CmsFileUtil",
".",
"addTrailingSeparator",
"(",
"CmsFileUtil",
".",
"addTrailingSeparator",
"(",
"dataDir",
")",
"+",
"\"index\"",
")",
"+",
"\"write.lock\"",
")",
")",
";",
"lockFiles",
".",
"add",
"(",
"new",
"File",
"(",
"CmsFileUtil",
".",
"addTrailingSeparator",
"(",
"CmsFileUtil",
".",
"addTrailingSeparator",
"(",
"dataDir",
")",
"+",
"\"spellcheck\"",
")",
"+",
"\"write.lock\"",
")",
")",
";",
"for",
"(",
"File",
"lockFile",
":",
"lockFiles",
")",
"{",
"if",
"(",
"lockFile",
".",
"exists",
"(",
")",
")",
"{",
"lockFile",
".",
"delete",
"(",
")",
";",
"LOG",
".",
"warn",
"(",
"\"Forcely unlocking index with data dir \\\"\"",
"+",
"dataDir",
"+",
"\"\\\" by removing file \\\"\"",
"+",
"lockFile",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"\\\".\"",
")",
";",
"}",
"}",
"}"
] |
Remove write.lock file in the data directory to ensure the index is unlocked.
@param dataDir the data directory of the Solr index that should be unlocked.
|
[
"Remove",
"write",
".",
"lock",
"file",
"in",
"the",
"data",
"directory",
"to",
"ensure",
"the",
"index",
"is",
"unlocked",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchManager.java#L3157-L3178
|
158,149
|
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/CmsScrollPanelImpl.java
|
CmsScrollPanelImpl.maybeUpdateScrollbarPositions
|
private void maybeUpdateScrollbarPositions() {
if (!isAttached()) {
return;
}
if (m_scrollbar != null) {
int vPos = getVerticalScrollPosition();
if (m_scrollbar.getVerticalScrollPosition() != vPos) {
m_scrollbar.setVerticalScrollPosition(vPos);
}
}
}
|
java
|
private void maybeUpdateScrollbarPositions() {
if (!isAttached()) {
return;
}
if (m_scrollbar != null) {
int vPos = getVerticalScrollPosition();
if (m_scrollbar.getVerticalScrollPosition() != vPos) {
m_scrollbar.setVerticalScrollPosition(vPos);
}
}
}
|
[
"private",
"void",
"maybeUpdateScrollbarPositions",
"(",
")",
"{",
"if",
"(",
"!",
"isAttached",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"m_scrollbar",
"!=",
"null",
")",
"{",
"int",
"vPos",
"=",
"getVerticalScrollPosition",
"(",
")",
";",
"if",
"(",
"m_scrollbar",
".",
"getVerticalScrollPosition",
"(",
")",
"!=",
"vPos",
")",
"{",
"m_scrollbar",
".",
"setVerticalScrollPosition",
"(",
"vPos",
")",
";",
"}",
"}",
"}"
] |
Synchronize the scroll positions of the scrollbars with the actual scroll
position of the content.
|
[
"Synchronize",
"the",
"scroll",
"positions",
"of",
"the",
"scrollbars",
"with",
"the",
"actual",
"scroll",
"position",
"of",
"the",
"content",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsScrollPanelImpl.java#L351-L363
|
158,150
|
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/CmsScrollPanelImpl.java
|
CmsScrollPanelImpl.setVerticalScrollbar
|
private void setVerticalScrollbar(final CmsScrollBar scrollbar, int width) {
// Validate.
if ((scrollbar == m_scrollbar) || (scrollbar == null)) {
return;
}
// Detach new child.
scrollbar.asWidget().removeFromParent();
// Remove old child.
if (m_scrollbar != null) {
if (m_verticalScrollbarHandlerRegistration != null) {
m_verticalScrollbarHandlerRegistration.removeHandler();
m_verticalScrollbarHandlerRegistration = null;
}
remove(m_scrollbar);
}
m_scrollLayer.appendChild(scrollbar.asWidget().getElement());
adopt(scrollbar.asWidget());
// Logical attach.
m_scrollbar = scrollbar;
m_verticalScrollbarWidth = width;
// Initialize the new scrollbar.
m_verticalScrollbarHandlerRegistration = scrollbar.addValueChangeHandler(new ValueChangeHandler<Integer>() {
public void onValueChange(ValueChangeEvent<Integer> event) {
int vPos = scrollbar.getVerticalScrollPosition();
int v = getVerticalScrollPosition();
if (v != vPos) {
setVerticalScrollPosition(vPos);
}
}
});
maybeUpdateScrollbars();
}
|
java
|
private void setVerticalScrollbar(final CmsScrollBar scrollbar, int width) {
// Validate.
if ((scrollbar == m_scrollbar) || (scrollbar == null)) {
return;
}
// Detach new child.
scrollbar.asWidget().removeFromParent();
// Remove old child.
if (m_scrollbar != null) {
if (m_verticalScrollbarHandlerRegistration != null) {
m_verticalScrollbarHandlerRegistration.removeHandler();
m_verticalScrollbarHandlerRegistration = null;
}
remove(m_scrollbar);
}
m_scrollLayer.appendChild(scrollbar.asWidget().getElement());
adopt(scrollbar.asWidget());
// Logical attach.
m_scrollbar = scrollbar;
m_verticalScrollbarWidth = width;
// Initialize the new scrollbar.
m_verticalScrollbarHandlerRegistration = scrollbar.addValueChangeHandler(new ValueChangeHandler<Integer>() {
public void onValueChange(ValueChangeEvent<Integer> event) {
int vPos = scrollbar.getVerticalScrollPosition();
int v = getVerticalScrollPosition();
if (v != vPos) {
setVerticalScrollPosition(vPos);
}
}
});
maybeUpdateScrollbars();
}
|
[
"private",
"void",
"setVerticalScrollbar",
"(",
"final",
"CmsScrollBar",
"scrollbar",
",",
"int",
"width",
")",
"{",
"// Validate.\r",
"if",
"(",
"(",
"scrollbar",
"==",
"m_scrollbar",
")",
"||",
"(",
"scrollbar",
"==",
"null",
")",
")",
"{",
"return",
";",
"}",
"// Detach new child.\r",
"scrollbar",
".",
"asWidget",
"(",
")",
".",
"removeFromParent",
"(",
")",
";",
"// Remove old child.\r",
"if",
"(",
"m_scrollbar",
"!=",
"null",
")",
"{",
"if",
"(",
"m_verticalScrollbarHandlerRegistration",
"!=",
"null",
")",
"{",
"m_verticalScrollbarHandlerRegistration",
".",
"removeHandler",
"(",
")",
";",
"m_verticalScrollbarHandlerRegistration",
"=",
"null",
";",
"}",
"remove",
"(",
"m_scrollbar",
")",
";",
"}",
"m_scrollLayer",
".",
"appendChild",
"(",
"scrollbar",
".",
"asWidget",
"(",
")",
".",
"getElement",
"(",
")",
")",
";",
"adopt",
"(",
"scrollbar",
".",
"asWidget",
"(",
")",
")",
";",
"// Logical attach.\r",
"m_scrollbar",
"=",
"scrollbar",
";",
"m_verticalScrollbarWidth",
"=",
"width",
";",
"// Initialize the new scrollbar.\r",
"m_verticalScrollbarHandlerRegistration",
"=",
"scrollbar",
".",
"addValueChangeHandler",
"(",
"new",
"ValueChangeHandler",
"<",
"Integer",
">",
"(",
")",
"{",
"public",
"void",
"onValueChange",
"(",
"ValueChangeEvent",
"<",
"Integer",
">",
"event",
")",
"{",
"int",
"vPos",
"=",
"scrollbar",
".",
"getVerticalScrollPosition",
"(",
")",
";",
"int",
"v",
"=",
"getVerticalScrollPosition",
"(",
")",
";",
"if",
"(",
"v",
"!=",
"vPos",
")",
"{",
"setVerticalScrollPosition",
"(",
"vPos",
")",
";",
"}",
"}",
"}",
")",
";",
"maybeUpdateScrollbars",
"(",
")",
";",
"}"
] |
Set the scrollbar used for vertical scrolling.
@param scrollbar the scrollbar, or null to clear it
@param width the width of the scrollbar in pixels
|
[
"Set",
"the",
"scrollbar",
"used",
"for",
"vertical",
"scrolling",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsScrollPanelImpl.java#L416-L454
|
158,151
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/UAgentInfo.java
|
UAgentInfo.detectBlackBerryHigh
|
public boolean detectBlackBerryHigh() {
//Disambiguate for BlackBerry OS 6 or 7 (WebKit) browser
if (detectBlackBerryWebKit()) {
return false;
}
if (detectBlackBerry()) {
if (detectBlackBerryTouch()
|| (userAgent.indexOf(deviceBBBold) != -1)
|| (userAgent.indexOf(deviceBBTour) != -1)
|| (userAgent.indexOf(deviceBBCurve) != -1)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
|
java
|
public boolean detectBlackBerryHigh() {
//Disambiguate for BlackBerry OS 6 or 7 (WebKit) browser
if (detectBlackBerryWebKit()) {
return false;
}
if (detectBlackBerry()) {
if (detectBlackBerryTouch()
|| (userAgent.indexOf(deviceBBBold) != -1)
|| (userAgent.indexOf(deviceBBTour) != -1)
|| (userAgent.indexOf(deviceBBCurve) != -1)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
|
[
"public",
"boolean",
"detectBlackBerryHigh",
"(",
")",
"{",
"//Disambiguate for BlackBerry OS 6 or 7 (WebKit) browser\r",
"if",
"(",
"detectBlackBerryWebKit",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"detectBlackBerry",
"(",
")",
")",
"{",
"if",
"(",
"detectBlackBerryTouch",
"(",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceBBBold",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceBBTour",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceBBCurve",
")",
"!=",
"-",
"1",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Detects if the current browser is a BlackBerry device AND
has a more capable recent browser. Excludes the Playbook.
Examples, Storm, Bold, Tour, Curve2
Excludes the new BlackBerry OS 6 and 7 browser!!
@return detection of a Blackberry device with a better browser
|
[
"Detects",
"if",
"the",
"current",
"browser",
"is",
"a",
"BlackBerry",
"device",
"AND",
"has",
"a",
"more",
"capable",
"recent",
"browser",
".",
"Excludes",
"the",
"Playbook",
".",
"Examples",
"Storm",
"Bold",
"Tour",
"Curve2",
"Excludes",
"the",
"new",
"BlackBerry",
"OS",
"6",
"and",
"7",
"browser!!"
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/UAgentInfo.java#L382-L400
|
158,152
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/UAgentInfo.java
|
UAgentInfo.detectBlackBerryTouch
|
public boolean detectBlackBerryTouch() {
if (detectBlackBerry()
&& ((userAgent.indexOf(deviceBBStorm) != -1)
|| (userAgent.indexOf(deviceBBTorch) != -1)
|| (userAgent.indexOf(deviceBBBoldTouch) != -1)
|| (userAgent.indexOf(deviceBBCurveTouch) != -1))) {
return true;
}
return false;
}
|
java
|
public boolean detectBlackBerryTouch() {
if (detectBlackBerry()
&& ((userAgent.indexOf(deviceBBStorm) != -1)
|| (userAgent.indexOf(deviceBBTorch) != -1)
|| (userAgent.indexOf(deviceBBBoldTouch) != -1)
|| (userAgent.indexOf(deviceBBCurveTouch) != -1))) {
return true;
}
return false;
}
|
[
"public",
"boolean",
"detectBlackBerryTouch",
"(",
")",
"{",
"if",
"(",
"detectBlackBerry",
"(",
")",
"&&",
"(",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceBBStorm",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceBBTorch",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceBBBoldTouch",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceBBCurveTouch",
")",
"!=",
"-",
"1",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Detects if the current browser is a BlackBerry Touch
device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.
@return detection of a Blackberry touchscreen device
|
[
"Detects",
"if",
"the",
"current",
"browser",
"is",
"a",
"BlackBerry",
"Touch",
"device",
"such",
"as",
"the",
"Storm",
"Torch",
"and",
"Bold",
"Touch",
".",
"Excludes",
"the",
"Playbook",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/UAgentInfo.java#L440-L450
|
158,153
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/UAgentInfo.java
|
UAgentInfo.detectMobileQuick
|
public boolean detectMobileQuick() {
//Let's exclude tablets
if (isTierTablet) {
return false;
}
//Most mobile browsing is done on smartphones
if (detectSmartphone()) {
return true;
}
//Catch-all for many mobile devices
if (userAgent.indexOf(mobile) != -1) {
return true;
}
if (detectOperaMobile()) {
return true;
}
//We also look for Kindle devices
if (detectKindle() || detectAmazonSilk()) {
return true;
}
if (detectWapWml() || detectMidpCapable() || detectBrewDevice()) {
return true;
}
if ((userAgent.indexOf(engineNetfront) != -1) || (userAgent.indexOf(engineUpBrowser) != -1)) {
return true;
}
return false;
}
|
java
|
public boolean detectMobileQuick() {
//Let's exclude tablets
if (isTierTablet) {
return false;
}
//Most mobile browsing is done on smartphones
if (detectSmartphone()) {
return true;
}
//Catch-all for many mobile devices
if (userAgent.indexOf(mobile) != -1) {
return true;
}
if (detectOperaMobile()) {
return true;
}
//We also look for Kindle devices
if (detectKindle() || detectAmazonSilk()) {
return true;
}
if (detectWapWml() || detectMidpCapable() || detectBrewDevice()) {
return true;
}
if ((userAgent.indexOf(engineNetfront) != -1) || (userAgent.indexOf(engineUpBrowser) != -1)) {
return true;
}
return false;
}
|
[
"public",
"boolean",
"detectMobileQuick",
"(",
")",
"{",
"//Let's exclude tablets\r",
"if",
"(",
"isTierTablet",
")",
"{",
"return",
"false",
";",
"}",
"//Most mobile browsing is done on smartphones\r",
"if",
"(",
"detectSmartphone",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"//Catch-all for many mobile devices\r",
"if",
"(",
"userAgent",
".",
"indexOf",
"(",
"mobile",
")",
"!=",
"-",
"1",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"detectOperaMobile",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"//We also look for Kindle devices\r",
"if",
"(",
"detectKindle",
"(",
")",
"||",
"detectAmazonSilk",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"detectWapWml",
"(",
")",
"||",
"detectMidpCapable",
"(",
")",
"||",
"detectBrewDevice",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"(",
"userAgent",
".",
"indexOf",
"(",
"engineNetfront",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"engineUpBrowser",
")",
"!=",
"-",
"1",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Detects if the current device is a mobile device.
This method catches most of the popular modern devices.
Excludes Apple iPads and other modern tablets.
@return detection of any mobile device using the quicker method
|
[
"Detects",
"if",
"the",
"current",
"device",
"is",
"a",
"mobile",
"device",
".",
"This",
"method",
"catches",
"most",
"of",
"the",
"popular",
"modern",
"devices",
".",
"Excludes",
"Apple",
"iPads",
"and",
"other",
"modern",
"tablets",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/UAgentInfo.java#L763-L797
|
158,154
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/UAgentInfo.java
|
UAgentInfo.detectNintendo
|
public boolean detectNintendo() {
if ((userAgent.indexOf(deviceNintendo) != -1)
|| (userAgent.indexOf(deviceWii) != -1)
|| (userAgent.indexOf(deviceNintendoDs) != -1)) {
return true;
}
return false;
}
|
java
|
public boolean detectNintendo() {
if ((userAgent.indexOf(deviceNintendo) != -1)
|| (userAgent.indexOf(deviceWii) != -1)
|| (userAgent.indexOf(deviceNintendoDs) != -1)) {
return true;
}
return false;
}
|
[
"public",
"boolean",
"detectNintendo",
"(",
")",
"{",
"if",
"(",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceNintendo",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceWii",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"deviceNintendoDs",
")",
"!=",
"-",
"1",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Detects if the current device is a Nintendo game device.
@return detection of Nintendo
|
[
"Detects",
"if",
"the",
"current",
"device",
"is",
"a",
"Nintendo",
"game",
"device",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/UAgentInfo.java#L803-L811
|
158,155
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/UAgentInfo.java
|
UAgentInfo.detectOperaMobile
|
public boolean detectOperaMobile() {
if ((userAgent.indexOf(engineOpera) != -1)
&& ((userAgent.indexOf(mini) != -1) || (userAgent.indexOf(mobi) != -1))) {
return true;
}
return false;
}
|
java
|
public boolean detectOperaMobile() {
if ((userAgent.indexOf(engineOpera) != -1)
&& ((userAgent.indexOf(mini) != -1) || (userAgent.indexOf(mobi) != -1))) {
return true;
}
return false;
}
|
[
"public",
"boolean",
"detectOperaMobile",
"(",
")",
"{",
"if",
"(",
"(",
"userAgent",
".",
"indexOf",
"(",
"engineOpera",
")",
"!=",
"-",
"1",
")",
"&&",
"(",
"(",
"userAgent",
".",
"indexOf",
"(",
"mini",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"mobi",
")",
"!=",
"-",
"1",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Detects Opera Mobile or Opera Mini.
@return detection of an Opera browser for a mobile device
|
[
"Detects",
"Opera",
"Mobile",
"or",
"Opera",
"Mini",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/UAgentInfo.java#L817-L824
|
158,156
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/UAgentInfo.java
|
UAgentInfo.detectSonyMylo
|
public boolean detectSonyMylo() {
if ((userAgent.indexOf(manuSony) != -1)
&& ((userAgent.indexOf(qtembedded) != -1) || (userAgent.indexOf(mylocom2) != -1))) {
return true;
}
return false;
}
|
java
|
public boolean detectSonyMylo() {
if ((userAgent.indexOf(manuSony) != -1)
&& ((userAgent.indexOf(qtembedded) != -1) || (userAgent.indexOf(mylocom2) != -1))) {
return true;
}
return false;
}
|
[
"public",
"boolean",
"detectSonyMylo",
"(",
")",
"{",
"if",
"(",
"(",
"userAgent",
".",
"indexOf",
"(",
"manuSony",
")",
"!=",
"-",
"1",
")",
"&&",
"(",
"(",
"userAgent",
".",
"indexOf",
"(",
"qtembedded",
")",
"!=",
"-",
"1",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"mylocom2",
")",
"!=",
"-",
"1",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Detects if the current browser is a Sony Mylo device.
@return detection of a Sony Mylo device
|
[
"Detects",
"if",
"the",
"current",
"browser",
"is",
"a",
"Sony",
"Mylo",
"device",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/UAgentInfo.java#L918-L925
|
158,157
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/UAgentInfo.java
|
UAgentInfo.detectTierIphone
|
public boolean detectTierIphone() {
if (detectIphoneOrIpod()
|| detectAndroidPhone()
|| detectWindowsPhone()
|| detectBlackBerry10Phone()
|| (detectBlackBerryWebKit() && detectBlackBerryTouch())
|| detectPalmWebOS()
|| detectBada()
|| detectTizen()
|| detectFirefoxOSPhone()
|| detectSailfishPhone()
|| detectUbuntuPhone()
|| detectGamingHandheld()) {
return true;
}
return false;
}
|
java
|
public boolean detectTierIphone() {
if (detectIphoneOrIpod()
|| detectAndroidPhone()
|| detectWindowsPhone()
|| detectBlackBerry10Phone()
|| (detectBlackBerryWebKit() && detectBlackBerryTouch())
|| detectPalmWebOS()
|| detectBada()
|| detectTizen()
|| detectFirefoxOSPhone()
|| detectSailfishPhone()
|| detectUbuntuPhone()
|| detectGamingHandheld()) {
return true;
}
return false;
}
|
[
"public",
"boolean",
"detectTierIphone",
"(",
")",
"{",
"if",
"(",
"detectIphoneOrIpod",
"(",
")",
"||",
"detectAndroidPhone",
"(",
")",
"||",
"detectWindowsPhone",
"(",
")",
"||",
"detectBlackBerry10Phone",
"(",
")",
"||",
"(",
"detectBlackBerryWebKit",
"(",
")",
"&&",
"detectBlackBerryTouch",
"(",
")",
")",
"||",
"detectPalmWebOS",
"(",
")",
"||",
"detectBada",
"(",
")",
"||",
"detectTizen",
"(",
")",
"||",
"detectFirefoxOSPhone",
"(",
")",
"||",
"detectSailfishPhone",
"(",
")",
"||",
"detectUbuntuPhone",
"(",
")",
"||",
"detectGamingHandheld",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
The quick way to detect for a tier of devices.
This method detects for devices which can
display iPhone-optimized web content.
Includes iPhone, iPod Touch, Android, Windows Phone 7 and 8, BB10, WebOS, Playstation Vita, etc.
@return detection of any device in the iPhone/Android/Windows Phone/BlackBerry/WebOS Tier
|
[
"The",
"quick",
"way",
"to",
"detect",
"for",
"a",
"tier",
"of",
"devices",
".",
"This",
"method",
"detects",
"for",
"devices",
"which",
"can",
"display",
"iPhone",
"-",
"optimized",
"web",
"content",
".",
"Includes",
"iPhone",
"iPod",
"Touch",
"Android",
"Windows",
"Phone",
"7",
"and",
"8",
"BB10",
"WebOS",
"Playstation",
"Vita",
"etc",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/UAgentInfo.java#L965-L982
|
158,158
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/UAgentInfo.java
|
UAgentInfo.detectTierRichCss
|
public boolean detectTierRichCss() {
boolean result = false;
//The following devices are explicitly ok.
//Note: 'High' BlackBerry devices ONLY
if (detectMobileQuick()) {
//Exclude iPhone Tier and e-Ink Kindle devices.
if (!detectTierIphone() && !detectKindle()) {
//The following devices are explicitly ok.
//Note: 'High' BlackBerry devices ONLY
//Older Windows 'Mobile' isn't good enough for iPhone Tier.
if (detectWebkit()
|| detectS60OssBrowser()
|| detectBlackBerryHigh()
|| detectWindowsMobile()
|| (userAgent.indexOf(engineTelecaQ) != -1)) {
result = true;
} // if detectWebkit()
} //if !detectTierIphone()
} //if detectMobileQuick()
return result;
}
|
java
|
public boolean detectTierRichCss() {
boolean result = false;
//The following devices are explicitly ok.
//Note: 'High' BlackBerry devices ONLY
if (detectMobileQuick()) {
//Exclude iPhone Tier and e-Ink Kindle devices.
if (!detectTierIphone() && !detectKindle()) {
//The following devices are explicitly ok.
//Note: 'High' BlackBerry devices ONLY
//Older Windows 'Mobile' isn't good enough for iPhone Tier.
if (detectWebkit()
|| detectS60OssBrowser()
|| detectBlackBerryHigh()
|| detectWindowsMobile()
|| (userAgent.indexOf(engineTelecaQ) != -1)) {
result = true;
} // if detectWebkit()
} //if !detectTierIphone()
} //if detectMobileQuick()
return result;
}
|
[
"public",
"boolean",
"detectTierRichCss",
"(",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"//The following devices are explicitly ok.\r",
"//Note: 'High' BlackBerry devices ONLY\r",
"if",
"(",
"detectMobileQuick",
"(",
")",
")",
"{",
"//Exclude iPhone Tier and e-Ink Kindle devices.\r",
"if",
"(",
"!",
"detectTierIphone",
"(",
")",
"&&",
"!",
"detectKindle",
"(",
")",
")",
"{",
"//The following devices are explicitly ok.\r",
"//Note: 'High' BlackBerry devices ONLY\r",
"//Older Windows 'Mobile' isn't good enough for iPhone Tier.\r",
"if",
"(",
"detectWebkit",
"(",
")",
"||",
"detectS60OssBrowser",
"(",
")",
"||",
"detectBlackBerryHigh",
"(",
")",
"||",
"detectWindowsMobile",
"(",
")",
"||",
"(",
"userAgent",
".",
"indexOf",
"(",
"engineTelecaQ",
")",
"!=",
"-",
"1",
")",
")",
"{",
"result",
"=",
"true",
";",
"}",
"// if detectWebkit()\r",
"}",
"//if !detectTierIphone()\r",
"}",
"//if detectMobileQuick()\r",
"return",
"result",
";",
"}"
] |
The quick way to detect for a tier of devices.
This method detects for devices which are likely to be capable
of viewing CSS content optimized for the iPhone,
but may not necessarily support JavaScript.
Excludes all iPhone Tier devices.
@return detection of any device in the 'Rich CSS' Tier
|
[
"The",
"quick",
"way",
"to",
"detect",
"for",
"a",
"tier",
"of",
"devices",
".",
"This",
"method",
"detects",
"for",
"devices",
"which",
"are",
"likely",
"to",
"be",
"capable",
"of",
"viewing",
"CSS",
"content",
"optimized",
"for",
"the",
"iPhone",
"but",
"may",
"not",
"necessarily",
"support",
"JavaScript",
".",
"Excludes",
"all",
"iPhone",
"Tier",
"devices",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/UAgentInfo.java#L1007-L1030
|
158,159
|
alkacon/opencms-core
|
src/org/opencms/widgets/serialdate/CmsSerialDateBeanMonthly.java
|
CmsSerialDateBeanMonthly.setCorrectDay
|
private void setCorrectDay(Calendar date) {
if (monthHasNotDay(date)) {
date.set(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));
} else {
date.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);
}
}
|
java
|
private void setCorrectDay(Calendar date) {
if (monthHasNotDay(date)) {
date.set(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));
} else {
date.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);
}
}
|
[
"private",
"void",
"setCorrectDay",
"(",
"Calendar",
"date",
")",
"{",
"if",
"(",
"monthHasNotDay",
"(",
"date",
")",
")",
"{",
"date",
".",
"set",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"date",
".",
"getActualMaximum",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
")",
")",
";",
"}",
"else",
"{",
"date",
".",
"set",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"m_dayOfMonth",
")",
";",
"}",
"}"
] |
Set the correct day for the date with year and month already fixed.
@param date the date, where year and month are already correct.
|
[
"Set",
"the",
"correct",
"day",
"for",
"the",
"date",
"with",
"year",
"and",
"month",
"already",
"fixed",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateBeanMonthly.java#L126-L133
|
158,160
|
alkacon/opencms-core
|
src-setup/org/opencms/setup/CmsSetupBean.java
|
CmsSetupBean.getDbProperty
|
public String getDbProperty(String key) {
// extract the database key out of the entire key
String databaseKey = key.substring(0, key.indexOf('.'));
Properties databaseProperties = getDatabaseProperties().get(databaseKey);
return databaseProperties.getProperty(key, "");
}
|
java
|
public String getDbProperty(String key) {
// extract the database key out of the entire key
String databaseKey = key.substring(0, key.indexOf('.'));
Properties databaseProperties = getDatabaseProperties().get(databaseKey);
return databaseProperties.getProperty(key, "");
}
|
[
"public",
"String",
"getDbProperty",
"(",
"String",
"key",
")",
"{",
"// extract the database key out of the entire key",
"String",
"databaseKey",
"=",
"key",
".",
"substring",
"(",
"0",
",",
"key",
".",
"indexOf",
"(",
"'",
"'",
")",
")",
";",
"Properties",
"databaseProperties",
"=",
"getDatabaseProperties",
"(",
")",
".",
"get",
"(",
"databaseKey",
")",
";",
"return",
"databaseProperties",
".",
"getProperty",
"(",
"key",
",",
"\"\"",
")",
";",
"}"
] |
Returns the value for a given key from the database properties.
@param key the property key
@return the string value for a given key
|
[
"Returns",
"the",
"value",
"for",
"a",
"given",
"key",
"from",
"the",
"database",
"properties",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L714-L721
|
158,161
|
alkacon/opencms-core
|
src-setup/org/opencms/setup/CmsSetupBean.java
|
CmsSetupBean.isChecked
|
public String isChecked(String value1, String value2) {
if ((value1 == null) || (value2 == null)) {
return "";
}
if (value1.trim().equalsIgnoreCase(value2.trim())) {
return "checked";
}
return "";
}
|
java
|
public String isChecked(String value1, String value2) {
if ((value1 == null) || (value2 == null)) {
return "";
}
if (value1.trim().equalsIgnoreCase(value2.trim())) {
return "checked";
}
return "";
}
|
[
"public",
"String",
"isChecked",
"(",
"String",
"value1",
",",
"String",
"value2",
")",
"{",
"if",
"(",
"(",
"value1",
"==",
"null",
")",
"||",
"(",
"value2",
"==",
"null",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"value1",
".",
"trim",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"value2",
".",
"trim",
"(",
")",
")",
")",
"{",
"return",
"\"checked\"",
";",
"}",
"return",
"\"\"",
";",
"}"
] |
Over simplistic helper to compare two strings to check radio buttons.
@param value1 the first value
@param value2 the second value
@return "checked" if both values are equal, the empty String "" otherwise
|
[
"Over",
"simplistic",
"helper",
"to",
"compare",
"two",
"strings",
"to",
"check",
"radio",
"buttons",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L1393-L1404
|
158,162
|
alkacon/opencms-core
|
src/org/opencms/db/CmsLoginManager.java
|
CmsLoginManager.canLockBecauseOfInactivity
|
public boolean canLockBecauseOfInactivity(CmsObject cms, CmsUser user) {
return !user.isManaged()
&& !user.isWebuser()
&& !OpenCms.getDefaultUsers().isDefaultUser(user.getName())
&& !OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ROOT_ADMIN);
}
|
java
|
public boolean canLockBecauseOfInactivity(CmsObject cms, CmsUser user) {
return !user.isManaged()
&& !user.isWebuser()
&& !OpenCms.getDefaultUsers().isDefaultUser(user.getName())
&& !OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ROOT_ADMIN);
}
|
[
"public",
"boolean",
"canLockBecauseOfInactivity",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
")",
"{",
"return",
"!",
"user",
".",
"isManaged",
"(",
")",
"&&",
"!",
"user",
".",
"isWebuser",
"(",
")",
"&&",
"!",
"OpenCms",
".",
"getDefaultUsers",
"(",
")",
".",
"isDefaultUser",
"(",
"user",
".",
"getName",
"(",
")",
")",
"&&",
"!",
"OpenCms",
".",
"getRoleManager",
"(",
")",
".",
"hasRole",
"(",
"cms",
",",
"user",
".",
"getName",
"(",
")",
",",
"CmsRole",
".",
"ROOT_ADMIN",
")",
";",
"}"
] |
Checks whether a user account can be locked because of inactivity.
@param cms the CMS context
@param user the user to check
@return true if the user may be locked after being inactive for too long
|
[
"Checks",
"whether",
"a",
"user",
"account",
"can",
"be",
"locked",
"because",
"of",
"inactivity",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L265-L271
|
158,163
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/logfile/CmsLogFileApp.java
|
CmsLogFileApp.addDownloadButton
|
private void addDownloadButton(final CmsLogFileView view) {
Button button = CmsToolBar.createButton(
FontOpenCms.DOWNLOAD,
CmsVaadinUtils.getMessageText(Messages.GUI_LOGFILE_DOWNLOAD_0));
button.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
Window window = CmsBasicDialog.prepareWindow(CmsBasicDialog.DialogWidth.wide);
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_LOGFILE_DOWNLOAD_0));
window.setContent(new CmsLogDownloadDialog(window, view.getCurrentFile()));
A_CmsUI.get().addWindow(window);
}
});
m_uiContext.addToolbarButton(button);
}
|
java
|
private void addDownloadButton(final CmsLogFileView view) {
Button button = CmsToolBar.createButton(
FontOpenCms.DOWNLOAD,
CmsVaadinUtils.getMessageText(Messages.GUI_LOGFILE_DOWNLOAD_0));
button.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
Window window = CmsBasicDialog.prepareWindow(CmsBasicDialog.DialogWidth.wide);
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_LOGFILE_DOWNLOAD_0));
window.setContent(new CmsLogDownloadDialog(window, view.getCurrentFile()));
A_CmsUI.get().addWindow(window);
}
});
m_uiContext.addToolbarButton(button);
}
|
[
"private",
"void",
"addDownloadButton",
"(",
"final",
"CmsLogFileView",
"view",
")",
"{",
"Button",
"button",
"=",
"CmsToolBar",
".",
"createButton",
"(",
"FontOpenCms",
".",
"DOWNLOAD",
",",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_LOGFILE_DOWNLOAD_0",
")",
")",
";",
"button",
".",
"addClickListener",
"(",
"new",
"ClickListener",
"(",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"public",
"void",
"buttonClick",
"(",
"ClickEvent",
"event",
")",
"{",
"Window",
"window",
"=",
"CmsBasicDialog",
".",
"prepareWindow",
"(",
"CmsBasicDialog",
".",
"DialogWidth",
".",
"wide",
")",
";",
"window",
".",
"setCaption",
"(",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_LOGFILE_DOWNLOAD_0",
")",
")",
";",
"window",
".",
"setContent",
"(",
"new",
"CmsLogDownloadDialog",
"(",
"window",
",",
"view",
".",
"getCurrentFile",
"(",
")",
")",
")",
";",
"A_CmsUI",
".",
"get",
"(",
")",
".",
"addWindow",
"(",
"window",
")",
";",
"}",
"}",
")",
";",
"m_uiContext",
".",
"addToolbarButton",
"(",
"button",
")",
";",
"}"
] |
Adds the download button.
@param view layout which displays the log file
|
[
"Adds",
"the",
"download",
"button",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/logfile/CmsLogFileApp.java#L253-L271
|
158,164
|
alkacon/opencms-core
|
src/org/opencms/cmis/CmsCmisUtil.java
|
CmsCmisUtil.addPropertyDefault
|
@SuppressWarnings("unchecked")
public static boolean addPropertyDefault(PropertiesImpl props, PropertyDefinition<?> propDef) {
if ((props == null) || (props.getProperties() == null)) {
throw new IllegalArgumentException("Props must not be null!");
}
if (propDef == null) {
return false;
}
List<?> defaultValue = propDef.getDefaultValue();
if ((defaultValue != null) && (!defaultValue.isEmpty())) {
switch (propDef.getPropertyType()) {
case BOOLEAN:
props.addProperty(new PropertyBooleanImpl(propDef.getId(), (List<Boolean>)defaultValue));
break;
case DATETIME:
props.addProperty(new PropertyDateTimeImpl(propDef.getId(), (List<GregorianCalendar>)defaultValue));
break;
case DECIMAL:
props.addProperty(new PropertyDecimalImpl(propDef.getId(), (List<BigDecimal>)defaultValue));
break;
case HTML:
props.addProperty(new PropertyHtmlImpl(propDef.getId(), (List<String>)defaultValue));
break;
case ID:
props.addProperty(new PropertyIdImpl(propDef.getId(), (List<String>)defaultValue));
break;
case INTEGER:
props.addProperty(new PropertyIntegerImpl(propDef.getId(), (List<BigInteger>)defaultValue));
break;
case STRING:
props.addProperty(new PropertyStringImpl(propDef.getId(), (List<String>)defaultValue));
break;
case URI:
props.addProperty(new PropertyUriImpl(propDef.getId(), (List<String>)defaultValue));
break;
default:
throw new RuntimeException("Unknown datatype! Spec change?");
}
return true;
}
return false;
}
|
java
|
@SuppressWarnings("unchecked")
public static boolean addPropertyDefault(PropertiesImpl props, PropertyDefinition<?> propDef) {
if ((props == null) || (props.getProperties() == null)) {
throw new IllegalArgumentException("Props must not be null!");
}
if (propDef == null) {
return false;
}
List<?> defaultValue = propDef.getDefaultValue();
if ((defaultValue != null) && (!defaultValue.isEmpty())) {
switch (propDef.getPropertyType()) {
case BOOLEAN:
props.addProperty(new PropertyBooleanImpl(propDef.getId(), (List<Boolean>)defaultValue));
break;
case DATETIME:
props.addProperty(new PropertyDateTimeImpl(propDef.getId(), (List<GregorianCalendar>)defaultValue));
break;
case DECIMAL:
props.addProperty(new PropertyDecimalImpl(propDef.getId(), (List<BigDecimal>)defaultValue));
break;
case HTML:
props.addProperty(new PropertyHtmlImpl(propDef.getId(), (List<String>)defaultValue));
break;
case ID:
props.addProperty(new PropertyIdImpl(propDef.getId(), (List<String>)defaultValue));
break;
case INTEGER:
props.addProperty(new PropertyIntegerImpl(propDef.getId(), (List<BigInteger>)defaultValue));
break;
case STRING:
props.addProperty(new PropertyStringImpl(propDef.getId(), (List<String>)defaultValue));
break;
case URI:
props.addProperty(new PropertyUriImpl(propDef.getId(), (List<String>)defaultValue));
break;
default:
throw new RuntimeException("Unknown datatype! Spec change?");
}
return true;
}
return false;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"boolean",
"addPropertyDefault",
"(",
"PropertiesImpl",
"props",
",",
"PropertyDefinition",
"<",
"?",
">",
"propDef",
")",
"{",
"if",
"(",
"(",
"props",
"==",
"null",
")",
"||",
"(",
"props",
".",
"getProperties",
"(",
")",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Props must not be null!\"",
")",
";",
"}",
"if",
"(",
"propDef",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"List",
"<",
"?",
">",
"defaultValue",
"=",
"propDef",
".",
"getDefaultValue",
"(",
")",
";",
"if",
"(",
"(",
"defaultValue",
"!=",
"null",
")",
"&&",
"(",
"!",
"defaultValue",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"switch",
"(",
"propDef",
".",
"getPropertyType",
"(",
")",
")",
"{",
"case",
"BOOLEAN",
":",
"props",
".",
"addProperty",
"(",
"new",
"PropertyBooleanImpl",
"(",
"propDef",
".",
"getId",
"(",
")",
",",
"(",
"List",
"<",
"Boolean",
">",
")",
"defaultValue",
")",
")",
";",
"break",
";",
"case",
"DATETIME",
":",
"props",
".",
"addProperty",
"(",
"new",
"PropertyDateTimeImpl",
"(",
"propDef",
".",
"getId",
"(",
")",
",",
"(",
"List",
"<",
"GregorianCalendar",
">",
")",
"defaultValue",
")",
")",
";",
"break",
";",
"case",
"DECIMAL",
":",
"props",
".",
"addProperty",
"(",
"new",
"PropertyDecimalImpl",
"(",
"propDef",
".",
"getId",
"(",
")",
",",
"(",
"List",
"<",
"BigDecimal",
">",
")",
"defaultValue",
")",
")",
";",
"break",
";",
"case",
"HTML",
":",
"props",
".",
"addProperty",
"(",
"new",
"PropertyHtmlImpl",
"(",
"propDef",
".",
"getId",
"(",
")",
",",
"(",
"List",
"<",
"String",
">",
")",
"defaultValue",
")",
")",
";",
"break",
";",
"case",
"ID",
":",
"props",
".",
"addProperty",
"(",
"new",
"PropertyIdImpl",
"(",
"propDef",
".",
"getId",
"(",
")",
",",
"(",
"List",
"<",
"String",
">",
")",
"defaultValue",
")",
")",
";",
"break",
";",
"case",
"INTEGER",
":",
"props",
".",
"addProperty",
"(",
"new",
"PropertyIntegerImpl",
"(",
"propDef",
".",
"getId",
"(",
")",
",",
"(",
"List",
"<",
"BigInteger",
">",
")",
"defaultValue",
")",
")",
";",
"break",
";",
"case",
"STRING",
":",
"props",
".",
"addProperty",
"(",
"new",
"PropertyStringImpl",
"(",
"propDef",
".",
"getId",
"(",
")",
",",
"(",
"List",
"<",
"String",
">",
")",
"defaultValue",
")",
")",
";",
"break",
";",
"case",
"URI",
":",
"props",
".",
"addProperty",
"(",
"new",
"PropertyUriImpl",
"(",
"propDef",
".",
"getId",
"(",
")",
",",
"(",
"List",
"<",
"String",
">",
")",
"defaultValue",
")",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Unknown datatype! Spec change?\"",
")",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Adds the default value of property if defined.
@param props the Properties object
@param propDef the property definition
@return true if the property could be added
|
[
"Adds",
"the",
"default",
"value",
"of",
"property",
"if",
"defined",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L215-L261
|
158,165
|
alkacon/opencms-core
|
src/org/opencms/cmis/CmsCmisUtil.java
|
CmsCmisUtil.checkAddProperty
|
public static boolean checkAddProperty(
CmsCmisTypeManager typeManager,
Properties properties,
String typeId,
Set<String> filter,
String id) {
if ((properties == null) || (properties.getProperties() == null)) {
throw new IllegalArgumentException("Properties must not be null!");
}
if (id == null) {
throw new IllegalArgumentException("Id must not be null!");
}
TypeDefinition type = typeManager.getType(typeId);
if (type == null) {
throw new IllegalArgumentException("Unknown type: " + typeId);
}
if (!type.getPropertyDefinitions().containsKey(id)) {
throw new IllegalArgumentException("Unknown property: " + id);
}
String queryName = type.getPropertyDefinitions().get(id).getQueryName();
if ((queryName != null) && (filter != null)) {
if (!filter.contains(queryName)) {
return false;
} else {
filter.remove(queryName);
}
}
return true;
}
|
java
|
public static boolean checkAddProperty(
CmsCmisTypeManager typeManager,
Properties properties,
String typeId,
Set<String> filter,
String id) {
if ((properties == null) || (properties.getProperties() == null)) {
throw new IllegalArgumentException("Properties must not be null!");
}
if (id == null) {
throw new IllegalArgumentException("Id must not be null!");
}
TypeDefinition type = typeManager.getType(typeId);
if (type == null) {
throw new IllegalArgumentException("Unknown type: " + typeId);
}
if (!type.getPropertyDefinitions().containsKey(id)) {
throw new IllegalArgumentException("Unknown property: " + id);
}
String queryName = type.getPropertyDefinitions().get(id).getQueryName();
if ((queryName != null) && (filter != null)) {
if (!filter.contains(queryName)) {
return false;
} else {
filter.remove(queryName);
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"checkAddProperty",
"(",
"CmsCmisTypeManager",
"typeManager",
",",
"Properties",
"properties",
",",
"String",
"typeId",
",",
"Set",
"<",
"String",
">",
"filter",
",",
"String",
"id",
")",
"{",
"if",
"(",
"(",
"properties",
"==",
"null",
")",
"||",
"(",
"properties",
".",
"getProperties",
"(",
")",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Properties must not be null!\"",
")",
";",
"}",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Id must not be null!\"",
")",
";",
"}",
"TypeDefinition",
"type",
"=",
"typeManager",
".",
"getType",
"(",
"typeId",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown type: \"",
"+",
"typeId",
")",
";",
"}",
"if",
"(",
"!",
"type",
".",
"getPropertyDefinitions",
"(",
")",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown property: \"",
"+",
"id",
")",
";",
"}",
"String",
"queryName",
"=",
"type",
".",
"getPropertyDefinitions",
"(",
")",
".",
"get",
"(",
"id",
")",
".",
"getQueryName",
"(",
")",
";",
"if",
"(",
"(",
"queryName",
"!=",
"null",
")",
"&&",
"(",
"filter",
"!=",
"null",
")",
")",
"{",
"if",
"(",
"!",
"filter",
".",
"contains",
"(",
"queryName",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"filter",
".",
"remove",
"(",
"queryName",
")",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Checks whether a property can be added to a Properties.
@param typeManager
@param properties the properties object
@param typeId the type id
@param filter the property filter
@param id the property id
@return true if the property should be added
|
[
"Checks",
"whether",
"a",
"property",
"can",
"be",
"added",
"to",
"a",
"Properties",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L373-L407
|
158,166
|
alkacon/opencms-core
|
src/org/opencms/cmis/CmsCmisUtil.java
|
CmsCmisUtil.millisToCalendar
|
public static GregorianCalendar millisToCalendar(long millis) {
GregorianCalendar result = new GregorianCalendar();
result.setTimeZone(TimeZone.getTimeZone("GMT"));
result.setTimeInMillis((long)(Math.ceil(millis / 1000) * 1000));
return result;
}
|
java
|
public static GregorianCalendar millisToCalendar(long millis) {
GregorianCalendar result = new GregorianCalendar();
result.setTimeZone(TimeZone.getTimeZone("GMT"));
result.setTimeInMillis((long)(Math.ceil(millis / 1000) * 1000));
return result;
}
|
[
"public",
"static",
"GregorianCalendar",
"millisToCalendar",
"(",
"long",
"millis",
")",
"{",
"GregorianCalendar",
"result",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"result",
".",
"setTimeZone",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"GMT\"",
")",
")",
";",
"result",
".",
"setTimeInMillis",
"(",
"(",
"long",
")",
"(",
"Math",
".",
"ceil",
"(",
"millis",
"/",
"1000",
")",
"*",
"1000",
")",
")",
";",
"return",
"result",
";",
"}"
] |
Converts milliseconds into a calendar object.
@param millis a time given in milliseconds after epoch
@return the calendar object for the given time
|
[
"Converts",
"milliseconds",
"into",
"a",
"calendar",
"object",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L580-L586
|
158,167
|
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/input/CmsTextArea.java
|
CmsTextArea.updateGhostStyle
|
private void updateGhostStyle() {
if (CmsStringUtil.isEmpty(m_realValue)) {
if (CmsStringUtil.isEmpty(m_ghostValue)) {
updateTextArea(m_realValue);
return;
}
if (!m_focus) {
setGhostStyleEnabled(true);
updateTextArea(m_ghostValue);
} else {
// don't show ghost mode while focused
setGhostStyleEnabled(false);
}
} else {
setGhostStyleEnabled(false);
updateTextArea(m_realValue);
}
}
|
java
|
private void updateGhostStyle() {
if (CmsStringUtil.isEmpty(m_realValue)) {
if (CmsStringUtil.isEmpty(m_ghostValue)) {
updateTextArea(m_realValue);
return;
}
if (!m_focus) {
setGhostStyleEnabled(true);
updateTextArea(m_ghostValue);
} else {
// don't show ghost mode while focused
setGhostStyleEnabled(false);
}
} else {
setGhostStyleEnabled(false);
updateTextArea(m_realValue);
}
}
|
[
"private",
"void",
"updateGhostStyle",
"(",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"isEmpty",
"(",
"m_realValue",
")",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"isEmpty",
"(",
"m_ghostValue",
")",
")",
"{",
"updateTextArea",
"(",
"m_realValue",
")",
";",
"return",
";",
"}",
"if",
"(",
"!",
"m_focus",
")",
"{",
"setGhostStyleEnabled",
"(",
"true",
")",
";",
"updateTextArea",
"(",
"m_ghostValue",
")",
";",
"}",
"else",
"{",
"// don't show ghost mode while focused",
"setGhostStyleEnabled",
"(",
"false",
")",
";",
"}",
"}",
"else",
"{",
"setGhostStyleEnabled",
"(",
"false",
")",
";",
"updateTextArea",
"(",
"m_realValue",
")",
";",
"}",
"}"
] |
Updates the styling and content of the internal text area based on the real value, the ghost value, and whether
it has focus.
|
[
"Updates",
"the",
"styling",
"and",
"content",
"of",
"the",
"internal",
"text",
"area",
"based",
"on",
"the",
"real",
"value",
"the",
"ghost",
"value",
"and",
"whether",
"it",
"has",
"focus",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/CmsTextArea.java#L618-L636
|
158,168
|
alkacon/opencms-core
|
src/org/opencms/widgets/CmsCategoryWidget.java
|
CmsCategoryWidget.generateCommonConfigPart
|
private Map<String, String> generateCommonConfigPart() {
Map<String, String> result = new HashMap<>();
if (m_category != null) {
result.put(CONFIGURATION_CATEGORY, m_category);
}
// append 'only leafs' to configuration
if (m_onlyLeafs) {
result.put(CONFIGURATION_ONLYLEAFS, null);
}
// append 'property' to configuration
if (m_property != null) {
result.put(CONFIGURATION_PROPERTY, m_property);
}
// append 'selectionType' to configuration
if (m_selectiontype != null) {
result.put(CONFIGURATION_SELECTIONTYPE, m_selectiontype);
}
return result;
}
|
java
|
private Map<String, String> generateCommonConfigPart() {
Map<String, String> result = new HashMap<>();
if (m_category != null) {
result.put(CONFIGURATION_CATEGORY, m_category);
}
// append 'only leafs' to configuration
if (m_onlyLeafs) {
result.put(CONFIGURATION_ONLYLEAFS, null);
}
// append 'property' to configuration
if (m_property != null) {
result.put(CONFIGURATION_PROPERTY, m_property);
}
// append 'selectionType' to configuration
if (m_selectiontype != null) {
result.put(CONFIGURATION_SELECTIONTYPE, m_selectiontype);
}
return result;
}
|
[
"private",
"Map",
"<",
"String",
",",
"String",
">",
"generateCommonConfigPart",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"if",
"(",
"m_category",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"CONFIGURATION_CATEGORY",
",",
"m_category",
")",
";",
"}",
"// append 'only leafs' to configuration",
"if",
"(",
"m_onlyLeafs",
")",
"{",
"result",
".",
"put",
"(",
"CONFIGURATION_ONLYLEAFS",
",",
"null",
")",
";",
"}",
"// append 'property' to configuration",
"if",
"(",
"m_property",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"CONFIGURATION_PROPERTY",
",",
"m_property",
")",
";",
"}",
"// append 'selectionType' to configuration",
"if",
"(",
"m_selectiontype",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"CONFIGURATION_SELECTIONTYPE",
",",
"m_selectiontype",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Helper to generate the common configuration part for client-side and server-side widget.
@return the common configuration options as map
|
[
"Helper",
"to",
"generate",
"the",
"common",
"configuration",
"part",
"for",
"client",
"-",
"side",
"and",
"server",
"-",
"side",
"widget",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsCategoryWidget.java#L642-L661
|
158,169
|
alkacon/opencms-core
|
src/org/opencms/importexport/CmsImportExportManager.java
|
CmsImportExportManager.getDefaultTimestampModes
|
public Map<TimestampMode, List<String>> getDefaultTimestampModes() {
Map<TimestampMode, List<String>> result = new HashMap<TimestampMode, List<String>>();
for (String resourcetype : m_defaultTimestampModes.keySet()) {
TimestampMode mode = m_defaultTimestampModes.get(resourcetype);
if (result.containsKey(mode)) {
result.get(mode).add(resourcetype);
} else {
List<String> list = new ArrayList<String>();
list.add(resourcetype);
result.put(mode, list);
}
}
return result;
}
|
java
|
public Map<TimestampMode, List<String>> getDefaultTimestampModes() {
Map<TimestampMode, List<String>> result = new HashMap<TimestampMode, List<String>>();
for (String resourcetype : m_defaultTimestampModes.keySet()) {
TimestampMode mode = m_defaultTimestampModes.get(resourcetype);
if (result.containsKey(mode)) {
result.get(mode).add(resourcetype);
} else {
List<String> list = new ArrayList<String>();
list.add(resourcetype);
result.put(mode, list);
}
}
return result;
}
|
[
"public",
"Map",
"<",
"TimestampMode",
",",
"List",
"<",
"String",
">",
">",
"getDefaultTimestampModes",
"(",
")",
"{",
"Map",
"<",
"TimestampMode",
",",
"List",
"<",
"String",
">",
">",
"result",
"=",
"new",
"HashMap",
"<",
"TimestampMode",
",",
"List",
"<",
"String",
">",
">",
"(",
")",
";",
"for",
"(",
"String",
"resourcetype",
":",
"m_defaultTimestampModes",
".",
"keySet",
"(",
")",
")",
"{",
"TimestampMode",
"mode",
"=",
"m_defaultTimestampModes",
".",
"get",
"(",
"resourcetype",
")",
";",
"if",
"(",
"result",
".",
"containsKey",
"(",
"mode",
")",
")",
"{",
"result",
".",
"get",
"(",
"mode",
")",
".",
"add",
"(",
"resourcetype",
")",
";",
"}",
"else",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"list",
".",
"add",
"(",
"resourcetype",
")",
";",
"result",
".",
"put",
"(",
"mode",
",",
"list",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Returns the map from resourcetype names to default timestamp modes.
@return the map from resourcetype names to default timestamp modes.
|
[
"Returns",
"the",
"map",
"from",
"resourcetype",
"names",
"to",
"default",
"timestamp",
"modes",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportExportManager.java#L679-L693
|
158,170
|
alkacon/opencms-core
|
src-gwt/org/opencms/acacia/client/CmsValidationHandler.java
|
CmsValidationHandler.addHandler
|
protected <H extends EventHandler> HandlerRegistration addHandler(final H handler, GwtEvent.Type<H> type) {
return ensureHandlers().addHandlerToSource(type, this, handler);
}
|
java
|
protected <H extends EventHandler> HandlerRegistration addHandler(final H handler, GwtEvent.Type<H> type) {
return ensureHandlers().addHandlerToSource(type, this, handler);
}
|
[
"protected",
"<",
"H",
"extends",
"EventHandler",
">",
"HandlerRegistration",
"addHandler",
"(",
"final",
"H",
"handler",
",",
"GwtEvent",
".",
"Type",
"<",
"H",
">",
"type",
")",
"{",
"return",
"ensureHandlers",
"(",
")",
".",
"addHandlerToSource",
"(",
"type",
",",
"this",
",",
"handler",
")",
";",
"}"
] |
Adds this handler to the widget.
@param <H> the type of handler to add
@param type the event type
@param handler the handler
@return {@link HandlerRegistration} used to remove the handler
|
[
"Adds",
"this",
"handler",
"to",
"the",
"widget",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsValidationHandler.java#L308-L311
|
158,171
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseFacetQueryItems
|
protected List<I_CmsFacetQueryItem> parseFacetQueryItems(final String path) throws Exception {
final List<I_CmsXmlContentValue> values = m_xml.getValues(path, m_locale);
if (values == null) {
return null;
} else {
List<I_CmsFacetQueryItem> parsedItems = new ArrayList<I_CmsFacetQueryItem>(values.size());
for (I_CmsXmlContentValue value : values) {
I_CmsFacetQueryItem item = parseFacetQueryItem(value.getPath() + "/");
if (null != item) {
parsedItems.add(item);
} else {
// TODO: log
}
}
return parsedItems;
}
}
|
java
|
protected List<I_CmsFacetQueryItem> parseFacetQueryItems(final String path) throws Exception {
final List<I_CmsXmlContentValue> values = m_xml.getValues(path, m_locale);
if (values == null) {
return null;
} else {
List<I_CmsFacetQueryItem> parsedItems = new ArrayList<I_CmsFacetQueryItem>(values.size());
for (I_CmsXmlContentValue value : values) {
I_CmsFacetQueryItem item = parseFacetQueryItem(value.getPath() + "/");
if (null != item) {
parsedItems.add(item);
} else {
// TODO: log
}
}
return parsedItems;
}
}
|
[
"protected",
"List",
"<",
"I_CmsFacetQueryItem",
">",
"parseFacetQueryItems",
"(",
"final",
"String",
"path",
")",
"throws",
"Exception",
"{",
"final",
"List",
"<",
"I_CmsXmlContentValue",
">",
"values",
"=",
"m_xml",
".",
"getValues",
"(",
"path",
",",
"m_locale",
")",
";",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"List",
"<",
"I_CmsFacetQueryItem",
">",
"parsedItems",
"=",
"new",
"ArrayList",
"<",
"I_CmsFacetQueryItem",
">",
"(",
"values",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"I_CmsXmlContentValue",
"value",
":",
"values",
")",
"{",
"I_CmsFacetQueryItem",
"item",
"=",
"parseFacetQueryItem",
"(",
"value",
".",
"getPath",
"(",
")",
"+",
"\"/\"",
")",
";",
"if",
"(",
"null",
"!=",
"item",
")",
"{",
"parsedItems",
".",
"add",
"(",
"item",
")",
";",
"}",
"else",
"{",
"// TODO: log",
"}",
"}",
"return",
"parsedItems",
";",
"}",
"}"
] |
Helper to read a mandatory String value list.
@param path The XML path of the element to read.
@return The String list stored in the XML, or <code>null</code> if the value could not be read.
@throws Exception thrown if the list of String values can not be read.
|
[
"Helper",
"to",
"read",
"a",
"mandatory",
"String",
"value",
"list",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L411-L428
|
158,172
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseFieldFacet
|
protected I_CmsSearchConfigurationFacetField parseFieldFacet(final String pathPrefix) {
try {
final String field = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_FACET_FIELD);
final String name = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_NAME);
final String label = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_LABEL);
final Integer minCount = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_MINCOUNT);
final Integer limit = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_LIMIT);
final String prefix = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_PREFIX);
final String sorder = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_ORDER);
I_CmsSearchConfigurationFacet.SortOrder order;
try {
order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder);
} catch (@SuppressWarnings("unused") final Exception e) {
order = null;
}
final String filterQueryModifier = parseOptionalStringValue(
pathPrefix + XML_ELEMENT_FACET_FILTERQUERYMODIFIER);
final Boolean isAndFacet = parseOptionalBooleanValue(pathPrefix + XML_ELEMENT_FACET_ISANDFACET);
final List<String> preselection = parseOptionalStringValues(pathPrefix + XML_ELEMENT_FACET_PRESELECTION);
final Boolean ignoreAllFacetFilters = parseOptionalBooleanValue(
pathPrefix + XML_ELEMENT_FACET_IGNOREALLFACETFILTERS);
return new CmsSearchConfigurationFacetField(
field,
name,
minCount,
limit,
prefix,
label,
order,
filterQueryModifier,
isAndFacet,
preselection,
ignoreAllFacetFilters);
} catch (final Exception e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1,
XML_ELEMENT_FACET_FIELD),
e);
return null;
}
}
|
java
|
protected I_CmsSearchConfigurationFacetField parseFieldFacet(final String pathPrefix) {
try {
final String field = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_FACET_FIELD);
final String name = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_NAME);
final String label = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_LABEL);
final Integer minCount = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_MINCOUNT);
final Integer limit = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_LIMIT);
final String prefix = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_PREFIX);
final String sorder = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_ORDER);
I_CmsSearchConfigurationFacet.SortOrder order;
try {
order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder);
} catch (@SuppressWarnings("unused") final Exception e) {
order = null;
}
final String filterQueryModifier = parseOptionalStringValue(
pathPrefix + XML_ELEMENT_FACET_FILTERQUERYMODIFIER);
final Boolean isAndFacet = parseOptionalBooleanValue(pathPrefix + XML_ELEMENT_FACET_ISANDFACET);
final List<String> preselection = parseOptionalStringValues(pathPrefix + XML_ELEMENT_FACET_PRESELECTION);
final Boolean ignoreAllFacetFilters = parseOptionalBooleanValue(
pathPrefix + XML_ELEMENT_FACET_IGNOREALLFACETFILTERS);
return new CmsSearchConfigurationFacetField(
field,
name,
minCount,
limit,
prefix,
label,
order,
filterQueryModifier,
isAndFacet,
preselection,
ignoreAllFacetFilters);
} catch (final Exception e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1,
XML_ELEMENT_FACET_FIELD),
e);
return null;
}
}
|
[
"protected",
"I_CmsSearchConfigurationFacetField",
"parseFieldFacet",
"(",
"final",
"String",
"pathPrefix",
")",
"{",
"try",
"{",
"final",
"String",
"field",
"=",
"parseMandatoryStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_FIELD",
")",
";",
"final",
"String",
"name",
"=",
"parseOptionalStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_NAME",
")",
";",
"final",
"String",
"label",
"=",
"parseOptionalStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_LABEL",
")",
";",
"final",
"Integer",
"minCount",
"=",
"parseOptionalIntValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_MINCOUNT",
")",
";",
"final",
"Integer",
"limit",
"=",
"parseOptionalIntValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_LIMIT",
")",
";",
"final",
"String",
"prefix",
"=",
"parseOptionalStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_PREFIX",
")",
";",
"final",
"String",
"sorder",
"=",
"parseOptionalStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_ORDER",
")",
";",
"I_CmsSearchConfigurationFacet",
".",
"SortOrder",
"order",
";",
"try",
"{",
"order",
"=",
"I_CmsSearchConfigurationFacet",
".",
"SortOrder",
".",
"valueOf",
"(",
"sorder",
")",
";",
"}",
"catch",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"final",
"Exception",
"e",
")",
"{",
"order",
"=",
"null",
";",
"}",
"final",
"String",
"filterQueryModifier",
"=",
"parseOptionalStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_FILTERQUERYMODIFIER",
")",
";",
"final",
"Boolean",
"isAndFacet",
"=",
"parseOptionalBooleanValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_ISANDFACET",
")",
";",
"final",
"List",
"<",
"String",
">",
"preselection",
"=",
"parseOptionalStringValues",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_PRESELECTION",
")",
";",
"final",
"Boolean",
"ignoreAllFacetFilters",
"=",
"parseOptionalBooleanValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_IGNOREALLFACETFILTERS",
")",
";",
"return",
"new",
"CmsSearchConfigurationFacetField",
"(",
"field",
",",
"name",
",",
"minCount",
",",
"limit",
",",
"prefix",
",",
"label",
",",
"order",
",",
"filterQueryModifier",
",",
"isAndFacet",
",",
"preselection",
",",
"ignoreAllFacetFilters",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1",
",",
"XML_ELEMENT_FACET_FIELD",
")",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
Reads the configuration of a field facet.
@param pathPrefix The XML Path that leads to the field facet configuration, or <code>null</code> if the XML was not correctly structured.
@return The read configuration, or <code>null</code> if the XML was not correctly structured.
|
[
"Reads",
"the",
"configuration",
"of",
"a",
"field",
"facet",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L434-L476
|
158,173
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseOptionalBooleanValue
|
protected Boolean parseOptionalBooleanValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null;
} else {
final String stringValue = value.getStringValue(null);
try {
final Boolean boolValue = Boolean.valueOf(stringValue);
return boolValue;
} catch (final NumberFormatException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_BOOLEAN_MISSING_1, path), e);
return null;
}
}
}
|
java
|
protected Boolean parseOptionalBooleanValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null;
} else {
final String stringValue = value.getStringValue(null);
try {
final Boolean boolValue = Boolean.valueOf(stringValue);
return boolValue;
} catch (final NumberFormatException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_BOOLEAN_MISSING_1, path), e);
return null;
}
}
}
|
[
"protected",
"Boolean",
"parseOptionalBooleanValue",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"I_CmsXmlContentValue",
"value",
"=",
"m_xml",
".",
"getValue",
"(",
"path",
",",
"m_locale",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"final",
"String",
"stringValue",
"=",
"value",
".",
"getStringValue",
"(",
"null",
")",
";",
"try",
"{",
"final",
"Boolean",
"boolValue",
"=",
"Boolean",
".",
"valueOf",
"(",
"stringValue",
")",
";",
"return",
"boolValue",
";",
"}",
"catch",
"(",
"final",
"NumberFormatException",
"e",
")",
"{",
"LOG",
".",
"info",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"LOG_OPTIONAL_BOOLEAN_MISSING_1",
",",
"path",
")",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"}",
"}"
] |
Helper to read an optional Boolean value.
@param path The XML path of the element to read.
@return The Boolean value stored in the XML, or <code>null</code> if the value could not be read.
|
[
"Helper",
"to",
"read",
"an",
"optional",
"Boolean",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L482-L497
|
158,174
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseOptionalIntValue
|
protected Integer parseOptionalIntValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null;
} else {
final String stringValue = value.getStringValue(null);
try {
final Integer intValue = Integer.valueOf(stringValue);
return intValue;
} catch (final NumberFormatException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_INTEGER_MISSING_1, path), e);
return null;
}
}
}
|
java
|
protected Integer parseOptionalIntValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null;
} else {
final String stringValue = value.getStringValue(null);
try {
final Integer intValue = Integer.valueOf(stringValue);
return intValue;
} catch (final NumberFormatException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_INTEGER_MISSING_1, path), e);
return null;
}
}
}
|
[
"protected",
"Integer",
"parseOptionalIntValue",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"I_CmsXmlContentValue",
"value",
"=",
"m_xml",
".",
"getValue",
"(",
"path",
",",
"m_locale",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"final",
"String",
"stringValue",
"=",
"value",
".",
"getStringValue",
"(",
"null",
")",
";",
"try",
"{",
"final",
"Integer",
"intValue",
"=",
"Integer",
".",
"valueOf",
"(",
"stringValue",
")",
";",
"return",
"intValue",
";",
"}",
"catch",
"(",
"final",
"NumberFormatException",
"e",
")",
"{",
"LOG",
".",
"info",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"LOG_OPTIONAL_INTEGER_MISSING_1",
",",
"path",
")",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"}",
"}"
] |
Helper to read an optional Integer value.
@param path The XML path of the element to read.
@return The Integer value stored in the XML, or <code>null</code> if the value could not be read.
|
[
"Helper",
"to",
"read",
"an",
"optional",
"Integer",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L503-L518
|
158,175
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseOptionalStringValue
|
protected String parseOptionalStringValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null;
} else {
return value.getStringValue(null);
}
}
|
java
|
protected String parseOptionalStringValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null;
} else {
return value.getStringValue(null);
}
}
|
[
"protected",
"String",
"parseOptionalStringValue",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"I_CmsXmlContentValue",
"value",
"=",
"m_xml",
".",
"getValue",
"(",
"path",
",",
"m_locale",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"value",
".",
"getStringValue",
"(",
"null",
")",
";",
"}",
"}"
] |
Helper to read an optional String value.
@param path The XML path of the element to read.
@return The String value stored in the XML, or <code>null</code> if the value could not be read.
|
[
"Helper",
"to",
"read",
"an",
"optional",
"String",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L524-L532
|
158,176
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseOptionalStringValues
|
protected List<String> parseOptionalStringValues(final String path) {
final List<I_CmsXmlContentValue> values = m_xml.getValues(path, m_locale);
if (values == null) {
return null;
} else {
List<String> stringValues = new ArrayList<String>(values.size());
for (I_CmsXmlContentValue value : values) {
stringValues.add(value.getStringValue(null));
}
return stringValues;
}
}
|
java
|
protected List<String> parseOptionalStringValues(final String path) {
final List<I_CmsXmlContentValue> values = m_xml.getValues(path, m_locale);
if (values == null) {
return null;
} else {
List<String> stringValues = new ArrayList<String>(values.size());
for (I_CmsXmlContentValue value : values) {
stringValues.add(value.getStringValue(null));
}
return stringValues;
}
}
|
[
"protected",
"List",
"<",
"String",
">",
"parseOptionalStringValues",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"List",
"<",
"I_CmsXmlContentValue",
">",
"values",
"=",
"m_xml",
".",
"getValues",
"(",
"path",
",",
"m_locale",
")",
";",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"List",
"<",
"String",
">",
"stringValues",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"values",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"I_CmsXmlContentValue",
"value",
":",
"values",
")",
"{",
"stringValues",
".",
"add",
"(",
"value",
".",
"getStringValue",
"(",
"null",
")",
")",
";",
"}",
"return",
"stringValues",
";",
"}",
"}"
] |
Helper to read an optional String value list.
@param path The XML path of the element to read.
@return The String list stored in the XML, or <code>null</code> if the value could not be read.
|
[
"Helper",
"to",
"read",
"an",
"optional",
"String",
"value",
"list",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L538-L550
|
158,177
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseRangeFacet
|
protected I_CmsSearchConfigurationFacetRange parseRangeFacet(String pathPrefix) {
try {
final String range = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_RANGE);
final String name = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_NAME);
final String label = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_LABEL);
final Integer minCount = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_MINCOUNT);
final String start = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_START);
final String end = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_END);
final String gap = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_GAP);
final String sother = parseOptionalStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_OTHER);
List<I_CmsSearchConfigurationFacetRange.Other> other = null;
if (sother != null) {
final List<String> sothers = Arrays.asList(sother.split(","));
other = new ArrayList<I_CmsSearchConfigurationFacetRange.Other>(sothers.size());
for (String so : sothers) {
try {
I_CmsSearchConfigurationFacetRange.Other o = I_CmsSearchConfigurationFacetRange.Other.valueOf(
so);
other.add(o);
} catch (final Exception e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_INVALID_OTHER_OPTION_1, so), e);
}
}
}
final Boolean hardEnd = parseOptionalBooleanValue(pathPrefix + XML_ELEMENT_RANGE_FACET_HARDEND);
final Boolean isAndFacet = parseOptionalBooleanValue(pathPrefix + XML_ELEMENT_FACET_ISANDFACET);
final List<String> preselection = parseOptionalStringValues(pathPrefix + XML_ELEMENT_FACET_PRESELECTION);
final Boolean ignoreAllFacetFilters = parseOptionalBooleanValue(
pathPrefix + XML_ELEMENT_FACET_IGNOREALLFACETFILTERS);
return new CmsSearchConfigurationFacetRange(
range,
start,
end,
gap,
other,
hardEnd,
name,
minCount,
label,
isAndFacet,
preselection,
ignoreAllFacetFilters);
} catch (final Exception e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_RANGE_FACET_MANDATORY_KEY_MISSING_1,
XML_ELEMENT_RANGE_FACET_RANGE
+ ", "
+ XML_ELEMENT_RANGE_FACET_START
+ ", "
+ XML_ELEMENT_RANGE_FACET_END
+ ", "
+ XML_ELEMENT_RANGE_FACET_GAP),
e);
return null;
}
}
|
java
|
protected I_CmsSearchConfigurationFacetRange parseRangeFacet(String pathPrefix) {
try {
final String range = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_RANGE);
final String name = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_NAME);
final String label = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_LABEL);
final Integer minCount = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_MINCOUNT);
final String start = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_START);
final String end = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_END);
final String gap = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_GAP);
final String sother = parseOptionalStringValue(pathPrefix + XML_ELEMENT_RANGE_FACET_OTHER);
List<I_CmsSearchConfigurationFacetRange.Other> other = null;
if (sother != null) {
final List<String> sothers = Arrays.asList(sother.split(","));
other = new ArrayList<I_CmsSearchConfigurationFacetRange.Other>(sothers.size());
for (String so : sothers) {
try {
I_CmsSearchConfigurationFacetRange.Other o = I_CmsSearchConfigurationFacetRange.Other.valueOf(
so);
other.add(o);
} catch (final Exception e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_INVALID_OTHER_OPTION_1, so), e);
}
}
}
final Boolean hardEnd = parseOptionalBooleanValue(pathPrefix + XML_ELEMENT_RANGE_FACET_HARDEND);
final Boolean isAndFacet = parseOptionalBooleanValue(pathPrefix + XML_ELEMENT_FACET_ISANDFACET);
final List<String> preselection = parseOptionalStringValues(pathPrefix + XML_ELEMENT_FACET_PRESELECTION);
final Boolean ignoreAllFacetFilters = parseOptionalBooleanValue(
pathPrefix + XML_ELEMENT_FACET_IGNOREALLFACETFILTERS);
return new CmsSearchConfigurationFacetRange(
range,
start,
end,
gap,
other,
hardEnd,
name,
minCount,
label,
isAndFacet,
preselection,
ignoreAllFacetFilters);
} catch (final Exception e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_RANGE_FACET_MANDATORY_KEY_MISSING_1,
XML_ELEMENT_RANGE_FACET_RANGE
+ ", "
+ XML_ELEMENT_RANGE_FACET_START
+ ", "
+ XML_ELEMENT_RANGE_FACET_END
+ ", "
+ XML_ELEMENT_RANGE_FACET_GAP),
e);
return null;
}
}
|
[
"protected",
"I_CmsSearchConfigurationFacetRange",
"parseRangeFacet",
"(",
"String",
"pathPrefix",
")",
"{",
"try",
"{",
"final",
"String",
"range",
"=",
"parseMandatoryStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_RANGE_FACET_RANGE",
")",
";",
"final",
"String",
"name",
"=",
"parseOptionalStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_NAME",
")",
";",
"final",
"String",
"label",
"=",
"parseOptionalStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_LABEL",
")",
";",
"final",
"Integer",
"minCount",
"=",
"parseOptionalIntValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_MINCOUNT",
")",
";",
"final",
"String",
"start",
"=",
"parseMandatoryStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_RANGE_FACET_START",
")",
";",
"final",
"String",
"end",
"=",
"parseMandatoryStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_RANGE_FACET_END",
")",
";",
"final",
"String",
"gap",
"=",
"parseMandatoryStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_RANGE_FACET_GAP",
")",
";",
"final",
"String",
"sother",
"=",
"parseOptionalStringValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_RANGE_FACET_OTHER",
")",
";",
"List",
"<",
"I_CmsSearchConfigurationFacetRange",
".",
"Other",
">",
"other",
"=",
"null",
";",
"if",
"(",
"sother",
"!=",
"null",
")",
"{",
"final",
"List",
"<",
"String",
">",
"sothers",
"=",
"Arrays",
".",
"asList",
"(",
"sother",
".",
"split",
"(",
"\",\"",
")",
")",
";",
"other",
"=",
"new",
"ArrayList",
"<",
"I_CmsSearchConfigurationFacetRange",
".",
"Other",
">",
"(",
"sothers",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"String",
"so",
":",
"sothers",
")",
"{",
"try",
"{",
"I_CmsSearchConfigurationFacetRange",
".",
"Other",
"o",
"=",
"I_CmsSearchConfigurationFacetRange",
".",
"Other",
".",
"valueOf",
"(",
"so",
")",
";",
"other",
".",
"add",
"(",
"o",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"ERR_INVALID_OTHER_OPTION_1",
",",
"so",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"final",
"Boolean",
"hardEnd",
"=",
"parseOptionalBooleanValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_RANGE_FACET_HARDEND",
")",
";",
"final",
"Boolean",
"isAndFacet",
"=",
"parseOptionalBooleanValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_ISANDFACET",
")",
";",
"final",
"List",
"<",
"String",
">",
"preselection",
"=",
"parseOptionalStringValues",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_PRESELECTION",
")",
";",
"final",
"Boolean",
"ignoreAllFacetFilters",
"=",
"parseOptionalBooleanValue",
"(",
"pathPrefix",
"+",
"XML_ELEMENT_FACET_IGNOREALLFACETFILTERS",
")",
";",
"return",
"new",
"CmsSearchConfigurationFacetRange",
"(",
"range",
",",
"start",
",",
"end",
",",
"gap",
",",
"other",
",",
"hardEnd",
",",
"name",
",",
"minCount",
",",
"label",
",",
"isAndFacet",
",",
"preselection",
",",
"ignoreAllFacetFilters",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"ERR_RANGE_FACET_MANDATORY_KEY_MISSING_1",
",",
"XML_ELEMENT_RANGE_FACET_RANGE",
"+",
"\", \"",
"+",
"XML_ELEMENT_RANGE_FACET_START",
"+",
"\", \"",
"+",
"XML_ELEMENT_RANGE_FACET_END",
"+",
"\", \"",
"+",
"XML_ELEMENT_RANGE_FACET_GAP",
")",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
Reads the configuration of a range facet.
@param pathPrefix The XML Path that leads to the range facet configuration, or <code>null</code> if the XML was not correctly structured.
@return The read configuration, or <code>null</code> if the XML was not correctly structured.
|
[
"Reads",
"the",
"configuration",
"of",
"a",
"range",
"facet",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L556-L614
|
158,178
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.getPageSizes
|
private List<Integer> getPageSizes() {
final String pageSizes = parseOptionalStringValue(XML_ELEMENT_PAGESIZE);
if (pageSizes != null) {
String[] pageSizesArray = pageSizes.split("-");
if (pageSizesArray.length > 0) {
try {
List<Integer> result = new ArrayList<>(pageSizesArray.length);
for (int i = 0; i < pageSizesArray.length; i++) {
result.add(Integer.valueOf(pageSizesArray[i]));
}
return result;
} catch (NumberFormatException e) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_PARSING_PAGE_SIZES_FAILED_1, pageSizes), e);
}
}
}
return null;
}
|
java
|
private List<Integer> getPageSizes() {
final String pageSizes = parseOptionalStringValue(XML_ELEMENT_PAGESIZE);
if (pageSizes != null) {
String[] pageSizesArray = pageSizes.split("-");
if (pageSizesArray.length > 0) {
try {
List<Integer> result = new ArrayList<>(pageSizesArray.length);
for (int i = 0; i < pageSizesArray.length; i++) {
result.add(Integer.valueOf(pageSizesArray[i]));
}
return result;
} catch (NumberFormatException e) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_PARSING_PAGE_SIZES_FAILED_1, pageSizes), e);
}
}
}
return null;
}
|
[
"private",
"List",
"<",
"Integer",
">",
"getPageSizes",
"(",
")",
"{",
"final",
"String",
"pageSizes",
"=",
"parseOptionalStringValue",
"(",
"XML_ELEMENT_PAGESIZE",
")",
";",
"if",
"(",
"pageSizes",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"pageSizesArray",
"=",
"pageSizes",
".",
"split",
"(",
"\"-\"",
")",
";",
"if",
"(",
"pageSizesArray",
".",
"length",
">",
"0",
")",
"{",
"try",
"{",
"List",
"<",
"Integer",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"pageSizesArray",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pageSizesArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
".",
"add",
"(",
"Integer",
".",
"valueOf",
"(",
"pageSizesArray",
"[",
"i",
"]",
")",
")",
";",
"}",
"return",
"result",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"LOG_PARSING_PAGE_SIZES_FAILED_1",
",",
"pageSizes",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Returns the configured page size, or the default page size if it is not configured.
@return The configured page size, or the default page size if it is not configured.
|
[
"Returns",
"the",
"configured",
"page",
"size",
"or",
"the",
"default",
"page",
"size",
"if",
"it",
"is",
"not",
"configured",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L742-L760
|
158,179
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.getQueryParam
|
private String getQueryParam() {
final String param = parseOptionalStringValue(XML_ELEMENT_QUERYPARAM);
if (param == null) {
return DEFAULT_QUERY_PARAM;
} else {
return param;
}
}
|
java
|
private String getQueryParam() {
final String param = parseOptionalStringValue(XML_ELEMENT_QUERYPARAM);
if (param == null) {
return DEFAULT_QUERY_PARAM;
} else {
return param;
}
}
|
[
"private",
"String",
"getQueryParam",
"(",
")",
"{",
"final",
"String",
"param",
"=",
"parseOptionalStringValue",
"(",
"XML_ELEMENT_QUERYPARAM",
")",
";",
"if",
"(",
"param",
"==",
"null",
")",
"{",
"return",
"DEFAULT_QUERY_PARAM",
";",
"}",
"else",
"{",
"return",
"param",
";",
"}",
"}"
] |
Returns the configured request parameter for the current query string, or the default parameter if the core is not specified.
@return The configured request parameter for the current query string, or the default parameter if the core is not specified.
|
[
"Returns",
"the",
"configured",
"request",
"parameter",
"for",
"the",
"current",
"query",
"string",
"or",
"the",
"default",
"parameter",
"if",
"the",
"core",
"is",
"not",
"specified",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L773-L781
|
158,180
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.getSortOptions
|
private List<I_CmsSearchConfigurationSortOption> getSortOptions() {
final List<I_CmsSearchConfigurationSortOption> options = new ArrayList<I_CmsSearchConfigurationSortOption>();
final CmsXmlContentValueSequence sortOptions = m_xml.getValueSequence(XML_ELEMENT_SORTOPTIONS, m_locale);
if (sortOptions == null) {
return null;
} else {
for (int i = 0; i < sortOptions.getElementCount(); i++) {
final I_CmsSearchConfigurationSortOption option = parseSortOption(
sortOptions.getValue(i).getPath() + "/");
if (option != null) {
options.add(option);
}
}
return options;
}
}
|
java
|
private List<I_CmsSearchConfigurationSortOption> getSortOptions() {
final List<I_CmsSearchConfigurationSortOption> options = new ArrayList<I_CmsSearchConfigurationSortOption>();
final CmsXmlContentValueSequence sortOptions = m_xml.getValueSequence(XML_ELEMENT_SORTOPTIONS, m_locale);
if (sortOptions == null) {
return null;
} else {
for (int i = 0; i < sortOptions.getElementCount(); i++) {
final I_CmsSearchConfigurationSortOption option = parseSortOption(
sortOptions.getValue(i).getPath() + "/");
if (option != null) {
options.add(option);
}
}
return options;
}
}
|
[
"private",
"List",
"<",
"I_CmsSearchConfigurationSortOption",
">",
"getSortOptions",
"(",
")",
"{",
"final",
"List",
"<",
"I_CmsSearchConfigurationSortOption",
">",
"options",
"=",
"new",
"ArrayList",
"<",
"I_CmsSearchConfigurationSortOption",
">",
"(",
")",
";",
"final",
"CmsXmlContentValueSequence",
"sortOptions",
"=",
"m_xml",
".",
"getValueSequence",
"(",
"XML_ELEMENT_SORTOPTIONS",
",",
"m_locale",
")",
";",
"if",
"(",
"sortOptions",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sortOptions",
".",
"getElementCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"I_CmsSearchConfigurationSortOption",
"option",
"=",
"parseSortOption",
"(",
"sortOptions",
".",
"getValue",
"(",
"i",
")",
".",
"getPath",
"(",
")",
"+",
"\"/\"",
")",
";",
"if",
"(",
"option",
"!=",
"null",
")",
"{",
"options",
".",
"add",
"(",
"option",
")",
";",
"}",
"}",
"return",
"options",
";",
"}",
"}"
] |
Returns the configured sort options, or the empty list if no such options are configured.
@return The configured sort options, or the empty list if no such options are configured.
|
[
"Returns",
"the",
"configured",
"sort",
"options",
"or",
"the",
"empty",
"list",
"if",
"no",
"such",
"options",
"are",
"configured",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L794-L810
|
158,181
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseFacetQueryItem
|
private I_CmsFacetQueryItem parseFacetQueryItem(final String prefix) {
I_CmsXmlContentValue query = m_xml.getValue(prefix + XML_ELEMENT_QUERY_FACET_QUERY_QUERY, m_locale);
if (null != query) {
String queryString = query.getStringValue(null);
I_CmsXmlContentValue label = m_xml.getValue(prefix + XML_ELEMENT_QUERY_FACET_QUERY_LABEL, m_locale);
String labelString = null != label ? label.getStringValue(null) : null;
return new CmsFacetQueryItem(queryString, labelString);
} else {
return null;
}
}
|
java
|
private I_CmsFacetQueryItem parseFacetQueryItem(final String prefix) {
I_CmsXmlContentValue query = m_xml.getValue(prefix + XML_ELEMENT_QUERY_FACET_QUERY_QUERY, m_locale);
if (null != query) {
String queryString = query.getStringValue(null);
I_CmsXmlContentValue label = m_xml.getValue(prefix + XML_ELEMENT_QUERY_FACET_QUERY_LABEL, m_locale);
String labelString = null != label ? label.getStringValue(null) : null;
return new CmsFacetQueryItem(queryString, labelString);
} else {
return null;
}
}
|
[
"private",
"I_CmsFacetQueryItem",
"parseFacetQueryItem",
"(",
"final",
"String",
"prefix",
")",
"{",
"I_CmsXmlContentValue",
"query",
"=",
"m_xml",
".",
"getValue",
"(",
"prefix",
"+",
"XML_ELEMENT_QUERY_FACET_QUERY_QUERY",
",",
"m_locale",
")",
";",
"if",
"(",
"null",
"!=",
"query",
")",
"{",
"String",
"queryString",
"=",
"query",
".",
"getStringValue",
"(",
"null",
")",
";",
"I_CmsXmlContentValue",
"label",
"=",
"m_xml",
".",
"getValue",
"(",
"prefix",
"+",
"XML_ELEMENT_QUERY_FACET_QUERY_LABEL",
",",
"m_locale",
")",
";",
"String",
"labelString",
"=",
"null",
"!=",
"label",
"?",
"label",
".",
"getStringValue",
"(",
"null",
")",
":",
"null",
";",
"return",
"new",
"CmsFacetQueryItem",
"(",
"queryString",
",",
"labelString",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Parses a single query facet item with query and label.
@param prefix path to the query facet item (with trailing '/').
@return the query facet item.
|
[
"Parses",
"a",
"single",
"query",
"facet",
"item",
"with",
"query",
"and",
"label",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L824-L835
|
158,182
|
alkacon/opencms-core
|
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
|
CmsXMLSearchConfigurationParser.parseMandatoryStringValue
|
private String parseMandatoryStringValue(final String path) throws Exception {
final String value = parseOptionalStringValue(path);
if (value == null) {
throw new Exception();
}
return value;
}
|
java
|
private String parseMandatoryStringValue(final String path) throws Exception {
final String value = parseOptionalStringValue(path);
if (value == null) {
throw new Exception();
}
return value;
}
|
[
"private",
"String",
"parseMandatoryStringValue",
"(",
"final",
"String",
"path",
")",
"throws",
"Exception",
"{",
"final",
"String",
"value",
"=",
"parseOptionalStringValue",
"(",
"path",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
")",
";",
"}",
"return",
"value",
";",
"}"
] |
Helper to read a mandatory String value.
@param path The XML path of the element to read.
@return The String value stored in the XML.
@throws Exception thrown if the value could not be read.
|
[
"Helper",
"to",
"read",
"a",
"mandatory",
"String",
"value",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L842-L849
|
158,183
|
alkacon/opencms-core
|
src/org/opencms/search/CmsIndexingThread.java
|
CmsIndexingThread.createDefaultIndexDocument
|
protected I_CmsSearchDocument createDefaultIndexDocument() {
try {
return m_index.getFieldConfiguration().createDocument(m_cms, m_res, m_index, null);
} catch (CmsException e) {
LOG.error(
"Default document for "
+ m_res.getRootPath()
+ " and index "
+ m_index.getName()
+ " could not be created.",
e);
return null;
}
}
|
java
|
protected I_CmsSearchDocument createDefaultIndexDocument() {
try {
return m_index.getFieldConfiguration().createDocument(m_cms, m_res, m_index, null);
} catch (CmsException e) {
LOG.error(
"Default document for "
+ m_res.getRootPath()
+ " and index "
+ m_index.getName()
+ " could not be created.",
e);
return null;
}
}
|
[
"protected",
"I_CmsSearchDocument",
"createDefaultIndexDocument",
"(",
")",
"{",
"try",
"{",
"return",
"m_index",
".",
"getFieldConfiguration",
"(",
")",
".",
"createDocument",
"(",
"m_cms",
",",
"m_res",
",",
"m_index",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Default document for \"",
"+",
"m_res",
".",
"getRootPath",
"(",
")",
"+",
"\" and index \"",
"+",
"m_index",
".",
"getName",
"(",
")",
"+",
"\" could not be created.\"",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
Creates a document for the resource without extracting the content. The aim is to get a content indexed,
even if extraction runs into a timeout.
@return the document for the resource generated if the content is discarded,
i.e., only meta information are indexed.
|
[
"Creates",
"a",
"document",
"for",
"the",
"resource",
"without",
"extracting",
"the",
"content",
".",
"The",
"aim",
"is",
"to",
"get",
"a",
"content",
"indexed",
"even",
"if",
"extraction",
"runs",
"into",
"a",
"timeout",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsIndexingThread.java#L197-L211
|
158,184
|
alkacon/opencms-core
|
src/org/opencms/jsp/util/A_CmsJspValueWrapper.java
|
A_CmsJspValueWrapper.getToInstanceDate
|
public CmsJspInstanceDateBean getToInstanceDate() {
if (m_instanceDate == null) {
m_instanceDate = new CmsJspInstanceDateBean(getToDate(), m_cms.getRequestContext().getLocale());
}
return m_instanceDate;
}
|
java
|
public CmsJspInstanceDateBean getToInstanceDate() {
if (m_instanceDate == null) {
m_instanceDate = new CmsJspInstanceDateBean(getToDate(), m_cms.getRequestContext().getLocale());
}
return m_instanceDate;
}
|
[
"public",
"CmsJspInstanceDateBean",
"getToInstanceDate",
"(",
")",
"{",
"if",
"(",
"m_instanceDate",
"==",
"null",
")",
"{",
"m_instanceDate",
"=",
"new",
"CmsJspInstanceDateBean",
"(",
"getToDate",
"(",
")",
",",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",
"(",
")",
")",
";",
"}",
"return",
"m_instanceDate",
";",
"}"
] |
Converts a date to an instance date bean.
@return the instance date bean.
|
[
"Converts",
"a",
"date",
"to",
"an",
"instance",
"date",
"bean",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/A_CmsJspValueWrapper.java#L448-L454
|
158,185
|
alkacon/opencms-core
|
src/org/opencms/workplace/galleries/Messages.java
|
Messages.getGalleryNotFoundKey
|
public static String getGalleryNotFoundKey(String gallery) {
StringBuffer sb = new StringBuffer(ERROR_REASON_NO_PREFIX);
sb.append(gallery.toUpperCase());
sb.append(GUI_TITLE_POSTFIX);
return sb.toString();
}
|
java
|
public static String getGalleryNotFoundKey(String gallery) {
StringBuffer sb = new StringBuffer(ERROR_REASON_NO_PREFIX);
sb.append(gallery.toUpperCase());
sb.append(GUI_TITLE_POSTFIX);
return sb.toString();
}
|
[
"public",
"static",
"String",
"getGalleryNotFoundKey",
"(",
"String",
"gallery",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"ERROR_REASON_NO_PREFIX",
")",
";",
"sb",
".",
"append",
"(",
"gallery",
".",
"toUpperCase",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"GUI_TITLE_POSTFIX",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Convert gallery name to not found error key.
@param gallery gallery name for example "downloadgallery"
@return key as string "ERR_REASON_NO_DOWNLOADGALLERY_0"
|
[
"Convert",
"gallery",
"name",
"to",
"not",
"found",
"error",
"key",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/galleries/Messages.java#L499-L505
|
158,186
|
alkacon/opencms-core
|
src/org/opencms/workplace/galleries/Messages.java
|
Messages.getTitleGalleryKey
|
public static String getTitleGalleryKey(String gallery) {
StringBuffer sb = new StringBuffer(GUI_TITLE_PREFIX);
sb.append(gallery.toUpperCase());
sb.append(GUI_TITLE_POSTFIX);
return sb.toString();
}
|
java
|
public static String getTitleGalleryKey(String gallery) {
StringBuffer sb = new StringBuffer(GUI_TITLE_PREFIX);
sb.append(gallery.toUpperCase());
sb.append(GUI_TITLE_POSTFIX);
return sb.toString();
}
|
[
"public",
"static",
"String",
"getTitleGalleryKey",
"(",
"String",
"gallery",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"GUI_TITLE_PREFIX",
")",
";",
"sb",
".",
"append",
"(",
"gallery",
".",
"toUpperCase",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"GUI_TITLE_POSTFIX",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Convert gallery name to title key.
@param gallery gallery name for example "downloadgallery"
@return key as string "ERR_REASON_NO_DOWNLOADGALLERY_0"
|
[
"Convert",
"gallery",
"name",
"to",
"title",
"key",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/galleries/Messages.java#L512-L518
|
158,187
|
alkacon/opencms-core
|
src/org/opencms/xml/templatemapper/CmsTemplateMapper.java
|
CmsTemplateMapper.getTemplateMapperConfig
|
public static String getTemplateMapperConfig(ServletRequest request) {
String result = null;
CmsTemplateContext templateContext = (CmsTemplateContext)request.getAttribute(
CmsTemplateContextManager.ATTR_TEMPLATE_CONTEXT);
if (templateContext != null) {
I_CmsTemplateContextProvider provider = templateContext.getProvider();
if (provider instanceof I_CmsTemplateMappingContextProvider) {
result = ((I_CmsTemplateMappingContextProvider)provider).getMappingConfigurationPath(
templateContext.getKey());
}
}
return result;
}
|
java
|
public static String getTemplateMapperConfig(ServletRequest request) {
String result = null;
CmsTemplateContext templateContext = (CmsTemplateContext)request.getAttribute(
CmsTemplateContextManager.ATTR_TEMPLATE_CONTEXT);
if (templateContext != null) {
I_CmsTemplateContextProvider provider = templateContext.getProvider();
if (provider instanceof I_CmsTemplateMappingContextProvider) {
result = ((I_CmsTemplateMappingContextProvider)provider).getMappingConfigurationPath(
templateContext.getKey());
}
}
return result;
}
|
[
"public",
"static",
"String",
"getTemplateMapperConfig",
"(",
"ServletRequest",
"request",
")",
"{",
"String",
"result",
"=",
"null",
";",
"CmsTemplateContext",
"templateContext",
"=",
"(",
"CmsTemplateContext",
")",
"request",
".",
"getAttribute",
"(",
"CmsTemplateContextManager",
".",
"ATTR_TEMPLATE_CONTEXT",
")",
";",
"if",
"(",
"templateContext",
"!=",
"null",
")",
"{",
"I_CmsTemplateContextProvider",
"provider",
"=",
"templateContext",
".",
"getProvider",
"(",
")",
";",
"if",
"(",
"provider",
"instanceof",
"I_CmsTemplateMappingContextProvider",
")",
"{",
"result",
"=",
"(",
"(",
"I_CmsTemplateMappingContextProvider",
")",
"provider",
")",
".",
"getMappingConfigurationPath",
"(",
"templateContext",
".",
"getKey",
"(",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Checks if the selected template context is "templatemapper".
@param request the current request
@return true if the selected template context is "templatemapper"
|
[
"Checks",
"if",
"the",
"selected",
"template",
"context",
"is",
"templatemapper",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/templatemapper/CmsTemplateMapper.java#L134-L147
|
158,188
|
alkacon/opencms-core
|
src/org/opencms/xml/templatemapper/CmsTemplateMapper.java
|
CmsTemplateMapper.getConfiguration
|
private CmsTemplateMapperConfiguration getConfiguration(final CmsObject cms) {
if (!m_enabled) {
return CmsTemplateMapperConfiguration.EMPTY_CONFIG;
}
if (m_configPath == null) {
m_configPath = OpenCms.getSystemInfo().getConfigFilePath(cms, "template-mapping.xml");
}
return (CmsTemplateMapperConfiguration)(CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(
cms,
m_configPath,
new Transformer() {
@Override
public Object transform(Object input) {
try {
CmsFile file = cms.readFile(m_configPath, CmsResourceFilter.IGNORE_EXPIRATION);
SAXReader saxBuilder = new SAXReader();
try (ByteArrayInputStream stream = new ByteArrayInputStream(file.getContents())) {
Document document = saxBuilder.read(stream);
CmsTemplateMapperConfiguration config = new CmsTemplateMapperConfiguration(cms, document);
return config;
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
return new CmsTemplateMapperConfiguration(); // empty configuration, does not do anything
}
}
}));
}
|
java
|
private CmsTemplateMapperConfiguration getConfiguration(final CmsObject cms) {
if (!m_enabled) {
return CmsTemplateMapperConfiguration.EMPTY_CONFIG;
}
if (m_configPath == null) {
m_configPath = OpenCms.getSystemInfo().getConfigFilePath(cms, "template-mapping.xml");
}
return (CmsTemplateMapperConfiguration)(CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(
cms,
m_configPath,
new Transformer() {
@Override
public Object transform(Object input) {
try {
CmsFile file = cms.readFile(m_configPath, CmsResourceFilter.IGNORE_EXPIRATION);
SAXReader saxBuilder = new SAXReader();
try (ByteArrayInputStream stream = new ByteArrayInputStream(file.getContents())) {
Document document = saxBuilder.read(stream);
CmsTemplateMapperConfiguration config = new CmsTemplateMapperConfiguration(cms, document);
return config;
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
return new CmsTemplateMapperConfiguration(); // empty configuration, does not do anything
}
}
}));
}
|
[
"private",
"CmsTemplateMapperConfiguration",
"getConfiguration",
"(",
"final",
"CmsObject",
"cms",
")",
"{",
"if",
"(",
"!",
"m_enabled",
")",
"{",
"return",
"CmsTemplateMapperConfiguration",
".",
"EMPTY_CONFIG",
";",
"}",
"if",
"(",
"m_configPath",
"==",
"null",
")",
"{",
"m_configPath",
"=",
"OpenCms",
".",
"getSystemInfo",
"(",
")",
".",
"getConfigFilePath",
"(",
"cms",
",",
"\"template-mapping.xml\"",
")",
";",
"}",
"return",
"(",
"CmsTemplateMapperConfiguration",
")",
"(",
"CmsVfsMemoryObjectCache",
".",
"getVfsMemoryObjectCache",
"(",
")",
".",
"loadVfsObject",
"(",
"cms",
",",
"m_configPath",
",",
"new",
"Transformer",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"transform",
"(",
"Object",
"input",
")",
"{",
"try",
"{",
"CmsFile",
"file",
"=",
"cms",
".",
"readFile",
"(",
"m_configPath",
",",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
")",
";",
"SAXReader",
"saxBuilder",
"=",
"new",
"SAXReader",
"(",
")",
";",
"try",
"(",
"ByteArrayInputStream",
"stream",
"=",
"new",
"ByteArrayInputStream",
"(",
"file",
".",
"getContents",
"(",
")",
")",
")",
"{",
"Document",
"document",
"=",
"saxBuilder",
".",
"read",
"(",
"stream",
")",
";",
"CmsTemplateMapperConfiguration",
"config",
"=",
"new",
"CmsTemplateMapperConfiguration",
"(",
"cms",
",",
"document",
")",
";",
"return",
"config",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"new",
"CmsTemplateMapperConfiguration",
"(",
")",
";",
"// empty configuration, does not do anything",
"}",
"}",
"}",
")",
")",
";",
"}"
] |
Loads the configuration file, using CmsVfsMemoryObjectCache for caching.
@param cms the CMS context
@return the template mapper configuration
|
[
"Loads",
"the",
"configuration",
"file",
"using",
"CmsVfsMemoryObjectCache",
"for",
"caching",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/templatemapper/CmsTemplateMapper.java#L348-L381
|
158,189
|
alkacon/opencms-core
|
src-gwt/org/opencms/gwt/client/ui/CmsErrorDialog.java
|
CmsErrorDialog.onShow
|
private void onShow() {
if (m_detailsFieldset != null) {
m_detailsFieldset.getContentPanel().getElement().getStyle().setPropertyPx(
"maxHeight",
getAvailableHeight(m_messageWidget.getOffsetHeight()));
}
}
|
java
|
private void onShow() {
if (m_detailsFieldset != null) {
m_detailsFieldset.getContentPanel().getElement().getStyle().setPropertyPx(
"maxHeight",
getAvailableHeight(m_messageWidget.getOffsetHeight()));
}
}
|
[
"private",
"void",
"onShow",
"(",
")",
"{",
"if",
"(",
"m_detailsFieldset",
"!=",
"null",
")",
"{",
"m_detailsFieldset",
".",
"getContentPanel",
"(",
")",
".",
"getElement",
"(",
")",
".",
"getStyle",
"(",
")",
".",
"setPropertyPx",
"(",
"\"maxHeight\"",
",",
"getAvailableHeight",
"(",
"m_messageWidget",
".",
"getOffsetHeight",
"(",
")",
")",
")",
";",
"}",
"}"
] |
Checks the available space and sets max-height to the details field-set.
|
[
"Checks",
"the",
"available",
"space",
"and",
"sets",
"max",
"-",
"height",
"to",
"the",
"details",
"field",
"-",
"set",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsErrorDialog.java#L329-L336
|
158,190
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitCheckin.java
|
CmsGitCheckin.addModuleToExport
|
public void addModuleToExport(final String moduleName) {
if (m_modulesToExport == null) {
m_modulesToExport = new HashSet<String>();
}
m_modulesToExport.add(moduleName);
}
|
java
|
public void addModuleToExport(final String moduleName) {
if (m_modulesToExport == null) {
m_modulesToExport = new HashSet<String>();
}
m_modulesToExport.add(moduleName);
}
|
[
"public",
"void",
"addModuleToExport",
"(",
"final",
"String",
"moduleName",
")",
"{",
"if",
"(",
"m_modulesToExport",
"==",
"null",
")",
"{",
"m_modulesToExport",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"}",
"m_modulesToExport",
".",
"add",
"(",
"moduleName",
")",
";",
"}"
] |
Adds a module to the modules that should be exported.
If called at least once, the explicitly added modules will be exported
instead of the default modules.
@param moduleName the name of the module to export.
|
[
"Adds",
"a",
"module",
"to",
"the",
"modules",
"that",
"should",
"be",
"exported",
".",
"If",
"called",
"at",
"least",
"once",
"the",
"explicitly",
"added",
"modules",
"will",
"be",
"exported",
"instead",
"of",
"the",
"default",
"modules",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L220-L226
|
158,191
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitCheckin.java
|
CmsGitCheckin.checkIn
|
public int checkIn() {
try {
synchronized (STATIC_LOCK) {
m_logStream = new PrintStream(new FileOutputStream(DEFAULT_LOGFILE_PATH, false));
CmsObject cms = getCmsObject();
if (cms != null) {
return checkInInternal();
} else {
m_logStream.println("No CmsObject given. Did you call init() first?");
return -1;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
return -2;
}
}
|
java
|
public int checkIn() {
try {
synchronized (STATIC_LOCK) {
m_logStream = new PrintStream(new FileOutputStream(DEFAULT_LOGFILE_PATH, false));
CmsObject cms = getCmsObject();
if (cms != null) {
return checkInInternal();
} else {
m_logStream.println("No CmsObject given. Did you call init() first?");
return -1;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
return -2;
}
}
|
[
"public",
"int",
"checkIn",
"(",
")",
"{",
"try",
"{",
"synchronized",
"(",
"STATIC_LOCK",
")",
"{",
"m_logStream",
"=",
"new",
"PrintStream",
"(",
"new",
"FileOutputStream",
"(",
"DEFAULT_LOGFILE_PATH",
",",
"false",
")",
")",
";",
"CmsObject",
"cms",
"=",
"getCmsObject",
"(",
")",
";",
"if",
"(",
"cms",
"!=",
"null",
")",
"{",
"return",
"checkInInternal",
"(",
")",
";",
"}",
"else",
"{",
"m_logStream",
".",
"println",
"(",
"\"No CmsObject given. Did you call init() first?\"",
")",
";",
"return",
"-",
"1",
";",
"}",
"}",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"-",
"2",
";",
"}",
"}"
] |
Start export and check in of the selected modules.
@return The exit code of the check in procedure (like a script's exit code).
|
[
"Start",
"export",
"and",
"check",
"in",
"of",
"the",
"selected",
"modules",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L232-L249
|
158,192
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitCheckin.java
|
CmsGitCheckin.setCurrentConfiguration
|
public boolean setCurrentConfiguration(CmsGitConfiguration configuration) {
if ((null != configuration) && configuration.isValid()) {
m_currentConfiguration = configuration;
return true;
}
return false;
}
|
java
|
public boolean setCurrentConfiguration(CmsGitConfiguration configuration) {
if ((null != configuration) && configuration.isValid()) {
m_currentConfiguration = configuration;
return true;
}
return false;
}
|
[
"public",
"boolean",
"setCurrentConfiguration",
"(",
"CmsGitConfiguration",
"configuration",
")",
"{",
"if",
"(",
"(",
"null",
"!=",
"configuration",
")",
"&&",
"configuration",
".",
"isValid",
"(",
")",
")",
"{",
"m_currentConfiguration",
"=",
"configuration",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Sets the current configuration if it is a valid configuration. Otherwise the configuration is not set.
@param configuration the configuration to set.
@return flag, indicating if the configuration is set.
|
[
"Sets",
"the",
"current",
"configuration",
"if",
"it",
"is",
"a",
"valid",
"configuration",
".",
"Otherwise",
"the",
"configuration",
"is",
"not",
"set",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L429-L436
|
158,193
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitCheckin.java
|
CmsGitCheckin.checkInInternal
|
private int checkInInternal() {
m_logStream.println("[" + new Date() + "] STARTING Git task");
m_logStream.println("=========================");
m_logStream.println();
if (m_checkout) {
m_logStream.println("Running checkout script");
} else if (!(m_resetHead || m_resetRemoteHead)) {
m_logStream.println("Exporting relevant modules");
m_logStream.println("--------------------------");
m_logStream.println();
exportModules();
m_logStream.println();
m_logStream.println("Calling script to check in the exports");
m_logStream.println("--------------------------------------");
m_logStream.println();
} else {
m_logStream.println();
m_logStream.println("Calling script to reset the repository");
m_logStream.println("--------------------------------------");
m_logStream.println();
}
int exitCode = runCommitScript();
if (exitCode != 0) {
m_logStream.println();
m_logStream.println("ERROR: Something went wrong. The script got exitcode " + exitCode + ".");
m_logStream.println();
}
if ((exitCode == 0) && m_checkout) {
boolean importOk = importModules();
if (!importOk) {
return -1;
}
}
m_logStream.println("[" + new Date() + "] FINISHED Git task");
m_logStream.println();
m_logStream.close();
return exitCode;
}
|
java
|
private int checkInInternal() {
m_logStream.println("[" + new Date() + "] STARTING Git task");
m_logStream.println("=========================");
m_logStream.println();
if (m_checkout) {
m_logStream.println("Running checkout script");
} else if (!(m_resetHead || m_resetRemoteHead)) {
m_logStream.println("Exporting relevant modules");
m_logStream.println("--------------------------");
m_logStream.println();
exportModules();
m_logStream.println();
m_logStream.println("Calling script to check in the exports");
m_logStream.println("--------------------------------------");
m_logStream.println();
} else {
m_logStream.println();
m_logStream.println("Calling script to reset the repository");
m_logStream.println("--------------------------------------");
m_logStream.println();
}
int exitCode = runCommitScript();
if (exitCode != 0) {
m_logStream.println();
m_logStream.println("ERROR: Something went wrong. The script got exitcode " + exitCode + ".");
m_logStream.println();
}
if ((exitCode == 0) && m_checkout) {
boolean importOk = importModules();
if (!importOk) {
return -1;
}
}
m_logStream.println("[" + new Date() + "] FINISHED Git task");
m_logStream.println();
m_logStream.close();
return exitCode;
}
|
[
"private",
"int",
"checkInInternal",
"(",
")",
"{",
"m_logStream",
".",
"println",
"(",
"\"[\"",
"+",
"new",
"Date",
"(",
")",
"+",
"\"] STARTING Git task\"",
")",
";",
"m_logStream",
".",
"println",
"(",
"\"=========================\"",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"if",
"(",
"m_checkout",
")",
"{",
"m_logStream",
".",
"println",
"(",
"\"Running checkout script\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"(",
"m_resetHead",
"||",
"m_resetRemoteHead",
")",
")",
"{",
"m_logStream",
".",
"println",
"(",
"\"Exporting relevant modules\"",
")",
";",
"m_logStream",
".",
"println",
"(",
"\"--------------------------\"",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"exportModules",
"(",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"m_logStream",
".",
"println",
"(",
"\"Calling script to check in the exports\"",
")",
";",
"m_logStream",
".",
"println",
"(",
"\"--------------------------------------\"",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"}",
"else",
"{",
"m_logStream",
".",
"println",
"(",
")",
";",
"m_logStream",
".",
"println",
"(",
"\"Calling script to reset the repository\"",
")",
";",
"m_logStream",
".",
"println",
"(",
"\"--------------------------------------\"",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"}",
"int",
"exitCode",
"=",
"runCommitScript",
"(",
")",
";",
"if",
"(",
"exitCode",
"!=",
"0",
")",
"{",
"m_logStream",
".",
"println",
"(",
")",
";",
"m_logStream",
".",
"println",
"(",
"\"ERROR: Something went wrong. The script got exitcode \"",
"+",
"exitCode",
"+",
"\".\"",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"}",
"if",
"(",
"(",
"exitCode",
"==",
"0",
")",
"&&",
"m_checkout",
")",
"{",
"boolean",
"importOk",
"=",
"importModules",
"(",
")",
";",
"if",
"(",
"!",
"importOk",
")",
"{",
"return",
"-",
"1",
";",
"}",
"}",
"m_logStream",
".",
"println",
"(",
"\"[\"",
"+",
"new",
"Date",
"(",
")",
"+",
"\"] FINISHED Git task\"",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"m_logStream",
".",
"close",
"(",
")",
";",
"return",
"exitCode",
";",
"}"
] |
Export modules and check them in. Assumes the log stream already open.
@return exit code of the commit-script.
|
[
"Export",
"modules",
"and",
"check",
"them",
"in",
".",
"Assumes",
"the",
"log",
"stream",
"already",
"open",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L558-L605
|
158,194
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitCheckin.java
|
CmsGitCheckin.checkinScriptCommand
|
private String checkinScriptCommand() {
String exportModules = "";
if ((m_modulesToExport != null) && !m_modulesToExport.isEmpty()) {
StringBuffer exportModulesParam = new StringBuffer();
for (String moduleName : m_modulesToExport) {
exportModulesParam.append(" ").append(moduleName);
}
exportModulesParam.replace(0, 1, " \"");
exportModulesParam.append("\" ");
exportModules = " --modules " + exportModulesParam.toString();
}
String commitMessage = "";
if (m_commitMessage != null) {
commitMessage = " -msg \"" + m_commitMessage.replace("\"", "\\\"") + "\"";
}
String gitUserName = "";
if (m_gitUserName != null) {
if (m_gitUserName.trim().isEmpty()) {
gitUserName = " --ignore-default-git-user-name";
} else {
gitUserName = " --git-user-name \"" + m_gitUserName + "\"";
}
}
String gitUserEmail = "";
if (m_gitUserEmail != null) {
if (m_gitUserEmail.trim().isEmpty()) {
gitUserEmail = " --ignore-default-git-user-email";
} else {
gitUserEmail = " --git-user-email \"" + m_gitUserEmail + "\"";
}
}
String autoPullBefore = "";
if (m_autoPullBefore != null) {
autoPullBefore = m_autoPullBefore.booleanValue() ? " --pull-before " : " --no-pull-before";
}
String autoPullAfter = "";
if (m_autoPullAfter != null) {
autoPullAfter = m_autoPullAfter.booleanValue() ? " --pull-after " : " --no-pull-after";
}
String autoPush = "";
if (m_autoPush != null) {
autoPush = m_autoPush.booleanValue() ? " --push " : " --no-push";
}
String exportFolder = " --export-folder \"" + m_currentConfiguration.getModuleExportPath() + "\"";
String exportMode = " --export-mode " + m_currentConfiguration.getExportMode();
String excludeLibs = "";
if (m_excludeLibs != null) {
excludeLibs = m_excludeLibs.booleanValue() ? " --exclude-libs" : " --no-exclude-libs";
}
String commitMode = "";
if (m_commitMode != null) {
commitMode = m_commitMode.booleanValue() ? " --commit" : " --no-commit";
}
String ignoreUncleanMode = "";
if (m_ignoreUnclean != null) {
ignoreUncleanMode = m_ignoreUnclean.booleanValue() ? " --ignore-unclean" : " --no-ignore-unclean";
}
String copyAndUnzip = "";
if (m_copyAndUnzip != null) {
copyAndUnzip = m_copyAndUnzip.booleanValue() ? " --copy-and-unzip" : " --no-copy-and-unzip";
}
String configFilePath = m_currentConfiguration.getFilePath();
return "\""
+ DEFAULT_SCRIPT_FILE
+ "\""
+ exportModules
+ commitMessage
+ gitUserName
+ gitUserEmail
+ autoPullBefore
+ autoPullAfter
+ autoPush
+ exportFolder
+ exportMode
+ excludeLibs
+ commitMode
+ ignoreUncleanMode
+ copyAndUnzip
+ " \""
+ configFilePath
+ "\"";
}
|
java
|
private String checkinScriptCommand() {
String exportModules = "";
if ((m_modulesToExport != null) && !m_modulesToExport.isEmpty()) {
StringBuffer exportModulesParam = new StringBuffer();
for (String moduleName : m_modulesToExport) {
exportModulesParam.append(" ").append(moduleName);
}
exportModulesParam.replace(0, 1, " \"");
exportModulesParam.append("\" ");
exportModules = " --modules " + exportModulesParam.toString();
}
String commitMessage = "";
if (m_commitMessage != null) {
commitMessage = " -msg \"" + m_commitMessage.replace("\"", "\\\"") + "\"";
}
String gitUserName = "";
if (m_gitUserName != null) {
if (m_gitUserName.trim().isEmpty()) {
gitUserName = " --ignore-default-git-user-name";
} else {
gitUserName = " --git-user-name \"" + m_gitUserName + "\"";
}
}
String gitUserEmail = "";
if (m_gitUserEmail != null) {
if (m_gitUserEmail.trim().isEmpty()) {
gitUserEmail = " --ignore-default-git-user-email";
} else {
gitUserEmail = " --git-user-email \"" + m_gitUserEmail + "\"";
}
}
String autoPullBefore = "";
if (m_autoPullBefore != null) {
autoPullBefore = m_autoPullBefore.booleanValue() ? " --pull-before " : " --no-pull-before";
}
String autoPullAfter = "";
if (m_autoPullAfter != null) {
autoPullAfter = m_autoPullAfter.booleanValue() ? " --pull-after " : " --no-pull-after";
}
String autoPush = "";
if (m_autoPush != null) {
autoPush = m_autoPush.booleanValue() ? " --push " : " --no-push";
}
String exportFolder = " --export-folder \"" + m_currentConfiguration.getModuleExportPath() + "\"";
String exportMode = " --export-mode " + m_currentConfiguration.getExportMode();
String excludeLibs = "";
if (m_excludeLibs != null) {
excludeLibs = m_excludeLibs.booleanValue() ? " --exclude-libs" : " --no-exclude-libs";
}
String commitMode = "";
if (m_commitMode != null) {
commitMode = m_commitMode.booleanValue() ? " --commit" : " --no-commit";
}
String ignoreUncleanMode = "";
if (m_ignoreUnclean != null) {
ignoreUncleanMode = m_ignoreUnclean.booleanValue() ? " --ignore-unclean" : " --no-ignore-unclean";
}
String copyAndUnzip = "";
if (m_copyAndUnzip != null) {
copyAndUnzip = m_copyAndUnzip.booleanValue() ? " --copy-and-unzip" : " --no-copy-and-unzip";
}
String configFilePath = m_currentConfiguration.getFilePath();
return "\""
+ DEFAULT_SCRIPT_FILE
+ "\""
+ exportModules
+ commitMessage
+ gitUserName
+ gitUserEmail
+ autoPullBefore
+ autoPullAfter
+ autoPush
+ exportFolder
+ exportMode
+ excludeLibs
+ commitMode
+ ignoreUncleanMode
+ copyAndUnzip
+ " \""
+ configFilePath
+ "\"";
}
|
[
"private",
"String",
"checkinScriptCommand",
"(",
")",
"{",
"String",
"exportModules",
"=",
"\"\"",
";",
"if",
"(",
"(",
"m_modulesToExport",
"!=",
"null",
")",
"&&",
"!",
"m_modulesToExport",
".",
"isEmpty",
"(",
")",
")",
"{",
"StringBuffer",
"exportModulesParam",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"String",
"moduleName",
":",
"m_modulesToExport",
")",
"{",
"exportModulesParam",
".",
"append",
"(",
"\" \"",
")",
".",
"append",
"(",
"moduleName",
")",
";",
"}",
"exportModulesParam",
".",
"replace",
"(",
"0",
",",
"1",
",",
"\" \\\"\"",
")",
";",
"exportModulesParam",
".",
"append",
"(",
"\"\\\" \"",
")",
";",
"exportModules",
"=",
"\" --modules \"",
"+",
"exportModulesParam",
".",
"toString",
"(",
")",
";",
"}",
"String",
"commitMessage",
"=",
"\"\"",
";",
"if",
"(",
"m_commitMessage",
"!=",
"null",
")",
"{",
"commitMessage",
"=",
"\" -msg \\\"\"",
"+",
"m_commitMessage",
".",
"replace",
"(",
"\"\\\"\"",
",",
"\"\\\\\\\"\"",
")",
"+",
"\"\\\"\"",
";",
"}",
"String",
"gitUserName",
"=",
"\"\"",
";",
"if",
"(",
"m_gitUserName",
"!=",
"null",
")",
"{",
"if",
"(",
"m_gitUserName",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"gitUserName",
"=",
"\" --ignore-default-git-user-name\"",
";",
"}",
"else",
"{",
"gitUserName",
"=",
"\" --git-user-name \\\"\"",
"+",
"m_gitUserName",
"+",
"\"\\\"\"",
";",
"}",
"}",
"String",
"gitUserEmail",
"=",
"\"\"",
";",
"if",
"(",
"m_gitUserEmail",
"!=",
"null",
")",
"{",
"if",
"(",
"m_gitUserEmail",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"gitUserEmail",
"=",
"\" --ignore-default-git-user-email\"",
";",
"}",
"else",
"{",
"gitUserEmail",
"=",
"\" --git-user-email \\\"\"",
"+",
"m_gitUserEmail",
"+",
"\"\\\"\"",
";",
"}",
"}",
"String",
"autoPullBefore",
"=",
"\"\"",
";",
"if",
"(",
"m_autoPullBefore",
"!=",
"null",
")",
"{",
"autoPullBefore",
"=",
"m_autoPullBefore",
".",
"booleanValue",
"(",
")",
"?",
"\" --pull-before \"",
":",
"\" --no-pull-before\"",
";",
"}",
"String",
"autoPullAfter",
"=",
"\"\"",
";",
"if",
"(",
"m_autoPullAfter",
"!=",
"null",
")",
"{",
"autoPullAfter",
"=",
"m_autoPullAfter",
".",
"booleanValue",
"(",
")",
"?",
"\" --pull-after \"",
":",
"\" --no-pull-after\"",
";",
"}",
"String",
"autoPush",
"=",
"\"\"",
";",
"if",
"(",
"m_autoPush",
"!=",
"null",
")",
"{",
"autoPush",
"=",
"m_autoPush",
".",
"booleanValue",
"(",
")",
"?",
"\" --push \"",
":",
"\" --no-push\"",
";",
"}",
"String",
"exportFolder",
"=",
"\" --export-folder \\\"\"",
"+",
"m_currentConfiguration",
".",
"getModuleExportPath",
"(",
")",
"+",
"\"\\\"\"",
";",
"String",
"exportMode",
"=",
"\" --export-mode \"",
"+",
"m_currentConfiguration",
".",
"getExportMode",
"(",
")",
";",
"String",
"excludeLibs",
"=",
"\"\"",
";",
"if",
"(",
"m_excludeLibs",
"!=",
"null",
")",
"{",
"excludeLibs",
"=",
"m_excludeLibs",
".",
"booleanValue",
"(",
")",
"?",
"\" --exclude-libs\"",
":",
"\" --no-exclude-libs\"",
";",
"}",
"String",
"commitMode",
"=",
"\"\"",
";",
"if",
"(",
"m_commitMode",
"!=",
"null",
")",
"{",
"commitMode",
"=",
"m_commitMode",
".",
"booleanValue",
"(",
")",
"?",
"\" --commit\"",
":",
"\" --no-commit\"",
";",
"}",
"String",
"ignoreUncleanMode",
"=",
"\"\"",
";",
"if",
"(",
"m_ignoreUnclean",
"!=",
"null",
")",
"{",
"ignoreUncleanMode",
"=",
"m_ignoreUnclean",
".",
"booleanValue",
"(",
")",
"?",
"\" --ignore-unclean\"",
":",
"\" --no-ignore-unclean\"",
";",
"}",
"String",
"copyAndUnzip",
"=",
"\"\"",
";",
"if",
"(",
"m_copyAndUnzip",
"!=",
"null",
")",
"{",
"copyAndUnzip",
"=",
"m_copyAndUnzip",
".",
"booleanValue",
"(",
")",
"?",
"\" --copy-and-unzip\"",
":",
"\" --no-copy-and-unzip\"",
";",
"}",
"String",
"configFilePath",
"=",
"m_currentConfiguration",
".",
"getFilePath",
"(",
")",
";",
"return",
"\"\\\"\"",
"+",
"DEFAULT_SCRIPT_FILE",
"+",
"\"\\\"\"",
"+",
"exportModules",
"+",
"commitMessage",
"+",
"gitUserName",
"+",
"gitUserEmail",
"+",
"autoPullBefore",
"+",
"autoPullAfter",
"+",
"autoPush",
"+",
"exportFolder",
"+",
"exportMode",
"+",
"excludeLibs",
"+",
"commitMode",
"+",
"ignoreUncleanMode",
"+",
"copyAndUnzip",
"+",
"\" \\\"\"",
"+",
"configFilePath",
"+",
"\"\\\"\"",
";",
"}"
] |
Returns the command to run by the shell to normally run the checkin script.
@return the command to run by the shell to normally run the checkin script.
|
[
"Returns",
"the",
"command",
"to",
"run",
"by",
"the",
"shell",
"to",
"normally",
"run",
"the",
"checkin",
"script",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L610-L695
|
158,195
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitCheckin.java
|
CmsGitCheckin.exportModules
|
private void exportModules() {
// avoid to export modules if unnecessary
if (((null != m_copyAndUnzip) && !m_copyAndUnzip.booleanValue())
|| ((null == m_copyAndUnzip) && !m_currentConfiguration.getDefaultCopyAndUnzip())) {
m_logStream.println();
m_logStream.println("NOT EXPORTING MODULES - you disabled copy and unzip.");
m_logStream.println();
return;
}
CmsModuleManager moduleManager = OpenCms.getModuleManager();
Collection<String> modulesToExport = ((m_modulesToExport == null) || m_modulesToExport.isEmpty())
? m_currentConfiguration.getConfiguredModules()
: m_modulesToExport;
for (String moduleName : modulesToExport) {
CmsModule module = moduleManager.getModule(moduleName);
if (module != null) {
CmsModuleImportExportHandler handler = CmsModuleImportExportHandler.getExportHandler(
getCmsObject(),
module,
"Git export handler");
try {
handler.exportData(
getCmsObject(),
new CmsPrintStreamReport(
m_logStream,
OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()),
false));
} catch (CmsRoleViolationException | CmsConfigurationException | CmsImportExportException e) {
e.printStackTrace(m_logStream);
}
}
}
}
|
java
|
private void exportModules() {
// avoid to export modules if unnecessary
if (((null != m_copyAndUnzip) && !m_copyAndUnzip.booleanValue())
|| ((null == m_copyAndUnzip) && !m_currentConfiguration.getDefaultCopyAndUnzip())) {
m_logStream.println();
m_logStream.println("NOT EXPORTING MODULES - you disabled copy and unzip.");
m_logStream.println();
return;
}
CmsModuleManager moduleManager = OpenCms.getModuleManager();
Collection<String> modulesToExport = ((m_modulesToExport == null) || m_modulesToExport.isEmpty())
? m_currentConfiguration.getConfiguredModules()
: m_modulesToExport;
for (String moduleName : modulesToExport) {
CmsModule module = moduleManager.getModule(moduleName);
if (module != null) {
CmsModuleImportExportHandler handler = CmsModuleImportExportHandler.getExportHandler(
getCmsObject(),
module,
"Git export handler");
try {
handler.exportData(
getCmsObject(),
new CmsPrintStreamReport(
m_logStream,
OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()),
false));
} catch (CmsRoleViolationException | CmsConfigurationException | CmsImportExportException e) {
e.printStackTrace(m_logStream);
}
}
}
}
|
[
"private",
"void",
"exportModules",
"(",
")",
"{",
"// avoid to export modules if unnecessary",
"if",
"(",
"(",
"(",
"null",
"!=",
"m_copyAndUnzip",
")",
"&&",
"!",
"m_copyAndUnzip",
".",
"booleanValue",
"(",
")",
")",
"||",
"(",
"(",
"null",
"==",
"m_copyAndUnzip",
")",
"&&",
"!",
"m_currentConfiguration",
".",
"getDefaultCopyAndUnzip",
"(",
")",
")",
")",
"{",
"m_logStream",
".",
"println",
"(",
")",
";",
"m_logStream",
".",
"println",
"(",
"\"NOT EXPORTING MODULES - you disabled copy and unzip.\"",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"return",
";",
"}",
"CmsModuleManager",
"moduleManager",
"=",
"OpenCms",
".",
"getModuleManager",
"(",
")",
";",
"Collection",
"<",
"String",
">",
"modulesToExport",
"=",
"(",
"(",
"m_modulesToExport",
"==",
"null",
")",
"||",
"m_modulesToExport",
".",
"isEmpty",
"(",
")",
")",
"?",
"m_currentConfiguration",
".",
"getConfiguredModules",
"(",
")",
":",
"m_modulesToExport",
";",
"for",
"(",
"String",
"moduleName",
":",
"modulesToExport",
")",
"{",
"CmsModule",
"module",
"=",
"moduleManager",
".",
"getModule",
"(",
"moduleName",
")",
";",
"if",
"(",
"module",
"!=",
"null",
")",
"{",
"CmsModuleImportExportHandler",
"handler",
"=",
"CmsModuleImportExportHandler",
".",
"getExportHandler",
"(",
"getCmsObject",
"(",
")",
",",
"module",
",",
"\"Git export handler\"",
")",
";",
"try",
"{",
"handler",
".",
"exportData",
"(",
"getCmsObject",
"(",
")",
",",
"new",
"CmsPrintStreamReport",
"(",
"m_logStream",
",",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getWorkplaceLocale",
"(",
"getCmsObject",
"(",
")",
")",
",",
"false",
")",
")",
";",
"}",
"catch",
"(",
"CmsRoleViolationException",
"|",
"CmsConfigurationException",
"|",
"CmsImportExportException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
"m_logStream",
")",
";",
"}",
"}",
"}",
"}"
] |
Export the modules that should be checked in into git.
|
[
"Export",
"the",
"modules",
"that",
"should",
"be",
"checked",
"in",
"into",
"git",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L709-L744
|
158,196
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitCheckin.java
|
CmsGitCheckin.readConfigFiles
|
private List<CmsGitConfiguration> readConfigFiles() {
List<CmsGitConfiguration> configurations = new LinkedList<CmsGitConfiguration>();
// Default configuration file for backwards compatibility
addConfigurationIfValid(configurations, new File(DEFAULT_CONFIG_FILE));
// All files in the config folder
File configFolder = new File(DEFAULT_CONFIG_FOLDER);
if (configFolder.isDirectory()) {
for (File configFile : configFolder.listFiles()) {
addConfigurationIfValid(configurations, configFile);
}
}
return configurations;
}
|
java
|
private List<CmsGitConfiguration> readConfigFiles() {
List<CmsGitConfiguration> configurations = new LinkedList<CmsGitConfiguration>();
// Default configuration file for backwards compatibility
addConfigurationIfValid(configurations, new File(DEFAULT_CONFIG_FILE));
// All files in the config folder
File configFolder = new File(DEFAULT_CONFIG_FOLDER);
if (configFolder.isDirectory()) {
for (File configFile : configFolder.listFiles()) {
addConfigurationIfValid(configurations, configFile);
}
}
return configurations;
}
|
[
"private",
"List",
"<",
"CmsGitConfiguration",
">",
"readConfigFiles",
"(",
")",
"{",
"List",
"<",
"CmsGitConfiguration",
">",
"configurations",
"=",
"new",
"LinkedList",
"<",
"CmsGitConfiguration",
">",
"(",
")",
";",
"// Default configuration file for backwards compatibility",
"addConfigurationIfValid",
"(",
"configurations",
",",
"new",
"File",
"(",
"DEFAULT_CONFIG_FILE",
")",
")",
";",
"// All files in the config folder",
"File",
"configFolder",
"=",
"new",
"File",
"(",
"DEFAULT_CONFIG_FOLDER",
")",
";",
"if",
"(",
"configFolder",
".",
"isDirectory",
"(",
")",
")",
"{",
"for",
"(",
"File",
"configFile",
":",
"configFolder",
".",
"listFiles",
"(",
")",
")",
"{",
"addConfigurationIfValid",
"(",
"configurations",
",",
"configFile",
")",
";",
"}",
"}",
"return",
"configurations",
";",
"}"
] |
Read all configuration files.
@return the list with all available configurations
|
[
"Read",
"all",
"configuration",
"files",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L861-L876
|
158,197
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitCheckin.java
|
CmsGitCheckin.runCommitScript
|
private int runCommitScript() {
if (m_checkout && !m_fetchAndResetBeforeImport) {
m_logStream.println("Skipping script....");
return 0;
}
try {
m_logStream.flush();
String commandParam;
if (m_resetRemoteHead) {
commandParam = resetRemoteHeadScriptCommand();
} else if (m_resetHead) {
commandParam = resetHeadScriptCommand();
} else if (m_checkout) {
commandParam = checkoutScriptCommand();
} else {
commandParam = checkinScriptCommand();
}
String[] cmd = {"bash", "-c", commandParam};
m_logStream.println("Calling the script as follows:");
m_logStream.println();
m_logStream.println(cmd[0] + " " + cmd[1] + " " + cmd[2]);
ProcessBuilder builder = new ProcessBuilder(cmd);
m_logStream.close();
m_logStream = null;
Redirect redirect = Redirect.appendTo(new File(DEFAULT_LOGFILE_PATH));
builder.redirectOutput(redirect);
builder.redirectError(redirect);
Process scriptProcess = builder.start();
int exitCode = scriptProcess.waitFor();
scriptProcess.getOutputStream().close();
m_logStream = new PrintStream(new FileOutputStream(DEFAULT_LOGFILE_PATH, true));
return exitCode;
} catch (InterruptedException | IOException e) {
e.printStackTrace(m_logStream);
return -1;
}
}
|
java
|
private int runCommitScript() {
if (m_checkout && !m_fetchAndResetBeforeImport) {
m_logStream.println("Skipping script....");
return 0;
}
try {
m_logStream.flush();
String commandParam;
if (m_resetRemoteHead) {
commandParam = resetRemoteHeadScriptCommand();
} else if (m_resetHead) {
commandParam = resetHeadScriptCommand();
} else if (m_checkout) {
commandParam = checkoutScriptCommand();
} else {
commandParam = checkinScriptCommand();
}
String[] cmd = {"bash", "-c", commandParam};
m_logStream.println("Calling the script as follows:");
m_logStream.println();
m_logStream.println(cmd[0] + " " + cmd[1] + " " + cmd[2]);
ProcessBuilder builder = new ProcessBuilder(cmd);
m_logStream.close();
m_logStream = null;
Redirect redirect = Redirect.appendTo(new File(DEFAULT_LOGFILE_PATH));
builder.redirectOutput(redirect);
builder.redirectError(redirect);
Process scriptProcess = builder.start();
int exitCode = scriptProcess.waitFor();
scriptProcess.getOutputStream().close();
m_logStream = new PrintStream(new FileOutputStream(DEFAULT_LOGFILE_PATH, true));
return exitCode;
} catch (InterruptedException | IOException e) {
e.printStackTrace(m_logStream);
return -1;
}
}
|
[
"private",
"int",
"runCommitScript",
"(",
")",
"{",
"if",
"(",
"m_checkout",
"&&",
"!",
"m_fetchAndResetBeforeImport",
")",
"{",
"m_logStream",
".",
"println",
"(",
"\"Skipping script....\"",
")",
";",
"return",
"0",
";",
"}",
"try",
"{",
"m_logStream",
".",
"flush",
"(",
")",
";",
"String",
"commandParam",
";",
"if",
"(",
"m_resetRemoteHead",
")",
"{",
"commandParam",
"=",
"resetRemoteHeadScriptCommand",
"(",
")",
";",
"}",
"else",
"if",
"(",
"m_resetHead",
")",
"{",
"commandParam",
"=",
"resetHeadScriptCommand",
"(",
")",
";",
"}",
"else",
"if",
"(",
"m_checkout",
")",
"{",
"commandParam",
"=",
"checkoutScriptCommand",
"(",
")",
";",
"}",
"else",
"{",
"commandParam",
"=",
"checkinScriptCommand",
"(",
")",
";",
"}",
"String",
"[",
"]",
"cmd",
"=",
"{",
"\"bash\"",
",",
"\"-c\"",
",",
"commandParam",
"}",
";",
"m_logStream",
".",
"println",
"(",
"\"Calling the script as follows:\"",
")",
";",
"m_logStream",
".",
"println",
"(",
")",
";",
"m_logStream",
".",
"println",
"(",
"cmd",
"[",
"0",
"]",
"+",
"\" \"",
"+",
"cmd",
"[",
"1",
"]",
"+",
"\" \"",
"+",
"cmd",
"[",
"2",
"]",
")",
";",
"ProcessBuilder",
"builder",
"=",
"new",
"ProcessBuilder",
"(",
"cmd",
")",
";",
"m_logStream",
".",
"close",
"(",
")",
";",
"m_logStream",
"=",
"null",
";",
"Redirect",
"redirect",
"=",
"Redirect",
".",
"appendTo",
"(",
"new",
"File",
"(",
"DEFAULT_LOGFILE_PATH",
")",
")",
";",
"builder",
".",
"redirectOutput",
"(",
"redirect",
")",
";",
"builder",
".",
"redirectError",
"(",
"redirect",
")",
";",
"Process",
"scriptProcess",
"=",
"builder",
".",
"start",
"(",
")",
";",
"int",
"exitCode",
"=",
"scriptProcess",
".",
"waitFor",
"(",
")",
";",
"scriptProcess",
".",
"getOutputStream",
"(",
")",
".",
"close",
"(",
")",
";",
"m_logStream",
"=",
"new",
"PrintStream",
"(",
"new",
"FileOutputStream",
"(",
"DEFAULT_LOGFILE_PATH",
",",
"true",
")",
")",
";",
"return",
"exitCode",
";",
"}",
"catch",
"(",
"InterruptedException",
"|",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
"m_logStream",
")",
";",
"return",
"-",
"1",
";",
"}",
"}"
] |
Runs the shell script for committing and optionally pushing the changes in the module.
@return exit code of the script.
|
[
"Runs",
"the",
"shell",
"script",
"for",
"committing",
"and",
"optionally",
"pushing",
"the",
"changes",
"in",
"the",
"module",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L902-L940
|
158,198
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitToolOptionsPanel.java
|
CmsGitToolOptionsPanel.updateForNewConfiguration
|
protected void updateForNewConfiguration(CmsGitConfiguration gitConfig) {
if (!m_checkinBean.setCurrentConfiguration(gitConfig)) {
Notification.show(
CmsVaadinUtils.getMessageText(Messages.GUI_GIT_CONFIGURATION_SWITCH_FAILED_0),
CmsVaadinUtils.getMessageText(Messages.GUI_GIT_CONFIGURATION_SWITCH_FAILED_DESC_0),
Type.ERROR_MESSAGE);
m_configurationSelector.select(m_checkinBean.getCurrentConfiguration());
return;
}
resetSelectableModules();
for (final String moduleName : gitConfig.getConfiguredModules()) {
addSelectableModule(moduleName);
}
updateNewModuleSelector();
m_pullFirst.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPullBefore()));
m_pullAfterCommit.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPullAfter()));
m_addAndCommit.setValue(Boolean.valueOf(gitConfig.getDefaultAutoCommit()));
m_pushAutomatically.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPush()));
m_commitMessage.setValue(Strings.nullToEmpty(gitConfig.getDefaultCommitMessage()));
m_copyAndUnzip.setValue(Boolean.valueOf(gitConfig.getDefaultCopyAndUnzip()));
m_excludeLib.setValue(Boolean.valueOf(gitConfig.getDefaultExcludeLibs()));
m_ignoreUnclean.setValue(Boolean.valueOf(gitConfig.getDefaultIngoreUnclean()));
m_userField.setValue(Strings.nullToEmpty(gitConfig.getDefaultGitUserName()));
m_emailField.setValue(Strings.nullToEmpty(gitConfig.getDefaultGitUserEmail()));
}
|
java
|
protected void updateForNewConfiguration(CmsGitConfiguration gitConfig) {
if (!m_checkinBean.setCurrentConfiguration(gitConfig)) {
Notification.show(
CmsVaadinUtils.getMessageText(Messages.GUI_GIT_CONFIGURATION_SWITCH_FAILED_0),
CmsVaadinUtils.getMessageText(Messages.GUI_GIT_CONFIGURATION_SWITCH_FAILED_DESC_0),
Type.ERROR_MESSAGE);
m_configurationSelector.select(m_checkinBean.getCurrentConfiguration());
return;
}
resetSelectableModules();
for (final String moduleName : gitConfig.getConfiguredModules()) {
addSelectableModule(moduleName);
}
updateNewModuleSelector();
m_pullFirst.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPullBefore()));
m_pullAfterCommit.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPullAfter()));
m_addAndCommit.setValue(Boolean.valueOf(gitConfig.getDefaultAutoCommit()));
m_pushAutomatically.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPush()));
m_commitMessage.setValue(Strings.nullToEmpty(gitConfig.getDefaultCommitMessage()));
m_copyAndUnzip.setValue(Boolean.valueOf(gitConfig.getDefaultCopyAndUnzip()));
m_excludeLib.setValue(Boolean.valueOf(gitConfig.getDefaultExcludeLibs()));
m_ignoreUnclean.setValue(Boolean.valueOf(gitConfig.getDefaultIngoreUnclean()));
m_userField.setValue(Strings.nullToEmpty(gitConfig.getDefaultGitUserName()));
m_emailField.setValue(Strings.nullToEmpty(gitConfig.getDefaultGitUserEmail()));
}
|
[
"protected",
"void",
"updateForNewConfiguration",
"(",
"CmsGitConfiguration",
"gitConfig",
")",
"{",
"if",
"(",
"!",
"m_checkinBean",
".",
"setCurrentConfiguration",
"(",
"gitConfig",
")",
")",
"{",
"Notification",
".",
"show",
"(",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_GIT_CONFIGURATION_SWITCH_FAILED_0",
")",
",",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_GIT_CONFIGURATION_SWITCH_FAILED_DESC_0",
")",
",",
"Type",
".",
"ERROR_MESSAGE",
")",
";",
"m_configurationSelector",
".",
"select",
"(",
"m_checkinBean",
".",
"getCurrentConfiguration",
"(",
")",
")",
";",
"return",
";",
"}",
"resetSelectableModules",
"(",
")",
";",
"for",
"(",
"final",
"String",
"moduleName",
":",
"gitConfig",
".",
"getConfiguredModules",
"(",
")",
")",
"{",
"addSelectableModule",
"(",
"moduleName",
")",
";",
"}",
"updateNewModuleSelector",
"(",
")",
";",
"m_pullFirst",
".",
"setValue",
"(",
"Boolean",
".",
"valueOf",
"(",
"gitConfig",
".",
"getDefaultAutoPullBefore",
"(",
")",
")",
")",
";",
"m_pullAfterCommit",
".",
"setValue",
"(",
"Boolean",
".",
"valueOf",
"(",
"gitConfig",
".",
"getDefaultAutoPullAfter",
"(",
")",
")",
")",
";",
"m_addAndCommit",
".",
"setValue",
"(",
"Boolean",
".",
"valueOf",
"(",
"gitConfig",
".",
"getDefaultAutoCommit",
"(",
")",
")",
")",
";",
"m_pushAutomatically",
".",
"setValue",
"(",
"Boolean",
".",
"valueOf",
"(",
"gitConfig",
".",
"getDefaultAutoPush",
"(",
")",
")",
")",
";",
"m_commitMessage",
".",
"setValue",
"(",
"Strings",
".",
"nullToEmpty",
"(",
"gitConfig",
".",
"getDefaultCommitMessage",
"(",
")",
")",
")",
";",
"m_copyAndUnzip",
".",
"setValue",
"(",
"Boolean",
".",
"valueOf",
"(",
"gitConfig",
".",
"getDefaultCopyAndUnzip",
"(",
")",
")",
")",
";",
"m_excludeLib",
".",
"setValue",
"(",
"Boolean",
".",
"valueOf",
"(",
"gitConfig",
".",
"getDefaultExcludeLibs",
"(",
")",
")",
")",
";",
"m_ignoreUnclean",
".",
"setValue",
"(",
"Boolean",
".",
"valueOf",
"(",
"gitConfig",
".",
"getDefaultIngoreUnclean",
"(",
")",
")",
")",
";",
"m_userField",
".",
"setValue",
"(",
"Strings",
".",
"nullToEmpty",
"(",
"gitConfig",
".",
"getDefaultGitUserName",
"(",
")",
")",
")",
";",
"m_emailField",
".",
"setValue",
"(",
"Strings",
".",
"nullToEmpty",
"(",
"gitConfig",
".",
"getDefaultGitUserEmail",
"(",
")",
")",
")",
";",
"}"
] |
Updates the options panel for a special configuration.
@param gitConfig the git configuration.
|
[
"Updates",
"the",
"options",
"panel",
"for",
"a",
"special",
"configuration",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitToolOptionsPanel.java#L621-L648
|
158,199
|
alkacon/opencms-core
|
src/org/opencms/ui/apps/git/CmsGitToolOptionsPanel.java
|
CmsGitToolOptionsPanel.configureConfigurationSelector
|
private void configureConfigurationSelector() {
if (m_checkinBean.getConfigurations().size() < 2) {
// Do not show the configuration selection at all.
removeComponent(m_configurationSelectionPanel);
} else {
for (CmsGitConfiguration configuration : m_checkinBean.getConfigurations()) {
m_configurationSelector.addItem(configuration);
m_configurationSelector.setItemCaption(configuration, configuration.getName());
}
m_configurationSelector.setNullSelectionAllowed(false);
m_configurationSelector.setNewItemsAllowed(false);
m_configurationSelector.setWidth("350px");
m_configurationSelector.select(m_checkinBean.getCurrentConfiguration());
// There is really a choice between configurations
m_configurationSelector.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("synthetic-access")
public void valueChange(ValueChangeEvent event) {
updateForNewConfiguration((CmsGitConfiguration)event.getProperty().getValue());
restoreFieldsFromUserInfo();
}
});
}
}
|
java
|
private void configureConfigurationSelector() {
if (m_checkinBean.getConfigurations().size() < 2) {
// Do not show the configuration selection at all.
removeComponent(m_configurationSelectionPanel);
} else {
for (CmsGitConfiguration configuration : m_checkinBean.getConfigurations()) {
m_configurationSelector.addItem(configuration);
m_configurationSelector.setItemCaption(configuration, configuration.getName());
}
m_configurationSelector.setNullSelectionAllowed(false);
m_configurationSelector.setNewItemsAllowed(false);
m_configurationSelector.setWidth("350px");
m_configurationSelector.select(m_checkinBean.getCurrentConfiguration());
// There is really a choice between configurations
m_configurationSelector.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("synthetic-access")
public void valueChange(ValueChangeEvent event) {
updateForNewConfiguration((CmsGitConfiguration)event.getProperty().getValue());
restoreFieldsFromUserInfo();
}
});
}
}
|
[
"private",
"void",
"configureConfigurationSelector",
"(",
")",
"{",
"if",
"(",
"m_checkinBean",
".",
"getConfigurations",
"(",
")",
".",
"size",
"(",
")",
"<",
"2",
")",
"{",
"// Do not show the configuration selection at all.",
"removeComponent",
"(",
"m_configurationSelectionPanel",
")",
";",
"}",
"else",
"{",
"for",
"(",
"CmsGitConfiguration",
"configuration",
":",
"m_checkinBean",
".",
"getConfigurations",
"(",
")",
")",
"{",
"m_configurationSelector",
".",
"addItem",
"(",
"configuration",
")",
";",
"m_configurationSelector",
".",
"setItemCaption",
"(",
"configuration",
",",
"configuration",
".",
"getName",
"(",
")",
")",
";",
"}",
"m_configurationSelector",
".",
"setNullSelectionAllowed",
"(",
"false",
")",
";",
"m_configurationSelector",
".",
"setNewItemsAllowed",
"(",
"false",
")",
";",
"m_configurationSelector",
".",
"setWidth",
"(",
"\"350px\"",
")",
";",
"m_configurationSelector",
".",
"select",
"(",
"m_checkinBean",
".",
"getCurrentConfiguration",
"(",
")",
")",
";",
"// There is really a choice between configurations",
"m_configurationSelector",
".",
"addValueChangeListener",
"(",
"new",
"ValueChangeListener",
"(",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"public",
"void",
"valueChange",
"(",
"ValueChangeEvent",
"event",
")",
"{",
"updateForNewConfiguration",
"(",
"(",
"CmsGitConfiguration",
")",
"event",
".",
"getProperty",
"(",
")",
".",
"getValue",
"(",
")",
")",
";",
"restoreFieldsFromUserInfo",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Configures the configuration selector.
|
[
"Configures",
"the",
"configuration",
"selector",
"."
] |
bc104acc75d2277df5864da939a1f2de5fdee504
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitToolOptionsPanel.java#L653-L682
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.