repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/search/CmsSearchUtil.java | CmsSearchUtil.getSolrRangeString | public static String getSolrRangeString(String from, String to) {
// If a parameter is not initialized, use the asterisk '*' operator
if (CmsStringUtil.isEmptyOrWhitespaceOnly(from)) {
from = "*";
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(to)) {
to = "*";
}
return String.format("[%s TO %s]", from, to);
} | java | public static String getSolrRangeString(String from, String to) {
// If a parameter is not initialized, use the asterisk '*' operator
if (CmsStringUtil.isEmptyOrWhitespaceOnly(from)) {
from = "*";
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(to)) {
to = "*";
}
return String.format("[%s TO %s]", from, to);
} | [
"public",
"static",
"String",
"getSolrRangeString",
"(",
"String",
"from",
",",
"String",
"to",
")",
"{",
"// If a parameter is not initialized, use the asterisk '*' operator",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"from",
")",
")",
"{",
"from... | Returns a string that represents a valid Solr query range.
@param from Lower bound of the query range.
@param to Upper bound of the query range.
@return String that represents a Solr query range. | [
"Returns",
"a",
"string",
"that",
"represents",
"a",
"valid",
"Solr",
"query",
"range",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchUtil.java#L277-L289 | train |
alkacon/opencms-core | src/org/opencms/search/CmsSearchUtil.java | CmsSearchUtil.toContentStreams | public static Collection<ContentStream> toContentStreams(final String str, final String contentType) {
if (str == null) {
return null;
}
ArrayList<ContentStream> streams = new ArrayList<>(1);
ContentStreamBase ccc = new ContentStreamBase.StringStream(str);
ccc.setContentType(contentType);
streams.add(ccc);
return streams;
} | java | public static Collection<ContentStream> toContentStreams(final String str, final String contentType) {
if (str == null) {
return null;
}
ArrayList<ContentStream> streams = new ArrayList<>(1);
ContentStreamBase ccc = new ContentStreamBase.StringStream(str);
ccc.setContentType(contentType);
streams.add(ccc);
return streams;
} | [
"public",
"static",
"Collection",
"<",
"ContentStream",
">",
"toContentStreams",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"contentType",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ArrayList",
"<",
"Conten... | Take a string and make it an iterable ContentStream | [
"Take",
"a",
"string",
"and",
"make",
"it",
"an",
"iterable",
"ContentStream"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchUtil.java#L390-L401 | train |
alkacon/opencms-core | src/org/opencms/jsp/search/result/CmsSearchStateParameters.java | CmsSearchStateParameters.paramMapToString | public static String paramMapToString(final Map<String, String[]> parameters) {
final StringBuffer result = new StringBuffer();
for (final String key : parameters.keySet()) {
String[] values = parameters.get(key);
if (null == values) {
result.append(key).append('&');
} else {
for (final String value : parameters.get(key)) {
result.append(key).append('=').append(CmsEncoder.encode(value)).append('&');
}
}
}
// remove last '&'
if (result.length() > 0) {
result.setLength(result.length() - 1);
}
return result.toString();
} | java | public static String paramMapToString(final Map<String, String[]> parameters) {
final StringBuffer result = new StringBuffer();
for (final String key : parameters.keySet()) {
String[] values = parameters.get(key);
if (null == values) {
result.append(key).append('&');
} else {
for (final String value : parameters.get(key)) {
result.append(key).append('=').append(CmsEncoder.encode(value)).append('&');
}
}
}
// remove last '&'
if (result.length() > 0) {
result.setLength(result.length() - 1);
}
return result.toString();
} | [
"public",
"static",
"String",
"paramMapToString",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parameters",
")",
"{",
"final",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"final",
"String",
"key",
... | Converts a parameter map to the parameter string.
@param parameters the parameter map.
@return the parameter string. | [
"Converts",
"a",
"parameter",
"map",
"to",
"the",
"parameter",
"string",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/result/CmsSearchStateParameters.java#L91-L109 | train |
alkacon/opencms-core | src/org/opencms/jsp/search/result/CmsSearchStateParameters.java | CmsSearchStateParameters.getFacetParamKey | String getFacetParamKey(String facet) {
I_CmsSearchControllerFacetField fieldFacet = m_result.getController().getFieldFacets().getFieldFacetController().get(
facet);
if (fieldFacet != null) {
return fieldFacet.getConfig().getParamKey();
}
I_CmsSearchControllerFacetRange rangeFacet = m_result.getController().getRangeFacets().getRangeFacetController().get(
facet);
if (rangeFacet != null) {
return rangeFacet.getConfig().getParamKey();
}
I_CmsSearchControllerFacetQuery queryFacet = m_result.getController().getQueryFacet();
if ((queryFacet != null) && queryFacet.getConfig().getName().equals(facet)) {
return queryFacet.getConfig().getParamKey();
}
// Facet did not exist
LOG.warn(Messages.get().getBundle().key(Messages.LOG_FACET_NOT_CONFIGURED_1, facet), new Throwable());
return null;
} | java | String getFacetParamKey(String facet) {
I_CmsSearchControllerFacetField fieldFacet = m_result.getController().getFieldFacets().getFieldFacetController().get(
facet);
if (fieldFacet != null) {
return fieldFacet.getConfig().getParamKey();
}
I_CmsSearchControllerFacetRange rangeFacet = m_result.getController().getRangeFacets().getRangeFacetController().get(
facet);
if (rangeFacet != null) {
return rangeFacet.getConfig().getParamKey();
}
I_CmsSearchControllerFacetQuery queryFacet = m_result.getController().getQueryFacet();
if ((queryFacet != null) && queryFacet.getConfig().getName().equals(facet)) {
return queryFacet.getConfig().getParamKey();
}
// Facet did not exist
LOG.warn(Messages.get().getBundle().key(Messages.LOG_FACET_NOT_CONFIGURED_1, facet), new Throwable());
return null;
} | [
"String",
"getFacetParamKey",
"(",
"String",
"facet",
")",
"{",
"I_CmsSearchControllerFacetField",
"fieldFacet",
"=",
"m_result",
".",
"getController",
"(",
")",
".",
"getFieldFacets",
"(",
")",
".",
"getFieldFacetController",
"(",
")",
".",
"get",
"(",
"facet",
... | Returns the parameter key of the facet with the given name.
@param facet the facet's name.
@return the parameter key for the facet. | [
"Returns",
"the",
"parameter",
"key",
"of",
"the",
"facet",
"with",
"the",
"given",
"name",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/result/CmsSearchStateParameters.java#L407-L428 | train |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.closeWindow | public static void closeWindow(Component component) {
Window window = getWindow(component);
if (window != null) {
window.close();
}
} | java | public static void closeWindow(Component component) {
Window window = getWindow(component);
if (window != null) {
window.close();
}
} | [
"public",
"static",
"void",
"closeWindow",
"(",
"Component",
"component",
")",
"{",
"Window",
"window",
"=",
"getWindow",
"(",
"component",
")",
";",
"if",
"(",
"window",
"!=",
"null",
")",
"{",
"window",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Closes the window containing the given component.
@param component a component | [
"Closes",
"the",
"window",
"containing",
"the",
"given",
"component",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L294-L300 | train |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.defaultHandleContextMenuForMultiselect | @SuppressWarnings("unchecked")
public static <T> void defaultHandleContextMenuForMultiselect(
Table table,
CmsContextMenu menu,
ItemClickEvent event,
List<I_CmsSimpleContextMenuEntry<Collection<T>>> entries) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
if (event.getButton().equals(MouseButton.RIGHT)) {
Collection<T> oldValue = ((Collection<T>)table.getValue());
if (oldValue.isEmpty() || !oldValue.contains(event.getItemId())) {
table.setValue(new HashSet<Object>(Arrays.asList(event.getItemId())));
}
Collection<T> selection = (Collection<T>)table.getValue();
menu.setEntries(entries, selection);
menu.openForTable(event, table);
}
}
} | java | @SuppressWarnings("unchecked")
public static <T> void defaultHandleContextMenuForMultiselect(
Table table,
CmsContextMenu menu,
ItemClickEvent event,
List<I_CmsSimpleContextMenuEntry<Collection<T>>> entries) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
if (event.getButton().equals(MouseButton.RIGHT)) {
Collection<T> oldValue = ((Collection<T>)table.getValue());
if (oldValue.isEmpty() || !oldValue.contains(event.getItemId())) {
table.setValue(new HashSet<Object>(Arrays.asList(event.getItemId())));
}
Collection<T> selection = (Collection<T>)table.getValue();
menu.setEntries(entries, selection);
menu.openForTable(event, table);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"void",
"defaultHandleContextMenuForMultiselect",
"(",
"Table",
"table",
",",
"CmsContextMenu",
"menu",
",",
"ItemClickEvent",
"event",
",",
"List",
"<",
"I_CmsSimpleContextMenuEntr... | Simple context menu handler for multi-select tables.
@param table the table
@param menu the table's context menu
@param event the click event
@param entries the context menu entries | [
"Simple",
"context",
"menu",
"handler",
"for",
"multi",
"-",
"select",
"tables",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L331-L350 | train |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.getGroupsOfUser | public static IndexedContainer getGroupsOfUser(
CmsObject cms,
CmsUser user,
String caption,
String iconProp,
String ou,
String propStatus,
Function<CmsGroup, CmsCssIcon> iconProvider) {
IndexedContainer container = new IndexedContainer();
container.addContainerProperty(caption, String.class, "");
container.addContainerProperty(ou, String.class, "");
container.addContainerProperty(propStatus, Boolean.class, new Boolean(true));
if (iconProvider != null) {
container.addContainerProperty(iconProp, CmsCssIcon.class, null);
}
try {
for (CmsGroup group : cms.getGroupsOfUser(user.getName(), true)) {
Item item = container.addItem(group);
item.getItemProperty(caption).setValue(group.getSimpleName());
item.getItemProperty(ou).setValue(group.getOuFqn());
if (iconProvider != null) {
item.getItemProperty(iconProp).setValue(iconProvider.apply(group));
}
}
} catch (CmsException e) {
LOG.error("Unable to read groups from user", e);
}
return container;
} | java | public static IndexedContainer getGroupsOfUser(
CmsObject cms,
CmsUser user,
String caption,
String iconProp,
String ou,
String propStatus,
Function<CmsGroup, CmsCssIcon> iconProvider) {
IndexedContainer container = new IndexedContainer();
container.addContainerProperty(caption, String.class, "");
container.addContainerProperty(ou, String.class, "");
container.addContainerProperty(propStatus, Boolean.class, new Boolean(true));
if (iconProvider != null) {
container.addContainerProperty(iconProp, CmsCssIcon.class, null);
}
try {
for (CmsGroup group : cms.getGroupsOfUser(user.getName(), true)) {
Item item = container.addItem(group);
item.getItemProperty(caption).setValue(group.getSimpleName());
item.getItemProperty(ou).setValue(group.getOuFqn());
if (iconProvider != null) {
item.getItemProperty(iconProp).setValue(iconProvider.apply(group));
}
}
} catch (CmsException e) {
LOG.error("Unable to read groups from user", e);
}
return container;
} | [
"public",
"static",
"IndexedContainer",
"getGroupsOfUser",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
",",
"String",
"caption",
",",
"String",
"iconProp",
",",
"String",
"ou",
",",
"String",
"propStatus",
",",
"Function",
"<",
"CmsGroup",
",",
"CmsCssIcon"... | Gets container with alls groups of a certain user.
@param cms cmsobject
@param user to find groups for
@param caption caption property
@param iconProp property
@param ou ou
@param propStatus status property
@param iconProvider the icon provider
@return Indexed Container | [
"Gets",
"container",
"with",
"alls",
"groups",
"of",
"a",
"certain",
"user",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L543-L572 | train |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.getPrincipalContainer | public static IndexedContainer getPrincipalContainer(
CmsObject cms,
List<? extends I_CmsPrincipal> list,
String captionID,
String descID,
String iconID,
String ouID,
String icon,
List<FontIcon> iconList) {
IndexedContainer res = new IndexedContainer();
res.addContainerProperty(captionID, String.class, "");
res.addContainerProperty(ouID, String.class, "");
res.addContainerProperty(iconID, FontIcon.class, new CmsCssIcon(icon));
if (descID != null) {
res.addContainerProperty(descID, String.class, "");
}
for (I_CmsPrincipal group : list) {
Item item = res.addItem(group);
item.getItemProperty(captionID).setValue(group.getSimpleName());
item.getItemProperty(ouID).setValue(group.getOuFqn());
if (descID != null) {
item.getItemProperty(descID).setValue(group.getDescription(A_CmsUI.get().getLocale()));
}
}
for (int i = 0; i < iconList.size(); i++) {
res.getItem(res.getIdByIndex(i)).getItemProperty(iconID).setValue(iconList.get(i));
}
return res;
} | java | public static IndexedContainer getPrincipalContainer(
CmsObject cms,
List<? extends I_CmsPrincipal> list,
String captionID,
String descID,
String iconID,
String ouID,
String icon,
List<FontIcon> iconList) {
IndexedContainer res = new IndexedContainer();
res.addContainerProperty(captionID, String.class, "");
res.addContainerProperty(ouID, String.class, "");
res.addContainerProperty(iconID, FontIcon.class, new CmsCssIcon(icon));
if (descID != null) {
res.addContainerProperty(descID, String.class, "");
}
for (I_CmsPrincipal group : list) {
Item item = res.addItem(group);
item.getItemProperty(captionID).setValue(group.getSimpleName());
item.getItemProperty(ouID).setValue(group.getOuFqn());
if (descID != null) {
item.getItemProperty(descID).setValue(group.getDescription(A_CmsUI.get().getLocale()));
}
}
for (int i = 0; i < iconList.size(); i++) {
res.getItem(res.getIdByIndex(i)).getItemProperty(iconID).setValue(iconList.get(i));
}
return res;
} | [
"public",
"static",
"IndexedContainer",
"getPrincipalContainer",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"?",
"extends",
"I_CmsPrincipal",
">",
"list",
",",
"String",
"captionID",
",",
"String",
"descID",
",",
"String",
"iconID",
",",
"String",
"ouID",
",",
... | Get container for principal.
@param cms cmsobject
@param list of principals
@param captionID caption id
@param descID description id
@param iconID icon id
@param ouID ou id
@param icon icon
@param iconList iconlist
@return indexedcontainer | [
"Get",
"container",
"for",
"principal",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L740-L774 | train |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.setFilterBoxStyle | public static void setFilterBoxStyle(TextField searchBox) {
searchBox.setIcon(FontOpenCms.FILTER);
searchBox.setPlaceholder(
org.opencms.ui.apps.Messages.get().getBundle(UI.getCurrent().getLocale()).key(
org.opencms.ui.apps.Messages.GUI_EXPLORER_FILTER_0));
searchBox.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
} | java | public static void setFilterBoxStyle(TextField searchBox) {
searchBox.setIcon(FontOpenCms.FILTER);
searchBox.setPlaceholder(
org.opencms.ui.apps.Messages.get().getBundle(UI.getCurrent().getLocale()).key(
org.opencms.ui.apps.Messages.GUI_EXPLORER_FILTER_0));
searchBox.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
} | [
"public",
"static",
"void",
"setFilterBoxStyle",
"(",
"TextField",
"searchBox",
")",
"{",
"searchBox",
".",
"setIcon",
"(",
"FontOpenCms",
".",
"FILTER",
")",
";",
"searchBox",
".",
"setPlaceholder",
"(",
"org",
".",
"opencms",
".",
"ui",
".",
"apps",
".",
... | Configures a text field to look like a filter box for a table.
@param searchBox the text field to configure | [
"Configures",
"a",
"text",
"field",
"to",
"look",
"like",
"a",
"filter",
"box",
"for",
"a",
"table",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1125-L1133 | train |
alkacon/opencms-core | src/org/opencms/importexport/CmsImportHelper.java | CmsImportHelper.getZipEntry | protected ZipEntry getZipEntry(String filename) throws ZipException {
// yes
ZipEntry entry = getZipFile().getEntry(filename);
// path to file might be relative, too
if ((entry == null) && filename.startsWith("/")) {
entry = m_zipFile.getEntry(filename.substring(1));
}
if (entry == null) {
throw new ZipException(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_FILE_NOT_FOUND_IN_ZIP_1, filename));
}
return entry;
} | java | protected ZipEntry getZipEntry(String filename) throws ZipException {
// yes
ZipEntry entry = getZipFile().getEntry(filename);
// path to file might be relative, too
if ((entry == null) && filename.startsWith("/")) {
entry = m_zipFile.getEntry(filename.substring(1));
}
if (entry == null) {
throw new ZipException(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_FILE_NOT_FOUND_IN_ZIP_1, filename));
}
return entry;
} | [
"protected",
"ZipEntry",
"getZipEntry",
"(",
"String",
"filename",
")",
"throws",
"ZipException",
"{",
"// yes",
"ZipEntry",
"entry",
"=",
"getZipFile",
"(",
")",
".",
"getEntry",
"(",
"filename",
")",
";",
"// path to file might be relative, too",
"if",
"(",
"(",... | Returns the zip entry for a file in the archive.
@param filename the file name
@return the zip entry for the file with the provided name
@throws ZipException thrown if the file is not in the zip archive | [
"Returns",
"the",
"zip",
"entry",
"for",
"a",
"file",
"in",
"the",
"archive",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportHelper.java#L336-L349 | train |
alkacon/opencms-core | src/org/opencms/notification/A_CmsNotification.java | A_CmsNotification.appenHtmlFooter | protected void appenHtmlFooter(StringBuffer buffer) {
if (m_configuredFooter != null) {
buffer.append(m_configuredFooter);
} else {
buffer.append(" </body>\r\n" + "</html>");
}
} | java | protected void appenHtmlFooter(StringBuffer buffer) {
if (m_configuredFooter != null) {
buffer.append(m_configuredFooter);
} else {
buffer.append(" </body>\r\n" + "</html>");
}
} | [
"protected",
"void",
"appenHtmlFooter",
"(",
"StringBuffer",
"buffer",
")",
"{",
"if",
"(",
"m_configuredFooter",
"!=",
"null",
")",
"{",
"buffer",
".",
"append",
"(",
"m_configuredFooter",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"\" </bod... | Append the html-code to finish a html mail message to the given buffer.
@param buffer The StringBuffer to add the html code to. | [
"Append",
"the",
"html",
"-",
"code",
"to",
"finish",
"a",
"html",
"mail",
"message",
"to",
"the",
"given",
"buffer",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/notification/A_CmsNotification.java#L305-L312 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/modules/CmsModuleApp.java | CmsModuleApp.openReport | public void openReport(String newState, A_CmsReportThread thread, String label) {
setReport(newState, thread);
m_labels.put(thread, label);
openSubView(newState, true);
} | java | public void openReport(String newState, A_CmsReportThread thread, String label) {
setReport(newState, thread);
m_labels.put(thread, label);
openSubView(newState, true);
} | [
"public",
"void",
"openReport",
"(",
"String",
"newState",
",",
"A_CmsReportThread",
"thread",
",",
"String",
"label",
")",
"{",
"setReport",
"(",
"newState",
",",
"thread",
")",
";",
"m_labels",
".",
"put",
"(",
"thread",
",",
"label",
")",
";",
"openSubV... | Changes to a new sub-view and stores a report to be displayed by that subview.<p<
@param newState the new state
@param thread the report thread which should be displayed in the sub view
@param label the label to display for the report | [
"Changes",
"to",
"a",
"new",
"sub",
"-",
"view",
"and",
"stores",
"a",
"report",
"to",
"be",
"displayed",
"by",
"that",
"subview",
".",
"<p<"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/modules/CmsModuleApp.java#L667-L672 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteEntry.java | CmsFavoriteEntry.readId | public static CmsUUID readId(JSONObject obj, String key) {
String strValue = obj.optString(key);
if (!CmsUUID.isValidUUID(strValue)) {
return null;
}
return new CmsUUID(strValue);
} | java | public static CmsUUID readId(JSONObject obj, String key) {
String strValue = obj.optString(key);
if (!CmsUUID.isValidUUID(strValue)) {
return null;
}
return new CmsUUID(strValue);
} | [
"public",
"static",
"CmsUUID",
"readId",
"(",
"JSONObject",
"obj",
",",
"String",
"key",
")",
"{",
"String",
"strValue",
"=",
"obj",
".",
"optString",
"(",
"key",
")",
";",
"if",
"(",
"!",
"CmsUUID",
".",
"isValidUUID",
"(",
"strValue",
")",
")",
"{",
... | Reads a UUID from a JSON object.
Returns null if the JSON value for the given key is not present or not a valid UUID
@param obj the JSON object
@param key the JSON key
@return the UUID | [
"Reads",
"a",
"UUID",
"from",
"a",
"JSON",
"object",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L157-L164 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteEntry.java | CmsFavoriteEntry.setSiteRoot | public void setSiteRoot(String siteRoot) {
if (siteRoot != null) {
siteRoot = siteRoot.replaceFirst("/$", "");
}
m_siteRoot = siteRoot;
} | java | public void setSiteRoot(String siteRoot) {
if (siteRoot != null) {
siteRoot = siteRoot.replaceFirst("/$", "");
}
m_siteRoot = siteRoot;
} | [
"public",
"void",
"setSiteRoot",
"(",
"String",
"siteRoot",
")",
"{",
"if",
"(",
"siteRoot",
"!=",
"null",
")",
"{",
"siteRoot",
"=",
"siteRoot",
".",
"replaceFirst",
"(",
"\"/$\"",
",",
"\"\"",
")",
";",
"}",
"m_siteRoot",
"=",
"siteRoot",
";",
"}"
] | Sets the site root.
@param siteRoot the site root | [
"Sets",
"the",
"site",
"root",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L241-L247 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteEntry.java | CmsFavoriteEntry.toJson | public JSONObject toJson() throws JSONException {
JSONObject result = new JSONObject();
if (m_detailId != null) {
result.put(JSON_DETAIL, "" + m_detailId);
}
if (m_siteRoot != null) {
result.put(JSON_SITEROOT, m_siteRoot);
}
if (m_structureId != null) {
result.put(JSON_STRUCTUREID, "" + m_structureId);
}
if (m_projectId != null) {
result.put(JSON_PROJECT, "" + m_projectId);
}
if (m_type != null) {
result.put(JSON_TYPE, "" + m_type.getJsonId());
}
return result;
} | java | public JSONObject toJson() throws JSONException {
JSONObject result = new JSONObject();
if (m_detailId != null) {
result.put(JSON_DETAIL, "" + m_detailId);
}
if (m_siteRoot != null) {
result.put(JSON_SITEROOT, m_siteRoot);
}
if (m_structureId != null) {
result.put(JSON_STRUCTUREID, "" + m_structureId);
}
if (m_projectId != null) {
result.put(JSON_PROJECT, "" + m_projectId);
}
if (m_type != null) {
result.put(JSON_TYPE, "" + m_type.getJsonId());
}
return result;
} | [
"public",
"JSONObject",
"toJson",
"(",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"result",
"=",
"new",
"JSONObject",
"(",
")",
";",
"if",
"(",
"m_detailId",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"JSON_DETAIL",
",",
"\"\"",
"+",
"m_d... | Converts this object to JSON.
@return the JSON representation
@throws JSONException if JSON operations fail | [
"Converts",
"this",
"object",
"to",
"JSON",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L275-L294 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteEntry.java | CmsFavoriteEntry.updateContextAndGetFavoriteUrl | public String updateContextAndGetFavoriteUrl(CmsObject cms) throws CmsException {
CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION;
CmsProject project = null;
switch (getType()) {
case explorerFolder:
CmsResource folder = cms.readResource(getStructureId(), filter);
project = cms.readProject(getProjectId());
cms.getRequestContext().setSiteRoot(getSiteRoot());
cms.getRequestContext().setCurrentProject(project);
String explorerLink = CmsVaadinUtils.getWorkplaceLink()
+ "#!"
+ CmsFileExplorerConfiguration.APP_ID
+ "/"
+ getProjectId()
+ "!!"
+ getSiteRoot()
+ "!!"
+ cms.getSitePath(folder);
return explorerLink;
case page:
project = cms.readProject(getProjectId());
CmsResource target = cms.readResource(getStructureId(), filter);
CmsResource detailContent = null;
String link = null;
cms.getRequestContext().setCurrentProject(project);
cms.getRequestContext().setSiteRoot(getSiteRoot());
if (getDetailId() != null) {
detailContent = cms.readResource(getDetailId());
link = OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
cms.getSitePath(detailContent),
cms.getSitePath(target),
false);
} else {
link = OpenCms.getLinkManager().substituteLink(cms, target);
}
return link;
default:
return null;
}
} | java | public String updateContextAndGetFavoriteUrl(CmsObject cms) throws CmsException {
CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION;
CmsProject project = null;
switch (getType()) {
case explorerFolder:
CmsResource folder = cms.readResource(getStructureId(), filter);
project = cms.readProject(getProjectId());
cms.getRequestContext().setSiteRoot(getSiteRoot());
cms.getRequestContext().setCurrentProject(project);
String explorerLink = CmsVaadinUtils.getWorkplaceLink()
+ "#!"
+ CmsFileExplorerConfiguration.APP_ID
+ "/"
+ getProjectId()
+ "!!"
+ getSiteRoot()
+ "!!"
+ cms.getSitePath(folder);
return explorerLink;
case page:
project = cms.readProject(getProjectId());
CmsResource target = cms.readResource(getStructureId(), filter);
CmsResource detailContent = null;
String link = null;
cms.getRequestContext().setCurrentProject(project);
cms.getRequestContext().setSiteRoot(getSiteRoot());
if (getDetailId() != null) {
detailContent = cms.readResource(getDetailId());
link = OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
cms.getSitePath(detailContent),
cms.getSitePath(target),
false);
} else {
link = OpenCms.getLinkManager().substituteLink(cms, target);
}
return link;
default:
return null;
}
} | [
"public",
"String",
"updateContextAndGetFavoriteUrl",
"(",
"CmsObject",
"cms",
")",
"throws",
"CmsException",
"{",
"CmsResourceFilter",
"filter",
"=",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
";",
"CmsProject",
"project",
"=",
"null",
";",
"switch",
"(",
"getTyp... | Prepares the CmsObject for jumping to this favorite location, and returns the appropriate URL.
@param cms the CmsObject to initialize for jumping to the favorite
@return the link for the favorite location
@throws CmsException if something goes wrong | [
"Prepares",
"the",
"CmsObject",
"for",
"jumping",
"to",
"this",
"favorite",
"location",
"and",
"returns",
"the",
"appropriate",
"URL",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L304-L345 | train |
alkacon/opencms-core | src/org/opencms/ui/components/CmsToolBar.java | CmsToolBar.openFavoriteDialog | public static void openFavoriteDialog(CmsFileExplorer explorer) {
try {
CmsExplorerFavoriteContext context = new CmsExplorerFavoriteContext(A_CmsUI.getCmsObject(), explorer);
CmsFavoriteDialog dialog = new CmsFavoriteDialog(context, new CmsFavoriteDAO(A_CmsUI.getCmsObject()));
Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
window.setContent(dialog);
window.setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_FAVORITES_DIALOG_TITLE_0));
A_CmsUI.get().addWindow(window);
window.center();
} catch (CmsException e) {
CmsErrorDialog.showErrorDialog(e);
}
} | java | public static void openFavoriteDialog(CmsFileExplorer explorer) {
try {
CmsExplorerFavoriteContext context = new CmsExplorerFavoriteContext(A_CmsUI.getCmsObject(), explorer);
CmsFavoriteDialog dialog = new CmsFavoriteDialog(context, new CmsFavoriteDAO(A_CmsUI.getCmsObject()));
Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
window.setContent(dialog);
window.setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_FAVORITES_DIALOG_TITLE_0));
A_CmsUI.get().addWindow(window);
window.center();
} catch (CmsException e) {
CmsErrorDialog.showErrorDialog(e);
}
} | [
"public",
"static",
"void",
"openFavoriteDialog",
"(",
"CmsFileExplorer",
"explorer",
")",
"{",
"try",
"{",
"CmsExplorerFavoriteContext",
"context",
"=",
"new",
"CmsExplorerFavoriteContext",
"(",
"A_CmsUI",
".",
"getCmsObject",
"(",
")",
",",
"explorer",
")",
";",
... | Opens the favorite dialog.
@param explorer the explorer instance (null if not currently in explorer) | [
"Opens",
"the",
"favorite",
"dialog",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsToolBar.java#L294-L307 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java | CmsMessageBundleEditorTypes.getDescriptor | public static CmsResource getDescriptor(CmsObject cms, String basename) {
CmsSolrQuery query = new CmsSolrQuery();
query.setResourceTypes(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString());
query.setFilterQueries("filename:\"" + basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX + "\"");
query.add("fl", "path");
CmsSolrResultList results;
try {
boolean isOnlineProject = cms.getRequestContext().getCurrentProject().isOnlineProject();
String indexName = isOnlineProject
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
: CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE;
results = OpenCms.getSearchManager().getIndexSolr(indexName).search(cms, query, true, null, true, null);
} catch (CmsSearchException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_SEARCH_ERROR_0), e);
return null;
}
switch (results.size()) {
case 0:
return null;
case 1:
return results.get(0);
default:
String files = "";
for (CmsResource res : results) {
files += " " + res.getRootPath();
}
LOG.warn(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_NOT_UNIQUE_1, files));
return results.get(0);
}
} | java | public static CmsResource getDescriptor(CmsObject cms, String basename) {
CmsSolrQuery query = new CmsSolrQuery();
query.setResourceTypes(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString());
query.setFilterQueries("filename:\"" + basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX + "\"");
query.add("fl", "path");
CmsSolrResultList results;
try {
boolean isOnlineProject = cms.getRequestContext().getCurrentProject().isOnlineProject();
String indexName = isOnlineProject
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
: CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE;
results = OpenCms.getSearchManager().getIndexSolr(indexName).search(cms, query, true, null, true, null);
} catch (CmsSearchException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_SEARCH_ERROR_0), e);
return null;
}
switch (results.size()) {
case 0:
return null;
case 1:
return results.get(0);
default:
String files = "";
for (CmsResource res : results) {
files += " " + res.getRootPath();
}
LOG.warn(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_NOT_UNIQUE_1, files));
return results.get(0);
}
} | [
"public",
"static",
"CmsResource",
"getDescriptor",
"(",
"CmsObject",
"cms",
",",
"String",
"basename",
")",
"{",
"CmsSolrQuery",
"query",
"=",
"new",
"CmsSolrQuery",
"(",
")",
";",
"query",
".",
"setResourceTypes",
"(",
"CmsMessageBundleEditorTypes",
".",
"Bundle... | Returns the bundle descriptor for the bundle with the provided base name.
@param cms {@link CmsObject} used for searching.
@param basename the bundle base name, for which the descriptor is searched.
@return the bundle descriptor, or <code>null</code> if it does not exist or searching fails. | [
"Returns",
"the",
"bundle",
"descriptor",
"for",
"the",
"bundle",
"with",
"the",
"provided",
"base",
"name",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java#L976-L1007 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java | CmsMessageBundleEditorTypes.showWarning | static void showWarning(final String caption, final String description) {
Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true);
warning.setDelayMsec(-1);
warning.show(UI.getCurrent().getPage());
} | java | static void showWarning(final String caption, final String description) {
Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true);
warning.setDelayMsec(-1);
warning.show(UI.getCurrent().getPage());
} | [
"static",
"void",
"showWarning",
"(",
"final",
"String",
"caption",
",",
"final",
"String",
"description",
")",
"{",
"Notification",
"warning",
"=",
"new",
"Notification",
"(",
"caption",
",",
"description",
",",
"Type",
".",
"WARNING_MESSAGE",
",",
"true",
")... | Displays a localized warning.
@param caption the caption of the warning.
@param description the description of the warning. | [
"Displays",
"a",
"localized",
"warning",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java#L1014-L1020 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/datebox/CmsDateBox.java | CmsDateBox.setDateOnly | public void setDateOnly(boolean dateOnly) {
if (m_dateOnly != dateOnly) {
m_dateOnly = dateOnly;
if (m_dateOnly) {
m_time.removeFromParent();
m_am.removeFromParent();
m_pm.removeFromParent();
} else {
m_timeField.add(m_time);
m_timeField.add(m_am);
m_timeField.add(m_pm);
}
}
} | java | public void setDateOnly(boolean dateOnly) {
if (m_dateOnly != dateOnly) {
m_dateOnly = dateOnly;
if (m_dateOnly) {
m_time.removeFromParent();
m_am.removeFromParent();
m_pm.removeFromParent();
} else {
m_timeField.add(m_time);
m_timeField.add(m_am);
m_timeField.add(m_pm);
}
}
} | [
"public",
"void",
"setDateOnly",
"(",
"boolean",
"dateOnly",
")",
"{",
"if",
"(",
"m_dateOnly",
"!=",
"dateOnly",
")",
"{",
"m_dateOnly",
"=",
"dateOnly",
";",
"if",
"(",
"m_dateOnly",
")",
"{",
"m_time",
".",
"removeFromParent",
"(",
")",
";",
"m_am",
"... | Sets the value if the date only should be shown.
@param dateOnly if the date only should be shown | [
"Sets",
"the",
"value",
"if",
"the",
"date",
"only",
"should",
"be",
"shown",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/datebox/CmsDateBox.java#L558-L572 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualView.java | CmsPatternPanelIndividualView.addButtonClick | @UiHandler("m_addButton")
void addButtonClick(ClickEvent e) {
if (null != m_newDate.getValue()) {
m_dateList.addDate(m_newDate.getValue());
m_newDate.setValue(null);
if (handleChange()) {
m_controller.setDates(m_dateList.getDates());
}
}
} | java | @UiHandler("m_addButton")
void addButtonClick(ClickEvent e) {
if (null != m_newDate.getValue()) {
m_dateList.addDate(m_newDate.getValue());
m_newDate.setValue(null);
if (handleChange()) {
m_controller.setDates(m_dateList.getDates());
}
}
} | [
"@",
"UiHandler",
"(",
"\"m_addButton\"",
")",
"void",
"addButtonClick",
"(",
"ClickEvent",
"e",
")",
"{",
"if",
"(",
"null",
"!=",
"m_newDate",
".",
"getValue",
"(",
")",
")",
"{",
"m_dateList",
".",
"addDate",
"(",
"m_newDate",
".",
"getValue",
"(",
")... | Handle click on "Add" button.
@param e the click event. | [
"Handle",
"click",
"on",
"Add",
"button",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualView.java#L120-L130 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualView.java | CmsPatternPanelIndividualView.dateListValueChange | @UiHandler("m_dateList")
void dateListValueChange(ValueChangeEvent<SortedSet<Date>> event) {
if (handleChange()) {
m_controller.setDates(event.getValue());
}
} | java | @UiHandler("m_dateList")
void dateListValueChange(ValueChangeEvent<SortedSet<Date>> event) {
if (handleChange()) {
m_controller.setDates(event.getValue());
}
} | [
"@",
"UiHandler",
"(",
"\"m_dateList\"",
")",
"void",
"dateListValueChange",
"(",
"ValueChangeEvent",
"<",
"SortedSet",
"<",
"Date",
">",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setDates",
"(",
"event",
... | Handle value change event on the individual dates list.
@param event the change event. | [
"Handle",
"value",
"change",
"event",
"on",
"the",
"individual",
"dates",
"list",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualView.java#L136-L142 | train |
alkacon/opencms-core | src/org/opencms/configuration/CmsParameterConfiguration.java | CmsParameterConfiguration.remove | @Override
public String remove(Object key) {
String result = m_configurationStrings.remove(key);
m_configurationObjects.remove(key);
return result;
} | java | @Override
public String remove(Object key) {
String result = m_configurationStrings.remove(key);
m_configurationObjects.remove(key);
return result;
} | [
"@",
"Override",
"public",
"String",
"remove",
"(",
"Object",
"key",
")",
"{",
"String",
"result",
"=",
"m_configurationStrings",
".",
"remove",
"(",
"key",
")",
";",
"m_configurationObjects",
".",
"remove",
"(",
"key",
")",
";",
"return",
"result",
";",
"... | Removes a parameter from this configuration.
@param key the parameter to remove | [
"Removes",
"a",
"parameter",
"from",
"this",
"configuration",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsParameterConfiguration.java#L799-L805 | train |
alkacon/opencms-core | src/org/opencms/main/OpenCmsServlet.java | OpenCmsServlet.loadCustomErrorPage | private boolean loadCustomErrorPage(
CmsObject cms,
HttpServletRequest req,
HttpServletResponse res,
String rootPath) {
try {
// get the site of the error page resource
CmsSite errorSite = OpenCms.getSiteManager().getSiteForRootPath(rootPath);
cms.getRequestContext().setSiteRoot(errorSite.getSiteRoot());
String relPath = cms.getRequestContext().removeSiteRoot(rootPath);
if (cms.existsResource(relPath)) {
cms.getRequestContext().setUri(relPath);
OpenCms.getResourceManager().loadResource(cms, cms.readResource(relPath), req, res);
return true;
} else {
return false;
}
} catch (Throwable e) {
// something went wrong log the exception and return false
LOG.error(e.getMessage(), e);
return false;
}
} | java | private boolean loadCustomErrorPage(
CmsObject cms,
HttpServletRequest req,
HttpServletResponse res,
String rootPath) {
try {
// get the site of the error page resource
CmsSite errorSite = OpenCms.getSiteManager().getSiteForRootPath(rootPath);
cms.getRequestContext().setSiteRoot(errorSite.getSiteRoot());
String relPath = cms.getRequestContext().removeSiteRoot(rootPath);
if (cms.existsResource(relPath)) {
cms.getRequestContext().setUri(relPath);
OpenCms.getResourceManager().loadResource(cms, cms.readResource(relPath), req, res);
return true;
} else {
return false;
}
} catch (Throwable e) {
// something went wrong log the exception and return false
LOG.error(e.getMessage(), e);
return false;
}
} | [
"private",
"boolean",
"loadCustomErrorPage",
"(",
"CmsObject",
"cms",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"String",
"rootPath",
")",
"{",
"try",
"{",
"// get the site of the error page resource",
"CmsSite",
"errorSite",
"=",
"OpenCm... | Tries to load the custom error page at the given rootPath.
@param cms {@link CmsObject} used for reading the resource (site root and uri get adjusted!)
@param req the current request
@param res the current response
@param rootPath the VFS root path to the error page resource
@return a flag, indicating if the error page could be loaded | [
"Tries",
"to",
"load",
"the",
"custom",
"error",
"page",
"at",
"the",
"given",
"rootPath",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsServlet.java#L364-L388 | train |
alkacon/opencms-core | src/org/opencms/main/OpenCmsServlet.java | OpenCmsServlet.tryCustomErrorPage | private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) {
String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot();
CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);
if (site != null) {
// store current site root and URI
String currentSiteRoot = cms.getRequestContext().getSiteRoot();
String currentUri = cms.getRequestContext().getUri();
try {
if (site.getErrorPage() != null) {
String rootPath = site.getErrorPage();
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
}
String rootPath = CmsStringUtil.joinPaths(siteRoot, "/.errorpages/handle" + errorCode + ".html");
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
} finally {
cms.getRequestContext().setSiteRoot(currentSiteRoot);
cms.getRequestContext().setUri(currentUri);
}
}
return false;
} | java | private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) {
String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot();
CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);
if (site != null) {
// store current site root and URI
String currentSiteRoot = cms.getRequestContext().getSiteRoot();
String currentUri = cms.getRequestContext().getUri();
try {
if (site.getErrorPage() != null) {
String rootPath = site.getErrorPage();
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
}
String rootPath = CmsStringUtil.joinPaths(siteRoot, "/.errorpages/handle" + errorCode + ".html");
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
} finally {
cms.getRequestContext().setSiteRoot(currentSiteRoot);
cms.getRequestContext().setUri(currentUri);
}
}
return false;
} | [
"private",
"boolean",
"tryCustomErrorPage",
"(",
"CmsObject",
"cms",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"int",
"errorCode",
")",
"{",
"String",
"siteRoot",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"matchRequest",... | Tries to load a site specific error page. If
@param cms {@link CmsObject} used for reading the resource (site root and uri get adjusted!)
@param req the current request
@param res the current response
@param errorCode the error code to display
@return a flag, indicating if the custom error page could be loaded. | [
"Tries",
"to",
"load",
"a",
"site",
"specific",
"error",
"page",
".",
"If"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsServlet.java#L398-L423 | train |
alkacon/opencms-core | src/org/opencms/ade/galleries/CmsGalleryService.java | CmsGalleryService.buildVfsEntryBeanForQuickSearch | private CmsVfsEntryBean buildVfsEntryBeanForQuickSearch(
CmsResource resource,
Multimap<CmsResource, CmsResource> childMap,
Set<CmsResource> filterMatches,
Set<String> parentPaths,
boolean isRoot)
throws CmsException {
CmsObject cms = getCmsObject();
String title = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue();
boolean isMatch = filterMatches.contains(resource);
List<CmsVfsEntryBean> childBeans = Lists.newArrayList();
Collection<CmsResource> children = childMap.get(resource);
if (!children.isEmpty()) {
for (CmsResource child : children) {
CmsVfsEntryBean childBean = buildVfsEntryBeanForQuickSearch(
child,
childMap,
filterMatches,
parentPaths,
false);
childBeans.add(childBean);
}
} else if (filterMatches.contains(resource)) {
if (parentPaths.contains(resource.getRootPath())) {
childBeans = null;
}
// otherwise childBeans remains an empty list
}
String rootPath = resource.getRootPath();
CmsVfsEntryBean result = new CmsVfsEntryBean(
rootPath,
resource.getStructureId(),
title,
CmsIconUtil.getIconClasses(CmsIconUtil.getDisplayType(cms, resource), resource.getName(), true),
isRoot,
isEditable(cms, resource),
childBeans,
isMatch);
String siteRoot = null;
if (OpenCms.getSiteManager().startsWithShared(rootPath)) {
siteRoot = OpenCms.getSiteManager().getSharedFolder();
} else {
String tempSiteRoot = OpenCms.getSiteManager().getSiteRoot(rootPath);
if (tempSiteRoot != null) {
siteRoot = tempSiteRoot;
} else {
siteRoot = "";
}
}
result.setSiteRoot(siteRoot);
return result;
} | java | private CmsVfsEntryBean buildVfsEntryBeanForQuickSearch(
CmsResource resource,
Multimap<CmsResource, CmsResource> childMap,
Set<CmsResource> filterMatches,
Set<String> parentPaths,
boolean isRoot)
throws CmsException {
CmsObject cms = getCmsObject();
String title = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue();
boolean isMatch = filterMatches.contains(resource);
List<CmsVfsEntryBean> childBeans = Lists.newArrayList();
Collection<CmsResource> children = childMap.get(resource);
if (!children.isEmpty()) {
for (CmsResource child : children) {
CmsVfsEntryBean childBean = buildVfsEntryBeanForQuickSearch(
child,
childMap,
filterMatches,
parentPaths,
false);
childBeans.add(childBean);
}
} else if (filterMatches.contains(resource)) {
if (parentPaths.contains(resource.getRootPath())) {
childBeans = null;
}
// otherwise childBeans remains an empty list
}
String rootPath = resource.getRootPath();
CmsVfsEntryBean result = new CmsVfsEntryBean(
rootPath,
resource.getStructureId(),
title,
CmsIconUtil.getIconClasses(CmsIconUtil.getDisplayType(cms, resource), resource.getName(), true),
isRoot,
isEditable(cms, resource),
childBeans,
isMatch);
String siteRoot = null;
if (OpenCms.getSiteManager().startsWithShared(rootPath)) {
siteRoot = OpenCms.getSiteManager().getSharedFolder();
} else {
String tempSiteRoot = OpenCms.getSiteManager().getSiteRoot(rootPath);
if (tempSiteRoot != null) {
siteRoot = tempSiteRoot;
} else {
siteRoot = "";
}
}
result.setSiteRoot(siteRoot);
return result;
} | [
"private",
"CmsVfsEntryBean",
"buildVfsEntryBeanForQuickSearch",
"(",
"CmsResource",
"resource",
",",
"Multimap",
"<",
"CmsResource",
",",
"CmsResource",
">",
"childMap",
",",
"Set",
"<",
"CmsResource",
">",
"filterMatches",
",",
"Set",
"<",
"String",
">",
"parentPa... | Recursively builds the VFS entry bean for the quick filtering function in the folder tab.<p<
@param resource the resource
@param childMap map from parent to child resources
@param filterMatches the resources matching the filter
@param parentPaths root paths of resources which are not leaves
@param isRoot true if this the root node
@return the VFS entry bean for the client
@throws CmsException if something goes wrong | [
"Recursively",
"builds",
"the",
"VFS",
"entry",
"bean",
"for",
"the",
"quick",
"filtering",
"function",
"in",
"the",
"folder",
"tab",
".",
"<p<"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L1875-L1929 | train |
alkacon/opencms-core | src/org/opencms/loader/CmsJspLoader.java | CmsJspLoader.doPurge | protected void doPurge(Runnable afterPurgeAction) {
if (LOG.isInfoEnabled()) {
LOG.info(
org.opencms.flex.Messages.get().getBundle().key(
org.opencms.flex.Messages.LOG_FLEXCACHE_WILL_PURGE_JSP_REPOSITORY_0));
}
File d;
d = new File(getJspRepository() + CmsFlexCache.REPOSITORY_ONLINE + File.separator);
CmsFileUtil.purgeDirectory(d);
d = new File(getJspRepository() + CmsFlexCache.REPOSITORY_OFFLINE + File.separator);
CmsFileUtil.purgeDirectory(d);
if (afterPurgeAction != null) {
afterPurgeAction.run();
}
if (LOG.isInfoEnabled()) {
LOG.info(
org.opencms.flex.Messages.get().getBundle().key(
org.opencms.flex.Messages.LOG_FLEXCACHE_PURGED_JSP_REPOSITORY_0));
}
} | java | protected void doPurge(Runnable afterPurgeAction) {
if (LOG.isInfoEnabled()) {
LOG.info(
org.opencms.flex.Messages.get().getBundle().key(
org.opencms.flex.Messages.LOG_FLEXCACHE_WILL_PURGE_JSP_REPOSITORY_0));
}
File d;
d = new File(getJspRepository() + CmsFlexCache.REPOSITORY_ONLINE + File.separator);
CmsFileUtil.purgeDirectory(d);
d = new File(getJspRepository() + CmsFlexCache.REPOSITORY_OFFLINE + File.separator);
CmsFileUtil.purgeDirectory(d);
if (afterPurgeAction != null) {
afterPurgeAction.run();
}
if (LOG.isInfoEnabled()) {
LOG.info(
org.opencms.flex.Messages.get().getBundle().key(
org.opencms.flex.Messages.LOG_FLEXCACHE_PURGED_JSP_REPOSITORY_0));
}
} | [
"protected",
"void",
"doPurge",
"(",
"Runnable",
"afterPurgeAction",
")",
"{",
"if",
"(",
"LOG",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"org",
".",
"opencms",
".",
"flex",
".",
"Messages",
".",
"get",
"(",
")",
".",
"getBu... | Purges the JSP repository.<p<
@param afterPurgeAction the action to execute after purging | [
"Purges",
"the",
"JSP",
"repository",
".",
"<p<"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L1079-L1103 | train |
alkacon/opencms-core | src/org/opencms/rmi/CmsRemoteShellClient.java | CmsRemoteShellClient.wrongUsage | private void wrongUsage() {
String usage = "Usage: java -cp $PATH_TO_OPENCMS_JAR org.opencms.rmi.CmsRemoteShellClient\n"
+ " -script=[path to script] (optional) \n"
+ " -registryPort=[port of RMI registry] (optional, default is "
+ CmsRemoteShellConstants.DEFAULT_PORT
+ ")\n"
+ " -additional=[additional commands class name] (optional)";
System.out.println(usage);
System.exit(1);
} | java | private void wrongUsage() {
String usage = "Usage: java -cp $PATH_TO_OPENCMS_JAR org.opencms.rmi.CmsRemoteShellClient\n"
+ " -script=[path to script] (optional) \n"
+ " -registryPort=[port of RMI registry] (optional, default is "
+ CmsRemoteShellConstants.DEFAULT_PORT
+ ")\n"
+ " -additional=[additional commands class name] (optional)";
System.out.println(usage);
System.exit(1);
} | [
"private",
"void",
"wrongUsage",
"(",
")",
"{",
"String",
"usage",
"=",
"\"Usage: java -cp $PATH_TO_OPENCMS_JAR org.opencms.rmi.CmsRemoteShellClient\\n\"",
"+",
"\" -script=[path to script] (optional) \\n\"",
"+",
"\" -registryPort=[port of RMI registry] (optional, default is \"",
... | Displays text which shows the valid command line parameters, and then exits. | [
"Displays",
"text",
"which",
"shows",
"the",
"valid",
"command",
"line",
"parameters",
"and",
"then",
"exits",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/rmi/CmsRemoteShellClient.java#L325-L335 | train |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagSearch.java | CmsJspTagSearch.setAddContentInfo | public void setAddContentInfo(final Boolean doAddInfo) {
if ((null != doAddInfo) && doAddInfo.booleanValue() && (null != m_addContentInfoForEntries)) {
m_addContentInfoForEntries = Integer.valueOf(DEFAULT_CONTENTINFO_ROWS);
}
} | java | public void setAddContentInfo(final Boolean doAddInfo) {
if ((null != doAddInfo) && doAddInfo.booleanValue() && (null != m_addContentInfoForEntries)) {
m_addContentInfoForEntries = Integer.valueOf(DEFAULT_CONTENTINFO_ROWS);
}
} | [
"public",
"void",
"setAddContentInfo",
"(",
"final",
"Boolean",
"doAddInfo",
")",
"{",
"if",
"(",
"(",
"null",
"!=",
"doAddInfo",
")",
"&&",
"doAddInfo",
".",
"booleanValue",
"(",
")",
"&&",
"(",
"null",
"!=",
"m_addContentInfoForEntries",
")",
")",
"{",
"... | Setter for "addContentInfo", indicating if content information should be added.
@param doAddInfo The value of the "addContentInfo" attribute of the tag | [
"Setter",
"for",
"addContentInfo",
"indicating",
"if",
"content",
"information",
"should",
"be",
"added",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagSearch.java#L261-L266 | train |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagSearch.java | CmsJspTagSearch.setFileFormat | public void setFileFormat(String fileFormat) {
if (fileFormat.toUpperCase().equals(FileFormat.JSON.toString())) {
m_fileFormat = FileFormat.JSON;
}
} | java | public void setFileFormat(String fileFormat) {
if (fileFormat.toUpperCase().equals(FileFormat.JSON.toString())) {
m_fileFormat = FileFormat.JSON;
}
} | [
"public",
"void",
"setFileFormat",
"(",
"String",
"fileFormat",
")",
"{",
"if",
"(",
"fileFormat",
".",
"toUpperCase",
"(",
")",
".",
"equals",
"(",
"FileFormat",
".",
"JSON",
".",
"toString",
"(",
")",
")",
")",
"{",
"m_fileFormat",
"=",
"FileFormat",
"... | Setter for the file format.
@param fileFormat File format the configuration file is in. | [
"Setter",
"for",
"the",
"file",
"format",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagSearch.java#L297-L302 | train |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagSearch.java | CmsJspTagSearch.addContentInfo | private void addContentInfo() {
if (!m_cms.getRequestContext().getCurrentProject().isOnlineProject()
&& (null == m_searchController.getCommon().getConfig().getSolrIndex())
&& (null != m_addContentInfoForEntries)) {
CmsSolrQuery query = new CmsSolrQuery();
m_searchController.addQueryParts(query, m_cms);
query.setStart(Integer.valueOf(0));
query.setRows(m_addContentInfoForEntries);
CmsContentLoadCollectorInfo info = new CmsContentLoadCollectorInfo();
info.setCollectorClass(this.getClass().getName());
info.setCollectorParams(query.getQuery());
info.setId((new CmsUUID()).getStringValue());
if (CmsJspTagEditable.getDirectEditProvider(pageContext) != null) {
try {
CmsJspTagEditable.getDirectEditProvider(pageContext).insertDirectEditListMetadata(
pageContext,
info);
} catch (JspException e) {
LOG.error("Could not write content info.", e);
}
}
}
} | java | private void addContentInfo() {
if (!m_cms.getRequestContext().getCurrentProject().isOnlineProject()
&& (null == m_searchController.getCommon().getConfig().getSolrIndex())
&& (null != m_addContentInfoForEntries)) {
CmsSolrQuery query = new CmsSolrQuery();
m_searchController.addQueryParts(query, m_cms);
query.setStart(Integer.valueOf(0));
query.setRows(m_addContentInfoForEntries);
CmsContentLoadCollectorInfo info = new CmsContentLoadCollectorInfo();
info.setCollectorClass(this.getClass().getName());
info.setCollectorParams(query.getQuery());
info.setId((new CmsUUID()).getStringValue());
if (CmsJspTagEditable.getDirectEditProvider(pageContext) != null) {
try {
CmsJspTagEditable.getDirectEditProvider(pageContext).insertDirectEditListMetadata(
pageContext,
info);
} catch (JspException e) {
LOG.error("Could not write content info.", e);
}
}
}
} | [
"private",
"void",
"addContentInfo",
"(",
")",
"{",
"if",
"(",
"!",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentProject",
"(",
")",
".",
"isOnlineProject",
"(",
")",
"&&",
"(",
"null",
"==",
"m_searchController",
".",
"getCommon",
"(",
")"... | Adds the content info for the collected resources used in the "This page" publish dialog. | [
"Adds",
"the",
"content",
"info",
"for",
"the",
"collected",
"resources",
"used",
"in",
"the",
"This",
"page",
"publish",
"dialog",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagSearch.java#L369-L392 | train |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagSearch.java | CmsJspTagSearch.getSearchResults | private I_CmsSearchResultWrapper getSearchResults() {
// The second parameter is just ignored - so it does not matter
m_searchController.updateFromRequestParameters(pageContext.getRequest().getParameterMap(), false);
I_CmsSearchControllerCommon common = m_searchController.getCommon();
// Do not search for empty query, if configured
if (common.getState().getQuery().isEmpty()
&& (!common.getConfig().getIgnoreQueryParam() && !common.getConfig().getSearchForEmptyQueryParam())) {
return new CmsSearchResultWrapper(m_searchController, null, null, m_cms, null);
}
Map<String, String[]> queryParams = null;
boolean isEditMode = CmsJspTagEditable.isEditableRequest(pageContext.getRequest());
if (isEditMode) {
String params = "";
if (common.getConfig().getIgnoreReleaseDate()) {
params += "&fq=released:[* TO *]";
}
if (common.getConfig().getIgnoreExpirationDate()) {
params += "&fq=expired:[* TO *]";
}
if (!params.isEmpty()) {
queryParams = CmsRequestUtil.createParameterMap(params.substring(1));
}
}
CmsSolrQuery query = new CmsSolrQuery(null, queryParams);
m_searchController.addQueryParts(query, m_cms);
try {
// use "complicated" constructor to allow more than 50 results -> set ignoreMaxResults to true
// also set resource filter to allow for returning unreleased/expired resources if necessary.
CmsSolrResultList solrResultList = m_index.search(
m_cms,
query.clone(), // use a clone of the query, since the search function manipulates the query (removes highlighting parts), but we want to keep the original one.
true,
isEditMode ? CmsResourceFilter.IGNORE_EXPIRATION : null);
return new CmsSearchResultWrapper(m_searchController, solrResultList, query, m_cms, null);
} catch (CmsSearchException e) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_TAG_SEARCH_SEARCH_FAILED_0), e);
return new CmsSearchResultWrapper(m_searchController, null, query, m_cms, e);
}
} | java | private I_CmsSearchResultWrapper getSearchResults() {
// The second parameter is just ignored - so it does not matter
m_searchController.updateFromRequestParameters(pageContext.getRequest().getParameterMap(), false);
I_CmsSearchControllerCommon common = m_searchController.getCommon();
// Do not search for empty query, if configured
if (common.getState().getQuery().isEmpty()
&& (!common.getConfig().getIgnoreQueryParam() && !common.getConfig().getSearchForEmptyQueryParam())) {
return new CmsSearchResultWrapper(m_searchController, null, null, m_cms, null);
}
Map<String, String[]> queryParams = null;
boolean isEditMode = CmsJspTagEditable.isEditableRequest(pageContext.getRequest());
if (isEditMode) {
String params = "";
if (common.getConfig().getIgnoreReleaseDate()) {
params += "&fq=released:[* TO *]";
}
if (common.getConfig().getIgnoreExpirationDate()) {
params += "&fq=expired:[* TO *]";
}
if (!params.isEmpty()) {
queryParams = CmsRequestUtil.createParameterMap(params.substring(1));
}
}
CmsSolrQuery query = new CmsSolrQuery(null, queryParams);
m_searchController.addQueryParts(query, m_cms);
try {
// use "complicated" constructor to allow more than 50 results -> set ignoreMaxResults to true
// also set resource filter to allow for returning unreleased/expired resources if necessary.
CmsSolrResultList solrResultList = m_index.search(
m_cms,
query.clone(), // use a clone of the query, since the search function manipulates the query (removes highlighting parts), but we want to keep the original one.
true,
isEditMode ? CmsResourceFilter.IGNORE_EXPIRATION : null);
return new CmsSearchResultWrapper(m_searchController, solrResultList, query, m_cms, null);
} catch (CmsSearchException e) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_TAG_SEARCH_SEARCH_FAILED_0), e);
return new CmsSearchResultWrapper(m_searchController, null, query, m_cms, e);
}
} | [
"private",
"I_CmsSearchResultWrapper",
"getSearchResults",
"(",
")",
"{",
"// The second parameter is just ignored - so it does not matter",
"m_searchController",
".",
"updateFromRequestParameters",
"(",
"pageContext",
".",
"getRequest",
"(",
")",
".",
"getParameterMap",
"(",
"... | Here the search query is composed and executed.
The result is wrapped in an easily usable form.
It is exposed to the JSP via the tag's "var" attribute.
@return The result object exposed via the tag's attribute "var". | [
"Here",
"the",
"search",
"query",
"is",
"composed",
"and",
"executed",
".",
"The",
"result",
"is",
"wrapped",
"in",
"an",
"easily",
"usable",
"form",
".",
"It",
"is",
"exposed",
"to",
"the",
"JSP",
"via",
"the",
"tag",
"s",
"var",
"attribute",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagSearch.java#L399-L438 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspDateSeriesBean.java | CmsJspDateSeriesBean.toDate | public Date toDate(Object date) {
Date d = null;
if (null != date) {
if (date instanceof Date) {
d = (Date)date;
} else if (date instanceof Long) {
d = new Date(((Long)date).longValue());
} else {
try {
long l = Long.parseLong(date.toString());
d = new Date(l);
} catch (Exception e) {
// do nothing, just let d remain null
}
}
}
return d;
} | java | public Date toDate(Object date) {
Date d = null;
if (null != date) {
if (date instanceof Date) {
d = (Date)date;
} else if (date instanceof Long) {
d = new Date(((Long)date).longValue());
} else {
try {
long l = Long.parseLong(date.toString());
d = new Date(l);
} catch (Exception e) {
// do nothing, just let d remain null
}
}
}
return d;
} | [
"public",
"Date",
"toDate",
"(",
"Object",
"date",
")",
"{",
"Date",
"d",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"date",
")",
"{",
"if",
"(",
"date",
"instanceof",
"Date",
")",
"{",
"d",
"=",
"(",
"Date",
")",
"date",
";",
"}",
"else",
"if"... | Converts the provided object to a date, if possible.
@param date the date.
@return the date as {@link java.util.Date} | [
"Converts",
"the",
"provided",
"object",
"to",
"a",
"date",
"if",
"possible",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspDateSeriesBean.java#L422-L440 | train |
alkacon/opencms-core | src/org/opencms/jlan/CmsJlanThreadManager.java | CmsJlanThreadManager.stop | public synchronized void stop() {
if (m_thread != null) {
long timeBeforeShutdownWasCalled = System.currentTimeMillis();
JLANServer.shutdownServer(new String[] {});
while (m_thread.isAlive()
&& ((System.currentTimeMillis() - timeBeforeShutdownWasCalled) < MAX_SHUTDOWN_WAIT_MILLIS)) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// ignore
}
}
}
} | java | public synchronized void stop() {
if (m_thread != null) {
long timeBeforeShutdownWasCalled = System.currentTimeMillis();
JLANServer.shutdownServer(new String[] {});
while (m_thread.isAlive()
&& ((System.currentTimeMillis() - timeBeforeShutdownWasCalled) < MAX_SHUTDOWN_WAIT_MILLIS)) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// ignore
}
}
}
} | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"m_thread",
"!=",
"null",
")",
"{",
"long",
"timeBeforeShutdownWasCalled",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"JLANServer",
".",
"shutdownServer",
"(",
"new",
"String",
... | Tries to stop the JLAN server and return after it is stopped, but will also return if the thread hasn't stopped after MAX_SHUTDOWN_WAIT_MILLIS. | [
"Tries",
"to",
"stop",
"the",
"JLAN",
"server",
"and",
"return",
"after",
"it",
"is",
"stopped",
"but",
"will",
"also",
"return",
"if",
"the",
"thread",
"hasn",
"t",
"stopped",
"after",
"MAX_SHUTDOWN_WAIT_MILLIS",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jlan/CmsJlanThreadManager.java#L112-L127 | train |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsUpdateInfo.java | CmsUpdateInfo.needToSetCategoryFolder | public boolean needToSetCategoryFolder() {
if (m_adeModuleVersion == null) {
return true;
}
CmsModuleVersion categoryFolderUpdateVersion = new CmsModuleVersion("9.0.0");
return (m_adeModuleVersion.compareTo(categoryFolderUpdateVersion) == -1);
} | java | public boolean needToSetCategoryFolder() {
if (m_adeModuleVersion == null) {
return true;
}
CmsModuleVersion categoryFolderUpdateVersion = new CmsModuleVersion("9.0.0");
return (m_adeModuleVersion.compareTo(categoryFolderUpdateVersion) == -1);
} | [
"public",
"boolean",
"needToSetCategoryFolder",
"(",
")",
"{",
"if",
"(",
"m_adeModuleVersion",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"CmsModuleVersion",
"categoryFolderUpdateVersion",
"=",
"new",
"CmsModuleVersion",
"(",
"\"9.0.0\"",
")",
";",
"retu... | Checks if the categoryfolder setting needs to be updated.
@return true if the categoryfolder setting needs to be updated | [
"Checks",
"if",
"the",
"categoryfolder",
"setting",
"needs",
"to",
"be",
"updated",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsUpdateInfo.java#L58-L65 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelWeeklyController.java | CmsPatternPanelWeeklyController.setWeekDays | public void setWeekDays(SortedSet<WeekDay> weekDays) {
final SortedSet<WeekDay> newWeekDays = null == weekDays ? new TreeSet<WeekDay>() : weekDays;
SortedSet<WeekDay> currentWeekDays = m_model.getWeekDays();
if (!currentWeekDays.equals(newWeekDays)) {
conditionallyRemoveExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekDays(newWeekDays);
onValueChange();
}
}, !newWeekDays.containsAll(m_model.getWeekDays()));
}
} | java | public void setWeekDays(SortedSet<WeekDay> weekDays) {
final SortedSet<WeekDay> newWeekDays = null == weekDays ? new TreeSet<WeekDay>() : weekDays;
SortedSet<WeekDay> currentWeekDays = m_model.getWeekDays();
if (!currentWeekDays.equals(newWeekDays)) {
conditionallyRemoveExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekDays(newWeekDays);
onValueChange();
}
}, !newWeekDays.containsAll(m_model.getWeekDays()));
}
} | [
"public",
"void",
"setWeekDays",
"(",
"SortedSet",
"<",
"WeekDay",
">",
"weekDays",
")",
"{",
"final",
"SortedSet",
"<",
"WeekDay",
">",
"newWeekDays",
"=",
"null",
"==",
"weekDays",
"?",
"new",
"TreeSet",
"<",
"WeekDay",
">",
"(",
")",
":",
"weekDays",
... | Set the weekdays at which the event should take place.
@param weekDays the weekdays at which the event should take place. | [
"Set",
"the",
"weekdays",
"at",
"which",
"the",
"event",
"should",
"take",
"place",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelWeeklyController.java#L66-L80 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsUserEditDialog.java | CmsUserEditDialog.switchTab | protected void switchTab() {
Component tab = m_tab.getSelectedTab();
int pos = m_tab.getTabPosition(m_tab.getTab(tab));
if (m_isWebOU) {
if (pos == 0) {
pos = 1;
}
}
m_tab.setSelectedTab(pos + 1);
} | java | protected void switchTab() {
Component tab = m_tab.getSelectedTab();
int pos = m_tab.getTabPosition(m_tab.getTab(tab));
if (m_isWebOU) {
if (pos == 0) {
pos = 1;
}
}
m_tab.setSelectedTab(pos + 1);
} | [
"protected",
"void",
"switchTab",
"(",
")",
"{",
"Component",
"tab",
"=",
"m_tab",
".",
"getSelectedTab",
"(",
")",
";",
"int",
"pos",
"=",
"m_tab",
".",
"getTabPosition",
"(",
"m_tab",
".",
"getTab",
"(",
"tab",
")",
")",
";",
"if",
"(",
"m_isWebOU",
... | Switches to the next tab. | [
"Switches",
"to",
"the",
"next",
"tab",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserEditDialog.java#L836-L846 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java | CmsListItemWidget.onEditTitleTextBox | protected void onEditTitleTextBox(TextBox box) {
if (m_titleEditHandler != null) {
m_titleEditHandler.handleEdit(m_title, box);
return;
}
String text = box.getText();
box.removeFromParent();
m_title.setText(text);
m_title.setVisible(true);
} | java | protected void onEditTitleTextBox(TextBox box) {
if (m_titleEditHandler != null) {
m_titleEditHandler.handleEdit(m_title, box);
return;
}
String text = box.getText();
box.removeFromParent();
m_title.setText(text);
m_title.setVisible(true);
} | [
"protected",
"void",
"onEditTitleTextBox",
"(",
"TextBox",
"box",
")",
"{",
"if",
"(",
"m_titleEditHandler",
"!=",
"null",
")",
"{",
"m_titleEditHandler",
".",
"handleEdit",
"(",
"m_title",
",",
"box",
")",
";",
"return",
";",
"}",
"String",
"text",
"=",
"... | Internal method which is called when the user has finished editing the title.
@param box the text box which has been edited | [
"Internal",
"method",
"which",
"is",
"called",
"when",
"the",
"user",
"has",
"finished",
"editing",
"the",
"title",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java#L1163-L1175 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java | CmsPatternPanelMonthlyController.setPatternScheme | public void setPatternScheme(final boolean isByWeekDay, final boolean fireChange) {
if (isByWeekDay ^ (null != m_model.getWeekDay())) {
removeExceptionsOnChange(new Command() {
public void execute() {
if (isByWeekDay) {
m_model.setWeekOfMonth(getPatternDefaultValues().getWeekOfMonth());
m_model.setWeekDay(getPatternDefaultValues().getWeekDay());
} else {
m_model.clearWeekDays();
m_model.clearWeeksOfMonth();
m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());
}
m_model.setInterval(getPatternDefaultValues().getInterval());
if (fireChange) {
onValueChange();
}
}
});
}
} | java | public void setPatternScheme(final boolean isByWeekDay, final boolean fireChange) {
if (isByWeekDay ^ (null != m_model.getWeekDay())) {
removeExceptionsOnChange(new Command() {
public void execute() {
if (isByWeekDay) {
m_model.setWeekOfMonth(getPatternDefaultValues().getWeekOfMonth());
m_model.setWeekDay(getPatternDefaultValues().getWeekDay());
} else {
m_model.clearWeekDays();
m_model.clearWeeksOfMonth();
m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());
}
m_model.setInterval(getPatternDefaultValues().getInterval());
if (fireChange) {
onValueChange();
}
}
});
}
} | [
"public",
"void",
"setPatternScheme",
"(",
"final",
"boolean",
"isByWeekDay",
",",
"final",
"boolean",
"fireChange",
")",
"{",
"if",
"(",
"isByWeekDay",
"^",
"(",
"null",
"!=",
"m_model",
".",
"getWeekDay",
"(",
")",
")",
")",
"{",
"removeExceptionsOnChange",
... | Set the pattern scheme to either "by weekday" or "by day of month".
@param isByWeekDay flag, indicating if the pattern "by weekday" should be set.
@param fireChange flag, indicating if a value change event should be fired. | [
"Set",
"the",
"pattern",
"scheme",
"to",
"either",
"by",
"weekday",
"or",
"by",
"day",
"of",
"month",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java#L65-L88 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java | CmsPatternPanelMonthlyController.setWeekDay | public void setWeekDay(String dayString) {
final WeekDay day = WeekDay.valueOf(dayString);
if (m_model.getWeekDay() != day) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekDay(day);
onValueChange();
}
});
}
} | java | public void setWeekDay(String dayString) {
final WeekDay day = WeekDay.valueOf(dayString);
if (m_model.getWeekDay() != day) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekDay(day);
onValueChange();
}
});
}
} | [
"public",
"void",
"setWeekDay",
"(",
"String",
"dayString",
")",
"{",
"final",
"WeekDay",
"day",
"=",
"WeekDay",
".",
"valueOf",
"(",
"dayString",
")",
";",
"if",
"(",
"m_model",
".",
"getWeekDay",
"(",
")",
"!=",
"day",
")",
"{",
"removeExceptionsOnChange... | Set the week day the event should take place.
@param dayString the day as string. | [
"Set",
"the",
"week",
"day",
"the",
"event",
"should",
"take",
"place",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java#L94-L108 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java | CmsPatternPanelMonthlyController.weeksChange | public void weeksChange(String week, Boolean value) {
final WeekOfMonth changedWeek = WeekOfMonth.valueOf(week);
boolean newValue = (null != value) && value.booleanValue();
boolean currentValue = m_model.getWeeksOfMonth().contains(changedWeek);
if (newValue != currentValue) {
if (newValue) {
setPatternScheme(true, false);
m_model.addWeekOfMonth(changedWeek);
onValueChange();
} else {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.removeWeekOfMonth(changedWeek);
onValueChange();
}
});
}
}
} | java | public void weeksChange(String week, Boolean value) {
final WeekOfMonth changedWeek = WeekOfMonth.valueOf(week);
boolean newValue = (null != value) && value.booleanValue();
boolean currentValue = m_model.getWeeksOfMonth().contains(changedWeek);
if (newValue != currentValue) {
if (newValue) {
setPatternScheme(true, false);
m_model.addWeekOfMonth(changedWeek);
onValueChange();
} else {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.removeWeekOfMonth(changedWeek);
onValueChange();
}
});
}
}
} | [
"public",
"void",
"weeksChange",
"(",
"String",
"week",
",",
"Boolean",
"value",
")",
"{",
"final",
"WeekOfMonth",
"changedWeek",
"=",
"WeekOfMonth",
".",
"valueOf",
"(",
"week",
")",
";",
"boolean",
"newValue",
"=",
"(",
"null",
"!=",
"value",
")",
"&&",
... | Handle a change in the weeks of month.
@param week the changed weeks checkbox's internal value.
@param value the new value of the changed checkbox. | [
"Handle",
"a",
"change",
"in",
"the",
"weeks",
"of",
"month",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyController.java#L115-L136 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java | CmsAliasList.validateAliases | public void validateAliases(
final CmsUUID uuid,
final Map<String, String> aliasPaths,
final AsyncCallback<Map<String, String>> callback) {
CmsRpcAction<Map<String, String>> action = new CmsRpcAction<Map<String, String>>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(200, true);
CmsCoreProvider.getVfsService().validateAliases(uuid, aliasPaths, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(Map<String, String> result) {
stop(false);
callback.onSuccess(result);
}
};
action.execute();
} | java | public void validateAliases(
final CmsUUID uuid,
final Map<String, String> aliasPaths,
final AsyncCallback<Map<String, String>> callback) {
CmsRpcAction<Map<String, String>> action = new CmsRpcAction<Map<String, String>>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(200, true);
CmsCoreProvider.getVfsService().validateAliases(uuid, aliasPaths, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(Map<String, String> result) {
stop(false);
callback.onSuccess(result);
}
};
action.execute();
} | [
"public",
"void",
"validateAliases",
"(",
"final",
"CmsUUID",
"uuid",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"aliasPaths",
",",
"final",
"AsyncCallback",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"callback",
")",
"{",
"CmsRpcActi... | Validates aliases.
@param uuid The structure id for which the aliases should be valid
@param aliasPaths a map from id strings to alias paths
@param callback the callback which should be called with the validation results | [
"Validates",
"aliases",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java#L423-L452 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/A_CmsPatternPanelController.java | A_CmsPatternPanelController.setDayOfMonth | void setDayOfMonth(String day) {
final int i = CmsSerialDateUtil.toIntWithDefault(day, -1);
if (m_model.getDayOfMonth() != i) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setDayOfMonth(i);
onValueChange();
}
});
}
} | java | void setDayOfMonth(String day) {
final int i = CmsSerialDateUtil.toIntWithDefault(day, -1);
if (m_model.getDayOfMonth() != i) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setDayOfMonth(i);
onValueChange();
}
});
}
} | [
"void",
"setDayOfMonth",
"(",
"String",
"day",
")",
"{",
"final",
"int",
"i",
"=",
"CmsSerialDateUtil",
".",
"toIntWithDefault",
"(",
"day",
",",
"-",
"1",
")",
";",
"if",
"(",
"m_model",
".",
"getDayOfMonth",
"(",
")",
"!=",
"i",
")",
"{",
"removeExce... | Sets the day of the month.
@param day the day to set. | [
"Sets",
"the",
"day",
"of",
"the",
"month",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/A_CmsPatternPanelController.java#L99-L112 | train |
alkacon/opencms-core | src/org/opencms/ui/report/CmsStreamReportWidget.java | CmsStreamReportWidget.convertOutputToHtml | private String convertOutputToHtml(String content) {
if (content.length() == 0) {
return "";
}
StringBuilder buffer = new StringBuilder();
for (String line : content.split("\n")) {
buffer.append(CmsEncoder.escapeXml(line) + "<br>");
}
return buffer.toString();
} | java | private String convertOutputToHtml(String content) {
if (content.length() == 0) {
return "";
}
StringBuilder buffer = new StringBuilder();
for (String line : content.split("\n")) {
buffer.append(CmsEncoder.escapeXml(line) + "<br>");
}
return buffer.toString();
} | [
"private",
"String",
"convertOutputToHtml",
"(",
"String",
"content",
")",
"{",
"if",
"(",
"content",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
... | Converts the text stream data to HTML form.
@param content the content to convert
@return the HTML version of the content | [
"Converts",
"the",
"text",
"stream",
"data",
"to",
"HTML",
"form",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/report/CmsStreamReportWidget.java#L166-L176 | train |
alkacon/opencms-core | src/org/opencms/ui/report/CmsStreamReportWidget.java | CmsStreamReportWidget.writeToDelegate | private void writeToDelegate(byte[] data) {
if (m_delegateStream != null) {
try {
m_delegateStream.write(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} | java | private void writeToDelegate(byte[] data) {
if (m_delegateStream != null) {
try {
m_delegateStream.write(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} | [
"private",
"void",
"writeToDelegate",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"m_delegateStream",
"!=",
"null",
")",
"{",
"try",
"{",
"m_delegateStream",
".",
"write",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
... | Writes data to delegate stream if it has been set.
@param data the data to write | [
"Writes",
"data",
"to",
"delegate",
"stream",
"if",
"it",
"has",
"been",
"set",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/report/CmsStreamReportWidget.java#L183-L192 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java | CmsUserInfoDialog.getStatusForItem | public static String getStatusForItem(Long lastActivity) {
if (lastActivity.longValue() < CmsSessionsTable.INACTIVE_LIMIT) {
return CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_COLS_STATUS_ACTIVE_0);
}
return CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_COLS_STATUS_INACTIVE_0);
} | java | public static String getStatusForItem(Long lastActivity) {
if (lastActivity.longValue() < CmsSessionsTable.INACTIVE_LIMIT) {
return CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_COLS_STATUS_ACTIVE_0);
}
return CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_BROADCAST_COLS_STATUS_INACTIVE_0);
} | [
"public",
"static",
"String",
"getStatusForItem",
"(",
"Long",
"lastActivity",
")",
"{",
"if",
"(",
"lastActivity",
".",
"longValue",
"(",
")",
"<",
"CmsSessionsTable",
".",
"INACTIVE_LIMIT",
")",
"{",
"return",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Mes... | Gets the status text from given session.
@param lastActivity miliseconds since last activity
@return status string | [
"Gets",
"the",
"status",
"text",
"from",
"given",
"session",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java#L136-L142 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java | CmsUserInfoDialog.showUserInfo | public static void showUserInfo(CmsSessionInfo session) {
final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
CmsUserInfoDialog dialog = new CmsUserInfoDialog(session, new Runnable() {
public void run() {
window.close();
}
});
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_SHOW_USER_0));
window.setContent(dialog);
A_CmsUI.get().addWindow(window);
} | java | public static void showUserInfo(CmsSessionInfo session) {
final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
CmsUserInfoDialog dialog = new CmsUserInfoDialog(session, new Runnable() {
public void run() {
window.close();
}
});
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_SHOW_USER_0));
window.setContent(dialog);
A_CmsUI.get().addWindow(window);
} | [
"public",
"static",
"void",
"showUserInfo",
"(",
"CmsSessionInfo",
"session",
")",
"{",
"final",
"Window",
"window",
"=",
"CmsBasicDialog",
".",
"prepareWindow",
"(",
"DialogWidth",
".",
"wide",
")",
";",
"CmsUserInfoDialog",
"dialog",
"=",
"new",
"CmsUserInfoDial... | Shows a dialog with user information for given session.
@param session to show information for | [
"Shows",
"a",
"dialog",
"with",
"user",
"information",
"for",
"given",
"session",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java#L163-L177 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsSliderMap.java | CmsSliderMap.onBrowserEvent | @Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEUP:
Event.releaseCapture(m_slider.getElement());
m_capturedMouse = false;
break;
case Event.ONMOUSEDOWN:
Event.setCapture(m_slider.getElement());
m_capturedMouse = true;
//$FALL-THROUGH$
case Event.ONMOUSEMOVE:
if (m_capturedMouse) {
event.preventDefault();
float x = ((event.getClientX() - (m_colorUnderlay.getAbsoluteLeft())) + Window.getScrollLeft());
float y = ((event.getClientY() - (m_colorUnderlay.getAbsoluteTop())) + Window.getScrollTop());
if (m_parent != null) {
m_parent.onMapSelected(x, y);
}
setSliderPosition(x, y);
}
//$FALL-THROUGH$
default:
}
} | java | @Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEUP:
Event.releaseCapture(m_slider.getElement());
m_capturedMouse = false;
break;
case Event.ONMOUSEDOWN:
Event.setCapture(m_slider.getElement());
m_capturedMouse = true;
//$FALL-THROUGH$
case Event.ONMOUSEMOVE:
if (m_capturedMouse) {
event.preventDefault();
float x = ((event.getClientX() - (m_colorUnderlay.getAbsoluteLeft())) + Window.getScrollLeft());
float y = ((event.getClientY() - (m_colorUnderlay.getAbsoluteTop())) + Window.getScrollTop());
if (m_parent != null) {
m_parent.onMapSelected(x, y);
}
setSliderPosition(x, y);
}
//$FALL-THROUGH$
default:
}
} | [
"@",
"Override",
"public",
"void",
"onBrowserEvent",
"(",
"Event",
"event",
")",
"{",
"super",
".",
"onBrowserEvent",
"(",
"event",
")",
";",
"switch",
"(",
"DOM",
".",
"eventGetType",
"(",
"event",
")",
")",
"{",
"case",
"Event",
".",
"ONMOUSEUP",
":",
... | Fired whenever a browser event is received.
@param event Event to process | [
"Fired",
"whenever",
"a",
"browser",
"event",
"is",
"received",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsSliderMap.java#L108-L138 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsOuTree.java | CmsOuTree.addChildrenForGroupsNode | private void addChildrenForGroupsNode(I_CmsOuTreeType type, String ouItem) {
try {
// Cut of type-specific prefix from ouItem with substring()
List<CmsGroup> groups = m_app.readGroupsForOu(m_cms, ouItem.substring(1), type, false);
for (CmsGroup group : groups) {
Pair<String, CmsUUID> key = Pair.of(type.getId(), group.getId());
Item groupItem = m_treeContainer.addItem(key);
if (groupItem == null) {
groupItem = getItem(key);
}
groupItem.getItemProperty(PROP_SID).setValue(group.getId());
groupItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(group, CmsOuTreeType.GROUP));
groupItem.getItemProperty(PROP_TYPE).setValue(type);
setChildrenAllowed(key, false);
m_treeContainer.setParent(key, ouItem);
}
} catch (CmsException e) {
LOG.error("Can not read group", e);
}
} | java | private void addChildrenForGroupsNode(I_CmsOuTreeType type, String ouItem) {
try {
// Cut of type-specific prefix from ouItem with substring()
List<CmsGroup> groups = m_app.readGroupsForOu(m_cms, ouItem.substring(1), type, false);
for (CmsGroup group : groups) {
Pair<String, CmsUUID> key = Pair.of(type.getId(), group.getId());
Item groupItem = m_treeContainer.addItem(key);
if (groupItem == null) {
groupItem = getItem(key);
}
groupItem.getItemProperty(PROP_SID).setValue(group.getId());
groupItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(group, CmsOuTreeType.GROUP));
groupItem.getItemProperty(PROP_TYPE).setValue(type);
setChildrenAllowed(key, false);
m_treeContainer.setParent(key, ouItem);
}
} catch (CmsException e) {
LOG.error("Can not read group", e);
}
} | [
"private",
"void",
"addChildrenForGroupsNode",
"(",
"I_CmsOuTreeType",
"type",
",",
"String",
"ouItem",
")",
"{",
"try",
"{",
"// Cut of type-specific prefix from ouItem with substring()",
"List",
"<",
"CmsGroup",
">",
"groups",
"=",
"m_app",
".",
"readGroupsForOu",
"("... | Add groups for given group parent item.
@param type the tree type
@param ouItem group parent item | [
"Add",
"groups",
"for",
"given",
"group",
"parent",
"item",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsOuTree.java#L257-L277 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsOuTree.java | CmsOuTree.addChildrenForRolesNode | private void addChildrenForRolesNode(String ouItem) {
try {
List<CmsRole> roles = OpenCms.getRoleManager().getRoles(m_cms, ouItem.substring(1), false);
CmsRole.applySystemRoleOrder(roles);
for (CmsRole role : roles) {
String roleId = ouItem + "/" + role.getId();
Item roleItem = m_treeContainer.addItem(roleId);
if (roleItem == null) {
roleItem = getItem(roleId);
}
roleItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(role, CmsOuTreeType.ROLE));
roleItem.getItemProperty(PROP_TYPE).setValue(CmsOuTreeType.ROLE);
setChildrenAllowed(roleId, false);
m_treeContainer.setParent(roleId, ouItem);
}
} catch (CmsException e) {
LOG.error("Can not read group", e);
}
} | java | private void addChildrenForRolesNode(String ouItem) {
try {
List<CmsRole> roles = OpenCms.getRoleManager().getRoles(m_cms, ouItem.substring(1), false);
CmsRole.applySystemRoleOrder(roles);
for (CmsRole role : roles) {
String roleId = ouItem + "/" + role.getId();
Item roleItem = m_treeContainer.addItem(roleId);
if (roleItem == null) {
roleItem = getItem(roleId);
}
roleItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(role, CmsOuTreeType.ROLE));
roleItem.getItemProperty(PROP_TYPE).setValue(CmsOuTreeType.ROLE);
setChildrenAllowed(roleId, false);
m_treeContainer.setParent(roleId, ouItem);
}
} catch (CmsException e) {
LOG.error("Can not read group", e);
}
} | [
"private",
"void",
"addChildrenForRolesNode",
"(",
"String",
"ouItem",
")",
"{",
"try",
"{",
"List",
"<",
"CmsRole",
">",
"roles",
"=",
"OpenCms",
".",
"getRoleManager",
"(",
")",
".",
"getRoles",
"(",
"m_cms",
",",
"ouItem",
".",
"substring",
"(",
"1",
... | Add roles for given role parent item.
@param ouItem group parent item | [
"Add",
"roles",
"for",
"given",
"role",
"parent",
"item",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsOuTree.java#L349-L368 | train |
alkacon/opencms-core | src/org/opencms/xml/templatemapper/CmsTemplateMappingContentRewriter.java | CmsTemplateMappingContentRewriter.checkConfiguredInModules | public static boolean checkConfiguredInModules() {
Boolean result = m_moduleCheckCache.get();
if (result == null) {
result = Boolean.valueOf(getConfiguredTemplateMapping() != null);
m_moduleCheckCache.set(result);
}
return result.booleanValue();
} | java | public static boolean checkConfiguredInModules() {
Boolean result = m_moduleCheckCache.get();
if (result == null) {
result = Boolean.valueOf(getConfiguredTemplateMapping() != null);
m_moduleCheckCache.set(result);
}
return result.booleanValue();
} | [
"public",
"static",
"boolean",
"checkConfiguredInModules",
"(",
")",
"{",
"Boolean",
"result",
"=",
"m_moduleCheckCache",
".",
"get",
"(",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"Boolean",
".",
"valueOf",
"(",
"getConfiguredTem... | Checks if template mapper is configured in modules.
@return true if the template mapper is configured in modules | [
"Checks",
"if",
"template",
"mapper",
"is",
"configured",
"in",
"modules",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/templatemapper/CmsTemplateMappingContentRewriter.java#L99-L107 | train |
alkacon/opencms-core | src/org/opencms/ui/components/extensions/CmsScrollPositionCss.java | CmsScrollPositionCss.addTo | @SuppressWarnings("unused")
public static void addTo(
AbstractSingleComponentContainer componentContainer,
int scrollBarrier,
int barrierMargin,
String styleName) {
new CmsScrollPositionCss(componentContainer, scrollBarrier, barrierMargin, styleName);
} | java | @SuppressWarnings("unused")
public static void addTo(
AbstractSingleComponentContainer componentContainer,
int scrollBarrier,
int barrierMargin,
String styleName) {
new CmsScrollPositionCss(componentContainer, scrollBarrier, barrierMargin, styleName);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"static",
"void",
"addTo",
"(",
"AbstractSingleComponentContainer",
"componentContainer",
",",
"int",
"scrollBarrier",
",",
"int",
"barrierMargin",
",",
"String",
"styleName",
")",
"{",
"new",
"CmsScrollPositi... | Adds the scroll position CSS extension to the given component
@param componentContainer the component to extend
@param scrollBarrier the scroll barrier
@param barrierMargin the margin
@param styleName the style name to set beyond the scroll barrier | [
"Adds",
"the",
"scroll",
"position",
"CSS",
"extension",
"to",
"the",
"given",
"component"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/extensions/CmsScrollPositionCss.java#L71-L79 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/CmsColorPicker.java | CmsColorPicker.checkvalue | protected boolean checkvalue(String colorvalue) {
boolean valid = validateColorValue(colorvalue);
if (valid) {
if (colorvalue.length() == 4) {
char[] chr = colorvalue.toCharArray();
for (int i = 1; i < 4; i++) {
String foo = String.valueOf(chr[i]);
colorvalue = colorvalue.replaceFirst(foo, foo + foo);
}
}
m_textboxColorValue.setValue(colorvalue, true);
m_colorField.getElement().getStyle().setBackgroundColor(colorvalue);
m_colorValue = colorvalue;
}
return valid;
} | java | protected boolean checkvalue(String colorvalue) {
boolean valid = validateColorValue(colorvalue);
if (valid) {
if (colorvalue.length() == 4) {
char[] chr = colorvalue.toCharArray();
for (int i = 1; i < 4; i++) {
String foo = String.valueOf(chr[i]);
colorvalue = colorvalue.replaceFirst(foo, foo + foo);
}
}
m_textboxColorValue.setValue(colorvalue, true);
m_colorField.getElement().getStyle().setBackgroundColor(colorvalue);
m_colorValue = colorvalue;
}
return valid;
} | [
"protected",
"boolean",
"checkvalue",
"(",
"String",
"colorvalue",
")",
"{",
"boolean",
"valid",
"=",
"validateColorValue",
"(",
"colorvalue",
")",
";",
"if",
"(",
"valid",
")",
"{",
"if",
"(",
"colorvalue",
".",
"length",
"(",
")",
"==",
"4",
")",
"{",
... | Validates the inputed color value.
@param colorvalue the value of the color
@return true if the inputed color value is valid | [
"Validates",
"the",
"inputed",
"color",
"value",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/CmsColorPicker.java#L370-L386 | train |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisResourceHelper.java | CmsCmisResourceHelper.collectAllowableActions | protected AllowableActions collectAllowableActions(CmsObject cms, CmsResource file) {
try {
if (file == null) {
throw new IllegalArgumentException("File must not be null!");
}
CmsLock lock = cms.getLock(file);
CmsUser user = cms.getRequestContext().getCurrentUser();
boolean canWrite = !cms.getRequestContext().getCurrentProject().isOnlineProject()
&& (lock.isOwnedBy(user) || lock.isLockableBy(user))
&& cms.hasPermissions(file, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.DEFAULT);
boolean isReadOnly = !canWrite;
boolean isFolder = file.isFolder();
boolean isRoot = file.getRootPath().length() <= 1;
Set<Action> aas = new LinkedHashSet<Action>();
addAction(aas, Action.CAN_GET_OBJECT_PARENTS, !isRoot);
addAction(aas, Action.CAN_GET_PROPERTIES, true);
addAction(aas, Action.CAN_UPDATE_PROPERTIES, !isReadOnly);
addAction(aas, Action.CAN_MOVE_OBJECT, !isReadOnly && !isRoot);
addAction(aas, Action.CAN_DELETE_OBJECT, !isReadOnly && !isRoot);
if (isFolder) {
addAction(aas, Action.CAN_GET_DESCENDANTS, true);
addAction(aas, Action.CAN_GET_CHILDREN, true);
addAction(aas, Action.CAN_GET_FOLDER_PARENT, !isRoot);
addAction(aas, Action.CAN_GET_FOLDER_TREE, true);
addAction(aas, Action.CAN_CREATE_DOCUMENT, !isReadOnly);
addAction(aas, Action.CAN_CREATE_FOLDER, !isReadOnly);
addAction(aas, Action.CAN_DELETE_TREE, !isReadOnly);
} else {
addAction(aas, Action.CAN_GET_CONTENT_STREAM, true);
addAction(aas, Action.CAN_SET_CONTENT_STREAM, !isReadOnly);
addAction(aas, Action.CAN_GET_ALL_VERSIONS, true);
}
AllowableActionsImpl result = new AllowableActionsImpl();
result.setAllowableActions(aas);
return result;
} catch (CmsException e) {
handleCmsException(e);
return null;
}
} | java | protected AllowableActions collectAllowableActions(CmsObject cms, CmsResource file) {
try {
if (file == null) {
throw new IllegalArgumentException("File must not be null!");
}
CmsLock lock = cms.getLock(file);
CmsUser user = cms.getRequestContext().getCurrentUser();
boolean canWrite = !cms.getRequestContext().getCurrentProject().isOnlineProject()
&& (lock.isOwnedBy(user) || lock.isLockableBy(user))
&& cms.hasPermissions(file, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.DEFAULT);
boolean isReadOnly = !canWrite;
boolean isFolder = file.isFolder();
boolean isRoot = file.getRootPath().length() <= 1;
Set<Action> aas = new LinkedHashSet<Action>();
addAction(aas, Action.CAN_GET_OBJECT_PARENTS, !isRoot);
addAction(aas, Action.CAN_GET_PROPERTIES, true);
addAction(aas, Action.CAN_UPDATE_PROPERTIES, !isReadOnly);
addAction(aas, Action.CAN_MOVE_OBJECT, !isReadOnly && !isRoot);
addAction(aas, Action.CAN_DELETE_OBJECT, !isReadOnly && !isRoot);
if (isFolder) {
addAction(aas, Action.CAN_GET_DESCENDANTS, true);
addAction(aas, Action.CAN_GET_CHILDREN, true);
addAction(aas, Action.CAN_GET_FOLDER_PARENT, !isRoot);
addAction(aas, Action.CAN_GET_FOLDER_TREE, true);
addAction(aas, Action.CAN_CREATE_DOCUMENT, !isReadOnly);
addAction(aas, Action.CAN_CREATE_FOLDER, !isReadOnly);
addAction(aas, Action.CAN_DELETE_TREE, !isReadOnly);
} else {
addAction(aas, Action.CAN_GET_CONTENT_STREAM, true);
addAction(aas, Action.CAN_SET_CONTENT_STREAM, !isReadOnly);
addAction(aas, Action.CAN_GET_ALL_VERSIONS, true);
}
AllowableActionsImpl result = new AllowableActionsImpl();
result.setAllowableActions(aas);
return result;
} catch (CmsException e) {
handleCmsException(e);
return null;
}
} | [
"protected",
"AllowableActions",
"collectAllowableActions",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"file",
")",
"{",
"try",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"File must not be null!\"",
")",
";... | Compiles the allowable actions for a file or folder.
@param cms the current CMS context
@param file the resource for which we want the allowable actions
@return the allowable actions for the given resource | [
"Compiles",
"the",
"allowable",
"actions",
"for",
"a",
"file",
"or",
"folder",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisResourceHelper.java#L276-L318 | train |
alkacon/opencms-core | src/org/opencms/webdav/CmsWebdavStatus.java | CmsWebdavStatus.getStatusText | public static String getStatusText(int nHttpStatusCode) {
Integer intKey = new Integer(nHttpStatusCode);
if (!mapStatusCodes.containsKey(intKey)) {
return "";
} else {
return mapStatusCodes.get(intKey);
}
} | java | public static String getStatusText(int nHttpStatusCode) {
Integer intKey = new Integer(nHttpStatusCode);
if (!mapStatusCodes.containsKey(intKey)) {
return "";
} else {
return mapStatusCodes.get(intKey);
}
} | [
"public",
"static",
"String",
"getStatusText",
"(",
"int",
"nHttpStatusCode",
")",
"{",
"Integer",
"intKey",
"=",
"new",
"Integer",
"(",
"nHttpStatusCode",
")",
";",
"if",
"(",
"!",
"mapStatusCodes",
".",
"containsKey",
"(",
"intKey",
")",
")",
"{",
"return"... | Returns the HTTP status text for the HTTP or WebDav status code
specified by looking it up in the static mapping. This is a
static function.
@param nHttpStatusCode [IN] HTTP or WebDAV status code
@return A string with a short descriptive phrase for the
HTTP status code (e.g., "OK"). | [
"Returns",
"the",
"HTTP",
"status",
"text",
"for",
"the",
"HTTP",
"or",
"WebDav",
"status",
"code",
"specified",
"by",
"looking",
"it",
"up",
"in",
"the",
"static",
"mapping",
".",
"This",
"is",
"a",
"static",
"function",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/webdav/CmsWebdavStatus.java#L292-L301 | train |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisTypeManager.java | CmsCmisTypeManager.addType | private boolean addType(TypeDefinition type) {
if (type == null) {
return false;
}
if (type.getBaseTypeId() == null) {
return false;
}
// find base type
TypeDefinition baseType = null;
if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
baseType = copyTypeDefintion(m_types.get(DOCUMENT_TYPE_ID).getTypeDefinition());
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
baseType = copyTypeDefintion(m_types.get(FOLDER_TYPE_ID).getTypeDefinition());
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
baseType = copyTypeDefintion(m_types.get(RELATIONSHIP_TYPE_ID).getTypeDefinition());
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
baseType = copyTypeDefintion(m_types.get(POLICY_TYPE_ID).getTypeDefinition());
} else {
return false;
}
AbstractTypeDefinition newType = (AbstractTypeDefinition)copyTypeDefintion(type);
// copy property definition
for (PropertyDefinition<?> propDef : baseType.getPropertyDefinitions().values()) {
((AbstractPropertyDefinition<?>)propDef).setIsInherited(Boolean.TRUE);
newType.addPropertyDefinition(propDef);
}
// add it
addTypeInternal(newType);
return true;
} | java | private boolean addType(TypeDefinition type) {
if (type == null) {
return false;
}
if (type.getBaseTypeId() == null) {
return false;
}
// find base type
TypeDefinition baseType = null;
if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
baseType = copyTypeDefintion(m_types.get(DOCUMENT_TYPE_ID).getTypeDefinition());
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
baseType = copyTypeDefintion(m_types.get(FOLDER_TYPE_ID).getTypeDefinition());
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
baseType = copyTypeDefintion(m_types.get(RELATIONSHIP_TYPE_ID).getTypeDefinition());
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
baseType = copyTypeDefintion(m_types.get(POLICY_TYPE_ID).getTypeDefinition());
} else {
return false;
}
AbstractTypeDefinition newType = (AbstractTypeDefinition)copyTypeDefintion(type);
// copy property definition
for (PropertyDefinition<?> propDef : baseType.getPropertyDefinitions().values()) {
((AbstractPropertyDefinition<?>)propDef).setIsInherited(Boolean.TRUE);
newType.addPropertyDefinition(propDef);
}
// add it
addTypeInternal(newType);
return true;
} | [
"private",
"boolean",
"addType",
"(",
"TypeDefinition",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"type",
".",
"getBaseTypeId",
"(",
")",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
... | Adds a type to collection with inheriting base type properties.
@param type the type definition to add
@return true if the type definition was added | [
"Adds",
"a",
"type",
"to",
"collection",
"with",
"inheriting",
"base",
"type",
"properties",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisTypeManager.java#L948-L983 | train |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsSecure.java | CmsSecure.buildRadio | public String buildRadio(String propName) throws CmsException {
String propVal = readProperty(propName);
StringBuffer result = new StringBuffer("<table border=\"0\"><tr>");
result.append("<td><input type=\"radio\" value=\"true\" onClick=\"checkNoIntern()\" name=\"").append(
propName).append("\" ").append(Boolean.valueOf(propVal).booleanValue() ? "checked=\"checked\"" : "").append(
"/></td><td id=\"tablelabel\">").append(key(Messages.GUI_LABEL_TRUE_0)).append("</td>");
result.append("<td><input type=\"radio\" value=\"false\" onClick=\"checkNoIntern()\" name=\"").append(
propName).append("\" ").append(Boolean.valueOf(propVal).booleanValue() ? "" : "checked=\"checked\"").append(
"/></td><td id=\"tablelabel\">").append(key(Messages.GUI_LABEL_FALSE_0)).append("</td>");
result.append("<td><input type=\"radio\" value=\"\" onClick=\"checkNoIntern()\" name=\"").append(
propName).append("\" ").append(CmsStringUtil.isEmpty(propVal) ? "checked=\"checked\"" : "").append(
"/></td><td id=\"tablelabel\">").append(getPropertyInheritanceInfo(propName)).append(
"</td></tr></table>");
return result.toString();
} | java | public String buildRadio(String propName) throws CmsException {
String propVal = readProperty(propName);
StringBuffer result = new StringBuffer("<table border=\"0\"><tr>");
result.append("<td><input type=\"radio\" value=\"true\" onClick=\"checkNoIntern()\" name=\"").append(
propName).append("\" ").append(Boolean.valueOf(propVal).booleanValue() ? "checked=\"checked\"" : "").append(
"/></td><td id=\"tablelabel\">").append(key(Messages.GUI_LABEL_TRUE_0)).append("</td>");
result.append("<td><input type=\"radio\" value=\"false\" onClick=\"checkNoIntern()\" name=\"").append(
propName).append("\" ").append(Boolean.valueOf(propVal).booleanValue() ? "" : "checked=\"checked\"").append(
"/></td><td id=\"tablelabel\">").append(key(Messages.GUI_LABEL_FALSE_0)).append("</td>");
result.append("<td><input type=\"radio\" value=\"\" onClick=\"checkNoIntern()\" name=\"").append(
propName).append("\" ").append(CmsStringUtil.isEmpty(propVal) ? "checked=\"checked\"" : "").append(
"/></td><td id=\"tablelabel\">").append(getPropertyInheritanceInfo(propName)).append(
"</td></tr></table>");
return result.toString();
} | [
"public",
"String",
"buildRadio",
"(",
"String",
"propName",
")",
"throws",
"CmsException",
"{",
"String",
"propVal",
"=",
"readProperty",
"(",
"propName",
")",
";",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"\"<table border=\\\"0\\\"><tr>\"",
")",
... | Builds the radio input to set the export and secure property.
@param propName the name of the property to build the radio input for
@return html for the radio input
@throws CmsException if the reading of a property fails | [
"Builds",
"the",
"radio",
"input",
"to",
"set",
"the",
"export",
"and",
"secure",
"property",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsSecure.java#L153-L168 | train |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceManager.java | CmsWorkplaceManager.setCategoryDisplayOptions | public void setCategoryDisplayOptions(
String displayCategoriesByRepository,
String displayCategorySelectionCollapsed) {
m_displayCategoriesByRepository = Boolean.parseBoolean(displayCategoriesByRepository);
m_displayCategorySelectionCollapsed = Boolean.parseBoolean(displayCategorySelectionCollapsed);
} | java | public void setCategoryDisplayOptions(
String displayCategoriesByRepository,
String displayCategorySelectionCollapsed) {
m_displayCategoriesByRepository = Boolean.parseBoolean(displayCategoriesByRepository);
m_displayCategorySelectionCollapsed = Boolean.parseBoolean(displayCategorySelectionCollapsed);
} | [
"public",
"void",
"setCategoryDisplayOptions",
"(",
"String",
"displayCategoriesByRepository",
",",
"String",
"displayCategorySelectionCollapsed",
")",
"{",
"m_displayCategoriesByRepository",
"=",
"Boolean",
".",
"parseBoolean",
"(",
"displayCategoriesByRepository",
")",
";",
... | Sets the category display options that affect how the category selection dialog is shown.
@param displayCategoriesByRepository if true, the categories are shown separated by repository.
@param displayCategorySelectionCollapsed if true, the selection dialog opens showing only the top-level categories
(or the various repositories) in collapsed state. | [
"Sets",
"the",
"category",
"display",
"options",
"that",
"affect",
"how",
"the",
"category",
"selection",
"dialog",
"is",
"shown",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceManager.java#L1857-L1863 | train |
alkacon/opencms-core | src/org/opencms/widgets/serialdate/A_CmsSerialDateBean.java | A_CmsSerialDateBean.showMoreEntries | protected boolean showMoreEntries(Calendar nextDate, int previousOccurrences) {
switch (getSerialEndType()) {
case DATE:
boolean moreByDate = nextDate.getTimeInMillis() < m_endMillis;
boolean moreByOccurrences = previousOccurrences < CmsSerialDateUtil.getMaxEvents();
if (moreByDate && !moreByOccurrences) {
m_hasTooManyOccurrences = Boolean.TRUE;
}
return moreByDate && moreByOccurrences;
case TIMES:
case SINGLE:
return previousOccurrences < getOccurrences();
default:
throw new IllegalArgumentException();
}
} | java | protected boolean showMoreEntries(Calendar nextDate, int previousOccurrences) {
switch (getSerialEndType()) {
case DATE:
boolean moreByDate = nextDate.getTimeInMillis() < m_endMillis;
boolean moreByOccurrences = previousOccurrences < CmsSerialDateUtil.getMaxEvents();
if (moreByDate && !moreByOccurrences) {
m_hasTooManyOccurrences = Boolean.TRUE;
}
return moreByDate && moreByOccurrences;
case TIMES:
case SINGLE:
return previousOccurrences < getOccurrences();
default:
throw new IllegalArgumentException();
}
} | [
"protected",
"boolean",
"showMoreEntries",
"(",
"Calendar",
"nextDate",
",",
"int",
"previousOccurrences",
")",
"{",
"switch",
"(",
"getSerialEndType",
"(",
")",
")",
"{",
"case",
"DATE",
":",
"boolean",
"moreByDate",
"=",
"nextDate",
".",
"getTimeInMillis",
"("... | Check if the provided date or any date after it are part of the series.
@param nextDate the current date to check.
@param previousOccurrences the number of events of the series that took place before the date to check.
@return <code>true</code> if more dates (including the provided one) could be in the series, <code>false</code> otherwise. | [
"Check",
"if",
"the",
"provided",
"date",
"or",
"any",
"date",
"after",
"it",
"are",
"part",
"of",
"the",
"series",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/A_CmsSerialDateBean.java#L264-L280 | train |
alkacon/opencms-core | src/org/opencms/widgets/serialdate/A_CmsSerialDateBean.java | A_CmsSerialDateBean.calculateDates | private SortedSet<Date> calculateDates() {
if (null == m_allDates) {
SortedSet<Date> result = new TreeSet<>();
if (isAnyDatePossible()) {
Calendar date = getFirstDate();
int previousOccurrences = 0;
while (showMoreEntries(date, previousOccurrences)) {
result.add(date.getTime());
toNextDate(date);
previousOccurrences++;
}
}
m_allDates = result;
}
return m_allDates;
} | java | private SortedSet<Date> calculateDates() {
if (null == m_allDates) {
SortedSet<Date> result = new TreeSet<>();
if (isAnyDatePossible()) {
Calendar date = getFirstDate();
int previousOccurrences = 0;
while (showMoreEntries(date, previousOccurrences)) {
result.add(date.getTime());
toNextDate(date);
previousOccurrences++;
}
}
m_allDates = result;
}
return m_allDates;
} | [
"private",
"SortedSet",
"<",
"Date",
">",
"calculateDates",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"m_allDates",
")",
"{",
"SortedSet",
"<",
"Date",
">",
"result",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"if",
"(",
"isAnyDatePossible",
"(",
")",
... | Calculates all dates of the series.
@return all dates of the series in milliseconds. | [
"Calculates",
"all",
"dates",
"of",
"the",
"series",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/A_CmsSerialDateBean.java#L292-L308 | train |
alkacon/opencms-core | src/org/opencms/widgets/serialdate/A_CmsSerialDateBean.java | A_CmsSerialDateBean.filterExceptions | private SortedSet<Date> filterExceptions(SortedSet<Date> dates) {
SortedSet<Date> result = new TreeSet<Date>();
for (Date d : dates) {
if (!m_exceptions.contains(d)) {
result.add(d);
}
}
return result;
} | java | private SortedSet<Date> filterExceptions(SortedSet<Date> dates) {
SortedSet<Date> result = new TreeSet<Date>();
for (Date d : dates) {
if (!m_exceptions.contains(d)) {
result.add(d);
}
}
return result;
} | [
"private",
"SortedSet",
"<",
"Date",
">",
"filterExceptions",
"(",
"SortedSet",
"<",
"Date",
">",
"dates",
")",
"{",
"SortedSet",
"<",
"Date",
">",
"result",
"=",
"new",
"TreeSet",
"<",
"Date",
">",
"(",
")",
";",
"for",
"(",
"Date",
"d",
":",
"dates... | Filters all exceptions from the provided dates.
@param dates the dates to filter.
@return the provided dates, except the ones that match some exception. | [
"Filters",
"all",
"exceptions",
"from",
"the",
"provided",
"dates",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/A_CmsSerialDateBean.java#L315-L324 | train |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexResponse.java | CmsFlexResponse.setHeaderList | private void setHeaderList(Map<String, List<String>> headers, String name, String value) {
List<String> values = new ArrayList<String>();
values.add(SET_HEADER + value);
headers.put(name, values);
} | java | private void setHeaderList(Map<String, List<String>> headers, String name, String value) {
List<String> values = new ArrayList<String>();
values.add(SET_HEADER + value);
headers.put(name, values);
} | [
"private",
"void",
"setHeaderList",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
",",
"String",
"name",
",",
"String",
"value",
")",
"{",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String",
">",
... | Helper method to set a value in the internal header list.
@param headers the headers to set the value in
@param name the name to set
@param value the value to set | [
"Helper",
"method",
"to",
"set",
"a",
"value",
"in",
"the",
"internal",
"header",
"list",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexResponse.java#L1198-L1203 | train |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.changeFileNameSuffixTo | public static String changeFileNameSuffixTo(String filename, String suffix) {
int dotPos = filename.lastIndexOf('.');
if (dotPos != -1) {
return filename.substring(0, dotPos + 1) + suffix;
} else {
// the string has no suffix
return filename;
}
} | java | public static String changeFileNameSuffixTo(String filename, String suffix) {
int dotPos = filename.lastIndexOf('.');
if (dotPos != -1) {
return filename.substring(0, dotPos + 1) + suffix;
} else {
// the string has no suffix
return filename;
}
} | [
"public",
"static",
"String",
"changeFileNameSuffixTo",
"(",
"String",
"filename",
",",
"String",
"suffix",
")",
"{",
"int",
"dotPos",
"=",
"filename",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"dotPos",
"!=",
"-",
"1",
")",
"{",
"return",
... | Changes the given filenames suffix from the current suffix to the provided suffix.
<b>Directly exposed for JSP EL</b>, not through {@link org.opencms.jsp.util.CmsJspElFunctions}.<p>
@param filename the filename to be changed
@param suffix the new suffix of the file
@return the filename with the replaced suffix | [
"Changes",
"the",
"given",
"filenames",
"suffix",
"from",
"the",
"current",
"suffix",
"to",
"the",
"provided",
"suffix",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L249-L258 | train |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.parseDuration | public static final long parseDuration(String durationStr, long defaultValue) {
durationStr = durationStr.toLowerCase().trim();
Matcher matcher = DURATION_NUMBER_AND_UNIT_PATTERN.matcher(durationStr);
long millis = 0;
boolean matched = false;
while (matcher.find()) {
long number = Long.valueOf(matcher.group(1)).longValue();
String unit = matcher.group(2);
long multiplier = 0;
for (int j = 0; j < DURATION_UNTIS.length; j++) {
if (unit.equals(DURATION_UNTIS[j])) {
multiplier = DURATION_MULTIPLIERS[j];
break;
}
}
if (multiplier == 0) {
LOG.warn("parseDuration: Unknown unit " + unit);
} else {
matched = true;
}
millis += number * multiplier;
}
if (!matched) {
millis = defaultValue;
}
return millis;
} | java | public static final long parseDuration(String durationStr, long defaultValue) {
durationStr = durationStr.toLowerCase().trim();
Matcher matcher = DURATION_NUMBER_AND_UNIT_PATTERN.matcher(durationStr);
long millis = 0;
boolean matched = false;
while (matcher.find()) {
long number = Long.valueOf(matcher.group(1)).longValue();
String unit = matcher.group(2);
long multiplier = 0;
for (int j = 0; j < DURATION_UNTIS.length; j++) {
if (unit.equals(DURATION_UNTIS[j])) {
multiplier = DURATION_MULTIPLIERS[j];
break;
}
}
if (multiplier == 0) {
LOG.warn("parseDuration: Unknown unit " + unit);
} else {
matched = true;
}
millis += number * multiplier;
}
if (!matched) {
millis = defaultValue;
}
return millis;
} | [
"public",
"static",
"final",
"long",
"parseDuration",
"(",
"String",
"durationStr",
",",
"long",
"defaultValue",
")",
"{",
"durationStr",
"=",
"durationStr",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"Matcher",
"matcher",
"=",
"DURATION_NUMBER_... | Parses a duration and returns the corresponding number of milliseconds.
Durations consist of a space-separated list of components of the form {number}{time unit},
for example 1d 5m. The available units are d (days), h (hours), m (months), s (seconds), ms (milliseconds).<p>
@param durationStr the duration string
@param defaultValue the default value to return in case the pattern does not match
@return the corresponding number of milliseconds | [
"Parses",
"a",
"duration",
"and",
"returns",
"the",
"corresponding",
"number",
"of",
"milliseconds",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1366-L1393 | train |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.readStringTemplateGroup | public static StringTemplateGroup readStringTemplateGroup(InputStream stream) {
try {
return new StringTemplateGroup(
new InputStreamReader(stream, "UTF-8"),
DefaultTemplateLexer.class,
new StringTemplateErrorListener() {
@SuppressWarnings("synthetic-access")
public void error(String arg0, Throwable arg1) {
LOG.error(arg0 + ": " + arg1.getMessage(), arg1);
}
@SuppressWarnings("synthetic-access")
public void warning(String arg0) {
LOG.warn(arg0);
}
});
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
return new StringTemplateGroup("dummy");
}
} | java | public static StringTemplateGroup readStringTemplateGroup(InputStream stream) {
try {
return new StringTemplateGroup(
new InputStreamReader(stream, "UTF-8"),
DefaultTemplateLexer.class,
new StringTemplateErrorListener() {
@SuppressWarnings("synthetic-access")
public void error(String arg0, Throwable arg1) {
LOG.error(arg0 + ": " + arg1.getMessage(), arg1);
}
@SuppressWarnings("synthetic-access")
public void warning(String arg0) {
LOG.warn(arg0);
}
});
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
return new StringTemplateGroup("dummy");
}
} | [
"public",
"static",
"StringTemplateGroup",
"readStringTemplateGroup",
"(",
"InputStream",
"stream",
")",
"{",
"try",
"{",
"return",
"new",
"StringTemplateGroup",
"(",
"new",
"InputStreamReader",
"(",
"stream",
",",
"\"UTF-8\"",
")",
",",
"DefaultTemplateLexer",
".",
... | Reads a stringtemplate group from a stream.
This will always return a group (empty if necessary), even if reading it from the stream fails.
@param stream the stream to read from
@return the string template group | [
"Reads",
"a",
"stringtemplate",
"group",
"from",
"a",
"stream",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1403-L1428 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/datebox/CmsDateBoxEvent.java | CmsDateBoxEvent.fire | public static void fire(I_CmsHasDateBoxEventHandlers source, Date date, boolean isTyping) {
if (TYPE != null) {
CmsDateBoxEvent event = new CmsDateBoxEvent(date, isTyping);
source.fireEvent(event);
}
} | java | public static void fire(I_CmsHasDateBoxEventHandlers source, Date date, boolean isTyping) {
if (TYPE != null) {
CmsDateBoxEvent event = new CmsDateBoxEvent(date, isTyping);
source.fireEvent(event);
}
} | [
"public",
"static",
"void",
"fire",
"(",
"I_CmsHasDateBoxEventHandlers",
"source",
",",
"Date",
"date",
",",
"boolean",
"isTyping",
")",
"{",
"if",
"(",
"TYPE",
"!=",
"null",
")",
"{",
"CmsDateBoxEvent",
"event",
"=",
"new",
"CmsDateBoxEvent",
"(",
"date",
"... | Fires the event.
@param source the event source
@param date the date
@param isTyping true if event was caused by user pressing key that may have changed the value | [
"Fires",
"the",
"event",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/datebox/CmsDateBoxEvent.java#L69-L75 | train |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.createAndSetModuleImportProject | protected CmsProject createAndSetModuleImportProject(CmsObject cms, CmsModule module) throws CmsException {
CmsProject importProject = cms.createProject(
org.opencms.module.Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
org.opencms.module.Messages.GUI_IMPORT_MODULE_PROJECT_NAME_1,
new Object[] {module.getName()}),
org.opencms.module.Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
org.opencms.module.Messages.GUI_IMPORT_MODULE_PROJECT_DESC_1,
new Object[] {module.getName()}),
OpenCms.getDefaultUsers().getGroupAdministrators(),
OpenCms.getDefaultUsers().getGroupAdministrators(),
CmsProject.PROJECT_TYPE_TEMPORARY);
cms.getRequestContext().setCurrentProject(importProject);
cms.copyResourceToProject("/");
return importProject;
} | java | protected CmsProject createAndSetModuleImportProject(CmsObject cms, CmsModule module) throws CmsException {
CmsProject importProject = cms.createProject(
org.opencms.module.Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
org.opencms.module.Messages.GUI_IMPORT_MODULE_PROJECT_NAME_1,
new Object[] {module.getName()}),
org.opencms.module.Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
org.opencms.module.Messages.GUI_IMPORT_MODULE_PROJECT_DESC_1,
new Object[] {module.getName()}),
OpenCms.getDefaultUsers().getGroupAdministrators(),
OpenCms.getDefaultUsers().getGroupAdministrators(),
CmsProject.PROJECT_TYPE_TEMPORARY);
cms.getRequestContext().setCurrentProject(importProject);
cms.copyResourceToProject("/");
return importProject;
} | [
"protected",
"CmsProject",
"createAndSetModuleImportProject",
"(",
"CmsObject",
"cms",
",",
"CmsModule",
"module",
")",
"throws",
"CmsException",
"{",
"CmsProject",
"importProject",
"=",
"cms",
".",
"createProject",
"(",
"org",
".",
"opencms",
".",
"module",
".",
... | Creates the project used to import module resources and sets it on the CmsObject.
@param cms the CmsObject to set the project on
@param module the module
@return the created project
@throws CmsException if something goes wrong | [
"Creates",
"the",
"project",
"used",
"to",
"import",
"module",
"resources",
"and",
"sets",
"it",
"on",
"the",
"CmsObject",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L398-L413 | train |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.deleteConflictingResources | protected void deleteConflictingResources(CmsObject cms, CmsModule module, Map<CmsUUID, CmsUUID> conflictingIds)
throws CmsException, Exception {
CmsProject conflictProject = cms.createProject(
"Deletion of conflicting resources for " + module.getName(),
"Deletion of conflicting resources for " + module.getName(),
OpenCms.getDefaultUsers().getGroupAdministrators(),
OpenCms.getDefaultUsers().getGroupAdministrators(),
CmsProject.PROJECT_TYPE_TEMPORARY);
CmsObject deleteCms = OpenCms.initCmsObject(cms);
deleteCms.getRequestContext().setCurrentProject(conflictProject);
for (CmsUUID vfsId : conflictingIds.values()) {
CmsResource toDelete = deleteCms.readResource(vfsId, CmsResourceFilter.ALL);
lock(deleteCms, toDelete);
deleteCms.deleteResource(toDelete, CmsResource.DELETE_PRESERVE_SIBLINGS);
}
OpenCms.getPublishManager().publishProject(deleteCms);
OpenCms.getPublishManager().waitWhileRunning();
} | java | protected void deleteConflictingResources(CmsObject cms, CmsModule module, Map<CmsUUID, CmsUUID> conflictingIds)
throws CmsException, Exception {
CmsProject conflictProject = cms.createProject(
"Deletion of conflicting resources for " + module.getName(),
"Deletion of conflicting resources for " + module.getName(),
OpenCms.getDefaultUsers().getGroupAdministrators(),
OpenCms.getDefaultUsers().getGroupAdministrators(),
CmsProject.PROJECT_TYPE_TEMPORARY);
CmsObject deleteCms = OpenCms.initCmsObject(cms);
deleteCms.getRequestContext().setCurrentProject(conflictProject);
for (CmsUUID vfsId : conflictingIds.values()) {
CmsResource toDelete = deleteCms.readResource(vfsId, CmsResourceFilter.ALL);
lock(deleteCms, toDelete);
deleteCms.deleteResource(toDelete, CmsResource.DELETE_PRESERVE_SIBLINGS);
}
OpenCms.getPublishManager().publishProject(deleteCms);
OpenCms.getPublishManager().waitWhileRunning();
} | [
"protected",
"void",
"deleteConflictingResources",
"(",
"CmsObject",
"cms",
",",
"CmsModule",
"module",
",",
"Map",
"<",
"CmsUUID",
",",
"CmsUUID",
">",
"conflictingIds",
")",
"throws",
"CmsException",
",",
"Exception",
"{",
"CmsProject",
"conflictProject",
"=",
"... | Deletes and publishes resources with ID conflicts.
@param cms the CMS context to use
@param module the module
@param conflictingIds the conflicting ids
@throws CmsException if something goes wrong
@throws Exception if something goes wrong | [
"Deletes",
"and",
"publishes",
"resources",
"with",
"ID",
"conflicts",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L424-L442 | train |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.parseLinks | protected void parseLinks(CmsObject cms) throws CmsException {
List<CmsResource> linkParseables = new ArrayList<>();
for (CmsResourceImportData resData : m_moduleData.getResourceData()) {
CmsResource importRes = resData.getImportResource();
if ((importRes != null) && m_importIds.contains(importRes.getStructureId()) && isLinkParsable(importRes)) {
linkParseables.add(importRes);
}
}
m_report.println(Messages.get().container(Messages.RPT_START_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
CmsImportVersion10.parseLinks(cms, linkParseables, m_report);
m_report.println(Messages.get().container(Messages.RPT_END_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
} | java | protected void parseLinks(CmsObject cms) throws CmsException {
List<CmsResource> linkParseables = new ArrayList<>();
for (CmsResourceImportData resData : m_moduleData.getResourceData()) {
CmsResource importRes = resData.getImportResource();
if ((importRes != null) && m_importIds.contains(importRes.getStructureId()) && isLinkParsable(importRes)) {
linkParseables.add(importRes);
}
}
m_report.println(Messages.get().container(Messages.RPT_START_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
CmsImportVersion10.parseLinks(cms, linkParseables, m_report);
m_report.println(Messages.get().container(Messages.RPT_END_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
} | [
"protected",
"void",
"parseLinks",
"(",
"CmsObject",
"cms",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsResource",
">",
"linkParseables",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"CmsResourceImportData",
"resData",
":",
"m_moduleData",
... | Parses links for XMLContents etc.
@param cms the CMS context to use
@throws CmsException if something goes wrong | [
"Parses",
"links",
"for",
"XMLContents",
"etc",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L450-L462 | train |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.processDeletions | protected void processDeletions(CmsObject cms, List<CmsResource> toDelete) throws CmsException {
Collections.sort(toDelete, (a, b) -> b.getRootPath().compareTo(a.getRootPath()));
for (CmsResource deleteRes : toDelete) {
m_report.print(
org.opencms.importexport.Messages.get().container(org.opencms.importexport.Messages.RPT_DELFOLDER_0),
I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
deleteRes.getRootPath()));
CmsLock lock = cms.getLock(deleteRes);
if (lock.isUnlocked()) {
lock(cms, deleteRes);
}
cms.deleteResource(deleteRes, CmsResource.DELETE_PRESERVE_SIBLINGS);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
}
} | java | protected void processDeletions(CmsObject cms, List<CmsResource> toDelete) throws CmsException {
Collections.sort(toDelete, (a, b) -> b.getRootPath().compareTo(a.getRootPath()));
for (CmsResource deleteRes : toDelete) {
m_report.print(
org.opencms.importexport.Messages.get().container(org.opencms.importexport.Messages.RPT_DELFOLDER_0),
I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
deleteRes.getRootPath()));
CmsLock lock = cms.getLock(deleteRes);
if (lock.isUnlocked()) {
lock(cms, deleteRes);
}
cms.deleteResource(deleteRes, CmsResource.DELETE_PRESERVE_SIBLINGS);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
}
} | [
"protected",
"void",
"processDeletions",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"CmsResource",
">",
"toDelete",
")",
"throws",
"CmsException",
"{",
"Collections",
".",
"sort",
"(",
"toDelete",
",",
"(",
"a",
",",
"b",
")",
"->",
"b",
".",
"getRootPath"... | Handles the file deletions.
@param cms the CMS context to use
@param toDelete the resources to delete
@throws CmsException if something goes wrong | [
"Handles",
"the",
"file",
"deletions",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L472-L493 | train |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.runImportScript | protected void runImportScript(CmsObject cms, CmsModule module) {
LOG.info("Executing import script for module " + module.getName());
m_report.println(
org.opencms.module.Messages.get().container(org.opencms.module.Messages.RPT_IMPORT_SCRIPT_HEADER_0),
I_CmsReport.FORMAT_HEADLINE);
String importScript = "echo on\n" + module.getImportScript();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PrintStream out = new PrintStream(buffer);
CmsShell shell = new CmsShell(cms, "${user}@${project}:${siteroot}|${uri}>", null, out, out);
shell.execute(importScript);
String outputString = buffer.toString();
LOG.info("Shell output for import script was: \n" + outputString);
m_report.println(
org.opencms.module.Messages.get().container(
org.opencms.module.Messages.RPT_IMPORT_SCRIPT_OUTPUT_1,
outputString));
} | java | protected void runImportScript(CmsObject cms, CmsModule module) {
LOG.info("Executing import script for module " + module.getName());
m_report.println(
org.opencms.module.Messages.get().container(org.opencms.module.Messages.RPT_IMPORT_SCRIPT_HEADER_0),
I_CmsReport.FORMAT_HEADLINE);
String importScript = "echo on\n" + module.getImportScript();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PrintStream out = new PrintStream(buffer);
CmsShell shell = new CmsShell(cms, "${user}@${project}:${siteroot}|${uri}>", null, out, out);
shell.execute(importScript);
String outputString = buffer.toString();
LOG.info("Shell output for import script was: \n" + outputString);
m_report.println(
org.opencms.module.Messages.get().container(
org.opencms.module.Messages.RPT_IMPORT_SCRIPT_OUTPUT_1,
outputString));
} | [
"protected",
"void",
"runImportScript",
"(",
"CmsObject",
"cms",
",",
"CmsModule",
"module",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Executing import script for module \"",
"+",
"module",
".",
"getName",
"(",
")",
")",
";",
"m_report",
".",
"println",
"(",
"org"... | Runs the module import script.
@param cms the CMS context to use
@param module the module for which to run the script | [
"Runs",
"the",
"module",
"import",
"script",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L607-L624 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspVfsAccessBean.java | CmsJspVfsAccessBean.getAvailableLocales | public Map<String, List<Locale>> getAvailableLocales() {
if (m_availableLocales == null) {
// create lazy map only on demand
m_availableLocales = CmsCollectionsGenericWrapper.createLazyMap(new CmsAvailableLocaleLoaderTransformer());
}
return m_availableLocales;
} | java | public Map<String, List<Locale>> getAvailableLocales() {
if (m_availableLocales == null) {
// create lazy map only on demand
m_availableLocales = CmsCollectionsGenericWrapper.createLazyMap(new CmsAvailableLocaleLoaderTransformer());
}
return m_availableLocales;
} | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"Locale",
">",
">",
"getAvailableLocales",
"(",
")",
"{",
"if",
"(",
"m_availableLocales",
"==",
"null",
")",
"{",
"// create lazy map only on demand",
"m_availableLocales",
"=",
"CmsCollectionsGenericWrapper",
".",
... | Returns a lazily generated map from site paths of resources to the available locales for the resource.
@return a lazily generated map from site paths of resources to the available locales for the resource. | [
"Returns",
"a",
"lazily",
"generated",
"map",
"from",
"site",
"paths",
"of",
"resources",
"to",
"the",
"available",
"locales",
"for",
"the",
"resource",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspVfsAccessBean.java#L402-L409 | train |
alkacon/opencms-core | src/org/opencms/module/CmsModule.java | CmsModule.adjustSiteRootIfNecessary | private static CmsObject adjustSiteRootIfNecessary(final CmsObject cms, final CmsModule module)
throws CmsException {
CmsObject cmsClone;
if ((null == module.getSite()) || cms.getRequestContext().getSiteRoot().equals(module.getSite())) {
cmsClone = cms;
} else {
cmsClone = OpenCms.initCmsObject(cms);
cmsClone.getRequestContext().setSiteRoot(module.getSite());
}
return cmsClone;
} | java | private static CmsObject adjustSiteRootIfNecessary(final CmsObject cms, final CmsModule module)
throws CmsException {
CmsObject cmsClone;
if ((null == module.getSite()) || cms.getRequestContext().getSiteRoot().equals(module.getSite())) {
cmsClone = cms;
} else {
cmsClone = OpenCms.initCmsObject(cms);
cmsClone.getRequestContext().setSiteRoot(module.getSite());
}
return cmsClone;
} | [
"private",
"static",
"CmsObject",
"adjustSiteRootIfNecessary",
"(",
"final",
"CmsObject",
"cms",
",",
"final",
"CmsModule",
"module",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cmsClone",
";",
"if",
"(",
"(",
"null",
"==",
"module",
".",
"getSite",
"(",
... | Adjusts the site root and returns a cloned CmsObject, iff the module has set an import site that differs
from the site root of the CmsObject provided as argument. Otherwise returns the provided CmsObject unchanged.
@param cms The original CmsObject.
@param module The module where the import site is read from.
@return The original CmsObject, or, if necessary, a clone with adjusted site root
@throws CmsException see {@link OpenCms#initCmsObject(CmsObject)} | [
"Adjusts",
"the",
"site",
"root",
"and",
"returns",
"a",
"cloned",
"CmsObject",
"iff",
"the",
"module",
"has",
"set",
"an",
"import",
"site",
"that",
"differs",
"from",
"the",
"site",
"root",
"of",
"the",
"CmsObject",
"provided",
"as",
"argument",
".",
"Ot... | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModule.java#L475-L487 | train |
alkacon/opencms-core | src/org/opencms/module/CmsModule.java | CmsModule.shouldIncrementVersionBasedOnResources | public boolean shouldIncrementVersionBasedOnResources(CmsObject cms) throws CmsException {
if (m_checkpointTime == 0) {
return true;
}
// adjust the site root, if necessary
CmsObject cmsClone = adjustSiteRootIfNecessary(cms, this);
// calculate the module resources
List<CmsResource> moduleResources = calculateModuleResources(cmsClone, this);
for (CmsResource resource : moduleResources) {
try {
List<CmsResource> resourcesToCheck = Lists.newArrayList();
resourcesToCheck.add(resource);
if (resource.isFolder()) {
resourcesToCheck.addAll(cms.readResources(resource, CmsResourceFilter.IGNORE_EXPIRATION, true));
}
for (CmsResource resourceToCheck : resourcesToCheck) {
if (resourceToCheck.getDateLastModified() > m_checkpointTime) {
return true;
}
}
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
continue;
}
}
return false;
} | java | public boolean shouldIncrementVersionBasedOnResources(CmsObject cms) throws CmsException {
if (m_checkpointTime == 0) {
return true;
}
// adjust the site root, if necessary
CmsObject cmsClone = adjustSiteRootIfNecessary(cms, this);
// calculate the module resources
List<CmsResource> moduleResources = calculateModuleResources(cmsClone, this);
for (CmsResource resource : moduleResources) {
try {
List<CmsResource> resourcesToCheck = Lists.newArrayList();
resourcesToCheck.add(resource);
if (resource.isFolder()) {
resourcesToCheck.addAll(cms.readResources(resource, CmsResourceFilter.IGNORE_EXPIRATION, true));
}
for (CmsResource resourceToCheck : resourcesToCheck) {
if (resourceToCheck.getDateLastModified() > m_checkpointTime) {
return true;
}
}
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
continue;
}
}
return false;
} | [
"public",
"boolean",
"shouldIncrementVersionBasedOnResources",
"(",
"CmsObject",
"cms",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"m_checkpointTime",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"// adjust the site root, if necessary",
"CmsObject",
"cmsClone",
... | Determines if the version should be incremented based on the module resources' modification dates.
@param cms the CMS context
@return true if the version number should be incremented
@throws CmsException if something goes wrong | [
"Determines",
"if",
"the",
"version",
"should",
"be",
"incremented",
"based",
"on",
"the",
"module",
"resources",
"modification",
"dates",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModule.java#L1667-L1697 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleResults.java | CmsSqlConsoleResults.getColumnType | public Class<?> getColumnType(int c) {
for (int r = 0; r < m_data.size(); r++) {
Object val = m_data.get(r).get(c);
if (val != null) {
return val.getClass();
}
}
return Object.class;
} | java | public Class<?> getColumnType(int c) {
for (int r = 0; r < m_data.size(); r++) {
Object val = m_data.get(r).get(c);
if (val != null) {
return val.getClass();
}
}
return Object.class;
} | [
"public",
"Class",
"<",
"?",
">",
"getColumnType",
"(",
"int",
"c",
")",
"{",
"for",
"(",
"int",
"r",
"=",
"0",
";",
"r",
"<",
"m_data",
".",
"size",
"(",
")",
";",
"r",
"++",
")",
"{",
"Object",
"val",
"=",
"m_data",
".",
"get",
"(",
"r",
... | Gets the type to use for the Vaadin table column corresponding to the c-th column in this result.
@param c the column index
@return the class to use for the c-th Vaadin table column | [
"Gets",
"the",
"type",
"to",
"use",
"for",
"the",
"Vaadin",
"table",
"column",
"corresponding",
"to",
"the",
"c",
"-",
"th",
"column",
"in",
"this",
"result",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleResults.java#L77-L86 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleResults.java | CmsSqlConsoleResults.getCsv | public String getCsv() {
StringWriter writer = new StringWriter();
try (CSVWriter csv = new CSVWriter(writer)) {
List<String> headers = new ArrayList<>();
for (String col : m_columns) {
headers.add(col);
}
csv.writeNext(headers.toArray(new String[] {}));
for (List<Object> row : m_data) {
List<String> colCsv = new ArrayList<>();
for (Object col : row) {
colCsv.add(String.valueOf(col));
}
csv.writeNext(colCsv.toArray(new String[] {}));
}
return writer.toString();
} catch (IOException e) {
return null;
}
} | java | public String getCsv() {
StringWriter writer = new StringWriter();
try (CSVWriter csv = new CSVWriter(writer)) {
List<String> headers = new ArrayList<>();
for (String col : m_columns) {
headers.add(col);
}
csv.writeNext(headers.toArray(new String[] {}));
for (List<Object> row : m_data) {
List<String> colCsv = new ArrayList<>();
for (Object col : row) {
colCsv.add(String.valueOf(col));
}
csv.writeNext(colCsv.toArray(new String[] {}));
}
return writer.toString();
} catch (IOException e) {
return null;
}
} | [
"public",
"String",
"getCsv",
"(",
")",
"{",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"(",
"CSVWriter",
"csv",
"=",
"new",
"CSVWriter",
"(",
"writer",
")",
")",
"{",
"List",
"<",
"String",
">",
"headers",
"=",
"new",
... | Converts the results to CSV data.
@return the CSV data | [
"Converts",
"the",
"results",
"to",
"CSV",
"data",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleResults.java#L93-L113 | train |
alkacon/opencms-core | src/org/opencms/ade/containerpage/inherited/CmsContainerConfigurationCacheState.java | CmsContainerConfigurationCacheState.getBasePath | protected String getBasePath(String rootPath) {
if (rootPath.endsWith(INHERITANCE_CONFIG_FILE_NAME)) {
return rootPath.substring(0, rootPath.length() - INHERITANCE_CONFIG_FILE_NAME.length());
}
return rootPath;
} | java | protected String getBasePath(String rootPath) {
if (rootPath.endsWith(INHERITANCE_CONFIG_FILE_NAME)) {
return rootPath.substring(0, rootPath.length() - INHERITANCE_CONFIG_FILE_NAME.length());
}
return rootPath;
} | [
"protected",
"String",
"getBasePath",
"(",
"String",
"rootPath",
")",
"{",
"if",
"(",
"rootPath",
".",
"endsWith",
"(",
"INHERITANCE_CONFIG_FILE_NAME",
")",
")",
"{",
"return",
"rootPath",
".",
"substring",
"(",
"0",
",",
"rootPath",
".",
"length",
"(",
")",... | Returns the base path for a given configuration file.
E.g. the result for the input '/sites/default/.container-config' will be '/sites/default'.<p>
@param rootPath the root path of the configuration file
@return the base path for the configuration file | [
"Returns",
"the",
"base",
"path",
"for",
"a",
"given",
"configuration",
"file",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/inherited/CmsContainerConfigurationCacheState.java#L129-L135 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/CmsWidgetUtil.java | CmsWidgetUtil.getStringOption | public static String getStringOption(Map<String, String> configOptions, String optionKey, String defaultValue) {
String result = configOptions.get(optionKey);
return null != result ? result : defaultValue;
} | java | public static String getStringOption(Map<String, String> configOptions, String optionKey, String defaultValue) {
String result = configOptions.get(optionKey);
return null != result ? result : defaultValue;
} | [
"public",
"static",
"String",
"getStringOption",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"configOptions",
",",
"String",
"optionKey",
",",
"String",
"defaultValue",
")",
"{",
"String",
"result",
"=",
"configOptions",
".",
"get",
"(",
"optionKey",
")",
... | Returns the value of an option, or the default if the value is null or the key is not part of the map.
@param configOptions the map with the config options.
@param optionKey the option to get the value of
@param defaultValue the default value to return if the option is not set.
@return the value of an option, or the default if the value is null or the key is not part of the map. | [
"Returns",
"the",
"value",
"of",
"an",
"option",
"or",
"the",
"default",
"if",
"the",
"value",
"is",
"null",
"or",
"the",
"key",
"is",
"not",
"part",
"of",
"the",
"map",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsWidgetUtil.java#L82-L86 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/CmsMultiSelectWidget.java | CmsMultiSelectWidget.generateValue | private String generateValue() {
String result = "";
for (CmsCheckBox checkbox : m_checkboxes) {
if (checkbox.isChecked()) {
result += checkbox.getInternalValue() + ",";
}
}
if (result.contains(",")) {
result = result.substring(0, result.lastIndexOf(","));
}
return result;
} | java | private String generateValue() {
String result = "";
for (CmsCheckBox checkbox : m_checkboxes) {
if (checkbox.isChecked()) {
result += checkbox.getInternalValue() + ",";
}
}
if (result.contains(",")) {
result = result.substring(0, result.lastIndexOf(","));
}
return result;
} | [
"private",
"String",
"generateValue",
"(",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"for",
"(",
"CmsCheckBox",
"checkbox",
":",
"m_checkboxes",
")",
"{",
"if",
"(",
"checkbox",
".",
"isChecked",
"(",
")",
")",
"{",
"result",
"+=",
"checkbox",
".",... | Generate a string with all selected checkboxes separated with ','.
@return a string with all selected checkboxes | [
"Generate",
"a",
"string",
"with",
"all",
"selected",
"checkboxes",
"separated",
"with",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/CmsMultiSelectWidget.java#L347-L359 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleLayout.java | CmsSqlConsoleLayout.runQuery | protected void runQuery() {
String pool = m_pool.getValue();
String stmt = m_script.getValue();
if (stmt.trim().isEmpty()) {
return;
}
CmsStringBufferReport report = new CmsStringBufferReport(Locale.ENGLISH);
List<Throwable> errors = new ArrayList<>();
CmsSqlConsoleResults result = m_console.execute(stmt, pool, report, errors);
if (errors.size() > 0) {
CmsErrorDialog.showErrorDialog(report.toString() + errors.get(0).getMessage(), errors.get(0));
} else {
Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_SQLCONSOLE_QUERY_RESULTS_0));
window.setContent(new CmsSqlConsoleResultsForm(result, report.toString()));
A_CmsUI.get().addWindow(window);
window.center();
}
} | java | protected void runQuery() {
String pool = m_pool.getValue();
String stmt = m_script.getValue();
if (stmt.trim().isEmpty()) {
return;
}
CmsStringBufferReport report = new CmsStringBufferReport(Locale.ENGLISH);
List<Throwable> errors = new ArrayList<>();
CmsSqlConsoleResults result = m_console.execute(stmt, pool, report, errors);
if (errors.size() > 0) {
CmsErrorDialog.showErrorDialog(report.toString() + errors.get(0).getMessage(), errors.get(0));
} else {
Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_SQLCONSOLE_QUERY_RESULTS_0));
window.setContent(new CmsSqlConsoleResultsForm(result, report.toString()));
A_CmsUI.get().addWindow(window);
window.center();
}
} | [
"protected",
"void",
"runQuery",
"(",
")",
"{",
"String",
"pool",
"=",
"m_pool",
".",
"getValue",
"(",
")",
";",
"String",
"stmt",
"=",
"m_script",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"stmt",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
... | Runs the currently entered query and displays the results. | [
"Runs",
"the",
"currently",
"entered",
"query",
"and",
"displays",
"the",
"results",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleLayout.java#L88-L108 | train |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupUI.java | CmsSetupUI.getSetupPage | public static Resource getSetupPage(I_SetupUiContext context, String name) {
String path = CmsStringUtil.joinPaths(context.getSetupBean().getContextPath(), CmsSetupBean.FOLDER_SETUP, name);
Resource resource = new ExternalResource(path);
return resource;
} | java | public static Resource getSetupPage(I_SetupUiContext context, String name) {
String path = CmsStringUtil.joinPaths(context.getSetupBean().getContextPath(), CmsSetupBean.FOLDER_SETUP, name);
Resource resource = new ExternalResource(path);
return resource;
} | [
"public",
"static",
"Resource",
"getSetupPage",
"(",
"I_SetupUiContext",
"context",
",",
"String",
"name",
")",
"{",
"String",
"path",
"=",
"CmsStringUtil",
".",
"joinPaths",
"(",
"context",
".",
"getSetupBean",
"(",
")",
".",
"getContextPath",
"(",
")",
",",
... | Gets external resource for an HTML page in the setup-resources folder.
@param context the context
@param name the file name
@return the resource for the HTML page | [
"Gets",
"external",
"resource",
"for",
"an",
"HTML",
"page",
"in",
"the",
"setup",
"-",
"resources",
"folder",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupUI.java#L84-L89 | train |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupUI.java | CmsSetupUI.showStep | protected void showStep(A_CmsSetupStep step) {
Window window = newWindow();
window.setContent(step);
window.setCaption(step.getTitle());
A_CmsUI.get().addWindow(window);
window.center();
} | java | protected void showStep(A_CmsSetupStep step) {
Window window = newWindow();
window.setContent(step);
window.setCaption(step.getTitle());
A_CmsUI.get().addWindow(window);
window.center();
} | [
"protected",
"void",
"showStep",
"(",
"A_CmsSetupStep",
"step",
")",
"{",
"Window",
"window",
"=",
"newWindow",
"(",
")",
";",
"window",
".",
"setContent",
"(",
"step",
")",
";",
"window",
".",
"setCaption",
"(",
"step",
".",
"getTitle",
"(",
")",
")",
... | Shows the given step.
@param step the step | [
"Shows",
"the",
"given",
"step",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupUI.java#L150-L157 | train |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupUI.java | CmsSetupUI.updateStep | protected void updateStep(int stepNo) {
if ((0 <= stepNo) && (stepNo < m_steps.size())) {
Class<? extends A_CmsSetupStep> cls = m_steps.get(stepNo);
A_CmsSetupStep step;
try {
step = cls.getConstructor(I_SetupUiContext.class).newInstance(this);
showStep(step);
m_stepNo = stepNo; // Only update step number if no exceptions
} catch (Exception e) {
CmsSetupErrorDialog.showErrorDialog(e);
}
}
} | java | protected void updateStep(int stepNo) {
if ((0 <= stepNo) && (stepNo < m_steps.size())) {
Class<? extends A_CmsSetupStep> cls = m_steps.get(stepNo);
A_CmsSetupStep step;
try {
step = cls.getConstructor(I_SetupUiContext.class).newInstance(this);
showStep(step);
m_stepNo = stepNo; // Only update step number if no exceptions
} catch (Exception e) {
CmsSetupErrorDialog.showErrorDialog(e);
}
}
} | [
"protected",
"void",
"updateStep",
"(",
"int",
"stepNo",
")",
"{",
"if",
"(",
"(",
"0",
"<=",
"stepNo",
")",
"&&",
"(",
"stepNo",
"<",
"m_steps",
".",
"size",
"(",
")",
")",
")",
"{",
"Class",
"<",
"?",
"extends",
"A_CmsSetupStep",
">",
"cls",
"=",... | Moves to the step with the given number.
<p>The step number is only updated if no exceptions are thrown when instantiating/displaying the given step
@param stepNo the step number to move to | [
"Moves",
"to",
"the",
"step",
"with",
"the",
"given",
"number",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupUI.java#L166-L180 | train |
alkacon/opencms-core | src/org/opencms/jsp/search/controller/CmsSearchControllerFacetField.java | CmsSearchControllerFacetField.appendFacetOption | protected void appendFacetOption(StringBuffer query, final String name, final String value) {
query.append(" facet.").append(name).append("=").append(value);
} | java | protected void appendFacetOption(StringBuffer query, final String name, final String value) {
query.append(" facet.").append(name).append("=").append(value);
} | [
"protected",
"void",
"appendFacetOption",
"(",
"StringBuffer",
"query",
",",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"query",
".",
"append",
"(",
"\" facet.\"",
")",
".",
"append",
"(",
"name",
")",
".",
"append",
"(",
"\"=\""... | Appends the query part for the facet to the query string.
@param query The current query string.
@param name The name of the facet parameter, e.g. "limit", "order", ....
@param value The value to set for the parameter specified by name. | [
"Appends",
"the",
"query",
"part",
"for",
"the",
"facet",
"to",
"the",
"query",
"string",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/controller/CmsSearchControllerFacetField.java#L204-L207 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.setEditedFilePath | public void setEditedFilePath(final String editedFilePath) {
m_filePathField.setReadOnly(false);
m_filePathField.setValue(editedFilePath);
m_filePathField.setReadOnly(true);
} | java | public void setEditedFilePath(final String editedFilePath) {
m_filePathField.setReadOnly(false);
m_filePathField.setValue(editedFilePath);
m_filePathField.setReadOnly(true);
} | [
"public",
"void",
"setEditedFilePath",
"(",
"final",
"String",
"editedFilePath",
")",
"{",
"m_filePathField",
".",
"setReadOnly",
"(",
"false",
")",
";",
"m_filePathField",
".",
"setValue",
"(",
"editedFilePath",
")",
";",
"m_filePathField",
".",
"setReadOnly",
"(... | Sets the path of the edited file in the corresponding display.
@param editedFilePath path of the edited file to set. | [
"Sets",
"the",
"path",
"of",
"the",
"edited",
"file",
"in",
"the",
"corresponding",
"display",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L146-L152 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.updateShownOptions | public void updateShownOptions(boolean showModeSwitch, boolean showAddKeyOption) {
if (showModeSwitch != m_showModeSwitch) {
m_upperLeftComponent.removeAllComponents();
m_upperLeftComponent.addComponent(m_languageSwitch);
if (showModeSwitch) {
m_upperLeftComponent.addComponent(m_modeSwitch);
}
m_upperLeftComponent.addComponent(m_filePathLabel);
m_showModeSwitch = showModeSwitch;
}
if (showAddKeyOption != m_showAddKeyOption) {
if (showAddKeyOption) {
m_optionsComponent.addComponent(m_lowerLeftComponent, 0, 1);
m_optionsComponent.addComponent(m_lowerRightComponent, 1, 1);
} else {
m_optionsComponent.removeComponent(0, 1);
m_optionsComponent.removeComponent(1, 1);
}
m_showAddKeyOption = showAddKeyOption;
}
} | java | public void updateShownOptions(boolean showModeSwitch, boolean showAddKeyOption) {
if (showModeSwitch != m_showModeSwitch) {
m_upperLeftComponent.removeAllComponents();
m_upperLeftComponent.addComponent(m_languageSwitch);
if (showModeSwitch) {
m_upperLeftComponent.addComponent(m_modeSwitch);
}
m_upperLeftComponent.addComponent(m_filePathLabel);
m_showModeSwitch = showModeSwitch;
}
if (showAddKeyOption != m_showAddKeyOption) {
if (showAddKeyOption) {
m_optionsComponent.addComponent(m_lowerLeftComponent, 0, 1);
m_optionsComponent.addComponent(m_lowerRightComponent, 1, 1);
} else {
m_optionsComponent.removeComponent(0, 1);
m_optionsComponent.removeComponent(1, 1);
}
m_showAddKeyOption = showAddKeyOption;
}
} | [
"public",
"void",
"updateShownOptions",
"(",
"boolean",
"showModeSwitch",
",",
"boolean",
"showAddKeyOption",
")",
"{",
"if",
"(",
"showModeSwitch",
"!=",
"m_showModeSwitch",
")",
"{",
"m_upperLeftComponent",
".",
"removeAllComponents",
"(",
")",
";",
"m_upperLeftComp... | Update which options are shown.
@param showModeSwitch flag, indicating if the mode switch should be shown.
@param showAddKeyOption flag, indicating if the "Add key" row should be shown. | [
"Update",
"which",
"options",
"are",
"shown",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L170-L191 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.handleAddKey | void handleAddKey() {
String key = m_addKeyInput.getValue();
if (m_listener.handleAddKey(key)) {
Notification.show(
key.isEmpty()
? m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_EMPTY_KEY_SUCCESSFULLY_ADDED_0)
: m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_SUCCESSFULLY_ADDED_1, key));
} else {
CmsMessageBundleEditorTypes.showWarning(
m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_ALREADEY_EXISTS_CAPTION_0),
m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_ALREADEY_EXISTS_DESCRIPTION_1, key));
}
m_addKeyInput.focus();
m_addKeyInput.selectAll();
} | java | void handleAddKey() {
String key = m_addKeyInput.getValue();
if (m_listener.handleAddKey(key)) {
Notification.show(
key.isEmpty()
? m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_EMPTY_KEY_SUCCESSFULLY_ADDED_0)
: m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_SUCCESSFULLY_ADDED_1, key));
} else {
CmsMessageBundleEditorTypes.showWarning(
m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_ALREADEY_EXISTS_CAPTION_0),
m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_ALREADEY_EXISTS_DESCRIPTION_1, key));
}
m_addKeyInput.focus();
m_addKeyInput.selectAll();
} | [
"void",
"handleAddKey",
"(",
")",
"{",
"String",
"key",
"=",
"m_addKeyInput",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"m_listener",
".",
"handleAddKey",
"(",
"key",
")",
")",
"{",
"Notification",
".",
"show",
"(",
"key",
".",
"isEmpty",
"(",
")",
... | Handles adding a key. Calls the registered listener and wraps it's method in some GUI adjustments. | [
"Handles",
"adding",
"a",
"key",
".",
"Calls",
"the",
"registered",
"listener",
"and",
"wraps",
"it",
"s",
"method",
"in",
"some",
"GUI",
"adjustments",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L196-L212 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.setLanguage | void setLanguage(final Locale locale) {
if (!m_languageSelect.getValue().equals(locale)) {
m_languageSelect.setValue(locale);
}
} | java | void setLanguage(final Locale locale) {
if (!m_languageSelect.getValue().equals(locale)) {
m_languageSelect.setValue(locale);
}
} | [
"void",
"setLanguage",
"(",
"final",
"Locale",
"locale",
")",
"{",
"if",
"(",
"!",
"m_languageSelect",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"locale",
")",
")",
"{",
"m_languageSelect",
".",
"setValue",
"(",
"locale",
")",
";",
"}",
"}"
] | Sets the currently edited locale.
@param locale the locale to set. | [
"Sets",
"the",
"currently",
"edited",
"locale",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L218-L223 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.createAddKeyButton | private Component createAddKeyButton() {
// the "+" button
Button addKeyButton = new Button();
addKeyButton.addStyleName("icon-only");
addKeyButton.addStyleName("borderless-colored");
addKeyButton.setDescription(m_messages.key(Messages.GUI_ADD_KEY_0));
addKeyButton.setIcon(FontOpenCms.CIRCLE_PLUS, m_messages.key(Messages.GUI_ADD_KEY_0));
addKeyButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
handleAddKey();
}
});
return addKeyButton;
} | java | private Component createAddKeyButton() {
// the "+" button
Button addKeyButton = new Button();
addKeyButton.addStyleName("icon-only");
addKeyButton.addStyleName("borderless-colored");
addKeyButton.setDescription(m_messages.key(Messages.GUI_ADD_KEY_0));
addKeyButton.setIcon(FontOpenCms.CIRCLE_PLUS, m_messages.key(Messages.GUI_ADD_KEY_0));
addKeyButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
handleAddKey();
}
});
return addKeyButton;
} | [
"private",
"Component",
"createAddKeyButton",
"(",
")",
"{",
"// the \"+\" button",
"Button",
"addKeyButton",
"=",
"new",
"Button",
"(",
")",
";",
"addKeyButton",
".",
"addStyleName",
"(",
"\"icon-only\"",
")",
";",
"addKeyButton",
".",
"addStyleName",
"(",
"\"bor... | Creates the "Add key" button.
@return the "Add key" button. | [
"Creates",
"the",
"Add",
"key",
"button",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L229-L248 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.initModeSwitch | private void initModeSwitch(final EditMode current) {
FormLayout modes = new FormLayout();
modes.setHeight("100%");
modes.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
m_modeSelect = new ComboBox();
m_modeSelect.setCaption(m_messages.key(Messages.GUI_VIEW_SWITCHER_LABEL_0));
// add Modes
m_modeSelect.addItem(CmsMessageBundleEditorTypes.EditMode.DEFAULT);
m_modeSelect.setItemCaption(
CmsMessageBundleEditorTypes.EditMode.DEFAULT,
m_messages.key(Messages.GUI_VIEW_SWITCHER_EDITMODE_DEFAULT_0));
m_modeSelect.addItem(CmsMessageBundleEditorTypes.EditMode.MASTER);
m_modeSelect.setItemCaption(
CmsMessageBundleEditorTypes.EditMode.MASTER,
m_messages.key(Messages.GUI_VIEW_SWITCHER_EDITMODE_MASTER_0));
// set current mode as selected
m_modeSelect.setValue(current);
m_modeSelect.setNewItemsAllowed(false);
m_modeSelect.setTextInputAllowed(false);
m_modeSelect.setNullSelectionAllowed(false);
m_modeSelect.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
m_listener.handleModeChange((EditMode)event.getProperty().getValue());
}
});
modes.addComponent(m_modeSelect);
m_modeSwitch = modes;
} | java | private void initModeSwitch(final EditMode current) {
FormLayout modes = new FormLayout();
modes.setHeight("100%");
modes.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
m_modeSelect = new ComboBox();
m_modeSelect.setCaption(m_messages.key(Messages.GUI_VIEW_SWITCHER_LABEL_0));
// add Modes
m_modeSelect.addItem(CmsMessageBundleEditorTypes.EditMode.DEFAULT);
m_modeSelect.setItemCaption(
CmsMessageBundleEditorTypes.EditMode.DEFAULT,
m_messages.key(Messages.GUI_VIEW_SWITCHER_EDITMODE_DEFAULT_0));
m_modeSelect.addItem(CmsMessageBundleEditorTypes.EditMode.MASTER);
m_modeSelect.setItemCaption(
CmsMessageBundleEditorTypes.EditMode.MASTER,
m_messages.key(Messages.GUI_VIEW_SWITCHER_EDITMODE_MASTER_0));
// set current mode as selected
m_modeSelect.setValue(current);
m_modeSelect.setNewItemsAllowed(false);
m_modeSelect.setTextInputAllowed(false);
m_modeSelect.setNullSelectionAllowed(false);
m_modeSelect.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
m_listener.handleModeChange((EditMode)event.getProperty().getValue());
}
});
modes.addComponent(m_modeSelect);
m_modeSwitch = modes;
} | [
"private",
"void",
"initModeSwitch",
"(",
"final",
"EditMode",
"current",
")",
"{",
"FormLayout",
"modes",
"=",
"new",
"FormLayout",
"(",
")",
";",
"modes",
".",
"setHeight",
"(",
"\"100%\"",
")",
";",
"modes",
".",
"setDefaultComponentAlignment",
"(",
"Alignm... | Initializes the mode switcher.
@param current the current edit mode | [
"Initializes",
"the",
"mode",
"switcher",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L437-L476 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.initUpperLeftComponent | private void initUpperLeftComponent() {
m_upperLeftComponent = new HorizontalLayout();
m_upperLeftComponent.setHeight("100%");
m_upperLeftComponent.setSpacing(true);
m_upperLeftComponent.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
m_upperLeftComponent.addComponent(m_languageSwitch);
m_upperLeftComponent.addComponent(m_filePathLabel);
} | java | private void initUpperLeftComponent() {
m_upperLeftComponent = new HorizontalLayout();
m_upperLeftComponent.setHeight("100%");
m_upperLeftComponent.setSpacing(true);
m_upperLeftComponent.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
m_upperLeftComponent.addComponent(m_languageSwitch);
m_upperLeftComponent.addComponent(m_filePathLabel);
} | [
"private",
"void",
"initUpperLeftComponent",
"(",
")",
"{",
"m_upperLeftComponent",
"=",
"new",
"HorizontalLayout",
"(",
")",
";",
"m_upperLeftComponent",
".",
"setHeight",
"(",
"\"100%\"",
")",
";",
"m_upperLeftComponent",
".",
"setSpacing",
"(",
"true",
")",
";"... | Initializes the upper left component. Does not show the mode switch. | [
"Initializes",
"the",
"upper",
"left",
"component",
".",
"Does",
"not",
"show",
"the",
"mode",
"switch",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L511-L520 | train |
alkacon/opencms-core | src/org/opencms/scheduler/CmsScheduleManager.java | CmsScheduleManager.getJob | public CmsScheduledJobInfo getJob(String id) {
Iterator<CmsScheduledJobInfo> it = m_jobs.iterator();
while (it.hasNext()) {
CmsScheduledJobInfo job = it.next();
if (job.getId().equals(id)) {
return job;
}
}
// not found
return null;
} | java | public CmsScheduledJobInfo getJob(String id) {
Iterator<CmsScheduledJobInfo> it = m_jobs.iterator();
while (it.hasNext()) {
CmsScheduledJobInfo job = it.next();
if (job.getId().equals(id)) {
return job;
}
}
// not found
return null;
} | [
"public",
"CmsScheduledJobInfo",
"getJob",
"(",
"String",
"id",
")",
"{",
"Iterator",
"<",
"CmsScheduledJobInfo",
">",
"it",
"=",
"m_jobs",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"CmsScheduledJobInfo",
"job"... | Returns the currently scheduled job description identified by the given id.
@param id the job id
@return a job or <code>null</code> if not found | [
"Returns",
"the",
"currently",
"scheduled",
"job",
"description",
"identified",
"by",
"the",
"given",
"id",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/scheduler/CmsScheduleManager.java#L192-L203 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyView.java | CmsPatternPanelYearlyView.onMonthChange | @UiHandler({"m_atMonth", "m_everyMonth"})
void onMonthChange(ValueChangeEvent<String> event) {
if (handleChange()) {
m_controller.setMonth(event.getValue());
}
} | java | @UiHandler({"m_atMonth", "m_everyMonth"})
void onMonthChange(ValueChangeEvent<String> event) {
if (handleChange()) {
m_controller.setMonth(event.getValue());
}
} | [
"@",
"UiHandler",
"(",
"{",
"\"m_atMonth\"",
",",
"\"m_everyMonth\"",
"}",
")",
"void",
"onMonthChange",
"(",
"ValueChangeEvent",
"<",
"String",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setMonth",
"(",
"e... | Handler for month changes.
@param event change event. | [
"Handler",
"for",
"month",
"changes",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyView.java#L228-L234 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyView.java | CmsPatternPanelYearlyView.onWeekOfMonthChange | @UiHandler("m_atNumber")
void onWeekOfMonthChange(ValueChangeEvent<String> event) {
if (handleChange()) {
m_controller.setWeekOfMonth(event.getValue());
}
} | java | @UiHandler("m_atNumber")
void onWeekOfMonthChange(ValueChangeEvent<String> event) {
if (handleChange()) {
m_controller.setWeekOfMonth(event.getValue());
}
} | [
"@",
"UiHandler",
"(",
"\"m_atNumber\"",
")",
"void",
"onWeekOfMonthChange",
"(",
"ValueChangeEvent",
"<",
"String",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setWeekOfMonth",
"(",
"event",
".",
"getValue",
... | Handler for week of month changes.
@param event the change event. | [
"Handler",
"for",
"week",
"of",
"month",
"changes",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyView.java#L252-L258 | train |
alkacon/opencms-core | src/org/opencms/file/CmsResourceBuilder.java | CmsResourceBuilder.buildResource | public CmsResource buildResource() {
return new CmsResource(
m_structureId,
m_resourceId,
m_rootPath,
m_type,
m_flags,
m_projectLastModified,
m_state,
m_dateCreated,
m_userCreated,
m_dateLastModified,
m_userLastModified,
m_dateReleased,
m_dateExpired,
m_length,
m_flags,
m_dateContent,
m_version);
} | java | public CmsResource buildResource() {
return new CmsResource(
m_structureId,
m_resourceId,
m_rootPath,
m_type,
m_flags,
m_projectLastModified,
m_state,
m_dateCreated,
m_userCreated,
m_dateLastModified,
m_userLastModified,
m_dateReleased,
m_dateExpired,
m_length,
m_flags,
m_dateContent,
m_version);
} | [
"public",
"CmsResource",
"buildResource",
"(",
")",
"{",
"return",
"new",
"CmsResource",
"(",
"m_structureId",
",",
"m_resourceId",
",",
"m_rootPath",
",",
"m_type",
",",
"m_flags",
",",
"m_projectLastModified",
",",
"m_state",
",",
"m_dateCreated",
",",
"m_userCr... | Builds the resource.
@return the cms resource | [
"Builds",
"the",
"resource",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsResourceBuilder.java#L102-L122 | train |
alkacon/opencms-core | src/org/opencms/security/CmsOrgUnitManager.java | CmsOrgUnitManager.getAllAccessibleProjects | public List<CmsProject> getAllAccessibleProjects(CmsObject cms, String ouFqn, boolean includeSubOus)
throws CmsException {
CmsOrganizationalUnit orgUnit = readOrganizationalUnit(cms, ouFqn);
return (m_securityManager.getAllAccessibleProjects(cms.getRequestContext(), orgUnit, includeSubOus));
} | java | public List<CmsProject> getAllAccessibleProjects(CmsObject cms, String ouFqn, boolean includeSubOus)
throws CmsException {
CmsOrganizationalUnit orgUnit = readOrganizationalUnit(cms, ouFqn);
return (m_securityManager.getAllAccessibleProjects(cms.getRequestContext(), orgUnit, includeSubOus));
} | [
"public",
"List",
"<",
"CmsProject",
">",
"getAllAccessibleProjects",
"(",
"CmsObject",
"cms",
",",
"String",
"ouFqn",
",",
"boolean",
"includeSubOus",
")",
"throws",
"CmsException",
"{",
"CmsOrganizationalUnit",
"orgUnit",
"=",
"readOrganizationalUnit",
"(",
"cms",
... | Returns all accessible projects of the given organizational unit.
That is all projects which are owned by the current user or which are
accessible for the group of the user.<p>
@param cms the opencms context
@param ouFqn the fully qualified name of the organizational unit to get projects for
@param includeSubOus if all projects of sub-organizational units should be retrieved too
@return all <code>{@link org.opencms.file.CmsProject}</code> objects in the organizational unit
@throws CmsException if operation was not successful | [
"Returns",
"all",
"accessible",
"projects",
"of",
"the",
"given",
"organizational",
"unit",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsOrgUnitManager.java#L166-L171 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.java | CmsJspContentAccessValueWrapper.getToDateSeries | public CmsJspDateSeriesBean getToDateSeries() {
if (m_dateSeries == null) {
m_dateSeries = new CmsJspDateSeriesBean(this, m_cms.getRequestContext().getLocale());
}
return m_dateSeries;
} | java | public CmsJspDateSeriesBean getToDateSeries() {
if (m_dateSeries == null) {
m_dateSeries = new CmsJspDateSeriesBean(this, m_cms.getRequestContext().getLocale());
}
return m_dateSeries;
} | [
"public",
"CmsJspDateSeriesBean",
"getToDateSeries",
"(",
")",
"{",
"if",
"(",
"m_dateSeries",
"==",
"null",
")",
"{",
"m_dateSeries",
"=",
"new",
"CmsJspDateSeriesBean",
"(",
"this",
",",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",
"(",
")"... | Converts a date series configuration to a date series bean.
@return the date series bean. | [
"Converts",
"a",
"date",
"series",
"configuration",
"to",
"a",
"date",
"series",
"bean",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.java#L850-L856 | train |
alkacon/opencms-core | src/org/opencms/i18n/tools/CmsContainerPageCopier.java | CmsContainerPageCopier.copyPageOnly | public void copyPageOnly(CmsResource originalPage, String targetPageRootPath)
throws CmsException, NoCustomReplacementException {
if ((null == originalPage)
|| !OpenCms.getResourceManager().getResourceType(originalPage).getTypeName().equals(
CmsResourceTypeXmlContainerPage.getStaticTypeName())) {
throw new CmsException(new CmsMessageContainer(Messages.get(), Messages.ERR_PAGECOPY_INVALID_PAGE_0));
}
m_originalPage = originalPage;
CmsObject rootCms = getRootCms();
rootCms.copyResource(originalPage.getRootPath(), targetPageRootPath);
CmsResource copiedPage = rootCms.readResource(targetPageRootPath, CmsResourceFilter.IGNORE_EXPIRATION);
m_targetFolder = rootCms.readResource(CmsResource.getFolderPath(copiedPage.getRootPath()));
replaceElements(copiedPage);
attachLocaleGroups(copiedPage);
tryUnlock(copiedPage);
} | java | public void copyPageOnly(CmsResource originalPage, String targetPageRootPath)
throws CmsException, NoCustomReplacementException {
if ((null == originalPage)
|| !OpenCms.getResourceManager().getResourceType(originalPage).getTypeName().equals(
CmsResourceTypeXmlContainerPage.getStaticTypeName())) {
throw new CmsException(new CmsMessageContainer(Messages.get(), Messages.ERR_PAGECOPY_INVALID_PAGE_0));
}
m_originalPage = originalPage;
CmsObject rootCms = getRootCms();
rootCms.copyResource(originalPage.getRootPath(), targetPageRootPath);
CmsResource copiedPage = rootCms.readResource(targetPageRootPath, CmsResourceFilter.IGNORE_EXPIRATION);
m_targetFolder = rootCms.readResource(CmsResource.getFolderPath(copiedPage.getRootPath()));
replaceElements(copiedPage);
attachLocaleGroups(copiedPage);
tryUnlock(copiedPage);
} | [
"public",
"void",
"copyPageOnly",
"(",
"CmsResource",
"originalPage",
",",
"String",
"targetPageRootPath",
")",
"throws",
"CmsException",
",",
"NoCustomReplacementException",
"{",
"if",
"(",
"(",
"null",
"==",
"originalPage",
")",
"||",
"!",
"OpenCms",
".",
"getRe... | Copies the given container page to the provided root path.
@param originalPage the page to copy
@param targetPageRootPath the root path of the copy target.
@throws CmsException thrown if something goes wrong.
@throws NoCustomReplacementException if a custom replacement is not found for a type which requires it. | [
"Copies",
"the",
"given",
"container",
"page",
"to",
"the",
"provided",
"root",
"path",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/tools/CmsContainerPageCopier.java#L223-L240 | train |
alkacon/opencms-core | src/org/opencms/i18n/tools/CmsContainerPageCopier.java | CmsContainerPageCopier.attachLocaleGroups | private void attachLocaleGroups(CmsResource copiedPage) throws CmsException {
CmsLocaleGroupService localeGroupService = getRootCms().getLocaleGroupService();
if (Status.linkable == localeGroupService.checkLinkable(m_originalPage, copiedPage)) {
try {
localeGroupService.attachLocaleGroupIndirect(m_originalPage, copiedPage);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} | java | private void attachLocaleGroups(CmsResource copiedPage) throws CmsException {
CmsLocaleGroupService localeGroupService = getRootCms().getLocaleGroupService();
if (Status.linkable == localeGroupService.checkLinkable(m_originalPage, copiedPage)) {
try {
localeGroupService.attachLocaleGroupIndirect(m_originalPage, copiedPage);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} | [
"private",
"void",
"attachLocaleGroups",
"(",
"CmsResource",
"copiedPage",
")",
"throws",
"CmsException",
"{",
"CmsLocaleGroupService",
"localeGroupService",
"=",
"getRootCms",
"(",
")",
".",
"getLocaleGroupService",
"(",
")",
";",
"if",
"(",
"Status",
".",
"linkabl... | Attaches locale groups to the copied page.
@param copiedPage the copied page.
@throws CmsException thrown if the root cms cannot be retrieved. | [
"Attaches",
"locale",
"groups",
"to",
"the",
"copied",
"page",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/tools/CmsContainerPageCopier.java#L667-L677 | train |
alkacon/opencms-core | src/org/opencms/ui/dialogs/CmsUndeleteDialog.java | CmsUndeleteDialog.undelete | protected List<CmsUUID> undelete() throws CmsException {
List<CmsUUID> modifiedResources = new ArrayList<CmsUUID>();
CmsObject cms = m_context.getCms();
for (CmsResource resource : m_context.getResources()) {
CmsLockActionRecord actionRecord = null;
try {
actionRecord = CmsLockUtil.ensureLock(m_context.getCms(), resource);
cms.undeleteResource(cms.getSitePath(resource), true);
modifiedResources.add(resource.getStructureId());
} finally {
if ((actionRecord != null) && (actionRecord.getChange() == LockChange.locked)) {
try {
cms.unlockResource(resource);
} catch (CmsLockException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
}
}
return modifiedResources;
} | java | protected List<CmsUUID> undelete() throws CmsException {
List<CmsUUID> modifiedResources = new ArrayList<CmsUUID>();
CmsObject cms = m_context.getCms();
for (CmsResource resource : m_context.getResources()) {
CmsLockActionRecord actionRecord = null;
try {
actionRecord = CmsLockUtil.ensureLock(m_context.getCms(), resource);
cms.undeleteResource(cms.getSitePath(resource), true);
modifiedResources.add(resource.getStructureId());
} finally {
if ((actionRecord != null) && (actionRecord.getChange() == LockChange.locked)) {
try {
cms.unlockResource(resource);
} catch (CmsLockException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
}
}
return modifiedResources;
} | [
"protected",
"List",
"<",
"CmsUUID",
">",
"undelete",
"(",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsUUID",
">",
"modifiedResources",
"=",
"new",
"ArrayList",
"<",
"CmsUUID",
">",
"(",
")",
";",
"CmsObject",
"cms",
"=",
"m_context",
".",
"getCms... | Undeletes the selected files
@return the ids of the modified resources
@throws CmsException if something goes wrong | [
"Undeletes",
"the",
"selected",
"files"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/CmsUndeleteDialog.java#L132-L154 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.