id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
158,400
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
RemoteServiceProxy.getEncodedInstance
private static String getEncodedInstance(String encodedResponse) { if (isReturnValue(encodedResponse) || isThrownException(encodedResponse)) { return encodedResponse.substring(4); } return encodedResponse; }
java
private static String getEncodedInstance(String encodedResponse) { if (isReturnValue(encodedResponse) || isThrownException(encodedResponse)) { return encodedResponse.substring(4); } return encodedResponse; }
[ "private", "static", "String", "getEncodedInstance", "(", "String", "encodedResponse", ")", "{", "if", "(", "isReturnValue", "(", "encodedResponse", ")", "||", "isThrownException", "(", "encodedResponse", ")", ")", "{", "return", "encodedResponse", ".", "substring", "(", "4", ")", ";", "}", "return", "encodedResponse", ";", "}" ]
Returns a string that encodes the result of a method invocation. Effectively, this just removes any headers from the encoded response. @param encodedResponse @return string that encodes the result of a method invocation
[ "Returns", "a", "string", "that", "encodes", "the", "result", "of", "a", "method", "invocation", ".", "Effectively", "this", "just", "removes", "any", "headers", "from", "the", "encoded", "response", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java#L202-L208
158,401
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
RemoteServiceProxy.doInvoke
protected <T> Request doInvoke(ResponseReader responseReader, String methodName, RpcStatsContext statsContext, String requestData, AsyncCallback<T> callback) { RequestBuilder rb = doPrepareRequestBuilderImpl(responseReader, methodName, statsContext, requestData, callback); try { return rb.send(); } catch (RequestException ex) { InvocationException iex = new InvocationException( "Unable to initiate the asynchronous service invocation (" + methodName + ") -- check the network connection", ex); callback.onFailure(iex); } finally { if (statsContext.isStatsAvailable()) { statsContext.stats(statsContext.bytesStat(methodName, requestData.length(), "requestSent")); } } return null; }
java
protected <T> Request doInvoke(ResponseReader responseReader, String methodName, RpcStatsContext statsContext, String requestData, AsyncCallback<T> callback) { RequestBuilder rb = doPrepareRequestBuilderImpl(responseReader, methodName, statsContext, requestData, callback); try { return rb.send(); } catch (RequestException ex) { InvocationException iex = new InvocationException( "Unable to initiate the asynchronous service invocation (" + methodName + ") -- check the network connection", ex); callback.onFailure(iex); } finally { if (statsContext.isStatsAvailable()) { statsContext.stats(statsContext.bytesStat(methodName, requestData.length(), "requestSent")); } } return null; }
[ "protected", "<", "T", ">", "Request", "doInvoke", "(", "ResponseReader", "responseReader", ",", "String", "methodName", ",", "RpcStatsContext", "statsContext", ",", "String", "requestData", ",", "AsyncCallback", "<", "T", ">", "callback", ")", "{", "RequestBuilder", "rb", "=", "doPrepareRequestBuilderImpl", "(", "responseReader", ",", "methodName", ",", "statsContext", ",", "requestData", ",", "callback", ")", ";", "try", "{", "return", "rb", ".", "send", "(", ")", ";", "}", "catch", "(", "RequestException", "ex", ")", "{", "InvocationException", "iex", "=", "new", "InvocationException", "(", "\"Unable to initiate the asynchronous service invocation (\"", "+", "methodName", "+", "\") -- check the network connection\"", ",", "ex", ")", ";", "callback", ".", "onFailure", "(", "iex", ")", ";", "}", "finally", "{", "if", "(", "statsContext", ".", "isStatsAvailable", "(", ")", ")", "{", "statsContext", ".", "stats", "(", "statsContext", ".", "bytesStat", "(", "methodName", ",", "requestData", ".", "length", "(", ")", ",", "\"requestSent\"", ")", ")", ";", "}", "}", "return", "null", ";", "}" ]
Performs a remote service method invocation. This method is called by generated proxy classes. @param <T> return type for the AsyncCallback @param responseReader instance used to read the return value of the invocation @param requestData payload that encodes the addressing and arguments of the RPC call @param callback callback handler @return a {@link Request} object that can be used to track the request
[ "Performs", "a", "remote", "service", "method", "invocation", ".", "This", "method", "is", "called", "by", "generated", "proxy", "classes", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java#L374-L396
158,402
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
RemoteServiceProxy.doPrepareRequestBuilder
protected <T> RequestBuilder doPrepareRequestBuilder( ResponseReader responseReader, String methodName, RpcStatsContext statsContext, String requestData, AsyncCallback<T> callback) { RequestBuilder rb = doPrepareRequestBuilderImpl(responseReader, methodName, statsContext, requestData, callback); return rb; }
java
protected <T> RequestBuilder doPrepareRequestBuilder( ResponseReader responseReader, String methodName, RpcStatsContext statsContext, String requestData, AsyncCallback<T> callback) { RequestBuilder rb = doPrepareRequestBuilderImpl(responseReader, methodName, statsContext, requestData, callback); return rb; }
[ "protected", "<", "T", ">", "RequestBuilder", "doPrepareRequestBuilder", "(", "ResponseReader", "responseReader", ",", "String", "methodName", ",", "RpcStatsContext", "statsContext", ",", "String", "requestData", ",", "AsyncCallback", "<", "T", ">", "callback", ")", "{", "RequestBuilder", "rb", "=", "doPrepareRequestBuilderImpl", "(", "responseReader", ",", "methodName", ",", "statsContext", ",", "requestData", ",", "callback", ")", ";", "return", "rb", ";", "}" ]
Configures a RequestBuilder to send an RPC request when the RequestBuilder is intended to be returned through the asynchronous proxy interface. @param <T> return type for the AsyncCallback @param responseReader instance used to read the return value of the invocation @param requestData payload that encodes the addressing and arguments of the RPC call @param callback callback handler @return a RequestBuilder object that is ready to have its {@link RequestBuilder#send()} method invoked.
[ "Configures", "a", "RequestBuilder", "to", "send", "an", "RPC", "request", "when", "the", "RequestBuilder", "is", "intended", "to", "be", "returned", "through", "the", "asynchronous", "proxy", "interface", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java#L412-L420
158,403
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
RemoteServiceProxy.doPrepareRequestBuilderImpl
private <T> RequestBuilder doPrepareRequestBuilderImpl( ResponseReader responseReader, String methodName, RpcStatsContext statsContext, String requestData, AsyncCallback<T> callback) { if (getServiceEntryPoint() == null) { throw new NoServiceEntryPointSpecifiedException(); } RequestCallback responseHandler = doCreateRequestCallback(responseReader, methodName, statsContext, callback); ensureRpcRequestBuilder(); rpcRequestBuilder.create(getServiceEntryPoint()); rpcRequestBuilder.setCallback(responseHandler); // changed code rpcRequestBuilder.setSync(isSync(methodName)); // changed code rpcRequestBuilder.setContentType(RPC_CONTENT_TYPE); rpcRequestBuilder.setRequestData(requestData); rpcRequestBuilder.setRequestId(statsContext.getRequestId()); return rpcRequestBuilder.finish(); }
java
private <T> RequestBuilder doPrepareRequestBuilderImpl( ResponseReader responseReader, String methodName, RpcStatsContext statsContext, String requestData, AsyncCallback<T> callback) { if (getServiceEntryPoint() == null) { throw new NoServiceEntryPointSpecifiedException(); } RequestCallback responseHandler = doCreateRequestCallback(responseReader, methodName, statsContext, callback); ensureRpcRequestBuilder(); rpcRequestBuilder.create(getServiceEntryPoint()); rpcRequestBuilder.setCallback(responseHandler); // changed code rpcRequestBuilder.setSync(isSync(methodName)); // changed code rpcRequestBuilder.setContentType(RPC_CONTENT_TYPE); rpcRequestBuilder.setRequestData(requestData); rpcRequestBuilder.setRequestId(statsContext.getRequestId()); return rpcRequestBuilder.finish(); }
[ "private", "<", "T", ">", "RequestBuilder", "doPrepareRequestBuilderImpl", "(", "ResponseReader", "responseReader", ",", "String", "methodName", ",", "RpcStatsContext", "statsContext", ",", "String", "requestData", ",", "AsyncCallback", "<", "T", ">", "callback", ")", "{", "if", "(", "getServiceEntryPoint", "(", ")", "==", "null", ")", "{", "throw", "new", "NoServiceEntryPointSpecifiedException", "(", ")", ";", "}", "RequestCallback", "responseHandler", "=", "doCreateRequestCallback", "(", "responseReader", ",", "methodName", ",", "statsContext", ",", "callback", ")", ";", "ensureRpcRequestBuilder", "(", ")", ";", "rpcRequestBuilder", ".", "create", "(", "getServiceEntryPoint", "(", ")", ")", ";", "rpcRequestBuilder", ".", "setCallback", "(", "responseHandler", ")", ";", "// changed code", "rpcRequestBuilder", ".", "setSync", "(", "isSync", "(", "methodName", ")", ")", ";", "// changed code", "rpcRequestBuilder", ".", "setContentType", "(", "RPC_CONTENT_TYPE", ")", ";", "rpcRequestBuilder", ".", "setRequestData", "(", "requestData", ")", ";", "rpcRequestBuilder", ".", "setRequestId", "(", "statsContext", ".", "getRequestId", "(", ")", ")", ";", "return", "rpcRequestBuilder", ".", "finish", "(", ")", ";", "}" ]
Configures a RequestBuilder to send an RPC request. @param <T> return type for the AsyncCallback @param responseReader instance used to read the return value of the invocation @param requestData payload that encodes the addressing and arguments of the RPC call @param callback callback handler @return a RequestBuilder object that is ready to have its {@link RequestBuilder#send()} method invoked.
[ "Configures", "a", "RequestBuilder", "to", "send", "an", "RPC", "request", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java#L435-L459
158,404
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java
CmsCategoryTree.deselectChildren
private void deselectChildren(CmsTreeItem item) { for (String childId : m_childrens.get(item.getId())) { CmsTreeItem child = m_categories.get(childId); deselectChildren(child); child.getCheckBox().setChecked(false); if (m_selectedCategories.contains(childId)) { m_selectedCategories.remove(childId); } } }
java
private void deselectChildren(CmsTreeItem item) { for (String childId : m_childrens.get(item.getId())) { CmsTreeItem child = m_categories.get(childId); deselectChildren(child); child.getCheckBox().setChecked(false); if (m_selectedCategories.contains(childId)) { m_selectedCategories.remove(childId); } } }
[ "private", "void", "deselectChildren", "(", "CmsTreeItem", "item", ")", "{", "for", "(", "String", "childId", ":", "m_childrens", ".", "get", "(", "item", ".", "getId", "(", ")", ")", ")", "{", "CmsTreeItem", "child", "=", "m_categories", ".", "get", "(", "childId", ")", ";", "deselectChildren", "(", "child", ")", ";", "child", ".", "getCheckBox", "(", ")", ".", "setChecked", "(", "false", ")", ";", "if", "(", "m_selectedCategories", ".", "contains", "(", "childId", ")", ")", "{", "m_selectedCategories", ".", "remove", "(", "childId", ")", ";", "}", "}", "}" ]
Deselects all child items of the provided item. @param item the item for which all childs should be deselected.d
[ "Deselects", "all", "child", "items", "of", "the", "provided", "item", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java#L972-L982
158,405
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java
CmsCategoryTree.normalizeSelectedCategories
private void normalizeSelectedCategories() { Collection<String> normalizedCategories = new ArrayList<String>(m_selectedCategories.size()); for (CmsTreeItem item : m_categories.values()) { if (item.getCheckBox().isChecked()) { normalizedCategories.add(item.getId()); } } m_selectedCategories = normalizedCategories; }
java
private void normalizeSelectedCategories() { Collection<String> normalizedCategories = new ArrayList<String>(m_selectedCategories.size()); for (CmsTreeItem item : m_categories.values()) { if (item.getCheckBox().isChecked()) { normalizedCategories.add(item.getId()); } } m_selectedCategories = normalizedCategories; }
[ "private", "void", "normalizeSelectedCategories", "(", ")", "{", "Collection", "<", "String", ">", "normalizedCategories", "=", "new", "ArrayList", "<", "String", ">", "(", "m_selectedCategories", ".", "size", "(", ")", ")", ";", "for", "(", "CmsTreeItem", "item", ":", "m_categories", ".", "values", "(", ")", ")", "{", "if", "(", "item", ".", "getCheckBox", "(", ")", ".", "isChecked", "(", ")", ")", "{", "normalizedCategories", ".", "add", "(", "item", ".", "getId", "(", ")", ")", ";", "}", "}", "m_selectedCategories", "=", "normalizedCategories", ";", "}" ]
Normalize the list of selected categories to fit for the ids of the tree items.
[ "Normalize", "the", "list", "of", "selected", "categories", "to", "fit", "for", "the", "ids", "of", "the", "tree", "items", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java#L1003-L1013
158,406
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java
CmsCategoryTree.uncheckAll
private void uncheckAll(CmsList<? extends I_CmsListItem> list) { for (Widget it : list) { CmsTreeItem treeItem = (CmsTreeItem)it; treeItem.getCheckBox().setChecked(false); uncheckAll(treeItem.getChildren()); } }
java
private void uncheckAll(CmsList<? extends I_CmsListItem> list) { for (Widget it : list) { CmsTreeItem treeItem = (CmsTreeItem)it; treeItem.getCheckBox().setChecked(false); uncheckAll(treeItem.getChildren()); } }
[ "private", "void", "uncheckAll", "(", "CmsList", "<", "?", "extends", "I_CmsListItem", ">", "list", ")", "{", "for", "(", "Widget", "it", ":", "list", ")", "{", "CmsTreeItem", "treeItem", "=", "(", "CmsTreeItem", ")", "it", ";", "treeItem", ".", "getCheckBox", "(", ")", ".", "setChecked", "(", "false", ")", ";", "uncheckAll", "(", "treeItem", ".", "getChildren", "(", ")", ")", ";", "}", "}" ]
Uncheck all items in the list including all sub-items. @param list list of CmsTreeItem entries.
[ "Uncheck", "all", "items", "in", "the", "list", "including", "all", "sub", "-", "items", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java#L1053-L1060
158,407
alkacon/opencms-core
src/org/opencms/widgets/Messages.java
Messages.getButtonName
public static String getButtonName(String gallery) { StringBuffer sb = new StringBuffer(GUI_BUTTON_PREF); sb.append(gallery.toUpperCase()); sb.append(GUI_BUTTON_SUF); return sb.toString(); }
java
public static String getButtonName(String gallery) { StringBuffer sb = new StringBuffer(GUI_BUTTON_PREF); sb.append(gallery.toUpperCase()); sb.append(GUI_BUTTON_SUF); return sb.toString(); }
[ "public", "static", "String", "getButtonName", "(", "String", "gallery", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "GUI_BUTTON_PREF", ")", ";", "sb", ".", "append", "(", "gallery", ".", "toUpperCase", "(", ")", ")", ";", "sb", ".", "append", "(", "GUI_BUTTON_SUF", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Create button message key. @param gallery name @return Button message key as String
[ "Create", "button", "message", "key", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/Messages.java#L181-L187
158,408
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.addDescriptor
public boolean addDescriptor() { saveLocalization(); IndexedContainer oldContainer = m_container; try { createAndLockDescriptorFile(); unmarshalDescriptor(); updateBundleDescriptorContent(); m_hasMasterMode = true; m_container = createContainer(); m_editorState.put(EditMode.DEFAULT, getDefaultState()); m_editorState.put(EditMode.MASTER, getMasterState()); } catch (CmsException | IOException e) { LOG.error(e.getLocalizedMessage(), e); if (m_descContent != null) { m_descContent = null; } if (m_descFile != null) { m_descFile = null; } if (m_desc != null) { try { m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1)); } catch (CmsException ex) { LOG.error(ex.getLocalizedMessage(), ex); } m_desc = null; } m_hasMasterMode = false; m_container = oldContainer; return false; } m_removeDescriptorOnCancel = true; return true; }
java
public boolean addDescriptor() { saveLocalization(); IndexedContainer oldContainer = m_container; try { createAndLockDescriptorFile(); unmarshalDescriptor(); updateBundleDescriptorContent(); m_hasMasterMode = true; m_container = createContainer(); m_editorState.put(EditMode.DEFAULT, getDefaultState()); m_editorState.put(EditMode.MASTER, getMasterState()); } catch (CmsException | IOException e) { LOG.error(e.getLocalizedMessage(), e); if (m_descContent != null) { m_descContent = null; } if (m_descFile != null) { m_descFile = null; } if (m_desc != null) { try { m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1)); } catch (CmsException ex) { LOG.error(ex.getLocalizedMessage(), ex); } m_desc = null; } m_hasMasterMode = false; m_container = oldContainer; return false; } m_removeDescriptorOnCancel = true; return true; }
[ "public", "boolean", "addDescriptor", "(", ")", "{", "saveLocalization", "(", ")", ";", "IndexedContainer", "oldContainer", "=", "m_container", ";", "try", "{", "createAndLockDescriptorFile", "(", ")", ";", "unmarshalDescriptor", "(", ")", ";", "updateBundleDescriptorContent", "(", ")", ";", "m_hasMasterMode", "=", "true", ";", "m_container", "=", "createContainer", "(", ")", ";", "m_editorState", ".", "put", "(", "EditMode", ".", "DEFAULT", ",", "getDefaultState", "(", ")", ")", ";", "m_editorState", ".", "put", "(", "EditMode", ".", "MASTER", ",", "getMasterState", "(", ")", ")", ";", "}", "catch", "(", "CmsException", "|", "IOException", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "if", "(", "m_descContent", "!=", "null", ")", "{", "m_descContent", "=", "null", ";", "}", "if", "(", "m_descFile", "!=", "null", ")", "{", "m_descFile", "=", "null", ";", "}", "if", "(", "m_desc", "!=", "null", ")", "{", "try", "{", "m_cms", ".", "deleteResource", "(", "m_desc", ",", "CmsResourceDeleteMode", ".", "valueOf", "(", "1", ")", ")", ";", "}", "catch", "(", "CmsException", "ex", ")", "{", "LOG", ".", "error", "(", "ex", ".", "getLocalizedMessage", "(", ")", ",", "ex", ")", ";", "}", "m_desc", "=", "null", ";", "}", "m_hasMasterMode", "=", "false", ";", "m_container", "=", "oldContainer", ";", "return", "false", ";", "}", "m_removeDescriptorOnCancel", "=", "true", ";", "return", "true", ";", "}" ]
Creates a descriptor for the currently edited message bundle. @return <code>true</code> if the descriptor could be created, <code>false</code> otherwise.
[ "Creates", "a", "descriptor", "for", "the", "currently", "edited", "message", "bundle", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L562-L596
158,409
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.deleteDescriptorIfNecessary
public void deleteDescriptorIfNecessary() throws CmsException { if (m_removeDescriptorOnCancel && (m_desc != null)) { m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(2)); } }
java
public void deleteDescriptorIfNecessary() throws CmsException { if (m_removeDescriptorOnCancel && (m_desc != null)) { m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(2)); } }
[ "public", "void", "deleteDescriptorIfNecessary", "(", ")", "throws", "CmsException", "{", "if", "(", "m_removeDescriptorOnCancel", "&&", "(", "m_desc", "!=", "null", ")", ")", "{", "m_cms", ".", "deleteResource", "(", "m_desc", ",", "CmsResourceDeleteMode", ".", "valueOf", "(", "2", ")", ")", ";", "}", "}" ]
When the descriptor was added while editing, but the change was not saved, it has to be removed when the editor is closed. @throws CmsException thrown when deleting the descriptor resource fails
[ "When", "the", "descriptor", "was", "added", "while", "editing", "but", "the", "change", "was", "not", "saved", "it", "has", "to", "be", "removed", "when", "the", "editor", "is", "closed", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L612-L618
158,410
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getConfigurableMessages
public ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, Locale locale) { return new ConfigurableMessages(defaultMessages, locale, m_configuredBundle); }
java
public ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, Locale locale) { return new ConfigurableMessages(defaultMessages, locale, m_configuredBundle); }
[ "public", "ConfigurableMessages", "getConfigurableMessages", "(", "CmsMessages", "defaultMessages", ",", "Locale", "locale", ")", "{", "return", "new", "ConfigurableMessages", "(", "defaultMessages", ",", "locale", ",", "m_configuredBundle", ")", ";", "}" ]
Returns the configured bundle, or the provided default bundle. @param defaultMessages the default bundle @param locale the preferred locale @return the configured bundle or, if not found, the default bundle.
[ "Returns", "the", "configured", "bundle", "or", "the", "provided", "default", "bundle", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L642-L646
158,411
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getContextMenuForItem
public CmsContextMenu getContextMenuForItem(Object itemId) { CmsContextMenu result = null; try { final Item item = m_container.getItem(itemId); Property<?> keyProp = item.getItemProperty(TableProperty.KEY); String key = (String)keyProp.getValue(); if ((null != key) && !key.isEmpty()) { loadAllRemainingLocalizations(); final Map<Locale, String> localesWithEntries = new HashMap<Locale, String>(); for (Locale l : m_localizations.keySet()) { if (l != m_locale) { String value = m_localizations.get(l).getProperty(key); if ((null != value) && !value.isEmpty()) { localesWithEntries.put(l, value); } } } if (!localesWithEntries.isEmpty()) { result = new CmsContextMenu(); ContextMenuItem mainItem = result.addItem( Messages.get().getBundle(UI.getCurrent().getLocale()).key( Messages.GUI_BUNDLE_EDITOR_CONTEXT_COPY_LOCALE_0)); for (final Locale l : localesWithEntries.keySet()) { ContextMenuItem menuItem = mainItem.addItem(l.getDisplayName(UI.getCurrent().getLocale())); menuItem.addItemClickListener(new ContextMenuItemClickListener() { public void contextMenuItemClicked(ContextMenuItemClickEvent event) { item.getItemProperty(TableProperty.TRANSLATION).setValue(localesWithEntries.get(l)); } }); } } } } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); //TODO: Improve } return result; }
java
public CmsContextMenu getContextMenuForItem(Object itemId) { CmsContextMenu result = null; try { final Item item = m_container.getItem(itemId); Property<?> keyProp = item.getItemProperty(TableProperty.KEY); String key = (String)keyProp.getValue(); if ((null != key) && !key.isEmpty()) { loadAllRemainingLocalizations(); final Map<Locale, String> localesWithEntries = new HashMap<Locale, String>(); for (Locale l : m_localizations.keySet()) { if (l != m_locale) { String value = m_localizations.get(l).getProperty(key); if ((null != value) && !value.isEmpty()) { localesWithEntries.put(l, value); } } } if (!localesWithEntries.isEmpty()) { result = new CmsContextMenu(); ContextMenuItem mainItem = result.addItem( Messages.get().getBundle(UI.getCurrent().getLocale()).key( Messages.GUI_BUNDLE_EDITOR_CONTEXT_COPY_LOCALE_0)); for (final Locale l : localesWithEntries.keySet()) { ContextMenuItem menuItem = mainItem.addItem(l.getDisplayName(UI.getCurrent().getLocale())); menuItem.addItemClickListener(new ContextMenuItemClickListener() { public void contextMenuItemClicked(ContextMenuItemClickEvent event) { item.getItemProperty(TableProperty.TRANSLATION).setValue(localesWithEntries.get(l)); } }); } } } } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); //TODO: Improve } return result; }
[ "public", "CmsContextMenu", "getContextMenuForItem", "(", "Object", "itemId", ")", "{", "CmsContextMenu", "result", "=", "null", ";", "try", "{", "final", "Item", "item", "=", "m_container", ".", "getItem", "(", "itemId", ")", ";", "Property", "<", "?", ">", "keyProp", "=", "item", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ";", "String", "key", "=", "(", "String", ")", "keyProp", ".", "getValue", "(", ")", ";", "if", "(", "(", "null", "!=", "key", ")", "&&", "!", "key", ".", "isEmpty", "(", ")", ")", "{", "loadAllRemainingLocalizations", "(", ")", ";", "final", "Map", "<", "Locale", ",", "String", ">", "localesWithEntries", "=", "new", "HashMap", "<", "Locale", ",", "String", ">", "(", ")", ";", "for", "(", "Locale", "l", ":", "m_localizations", ".", "keySet", "(", ")", ")", "{", "if", "(", "l", "!=", "m_locale", ")", "{", "String", "value", "=", "m_localizations", ".", "get", "(", "l", ")", ".", "getProperty", "(", "key", ")", ";", "if", "(", "(", "null", "!=", "value", ")", "&&", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "localesWithEntries", ".", "put", "(", "l", ",", "value", ")", ";", "}", "}", "}", "if", "(", "!", "localesWithEntries", ".", "isEmpty", "(", ")", ")", "{", "result", "=", "new", "CmsContextMenu", "(", ")", ";", "ContextMenuItem", "mainItem", "=", "result", ".", "addItem", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "UI", ".", "getCurrent", "(", ")", ".", "getLocale", "(", ")", ")", ".", "key", "(", "Messages", ".", "GUI_BUNDLE_EDITOR_CONTEXT_COPY_LOCALE_0", ")", ")", ";", "for", "(", "final", "Locale", "l", ":", "localesWithEntries", ".", "keySet", "(", ")", ")", "{", "ContextMenuItem", "menuItem", "=", "mainItem", ".", "addItem", "(", "l", ".", "getDisplayName", "(", "UI", ".", "getCurrent", "(", ")", ".", "getLocale", "(", ")", ")", ")", ";", "menuItem", ".", "addItemClickListener", "(", "new", "ContextMenuItemClickListener", "(", ")", "{", "public", "void", "contextMenuItemClicked", "(", "ContextMenuItemClickEvent", "event", ")", "{", "item", ".", "getItemProperty", "(", "TableProperty", ".", "TRANSLATION", ")", ".", "setValue", "(", "localesWithEntries", ".", "get", "(", "l", ")", ")", ";", "}", "}", ")", ";", "}", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "//TODO: Improve", "}", "return", "result", ";", "}" ]
Returns the context menu for the table item. @param itemId the table item. @return the context menu for the given item.
[ "Returns", "the", "context", "menu", "for", "the", "table", "item", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L667-L709
158,412
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getEditableColumns
public List<TableProperty> getEditableColumns(CmsMessageBundleEditorTypes.EditMode mode) { return m_editorState.get(mode).getEditableColumns(); }
java
public List<TableProperty> getEditableColumns(CmsMessageBundleEditorTypes.EditMode mode) { return m_editorState.get(mode).getEditableColumns(); }
[ "public", "List", "<", "TableProperty", ">", "getEditableColumns", "(", "CmsMessageBundleEditorTypes", ".", "EditMode", "mode", ")", "{", "return", "m_editorState", ".", "get", "(", "mode", ")", ".", "getEditableColumns", "(", ")", ";", "}" ]
Returns the editable columns for the provided edit mode. @param mode the edit mode. @return the editable columns for the provided edit mode.
[ "Returns", "the", "editable", "columns", "for", "the", "provided", "edit", "mode", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L725-L728
158,413
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getEditedFilePath
public String getEditedFilePath() { switch (getBundleType()) { case DESCRIPTOR: return m_cms.getSitePath(m_desc); case PROPERTY: return null != m_lockedBundleFiles.get(getLocale()) ? m_cms.getSitePath(m_lockedBundleFiles.get(getLocale()).getFile()) : m_cms.getSitePath(m_resource); case XML: return m_cms.getSitePath(m_resource); default: throw new IllegalArgumentException(); } }
java
public String getEditedFilePath() { switch (getBundleType()) { case DESCRIPTOR: return m_cms.getSitePath(m_desc); case PROPERTY: return null != m_lockedBundleFiles.get(getLocale()) ? m_cms.getSitePath(m_lockedBundleFiles.get(getLocale()).getFile()) : m_cms.getSitePath(m_resource); case XML: return m_cms.getSitePath(m_resource); default: throw new IllegalArgumentException(); } }
[ "public", "String", "getEditedFilePath", "(", ")", "{", "switch", "(", "getBundleType", "(", ")", ")", "{", "case", "DESCRIPTOR", ":", "return", "m_cms", ".", "getSitePath", "(", "m_desc", ")", ";", "case", "PROPERTY", ":", "return", "null", "!=", "m_lockedBundleFiles", ".", "get", "(", "getLocale", "(", ")", ")", "?", "m_cms", ".", "getSitePath", "(", "m_lockedBundleFiles", ".", "get", "(", "getLocale", "(", ")", ")", ".", "getFile", "(", ")", ")", ":", "m_cms", ".", "getSitePath", "(", "m_resource", ")", ";", "case", "XML", ":", "return", "m_cms", ".", "getSitePath", "(", "m_resource", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}" ]
Returns the site path for the edited bundle file. @return the site path for the edited bundle file.
[ "Returns", "the", "site", "path", "for", "the", "edited", "bundle", "file", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L735-L749
158,414
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.handleChange
public void handleChange(Object propertyId) { try { lockOnChange(propertyId); } catch (CmsException e) { LOG.debug(e); } if (isDescriptorProperty(propertyId)) { m_descriptorHasChanges = true; } if (isBundleProperty(propertyId)) { m_changedTranslations.add(getLocale()); } }
java
public void handleChange(Object propertyId) { try { lockOnChange(propertyId); } catch (CmsException e) { LOG.debug(e); } if (isDescriptorProperty(propertyId)) { m_descriptorHasChanges = true; } if (isBundleProperty(propertyId)) { m_changedTranslations.add(getLocale()); } }
[ "public", "void", "handleChange", "(", "Object", "propertyId", ")", "{", "try", "{", "lockOnChange", "(", "propertyId", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "debug", "(", "e", ")", ";", "}", "if", "(", "isDescriptorProperty", "(", "propertyId", ")", ")", "{", "m_descriptorHasChanges", "=", "true", ";", "}", "if", "(", "isBundleProperty", "(", "propertyId", ")", ")", "{", "m_changedTranslations", ".", "add", "(", "getLocale", "(", ")", ")", ";", "}", "}" ]
Handles the change of a value in the current translation. @param propertyId the property id of the column where the value has changed.
[ "Handles", "the", "change", "of", "a", "value", "in", "the", "current", "translation", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L792-L806
158,415
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.handleKeyChange
public KeyChangeResult handleKeyChange(EntryChangeEvent event, boolean allLanguages) { if (m_keyset.getKeySet().contains(event.getNewValue())) { m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue()); return KeyChangeResult.FAILED_DUPLICATED_KEY; } if (allLanguages && !renameKeyForAllLanguages(event.getOldValue(), event.getNewValue())) { m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue()); return KeyChangeResult.FAILED_FOR_OTHER_LANGUAGE; } return KeyChangeResult.SUCCESS; }
java
public KeyChangeResult handleKeyChange(EntryChangeEvent event, boolean allLanguages) { if (m_keyset.getKeySet().contains(event.getNewValue())) { m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue()); return KeyChangeResult.FAILED_DUPLICATED_KEY; } if (allLanguages && !renameKeyForAllLanguages(event.getOldValue(), event.getNewValue())) { m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue()); return KeyChangeResult.FAILED_FOR_OTHER_LANGUAGE; } return KeyChangeResult.SUCCESS; }
[ "public", "KeyChangeResult", "handleKeyChange", "(", "EntryChangeEvent", "event", ",", "boolean", "allLanguages", ")", "{", "if", "(", "m_keyset", ".", "getKeySet", "(", ")", ".", "contains", "(", "event", ".", "getNewValue", "(", ")", ")", ")", "{", "m_container", ".", "getItem", "(", "event", ".", "getItemId", "(", ")", ")", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ".", "setValue", "(", "event", ".", "getOldValue", "(", ")", ")", ";", "return", "KeyChangeResult", ".", "FAILED_DUPLICATED_KEY", ";", "}", "if", "(", "allLanguages", "&&", "!", "renameKeyForAllLanguages", "(", "event", ".", "getOldValue", "(", ")", ",", "event", ".", "getNewValue", "(", ")", ")", ")", "{", "m_container", ".", "getItem", "(", "event", ".", "getItemId", "(", ")", ")", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ".", "setValue", "(", "event", ".", "getOldValue", "(", ")", ")", ";", "return", "KeyChangeResult", ".", "FAILED_FOR_OTHER_LANGUAGE", ";", "}", "return", "KeyChangeResult", ".", "SUCCESS", ";", "}" ]
Handles a key change. @param event the key change event. @param allLanguages <code>true</code> for changing the key for all languages, <code>false</code> if the key should be changed only for the current language. @return result, indicating if the key change was successful.
[ "Handles", "a", "key", "change", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L815-L826
158,416
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.handleKeyDeletion
public boolean handleKeyDeletion(final String key) { if (m_keyset.getKeySet().contains(key)) { if (removeKeyForAllLanguages(key)) { m_keyset.removeKey(key); return true; } else { return false; } } return true; }
java
public boolean handleKeyDeletion(final String key) { if (m_keyset.getKeySet().contains(key)) { if (removeKeyForAllLanguages(key)) { m_keyset.removeKey(key); return true; } else { return false; } } return true; }
[ "public", "boolean", "handleKeyDeletion", "(", "final", "String", "key", ")", "{", "if", "(", "m_keyset", ".", "getKeySet", "(", ")", ".", "contains", "(", "key", ")", ")", "{", "if", "(", "removeKeyForAllLanguages", "(", "key", ")", ")", "{", "m_keyset", ".", "removeKey", "(", "key", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Handles the deletion of a key. @param key the deleted key. @return <code>true</code> if the deletion was successful, <code>false</code> otherwise.
[ "Handles", "the", "deletion", "of", "a", "key", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L833-L844
158,417
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.publish
public void publish() { CmsDirectPublishDialogAction action = new CmsDirectPublishDialogAction(); List<CmsResource> resources = getBundleResources(); I_CmsDialogContext context = new A_CmsDialogContext("", ContextType.appToolbar, resources) { public void focus(CmsUUID structureId) { //Nothing to do. } public List<CmsUUID> getAllStructureIdsInView() { return null; } public void updateUserInfo() { //Nothing to do. } }; action.executeAction(context); updateLockInformation(); }
java
public void publish() { CmsDirectPublishDialogAction action = new CmsDirectPublishDialogAction(); List<CmsResource> resources = getBundleResources(); I_CmsDialogContext context = new A_CmsDialogContext("", ContextType.appToolbar, resources) { public void focus(CmsUUID structureId) { //Nothing to do. } public List<CmsUUID> getAllStructureIdsInView() { return null; } public void updateUserInfo() { //Nothing to do. } }; action.executeAction(context); updateLockInformation(); }
[ "public", "void", "publish", "(", ")", "{", "CmsDirectPublishDialogAction", "action", "=", "new", "CmsDirectPublishDialogAction", "(", ")", ";", "List", "<", "CmsResource", ">", "resources", "=", "getBundleResources", "(", ")", ";", "I_CmsDialogContext", "context", "=", "new", "A_CmsDialogContext", "(", "\"\"", ",", "ContextType", ".", "appToolbar", ",", "resources", ")", "{", "public", "void", "focus", "(", "CmsUUID", "structureId", ")", "{", "//Nothing to do.", "}", "public", "List", "<", "CmsUUID", ">", "getAllStructureIdsInView", "(", ")", "{", "return", "null", ";", "}", "public", "void", "updateUserInfo", "(", ")", "{", "//Nothing to do.", "}", "}", ";", "action", ".", "executeAction", "(", "context", ")", ";", "updateLockInformation", "(", ")", ";", "}" ]
Publish the bundle resources directly.
[ "Publish", "the", "bundle", "resources", "directly", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L904-L928
158,418
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.save
public void save() throws CmsException { if (hasChanges()) { switch (m_bundleType) { case PROPERTY: saveLocalization(); saveToPropertyVfsBundle(); break; case XML: saveLocalization(); saveToXmlVfsBundle(); break; case DESCRIPTOR: break; default: throw new IllegalArgumentException(); } if (null != m_descFile) { saveToBundleDescriptor(); } resetChanges(); } }
java
public void save() throws CmsException { if (hasChanges()) { switch (m_bundleType) { case PROPERTY: saveLocalization(); saveToPropertyVfsBundle(); break; case XML: saveLocalization(); saveToXmlVfsBundle(); break; case DESCRIPTOR: break; default: throw new IllegalArgumentException(); } if (null != m_descFile) { saveToBundleDescriptor(); } resetChanges(); } }
[ "public", "void", "save", "(", ")", "throws", "CmsException", "{", "if", "(", "hasChanges", "(", ")", ")", "{", "switch", "(", "m_bundleType", ")", "{", "case", "PROPERTY", ":", "saveLocalization", "(", ")", ";", "saveToPropertyVfsBundle", "(", ")", ";", "break", ";", "case", "XML", ":", "saveLocalization", "(", ")", ";", "saveToXmlVfsBundle", "(", ")", ";", "break", ";", "case", "DESCRIPTOR", ":", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "null", "!=", "m_descFile", ")", "{", "saveToBundleDescriptor", "(", ")", ";", "}", "resetChanges", "(", ")", ";", "}", "}" ]
Saves the messages for all languages that were opened in the editor. @throws CmsException thrown if saving fails.
[ "Saves", "the", "messages", "for", "all", "languages", "that", "were", "opened", "in", "the", "editor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L935-L962
158,419
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.saveAsPropertyBundle
public void saveAsPropertyBundle() throws UnsupportedEncodingException, CmsException, IOException { switch (m_bundleType) { case XML: saveLocalization(); loadAllRemainingLocalizations(); createPropertyVfsBundleFiles(); saveToPropertyVfsBundle(); m_bundleType = BundleType.PROPERTY; removeXmlBundleFile(); break; default: throw new IllegalArgumentException( "The method should only be called when editing an XMLResourceBundle."); } }
java
public void saveAsPropertyBundle() throws UnsupportedEncodingException, CmsException, IOException { switch (m_bundleType) { case XML: saveLocalization(); loadAllRemainingLocalizations(); createPropertyVfsBundleFiles(); saveToPropertyVfsBundle(); m_bundleType = BundleType.PROPERTY; removeXmlBundleFile(); break; default: throw new IllegalArgumentException( "The method should only be called when editing an XMLResourceBundle."); } }
[ "public", "void", "saveAsPropertyBundle", "(", ")", "throws", "UnsupportedEncodingException", ",", "CmsException", ",", "IOException", "{", "switch", "(", "m_bundleType", ")", "{", "case", "XML", ":", "saveLocalization", "(", ")", ";", "loadAllRemainingLocalizations", "(", ")", ";", "createPropertyVfsBundleFiles", "(", ")", ";", "saveToPropertyVfsBundle", "(", ")", ";", "m_bundleType", "=", "BundleType", ".", "PROPERTY", ";", "removeXmlBundleFile", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"The method should only be called when editing an XMLResourceBundle.\"", ")", ";", "}", "}" ]
Saves the loaded XML bundle as property bundle. @throws UnsupportedEncodingException thrown if localizations from the XML bundle could not be loaded correctly. @throws CmsException thrown if any of the interactions with the VFS fails. @throws IOException thrown if localizations from the XML bundle could not be loaded correctly.
[ "Saves", "the", "loaded", "XML", "bundle", "as", "property", "bundle", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L970-L987
158,420
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.unlock
public void unlock() { for (Locale l : m_lockedBundleFiles.keySet()) { LockedFile f = m_lockedBundleFiles.get(l); f.tryUnlock(); } if (null != m_descFile) { m_descFile.tryUnlock(); } }
java
public void unlock() { for (Locale l : m_lockedBundleFiles.keySet()) { LockedFile f = m_lockedBundleFiles.get(l); f.tryUnlock(); } if (null != m_descFile) { m_descFile.tryUnlock(); } }
[ "public", "void", "unlock", "(", ")", "{", "for", "(", "Locale", "l", ":", "m_lockedBundleFiles", ".", "keySet", "(", ")", ")", "{", "LockedFile", "f", "=", "m_lockedBundleFiles", ".", "get", "(", "l", ")", ";", "f", ".", "tryUnlock", "(", ")", ";", "}", "if", "(", "null", "!=", "m_descFile", ")", "{", "m_descFile", ".", "tryUnlock", "(", ")", ";", "}", "}" ]
Unlock all files opened for writing.
[ "Unlock", "all", "files", "opened", "for", "writing", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1025-L1034
158,421
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getBundleResources
List<CmsResource> getBundleResources() { List<CmsResource> resources = new ArrayList<>(m_bundleFiles.values()); if (m_desc != null) { resources.add(m_desc); } return resources; }
java
List<CmsResource> getBundleResources() { List<CmsResource> resources = new ArrayList<>(m_bundleFiles.values()); if (m_desc != null) { resources.add(m_desc); } return resources; }
[ "List", "<", "CmsResource", ">", "getBundleResources", "(", ")", "{", "List", "<", "CmsResource", ">", "resources", "=", "new", "ArrayList", "<>", "(", "m_bundleFiles", ".", "values", "(", ")", ")", ";", "if", "(", "m_desc", "!=", "null", ")", "{", "resources", ".", "add", "(", "m_desc", ")", ";", "}", "return", "resources", ";", "}" ]
Returns all resources that belong to the bundle This includes the descriptor if one exists. @return List of the bundle resources, including the descriptor.
[ "Returns", "all", "resources", "that", "belong", "to", "the", "bundle", "This", "includes", "the", "descriptor", "if", "one", "exists", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1042-L1050
158,422
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.createAndLockDescriptorFile
private void createAndLockDescriptorFile() throws CmsException { String sitePath = m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX; m_desc = m_cms.createResource( sitePath, OpenCms.getResourceManager().getResourceType(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString())); m_descFile = LockedFile.lockResource(m_cms, m_desc); m_descFile.setCreated(true); }
java
private void createAndLockDescriptorFile() throws CmsException { String sitePath = m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX; m_desc = m_cms.createResource( sitePath, OpenCms.getResourceManager().getResourceType(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString())); m_descFile = LockedFile.lockResource(m_cms, m_desc); m_descFile.setCreated(true); }
[ "private", "void", "createAndLockDescriptorFile", "(", ")", "throws", "CmsException", "{", "String", "sitePath", "=", "m_sitepath", "+", "m_basename", "+", "CmsMessageBundleEditorTypes", ".", "Descriptor", ".", "POSTFIX", ";", "m_desc", "=", "m_cms", ".", "createResource", "(", "sitePath", ",", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "CmsMessageBundleEditorTypes", ".", "BundleType", ".", "DESCRIPTOR", ".", "toString", "(", ")", ")", ")", ";", "m_descFile", "=", "LockedFile", ".", "lockResource", "(", "m_cms", ",", "m_desc", ")", ";", "m_descFile", ".", "setCreated", "(", "true", ")", ";", "}" ]
Creates a descriptor for the bundle in the same folder where the bundle files are located. @throws CmsException thrown if creation fails.
[ "Creates", "a", "descriptor", "for", "the", "bundle", "in", "the", "same", "folder", "where", "the", "bundle", "files", "are", "located", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1069-L1077
158,423
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.createContainerForBundleWithDescriptor
private IndexedContainer createContainerForBundleWithDescriptor() throws IOException, CmsException { IndexedContainer container = new IndexedContainer(); // create properties container.addContainerProperty(TableProperty.KEY, String.class, ""); container.addContainerProperty(TableProperty.DESCRIPTION, String.class, ""); container.addContainerProperty(TableProperty.DEFAULT, String.class, ""); container.addContainerProperty(TableProperty.TRANSLATION, String.class, ""); // add entries SortedProperties localization = getLocalization(m_locale); CmsXmlContentValueSequence messages = m_descContent.getValueSequence(Descriptor.N_MESSAGE, Descriptor.LOCALE); String descValue; boolean hasDescription = false; String defaultValue; boolean hasDefault = false; for (int i = 0; i < messages.getElementCount(); i++) { String prefix = messages.getValue(i).getPath() + "/"; Object itemId = container.addItem(); Item item = container.getItem(itemId); String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms); item.getItemProperty(TableProperty.KEY).setValue(key); String translation = localization.getProperty(key); item.getItemProperty(TableProperty.TRANSLATION).setValue(null == translation ? "" : translation); descValue = m_descContent.getValue(prefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).getStringValue( m_cms); item.getItemProperty(TableProperty.DESCRIPTION).setValue(descValue); hasDescription = hasDescription || !descValue.isEmpty(); defaultValue = m_descContent.getValue(prefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).getStringValue( m_cms); item.getItemProperty(TableProperty.DEFAULT).setValue(defaultValue); hasDefault = hasDefault || !defaultValue.isEmpty(); } m_hasDefault = hasDefault; m_hasDescription = hasDescription; return container; }
java
private IndexedContainer createContainerForBundleWithDescriptor() throws IOException, CmsException { IndexedContainer container = new IndexedContainer(); // create properties container.addContainerProperty(TableProperty.KEY, String.class, ""); container.addContainerProperty(TableProperty.DESCRIPTION, String.class, ""); container.addContainerProperty(TableProperty.DEFAULT, String.class, ""); container.addContainerProperty(TableProperty.TRANSLATION, String.class, ""); // add entries SortedProperties localization = getLocalization(m_locale); CmsXmlContentValueSequence messages = m_descContent.getValueSequence(Descriptor.N_MESSAGE, Descriptor.LOCALE); String descValue; boolean hasDescription = false; String defaultValue; boolean hasDefault = false; for (int i = 0; i < messages.getElementCount(); i++) { String prefix = messages.getValue(i).getPath() + "/"; Object itemId = container.addItem(); Item item = container.getItem(itemId); String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms); item.getItemProperty(TableProperty.KEY).setValue(key); String translation = localization.getProperty(key); item.getItemProperty(TableProperty.TRANSLATION).setValue(null == translation ? "" : translation); descValue = m_descContent.getValue(prefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).getStringValue( m_cms); item.getItemProperty(TableProperty.DESCRIPTION).setValue(descValue); hasDescription = hasDescription || !descValue.isEmpty(); defaultValue = m_descContent.getValue(prefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).getStringValue( m_cms); item.getItemProperty(TableProperty.DEFAULT).setValue(defaultValue); hasDefault = hasDefault || !defaultValue.isEmpty(); } m_hasDefault = hasDefault; m_hasDescription = hasDescription; return container; }
[ "private", "IndexedContainer", "createContainerForBundleWithDescriptor", "(", ")", "throws", "IOException", ",", "CmsException", "{", "IndexedContainer", "container", "=", "new", "IndexedContainer", "(", ")", ";", "// create properties", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "KEY", ",", "String", ".", "class", ",", "\"\"", ")", ";", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "DESCRIPTION", ",", "String", ".", "class", ",", "\"\"", ")", ";", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "DEFAULT", ",", "String", ".", "class", ",", "\"\"", ")", ";", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "TRANSLATION", ",", "String", ".", "class", ",", "\"\"", ")", ";", "// add entries", "SortedProperties", "localization", "=", "getLocalization", "(", "m_locale", ")", ";", "CmsXmlContentValueSequence", "messages", "=", "m_descContent", ".", "getValueSequence", "(", "Descriptor", ".", "N_MESSAGE", ",", "Descriptor", ".", "LOCALE", ")", ";", "String", "descValue", ";", "boolean", "hasDescription", "=", "false", ";", "String", "defaultValue", ";", "boolean", "hasDefault", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "messages", ".", "getElementCount", "(", ")", ";", "i", "++", ")", "{", "String", "prefix", "=", "messages", ".", "getValue", "(", "i", ")", ".", "getPath", "(", ")", "+", "\"/\"", ";", "Object", "itemId", "=", "container", ".", "addItem", "(", ")", ";", "Item", "item", "=", "container", ".", "getItem", "(", "itemId", ")", ";", "String", "key", "=", "m_descContent", ".", "getValue", "(", "prefix", "+", "Descriptor", ".", "N_KEY", ",", "Descriptor", ".", "LOCALE", ")", ".", "getStringValue", "(", "m_cms", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ".", "setValue", "(", "key", ")", ";", "String", "translation", "=", "localization", ".", "getProperty", "(", "key", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "TRANSLATION", ")", ".", "setValue", "(", "null", "==", "translation", "?", "\"\"", ":", "translation", ")", ";", "descValue", "=", "m_descContent", ".", "getValue", "(", "prefix", "+", "Descriptor", ".", "N_DESCRIPTION", ",", "Descriptor", ".", "LOCALE", ")", ".", "getStringValue", "(", "m_cms", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "DESCRIPTION", ")", ".", "setValue", "(", "descValue", ")", ";", "hasDescription", "=", "hasDescription", "||", "!", "descValue", ".", "isEmpty", "(", ")", ";", "defaultValue", "=", "m_descContent", ".", "getValue", "(", "prefix", "+", "Descriptor", ".", "N_DEFAULT", ",", "Descriptor", ".", "LOCALE", ")", ".", "getStringValue", "(", "m_cms", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "DEFAULT", ")", ".", "setValue", "(", "defaultValue", ")", ";", "hasDefault", "=", "hasDefault", "||", "!", "defaultValue", ".", "isEmpty", "(", ")", ";", "}", "m_hasDefault", "=", "hasDefault", ";", "m_hasDescription", "=", "hasDescription", ";", "return", "container", ";", "}" ]
Creates the container for a bundle with descriptor. @return the container for a bundle with descriptor. @throws IOException thrown if reading the bundle fails. @throws CmsException thrown if reading the bundle fails.
[ "Creates", "the", "container", "for", "a", "bundle", "with", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1109-L1149
158,424
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.createContainerForBundleWithoutDescriptor
private IndexedContainer createContainerForBundleWithoutDescriptor() throws IOException, CmsException { IndexedContainer container = new IndexedContainer(); // create properties container.addContainerProperty(TableProperty.KEY, String.class, ""); container.addContainerProperty(TableProperty.TRANSLATION, String.class, ""); // add entries SortedProperties localization = getLocalization(m_locale); Set<Object> keySet = m_keyset.getKeySet(); for (Object key : keySet) { Object itemId = container.addItem(); Item item = container.getItem(itemId); item.getItemProperty(TableProperty.KEY).setValue(key); Object translation = localization.get(key); item.getItemProperty(TableProperty.TRANSLATION).setValue(null == translation ? "" : translation); } return container; }
java
private IndexedContainer createContainerForBundleWithoutDescriptor() throws IOException, CmsException { IndexedContainer container = new IndexedContainer(); // create properties container.addContainerProperty(TableProperty.KEY, String.class, ""); container.addContainerProperty(TableProperty.TRANSLATION, String.class, ""); // add entries SortedProperties localization = getLocalization(m_locale); Set<Object> keySet = m_keyset.getKeySet(); for (Object key : keySet) { Object itemId = container.addItem(); Item item = container.getItem(itemId); item.getItemProperty(TableProperty.KEY).setValue(key); Object translation = localization.get(key); item.getItemProperty(TableProperty.TRANSLATION).setValue(null == translation ? "" : translation); } return container; }
[ "private", "IndexedContainer", "createContainerForBundleWithoutDescriptor", "(", ")", "throws", "IOException", ",", "CmsException", "{", "IndexedContainer", "container", "=", "new", "IndexedContainer", "(", ")", ";", "// create properties", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "KEY", ",", "String", ".", "class", ",", "\"\"", ")", ";", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "TRANSLATION", ",", "String", ".", "class", ",", "\"\"", ")", ";", "// add entries", "SortedProperties", "localization", "=", "getLocalization", "(", "m_locale", ")", ";", "Set", "<", "Object", ">", "keySet", "=", "m_keyset", ".", "getKeySet", "(", ")", ";", "for", "(", "Object", "key", ":", "keySet", ")", "{", "Object", "itemId", "=", "container", ".", "addItem", "(", ")", ";", "Item", "item", "=", "container", ".", "getItem", "(", "itemId", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ".", "setValue", "(", "key", ")", ";", "Object", "translation", "=", "localization", ".", "get", "(", "key", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "TRANSLATION", ")", ".", "setValue", "(", "null", "==", "translation", "?", "\"\"", ":", "translation", ")", ";", "}", "return", "container", ";", "}" ]
Creates the container for a bundle without descriptor. @return the container for a bundle without descriptor. @throws IOException thrown if reading the bundle fails. @throws CmsException thrown if reading the bundle fails.
[ "Creates", "the", "container", "for", "a", "bundle", "without", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1157-L1178
158,425
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.createContainerForDescriptorEditing
private IndexedContainer createContainerForDescriptorEditing() { IndexedContainer container = new IndexedContainer(); // create properties container.addContainerProperty(TableProperty.KEY, String.class, ""); container.addContainerProperty(TableProperty.DESCRIPTION, String.class, ""); container.addContainerProperty(TableProperty.DEFAULT, String.class, ""); // add entries CmsXmlContentValueSequence messages = m_descContent.getValueSequence( "/" + Descriptor.N_MESSAGE, Descriptor.LOCALE); for (int i = 0; i < messages.getElementCount(); i++) { String prefix = messages.getValue(i).getPath() + "/"; Object itemId = container.addItem(); Item item = container.getItem(itemId); String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms); item.getItemProperty(TableProperty.KEY).setValue(key); item.getItemProperty(TableProperty.DESCRIPTION).setValue( m_descContent.getValue(prefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).getStringValue(m_cms)); item.getItemProperty(TableProperty.DEFAULT).setValue( m_descContent.getValue(prefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).getStringValue(m_cms)); } return container; }
java
private IndexedContainer createContainerForDescriptorEditing() { IndexedContainer container = new IndexedContainer(); // create properties container.addContainerProperty(TableProperty.KEY, String.class, ""); container.addContainerProperty(TableProperty.DESCRIPTION, String.class, ""); container.addContainerProperty(TableProperty.DEFAULT, String.class, ""); // add entries CmsXmlContentValueSequence messages = m_descContent.getValueSequence( "/" + Descriptor.N_MESSAGE, Descriptor.LOCALE); for (int i = 0; i < messages.getElementCount(); i++) { String prefix = messages.getValue(i).getPath() + "/"; Object itemId = container.addItem(); Item item = container.getItem(itemId); String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms); item.getItemProperty(TableProperty.KEY).setValue(key); item.getItemProperty(TableProperty.DESCRIPTION).setValue( m_descContent.getValue(prefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).getStringValue(m_cms)); item.getItemProperty(TableProperty.DEFAULT).setValue( m_descContent.getValue(prefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).getStringValue(m_cms)); } return container; }
[ "private", "IndexedContainer", "createContainerForDescriptorEditing", "(", ")", "{", "IndexedContainer", "container", "=", "new", "IndexedContainer", "(", ")", ";", "// create properties", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "KEY", ",", "String", ".", "class", ",", "\"\"", ")", ";", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "DESCRIPTION", ",", "String", ".", "class", ",", "\"\"", ")", ";", "container", ".", "addContainerProperty", "(", "TableProperty", ".", "DEFAULT", ",", "String", ".", "class", ",", "\"\"", ")", ";", "// add entries", "CmsXmlContentValueSequence", "messages", "=", "m_descContent", ".", "getValueSequence", "(", "\"/\"", "+", "Descriptor", ".", "N_MESSAGE", ",", "Descriptor", ".", "LOCALE", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "messages", ".", "getElementCount", "(", ")", ";", "i", "++", ")", "{", "String", "prefix", "=", "messages", ".", "getValue", "(", "i", ")", ".", "getPath", "(", ")", "+", "\"/\"", ";", "Object", "itemId", "=", "container", ".", "addItem", "(", ")", ";", "Item", "item", "=", "container", ".", "getItem", "(", "itemId", ")", ";", "String", "key", "=", "m_descContent", ".", "getValue", "(", "prefix", "+", "Descriptor", ".", "N_KEY", ",", "Descriptor", ".", "LOCALE", ")", ".", "getStringValue", "(", "m_cms", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ".", "setValue", "(", "key", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "DESCRIPTION", ")", ".", "setValue", "(", "m_descContent", ".", "getValue", "(", "prefix", "+", "Descriptor", ".", "N_DESCRIPTION", ",", "Descriptor", ".", "LOCALE", ")", ".", "getStringValue", "(", "m_cms", ")", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "DEFAULT", ")", ".", "setValue", "(", "m_descContent", ".", "getValue", "(", "prefix", "+", "Descriptor", ".", "N_DEFAULT", ",", "Descriptor", ".", "LOCALE", ")", ".", "getStringValue", "(", "m_cms", ")", ")", ";", "}", "return", "container", ";", "}" ]
Creates the container for a bundle descriptor. @return the container for a bundle descriptor.
[ "Creates", "the", "container", "for", "a", "bundle", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1184-L1212
158,426
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.createPropertyVfsBundleFiles
private void createPropertyVfsBundleFiles() throws CmsIllegalArgumentException, CmsLoaderException, CmsException { String bundleFileBasePath = m_sitepath + m_basename + "_"; for (Locale l : m_localizations.keySet()) { CmsResource res = m_cms.createResource( bundleFileBasePath + l.toString(), OpenCms.getResourceManager().getResourceType( CmsMessageBundleEditorTypes.BundleType.PROPERTY.toString())); m_bundleFiles.put(l, res); LockedFile file = LockedFile.lockResource(m_cms, res); file.setCreated(true); m_lockedBundleFiles.put(l, file); m_changedTranslations.add(l); } }
java
private void createPropertyVfsBundleFiles() throws CmsIllegalArgumentException, CmsLoaderException, CmsException { String bundleFileBasePath = m_sitepath + m_basename + "_"; for (Locale l : m_localizations.keySet()) { CmsResource res = m_cms.createResource( bundleFileBasePath + l.toString(), OpenCms.getResourceManager().getResourceType( CmsMessageBundleEditorTypes.BundleType.PROPERTY.toString())); m_bundleFiles.put(l, res); LockedFile file = LockedFile.lockResource(m_cms, res); file.setCreated(true); m_lockedBundleFiles.put(l, file); m_changedTranslations.add(l); } }
[ "private", "void", "createPropertyVfsBundleFiles", "(", ")", "throws", "CmsIllegalArgumentException", ",", "CmsLoaderException", ",", "CmsException", "{", "String", "bundleFileBasePath", "=", "m_sitepath", "+", "m_basename", "+", "\"_\"", ";", "for", "(", "Locale", "l", ":", "m_localizations", ".", "keySet", "(", ")", ")", "{", "CmsResource", "res", "=", "m_cms", ".", "createResource", "(", "bundleFileBasePath", "+", "l", ".", "toString", "(", ")", ",", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "CmsMessageBundleEditorTypes", ".", "BundleType", ".", "PROPERTY", ".", "toString", "(", ")", ")", ")", ";", "m_bundleFiles", ".", "put", "(", "l", ",", "res", ")", ";", "LockedFile", "file", "=", "LockedFile", ".", "lockResource", "(", "m_cms", ",", "res", ")", ";", "file", ".", "setCreated", "(", "true", ")", ";", "m_lockedBundleFiles", ".", "put", "(", "l", ",", "file", ")", ";", "m_changedTranslations", ".", "add", "(", "l", ")", ";", "}", "}" ]
Creates all propertyvfsbundle files for the currently loaded translations. The method is used to convert xmlvfsbundle files into propertyvfsbundle files. @throws CmsIllegalArgumentException thrown if resource creation fails. @throws CmsLoaderException thrown if the propertyvfsbundle type can't be read from the resource manager. @throws CmsException thrown if creation, type retrieval or locking fails.
[ "Creates", "all", "propertyvfsbundle", "files", "for", "the", "currently", "loaded", "translations", ".", "The", "method", "is", "used", "to", "convert", "xmlvfsbundle", "files", "into", "propertyvfsbundle", "files", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1222-L1237
158,427
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getDefaultState
private EditorState getDefaultState() { List<TableProperty> cols = new ArrayList<TableProperty>(1); cols.add(TableProperty.TRANSLATION); return new EditorState(cols, false); }
java
private EditorState getDefaultState() { List<TableProperty> cols = new ArrayList<TableProperty>(1); cols.add(TableProperty.TRANSLATION); return new EditorState(cols, false); }
[ "private", "EditorState", "getDefaultState", "(", ")", "{", "List", "<", "TableProperty", ">", "cols", "=", "new", "ArrayList", "<", "TableProperty", ">", "(", "1", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "TRANSLATION", ")", ";", "return", "new", "EditorState", "(", "cols", ",", "false", ")", ";", "}" ]
Creates the default editor state for editing a bundle with descriptor. @return the default editor state for editing a bundle with descriptor.
[ "Creates", "the", "default", "editor", "state", "for", "editing", "a", "bundle", "with", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1243-L1249
158,428
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getLocalization
private SortedProperties getLocalization(Locale locale) throws IOException, CmsException { if (null == m_localizations.get(locale)) { switch (m_bundleType) { case PROPERTY: loadLocalizationFromPropertyBundle(locale); break; case XML: loadLocalizationFromXmlBundle(locale); break; case DESCRIPTOR: return null; default: break; } } return m_localizations.get(locale); }
java
private SortedProperties getLocalization(Locale locale) throws IOException, CmsException { if (null == m_localizations.get(locale)) { switch (m_bundleType) { case PROPERTY: loadLocalizationFromPropertyBundle(locale); break; case XML: loadLocalizationFromXmlBundle(locale); break; case DESCRIPTOR: return null; default: break; } } return m_localizations.get(locale); }
[ "private", "SortedProperties", "getLocalization", "(", "Locale", "locale", ")", "throws", "IOException", ",", "CmsException", "{", "if", "(", "null", "==", "m_localizations", ".", "get", "(", "locale", ")", ")", "{", "switch", "(", "m_bundleType", ")", "{", "case", "PROPERTY", ":", "loadLocalizationFromPropertyBundle", "(", "locale", ")", ";", "break", ";", "case", "XML", ":", "loadLocalizationFromXmlBundle", "(", "locale", ")", ";", "break", ";", "case", "DESCRIPTOR", ":", "return", "null", ";", "default", ":", "break", ";", "}", "}", "return", "m_localizations", ".", "get", "(", "locale", ")", ";", "}" ]
Reads the current properties for a language. If not already done, the properties are read from the respective file. @param locale the locale for which the localization should be returned. @return the properties. @throws IOException thrown if reading the properties from a file fails. @throws CmsException thrown if reading the properties from a file fails.
[ "Reads", "the", "current", "properties", "for", "a", "language", ".", "If", "not", "already", "done", "the", "properties", "are", "read", "from", "the", "respective", "file", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1275-L1292
158,429
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.getMasterState
private EditorState getMasterState() { List<TableProperty> cols = new ArrayList<TableProperty>(4); cols.add(TableProperty.KEY); cols.add(TableProperty.DESCRIPTION); cols.add(TableProperty.DEFAULT); cols.add(TableProperty.TRANSLATION); return new EditorState(cols, true); }
java
private EditorState getMasterState() { List<TableProperty> cols = new ArrayList<TableProperty>(4); cols.add(TableProperty.KEY); cols.add(TableProperty.DESCRIPTION); cols.add(TableProperty.DEFAULT); cols.add(TableProperty.TRANSLATION); return new EditorState(cols, true); }
[ "private", "EditorState", "getMasterState", "(", ")", "{", "List", "<", "TableProperty", ">", "cols", "=", "new", "ArrayList", "<", "TableProperty", ">", "(", "4", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "KEY", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "DESCRIPTION", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "DEFAULT", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "TRANSLATION", ")", ";", "return", "new", "EditorState", "(", "cols", ",", "true", ")", ";", "}" ]
Returns the master mode's editor state for editing a bundle with descriptor. @return the master mode's editor state for editing a bundle with descriptor.
[ "Returns", "the", "master", "mode", "s", "editor", "state", "for", "editing", "a", "bundle", "with", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1298-L1306
158,430
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initBundleType
private CmsMessageBundleEditorTypes.BundleType initBundleType() { String resourceTypeName = OpenCms.getResourceManager().getResourceType(m_resource).getTypeName(); return CmsMessageBundleEditorTypes.BundleType.toBundleType(resourceTypeName); }
java
private CmsMessageBundleEditorTypes.BundleType initBundleType() { String resourceTypeName = OpenCms.getResourceManager().getResourceType(m_resource).getTypeName(); return CmsMessageBundleEditorTypes.BundleType.toBundleType(resourceTypeName); }
[ "private", "CmsMessageBundleEditorTypes", ".", "BundleType", "initBundleType", "(", ")", "{", "String", "resourceTypeName", "=", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "m_resource", ")", ".", "getTypeName", "(", ")", ";", "return", "CmsMessageBundleEditorTypes", ".", "BundleType", ".", "toBundleType", "(", "resourceTypeName", ")", ";", "}" ]
Init the bundle type member variable. @return the bundle type of the opened resource.
[ "Init", "the", "bundle", "type", "member", "variable", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1312-L1316
158,431
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initDescriptor
private void initDescriptor() throws CmsXmlException, CmsException { if (m_bundleType.equals(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR)) { m_desc = m_resource; } else { //First try to read from same folder like resource, if it fails use CmsMessageBundleEditorTypes.getDescriptor() try { m_desc = m_cms.readResource(m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX); } catch (CmsVfsResourceNotFoundException e) { m_desc = CmsMessageBundleEditorTypes.getDescriptor(m_cms, m_basename); } } unmarshalDescriptor(); }
java
private void initDescriptor() throws CmsXmlException, CmsException { if (m_bundleType.equals(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR)) { m_desc = m_resource; } else { //First try to read from same folder like resource, if it fails use CmsMessageBundleEditorTypes.getDescriptor() try { m_desc = m_cms.readResource(m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX); } catch (CmsVfsResourceNotFoundException e) { m_desc = CmsMessageBundleEditorTypes.getDescriptor(m_cms, m_basename); } } unmarshalDescriptor(); }
[ "private", "void", "initDescriptor", "(", ")", "throws", "CmsXmlException", ",", "CmsException", "{", "if", "(", "m_bundleType", ".", "equals", "(", "CmsMessageBundleEditorTypes", ".", "BundleType", ".", "DESCRIPTOR", ")", ")", "{", "m_desc", "=", "m_resource", ";", "}", "else", "{", "//First try to read from same folder like resource, if it fails use CmsMessageBundleEditorTypes.getDescriptor()", "try", "{", "m_desc", "=", "m_cms", ".", "readResource", "(", "m_sitepath", "+", "m_basename", "+", "CmsMessageBundleEditorTypes", ".", "Descriptor", ".", "POSTFIX", ")", ";", "}", "catch", "(", "CmsVfsResourceNotFoundException", "e", ")", "{", "m_desc", "=", "CmsMessageBundleEditorTypes", ".", "getDescriptor", "(", "m_cms", ",", "m_basename", ")", ";", "}", "}", "unmarshalDescriptor", "(", ")", ";", "}" ]
Reads the bundle descriptor, sets m_desc and m_descContent. @throws CmsXmlException thrown when unmarshalling fails. @throws CmsException thrown when reading the resource fails or several bundle descriptors for the bundle exist.
[ "Reads", "the", "bundle", "descriptor", "sets", "m_desc", "and", "m_descContent", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1323-L1337
158,432
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initEditorStates
private void initEditorStates() { m_editorState = new HashMap<CmsMessageBundleEditorTypes.EditMode, EditorState>(); List<TableProperty> cols = null; switch (m_bundleType) { case PROPERTY: case XML: if (hasDescriptor()) { // bundle descriptor is present, keys are not editable in default mode, maybe master mode is available m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, getDefaultState()); if (hasMasterMode()) { // the bundle descriptor is editable m_editorState.put(CmsMessageBundleEditorTypes.EditMode.MASTER, getMasterState()); } } else { // no bundle descriptor given - implies no master mode cols = new ArrayList<TableProperty>(1); cols.add(TableProperty.KEY); cols.add(TableProperty.TRANSLATION); m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); } break; case DESCRIPTOR: cols = new ArrayList<TableProperty>(3); cols.add(TableProperty.KEY); cols.add(TableProperty.DESCRIPTION); cols.add(TableProperty.DEFAULT); m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); break; default: throw new IllegalArgumentException(); } }
java
private void initEditorStates() { m_editorState = new HashMap<CmsMessageBundleEditorTypes.EditMode, EditorState>(); List<TableProperty> cols = null; switch (m_bundleType) { case PROPERTY: case XML: if (hasDescriptor()) { // bundle descriptor is present, keys are not editable in default mode, maybe master mode is available m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, getDefaultState()); if (hasMasterMode()) { // the bundle descriptor is editable m_editorState.put(CmsMessageBundleEditorTypes.EditMode.MASTER, getMasterState()); } } else { // no bundle descriptor given - implies no master mode cols = new ArrayList<TableProperty>(1); cols.add(TableProperty.KEY); cols.add(TableProperty.TRANSLATION); m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); } break; case DESCRIPTOR: cols = new ArrayList<TableProperty>(3); cols.add(TableProperty.KEY); cols.add(TableProperty.DESCRIPTION); cols.add(TableProperty.DEFAULT); m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); break; default: throw new IllegalArgumentException(); } }
[ "private", "void", "initEditorStates", "(", ")", "{", "m_editorState", "=", "new", "HashMap", "<", "CmsMessageBundleEditorTypes", ".", "EditMode", ",", "EditorState", ">", "(", ")", ";", "List", "<", "TableProperty", ">", "cols", "=", "null", ";", "switch", "(", "m_bundleType", ")", "{", "case", "PROPERTY", ":", "case", "XML", ":", "if", "(", "hasDescriptor", "(", ")", ")", "{", "// bundle descriptor is present, keys are not editable in default mode, maybe master mode is available", "m_editorState", ".", "put", "(", "CmsMessageBundleEditorTypes", ".", "EditMode", ".", "DEFAULT", ",", "getDefaultState", "(", ")", ")", ";", "if", "(", "hasMasterMode", "(", ")", ")", "{", "// the bundle descriptor is editable", "m_editorState", ".", "put", "(", "CmsMessageBundleEditorTypes", ".", "EditMode", ".", "MASTER", ",", "getMasterState", "(", ")", ")", ";", "}", "}", "else", "{", "// no bundle descriptor given - implies no master mode", "cols", "=", "new", "ArrayList", "<", "TableProperty", ">", "(", "1", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "KEY", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "TRANSLATION", ")", ";", "m_editorState", ".", "put", "(", "CmsMessageBundleEditorTypes", ".", "EditMode", ".", "DEFAULT", ",", "new", "EditorState", "(", "cols", ",", "true", ")", ")", ";", "}", "break", ";", "case", "DESCRIPTOR", ":", "cols", "=", "new", "ArrayList", "<", "TableProperty", ">", "(", "3", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "KEY", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "DESCRIPTION", ")", ";", "cols", ".", "add", "(", "TableProperty", ".", "DEFAULT", ")", ";", "m_editorState", ".", "put", "(", "CmsMessageBundleEditorTypes", ".", "EditMode", ".", "DEFAULT", ",", "new", "EditorState", "(", "cols", ",", "true", ")", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}" ]
Initializes the editor states for the different modes, depending on the type of the opened file.
[ "Initializes", "the", "editor", "states", "for", "the", "different", "modes", "depending", "on", "the", "type", "of", "the", "opened", "file", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1342-L1372
158,433
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initHasMasterMode
private void initHasMasterMode() throws CmsException { if (hasDescriptor() && m_cms.hasPermissions(m_desc, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL)) { m_hasMasterMode = true; } else { m_hasMasterMode = false; } }
java
private void initHasMasterMode() throws CmsException { if (hasDescriptor() && m_cms.hasPermissions(m_desc, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL)) { m_hasMasterMode = true; } else { m_hasMasterMode = false; } }
[ "private", "void", "initHasMasterMode", "(", ")", "throws", "CmsException", "{", "if", "(", "hasDescriptor", "(", ")", "&&", "m_cms", ".", "hasPermissions", "(", "m_desc", ",", "CmsPermissionSet", ".", "ACCESS_WRITE", ",", "false", ",", "CmsResourceFilter", ".", "ALL", ")", ")", "{", "m_hasMasterMode", "=", "true", ";", "}", "else", "{", "m_hasMasterMode", "=", "false", ";", "}", "}" ]
Initializes the information on an available master mode. @throws CmsException thrown if the write permission check on the bundle descriptor fails.
[ "Initializes", "the", "information", "on", "an", "available", "master", "mode", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1378-L1386
158,434
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initKeySetForXmlBundle
private void initKeySetForXmlBundle() { // consider only available locales for (Locale l : m_locales) { if (m_xmlBundle.hasLocale(l)) { Set<Object> keys = new HashSet<Object>(); for (I_CmsXmlContentValue msg : m_xmlBundle.getValueSequence("Message", l).getValues()) { String msgpath = msg.getPath(); keys.add(m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", l)); } m_keyset.updateKeySet(null, keys); } } }
java
private void initKeySetForXmlBundle() { // consider only available locales for (Locale l : m_locales) { if (m_xmlBundle.hasLocale(l)) { Set<Object> keys = new HashSet<Object>(); for (I_CmsXmlContentValue msg : m_xmlBundle.getValueSequence("Message", l).getValues()) { String msgpath = msg.getPath(); keys.add(m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", l)); } m_keyset.updateKeySet(null, keys); } } }
[ "private", "void", "initKeySetForXmlBundle", "(", ")", "{", "// consider only available locales", "for", "(", "Locale", "l", ":", "m_locales", ")", "{", "if", "(", "m_xmlBundle", ".", "hasLocale", "(", "l", ")", ")", "{", "Set", "<", "Object", ">", "keys", "=", "new", "HashSet", "<", "Object", ">", "(", ")", ";", "for", "(", "I_CmsXmlContentValue", "msg", ":", "m_xmlBundle", ".", "getValueSequence", "(", "\"Message\"", ",", "l", ")", ".", "getValues", "(", ")", ")", "{", "String", "msgpath", "=", "msg", ".", "getPath", "(", ")", ";", "keys", ".", "add", "(", "m_xmlBundle", ".", "getStringValue", "(", "m_cms", ",", "msgpath", "+", "\"/Key\"", ",", "l", ")", ")", ";", "}", "m_keyset", ".", "updateKeySet", "(", "null", ",", "keys", ")", ";", "}", "}", "}" ]
Initialize the key set for an xml bundle.
[ "Initialize", "the", "key", "set", "for", "an", "xml", "bundle", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1391-L1405
158,435
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initLocales
private Collection<Locale> initLocales() { Collection<Locale> locales = null; switch (m_bundleType) { case DESCRIPTOR: locales = new ArrayList<Locale>(1); locales.add(Descriptor.LOCALE); break; case XML: case PROPERTY: locales = OpenCms.getLocaleManager().getAvailableLocales(m_cms, m_resource); break; default: throw new IllegalArgumentException(); } return locales; }
java
private Collection<Locale> initLocales() { Collection<Locale> locales = null; switch (m_bundleType) { case DESCRIPTOR: locales = new ArrayList<Locale>(1); locales.add(Descriptor.LOCALE); break; case XML: case PROPERTY: locales = OpenCms.getLocaleManager().getAvailableLocales(m_cms, m_resource); break; default: throw new IllegalArgumentException(); } return locales; }
[ "private", "Collection", "<", "Locale", ">", "initLocales", "(", ")", "{", "Collection", "<", "Locale", ">", "locales", "=", "null", ";", "switch", "(", "m_bundleType", ")", "{", "case", "DESCRIPTOR", ":", "locales", "=", "new", "ArrayList", "<", "Locale", ">", "(", "1", ")", ";", "locales", ".", "add", "(", "Descriptor", ".", "LOCALE", ")", ";", "break", ";", "case", "XML", ":", "case", "PROPERTY", ":", "locales", "=", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getAvailableLocales", "(", "m_cms", ",", "m_resource", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "locales", ";", "}" ]
Initializes the locales that can be selected via the language switcher in the bundle editor. @return the locales for which keys can be edited.
[ "Initializes", "the", "locales", "that", "can", "be", "selected", "via", "the", "language", "switcher", "in", "the", "bundle", "editor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1411-L1428
158,436
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initPropertyBundle
private void initPropertyBundle() throws CmsLoaderException, CmsException, IOException { for (Locale l : m_locales) { String filePath = m_sitepath + m_basename + "_" + l.toString(); CmsResource resource = null; if (m_cms.existsResource( filePath, CmsResourceFilter.requireType( OpenCms.getResourceManager().getResourceType(BundleType.PROPERTY.toString())))) { resource = m_cms.readResource(filePath); SortedProperties props = new SortedProperties(); CmsFile file = m_cms.readFile(resource); props.load( new InputStreamReader( new ByteArrayInputStream(file.getContents()), CmsFileUtil.getEncoding(m_cms, file))); m_keyset.updateKeySet(null, props.keySet()); m_bundleFiles.put(l, resource); } } }
java
private void initPropertyBundle() throws CmsLoaderException, CmsException, IOException { for (Locale l : m_locales) { String filePath = m_sitepath + m_basename + "_" + l.toString(); CmsResource resource = null; if (m_cms.existsResource( filePath, CmsResourceFilter.requireType( OpenCms.getResourceManager().getResourceType(BundleType.PROPERTY.toString())))) { resource = m_cms.readResource(filePath); SortedProperties props = new SortedProperties(); CmsFile file = m_cms.readFile(resource); props.load( new InputStreamReader( new ByteArrayInputStream(file.getContents()), CmsFileUtil.getEncoding(m_cms, file))); m_keyset.updateKeySet(null, props.keySet()); m_bundleFiles.put(l, resource); } } }
[ "private", "void", "initPropertyBundle", "(", ")", "throws", "CmsLoaderException", ",", "CmsException", ",", "IOException", "{", "for", "(", "Locale", "l", ":", "m_locales", ")", "{", "String", "filePath", "=", "m_sitepath", "+", "m_basename", "+", "\"_\"", "+", "l", ".", "toString", "(", ")", ";", "CmsResource", "resource", "=", "null", ";", "if", "(", "m_cms", ".", "existsResource", "(", "filePath", ",", "CmsResourceFilter", ".", "requireType", "(", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "BundleType", ".", "PROPERTY", ".", "toString", "(", ")", ")", ")", ")", ")", "{", "resource", "=", "m_cms", ".", "readResource", "(", "filePath", ")", ";", "SortedProperties", "props", "=", "new", "SortedProperties", "(", ")", ";", "CmsFile", "file", "=", "m_cms", ".", "readFile", "(", "resource", ")", ";", "props", ".", "load", "(", "new", "InputStreamReader", "(", "new", "ByteArrayInputStream", "(", "file", ".", "getContents", "(", ")", ")", ",", "CmsFileUtil", ".", "getEncoding", "(", "m_cms", ",", "file", ")", ")", ")", ";", "m_keyset", ".", "updateKeySet", "(", "null", ",", "props", ".", "keySet", "(", ")", ")", ";", "m_bundleFiles", ".", "put", "(", "l", ",", "resource", ")", ";", "}", "}", "}" ]
Initialization necessary for editing a property bundle. @throws CmsLoaderException thrown if loading a bundle file fails. @throws CmsException thrown if loading a bundle file fails. @throws IOException thrown if loading a bundle file fails.
[ "Initialization", "necessary", "for", "editing", "a", "property", "bundle", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1437-L1458
158,437
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.initXmlBundle
private void initXmlBundle() throws CmsException { CmsFile file = m_cms.readFile(m_resource); m_bundleFiles.put(null, m_resource); m_xmlBundle = CmsXmlContentFactory.unmarshal(m_cms, file); initKeySetForXmlBundle(); }
java
private void initXmlBundle() throws CmsException { CmsFile file = m_cms.readFile(m_resource); m_bundleFiles.put(null, m_resource); m_xmlBundle = CmsXmlContentFactory.unmarshal(m_cms, file); initKeySetForXmlBundle(); }
[ "private", "void", "initXmlBundle", "(", ")", "throws", "CmsException", "{", "CmsFile", "file", "=", "m_cms", ".", "readFile", "(", "m_resource", ")", ";", "m_bundleFiles", ".", "put", "(", "null", ",", "m_resource", ")", ";", "m_xmlBundle", "=", "CmsXmlContentFactory", ".", "unmarshal", "(", "m_cms", ",", "file", ")", ";", "initKeySetForXmlBundle", "(", ")", ";", "}" ]
Unmarshals the XML content and adds the file to the bundle files. @throws CmsException thrown if reading the file or unmarshaling fails.
[ "Unmarshals", "the", "XML", "content", "and", "adds", "the", "file", "to", "the", "bundle", "files", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1464-L1471
158,438
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.isBundleProperty
private boolean isBundleProperty(Object property) { return (property.equals(TableProperty.KEY) || property.equals(TableProperty.TRANSLATION)); }
java
private boolean isBundleProperty(Object property) { return (property.equals(TableProperty.KEY) || property.equals(TableProperty.TRANSLATION)); }
[ "private", "boolean", "isBundleProperty", "(", "Object", "property", ")", "{", "return", "(", "property", ".", "equals", "(", "TableProperty", ".", "KEY", ")", "||", "property", ".", "equals", "(", "TableProperty", ".", "TRANSLATION", ")", ")", ";", "}" ]
Check if values in the column "property" are written to the bundle files. @param property the property id of the table column. @return a flag, indicating if values of the table column are stored to the bundle files.
[ "Check", "if", "values", "in", "the", "column", "property", "are", "written", "to", "the", "bundle", "files", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1478-L1481
158,439
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.isDescriptorProperty
private boolean isDescriptorProperty(Object property) { return (getBundleType().equals(BundleType.DESCRIPTOR) || (hasDescriptor() && (property.equals(TableProperty.KEY) || property.equals(TableProperty.DEFAULT) || property.equals(TableProperty.DESCRIPTION)))); }
java
private boolean isDescriptorProperty(Object property) { return (getBundleType().equals(BundleType.DESCRIPTOR) || (hasDescriptor() && (property.equals(TableProperty.KEY) || property.equals(TableProperty.DEFAULT) || property.equals(TableProperty.DESCRIPTION)))); }
[ "private", "boolean", "isDescriptorProperty", "(", "Object", "property", ")", "{", "return", "(", "getBundleType", "(", ")", ".", "equals", "(", "BundleType", ".", "DESCRIPTOR", ")", "||", "(", "hasDescriptor", "(", ")", "&&", "(", "property", ".", "equals", "(", "TableProperty", ".", "KEY", ")", "||", "property", ".", "equals", "(", "TableProperty", ".", "DEFAULT", ")", "||", "property", ".", "equals", "(", "TableProperty", ".", "DESCRIPTION", ")", ")", ")", ")", ";", "}" ]
Check if values in the column "property" are written to the bundle descriptor. @param property the property id of the table column. @return a flag, indicating if values of the table column are stored to the bundle descriptor.
[ "Check", "if", "values", "in", "the", "column", "property", "are", "written", "to", "the", "bundle", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1488-L1495
158,440
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.loadAllRemainingLocalizations
private void loadAllRemainingLocalizations() throws CmsException, UnsupportedEncodingException, IOException { if (!m_alreadyLoadedAllLocalizations) { // is only necessary for property bundles if (m_bundleType.equals(BundleType.PROPERTY)) { for (Locale l : m_locales) { if (null == m_localizations.get(l)) { CmsResource resource = m_bundleFiles.get(l); if (resource != null) { CmsFile file = m_cms.readFile(resource); m_bundleFiles.put(l, file); SortedProperties props = new SortedProperties(); props.load( new InputStreamReader( new ByteArrayInputStream(file.getContents()), CmsFileUtil.getEncoding(m_cms, file))); m_localizations.put(l, props); } } } } if (m_bundleType.equals(BundleType.XML)) { for (Locale l : m_locales) { if (null == m_localizations.get(l)) { loadLocalizationFromXmlBundle(l); } } } m_alreadyLoadedAllLocalizations = true; } }
java
private void loadAllRemainingLocalizations() throws CmsException, UnsupportedEncodingException, IOException { if (!m_alreadyLoadedAllLocalizations) { // is only necessary for property bundles if (m_bundleType.equals(BundleType.PROPERTY)) { for (Locale l : m_locales) { if (null == m_localizations.get(l)) { CmsResource resource = m_bundleFiles.get(l); if (resource != null) { CmsFile file = m_cms.readFile(resource); m_bundleFiles.put(l, file); SortedProperties props = new SortedProperties(); props.load( new InputStreamReader( new ByteArrayInputStream(file.getContents()), CmsFileUtil.getEncoding(m_cms, file))); m_localizations.put(l, props); } } } } if (m_bundleType.equals(BundleType.XML)) { for (Locale l : m_locales) { if (null == m_localizations.get(l)) { loadLocalizationFromXmlBundle(l); } } } m_alreadyLoadedAllLocalizations = true; } }
[ "private", "void", "loadAllRemainingLocalizations", "(", ")", "throws", "CmsException", ",", "UnsupportedEncodingException", ",", "IOException", "{", "if", "(", "!", "m_alreadyLoadedAllLocalizations", ")", "{", "// is only necessary for property bundles", "if", "(", "m_bundleType", ".", "equals", "(", "BundleType", ".", "PROPERTY", ")", ")", "{", "for", "(", "Locale", "l", ":", "m_locales", ")", "{", "if", "(", "null", "==", "m_localizations", ".", "get", "(", "l", ")", ")", "{", "CmsResource", "resource", "=", "m_bundleFiles", ".", "get", "(", "l", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "CmsFile", "file", "=", "m_cms", ".", "readFile", "(", "resource", ")", ";", "m_bundleFiles", ".", "put", "(", "l", ",", "file", ")", ";", "SortedProperties", "props", "=", "new", "SortedProperties", "(", ")", ";", "props", ".", "load", "(", "new", "InputStreamReader", "(", "new", "ByteArrayInputStream", "(", "file", ".", "getContents", "(", ")", ")", ",", "CmsFileUtil", ".", "getEncoding", "(", "m_cms", ",", "file", ")", ")", ")", ";", "m_localizations", ".", "put", "(", "l", ",", "props", ")", ";", "}", "}", "}", "}", "if", "(", "m_bundleType", ".", "equals", "(", "BundleType", ".", "XML", ")", ")", "{", "for", "(", "Locale", "l", ":", "m_locales", ")", "{", "if", "(", "null", "==", "m_localizations", ".", "get", "(", "l", ")", ")", "{", "loadLocalizationFromXmlBundle", "(", "l", ")", ";", "}", "}", "}", "m_alreadyLoadedAllLocalizations", "=", "true", ";", "}", "}" ]
Loads all localizations not already loaded. @throws CmsException thrown if locking a file fails. @throws UnsupportedEncodingException thrown if reading a file fails. @throws IOException thrown if reading a file fails.
[ "Loads", "all", "localizations", "not", "already", "loaded", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1503-L1534
158,441
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.loadLocalizationFromXmlBundle
private void loadLocalizationFromXmlBundle(Locale locale) { CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence("Message", locale); SortedProperties props = new SortedProperties(); if (null != messages) { for (I_CmsXmlContentValue msg : messages.getValues()) { String msgpath = msg.getPath(); props.put( m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", locale), m_xmlBundle.getStringValue(m_cms, msgpath + "/Value", locale)); } } m_localizations.put(locale, props); }
java
private void loadLocalizationFromXmlBundle(Locale locale) { CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence("Message", locale); SortedProperties props = new SortedProperties(); if (null != messages) { for (I_CmsXmlContentValue msg : messages.getValues()) { String msgpath = msg.getPath(); props.put( m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", locale), m_xmlBundle.getStringValue(m_cms, msgpath + "/Value", locale)); } } m_localizations.put(locale, props); }
[ "private", "void", "loadLocalizationFromXmlBundle", "(", "Locale", "locale", ")", "{", "CmsXmlContentValueSequence", "messages", "=", "m_xmlBundle", ".", "getValueSequence", "(", "\"Message\"", ",", "locale", ")", ";", "SortedProperties", "props", "=", "new", "SortedProperties", "(", ")", ";", "if", "(", "null", "!=", "messages", ")", "{", "for", "(", "I_CmsXmlContentValue", "msg", ":", "messages", ".", "getValues", "(", ")", ")", "{", "String", "msgpath", "=", "msg", ".", "getPath", "(", ")", ";", "props", ".", "put", "(", "m_xmlBundle", ".", "getStringValue", "(", "m_cms", ",", "msgpath", "+", "\"/Key\"", ",", "locale", ")", ",", "m_xmlBundle", ".", "getStringValue", "(", "m_cms", ",", "msgpath", "+", "\"/Value\"", ",", "locale", ")", ")", ";", "}", "}", "m_localizations", ".", "put", "(", "locale", ",", "props", ")", ";", "}" ]
Loads the localization for the current locale from a bundle of type xmlvfsbundle. It assumes, the content has already been unmarshalled before. @param locale the locale for which the localization should be loaded
[ "Loads", "the", "localization", "for", "the", "current", "locale", "from", "a", "bundle", "of", "type", "xmlvfsbundle", ".", "It", "assumes", "the", "content", "has", "already", "been", "unmarshalled", "before", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1584-L1597
158,442
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.lockDescriptor
private void lockDescriptor() throws CmsException { if ((null == m_descFile) && (null != m_desc)) { m_descFile = LockedFile.lockResource(m_cms, m_desc); } }
java
private void lockDescriptor() throws CmsException { if ((null == m_descFile) && (null != m_desc)) { m_descFile = LockedFile.lockResource(m_cms, m_desc); } }
[ "private", "void", "lockDescriptor", "(", ")", "throws", "CmsException", "{", "if", "(", "(", "null", "==", "m_descFile", ")", "&&", "(", "null", "!=", "m_desc", ")", ")", "{", "m_descFile", "=", "LockedFile", ".", "lockResource", "(", "m_cms", ",", "m_desc", ")", ";", "}", "}" ]
Locks the bundle descriptor. @throws CmsException thrown if locking fails.
[ "Locks", "the", "bundle", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1617-L1622
158,443
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.lockLocalization
private void lockLocalization(Locale l) throws CmsException { if (null == m_lockedBundleFiles.get(l)) { LockedFile lf = LockedFile.lockResource(m_cms, m_bundleFiles.get(l)); m_lockedBundleFiles.put(l, lf); } }
java
private void lockLocalization(Locale l) throws CmsException { if (null == m_lockedBundleFiles.get(l)) { LockedFile lf = LockedFile.lockResource(m_cms, m_bundleFiles.get(l)); m_lockedBundleFiles.put(l, lf); } }
[ "private", "void", "lockLocalization", "(", "Locale", "l", ")", "throws", "CmsException", "{", "if", "(", "null", "==", "m_lockedBundleFiles", ".", "get", "(", "l", ")", ")", "{", "LockedFile", "lf", "=", "LockedFile", ".", "lockResource", "(", "m_cms", ",", "m_bundleFiles", ".", "get", "(", "l", ")", ")", ";", "m_lockedBundleFiles", ".", "put", "(", "l", ",", "lf", ")", ";", "}", "}" ]
Locks the bundle file that contains the translation for the provided locale. @param l the locale for which the bundle file should be locked. @throws CmsException thrown if locking fails.
[ "Locks", "the", "bundle", "file", "that", "contains", "the", "translation", "for", "the", "provided", "locale", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1629-L1636
158,444
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.lockOnChange
private void lockOnChange(Object propertyId) throws CmsException { if (isDescriptorProperty(propertyId)) { lockDescriptor(); } else { Locale l = m_bundleType.equals(BundleType.PROPERTY) ? m_locale : null; lockLocalization(l); } }
java
private void lockOnChange(Object propertyId) throws CmsException { if (isDescriptorProperty(propertyId)) { lockDescriptor(); } else { Locale l = m_bundleType.equals(BundleType.PROPERTY) ? m_locale : null; lockLocalization(l); } }
[ "private", "void", "lockOnChange", "(", "Object", "propertyId", ")", "throws", "CmsException", "{", "if", "(", "isDescriptorProperty", "(", "propertyId", ")", ")", "{", "lockDescriptor", "(", ")", ";", "}", "else", "{", "Locale", "l", "=", "m_bundleType", ".", "equals", "(", "BundleType", ".", "PROPERTY", ")", "?", "m_locale", ":", "null", ";", "lockLocalization", "(", "l", ")", ";", "}", "}" ]
Lock a file lazily, if a value that should be written to the file has changed. @param propertyId the table column in which the value has changed (e.g., KEY, TRANSLATION, ...) @throws CmsException thrown if locking fails.
[ "Lock", "a", "file", "lazily", "if", "a", "value", "that", "should", "be", "written", "to", "the", "file", "has", "changed", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1643-L1652
158,445
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.removeKeyForAllLanguages
private boolean removeKeyForAllLanguages(String key) { try { if (hasDescriptor()) { lockDescriptor(); } loadAllRemainingLocalizations(); lockAllLocalizations(key); } catch (CmsException | IOException e) { LOG.warn("Not able lock all localications for bundle.", e); return false; } if (!hasDescriptor()) { for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) { SortedProperties localization = entry.getValue(); if (localization.containsKey(key)) { localization.remove(key); m_changedTranslations.add(entry.getKey()); } } } return true; }
java
private boolean removeKeyForAllLanguages(String key) { try { if (hasDescriptor()) { lockDescriptor(); } loadAllRemainingLocalizations(); lockAllLocalizations(key); } catch (CmsException | IOException e) { LOG.warn("Not able lock all localications for bundle.", e); return false; } if (!hasDescriptor()) { for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) { SortedProperties localization = entry.getValue(); if (localization.containsKey(key)) { localization.remove(key); m_changedTranslations.add(entry.getKey()); } } } return true; }
[ "private", "boolean", "removeKeyForAllLanguages", "(", "String", "key", ")", "{", "try", "{", "if", "(", "hasDescriptor", "(", ")", ")", "{", "lockDescriptor", "(", ")", ";", "}", "loadAllRemainingLocalizations", "(", ")", ";", "lockAllLocalizations", "(", "key", ")", ";", "}", "catch", "(", "CmsException", "|", "IOException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Not able lock all localications for bundle.\"", ",", "e", ")", ";", "return", "false", ";", "}", "if", "(", "!", "hasDescriptor", "(", ")", ")", "{", "for", "(", "Entry", "<", "Locale", ",", "SortedProperties", ">", "entry", ":", "m_localizations", ".", "entrySet", "(", ")", ")", "{", "SortedProperties", "localization", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "localization", ".", "containsKey", "(", "key", ")", ")", "{", "localization", ".", "remove", "(", "key", ")", ";", "m_changedTranslations", ".", "add", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "}", "}", "return", "true", ";", "}" ]
Remove a key for all language versions. If a descriptor is present, the key is only removed in the descriptor. @param key the key to remove. @return <code>true</code> if removing was successful, <code>false</code> otherwise.
[ "Remove", "a", "key", "for", "all", "language", "versions", ".", "If", "a", "descriptor", "is", "present", "the", "key", "is", "only", "removed", "in", "the", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1660-L1683
158,446
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.removeXmlBundleFile
private void removeXmlBundleFile() throws CmsException { lockLocalization(null); m_cms.deleteResource(m_resource, CmsResource.DELETE_PRESERVE_SIBLINGS); m_resource = null; }
java
private void removeXmlBundleFile() throws CmsException { lockLocalization(null); m_cms.deleteResource(m_resource, CmsResource.DELETE_PRESERVE_SIBLINGS); m_resource = null; }
[ "private", "void", "removeXmlBundleFile", "(", ")", "throws", "CmsException", "{", "lockLocalization", "(", "null", ")", ";", "m_cms", ".", "deleteResource", "(", "m_resource", ",", "CmsResource", ".", "DELETE_PRESERVE_SIBLINGS", ")", ";", "m_resource", "=", "null", ";", "}" ]
Deletes the VFS XML bundle file. @throws CmsException thrown if the delete operation fails.
[ "Deletes", "the", "VFS", "XML", "bundle", "file", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1689-L1695
158,447
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.renameKeyForAllLanguages
private boolean renameKeyForAllLanguages(String oldKey, String newKey) { try { loadAllRemainingLocalizations(); lockAllLocalizations(oldKey); if (hasDescriptor()) { lockDescriptor(); } } catch (CmsException | IOException e) { LOG.error(e.getLocalizedMessage(), e); return false; } for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) { SortedProperties localization = entry.getValue(); if (localization.containsKey(oldKey)) { String value = localization.getProperty(oldKey); localization.remove(oldKey); localization.put(newKey, value); m_changedTranslations.add(entry.getKey()); } } if (hasDescriptor()) { CmsXmlContentValueSequence messages = m_descContent.getValueSequence( Descriptor.N_MESSAGE, Descriptor.LOCALE); for (int i = 0; i < messages.getElementCount(); i++) { String prefix = messages.getValue(i).getPath() + "/"; String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms); if (key == oldKey) { m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).setStringValue(m_cms, newKey); break; } } m_descriptorHasChanges = true; } m_keyset.renameKey(oldKey, newKey); return true; }
java
private boolean renameKeyForAllLanguages(String oldKey, String newKey) { try { loadAllRemainingLocalizations(); lockAllLocalizations(oldKey); if (hasDescriptor()) { lockDescriptor(); } } catch (CmsException | IOException e) { LOG.error(e.getLocalizedMessage(), e); return false; } for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) { SortedProperties localization = entry.getValue(); if (localization.containsKey(oldKey)) { String value = localization.getProperty(oldKey); localization.remove(oldKey); localization.put(newKey, value); m_changedTranslations.add(entry.getKey()); } } if (hasDescriptor()) { CmsXmlContentValueSequence messages = m_descContent.getValueSequence( Descriptor.N_MESSAGE, Descriptor.LOCALE); for (int i = 0; i < messages.getElementCount(); i++) { String prefix = messages.getValue(i).getPath() + "/"; String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms); if (key == oldKey) { m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).setStringValue(m_cms, newKey); break; } } m_descriptorHasChanges = true; } m_keyset.renameKey(oldKey, newKey); return true; }
[ "private", "boolean", "renameKeyForAllLanguages", "(", "String", "oldKey", ",", "String", "newKey", ")", "{", "try", "{", "loadAllRemainingLocalizations", "(", ")", ";", "lockAllLocalizations", "(", "oldKey", ")", ";", "if", "(", "hasDescriptor", "(", ")", ")", "{", "lockDescriptor", "(", ")", ";", "}", "}", "catch", "(", "CmsException", "|", "IOException", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "return", "false", ";", "}", "for", "(", "Entry", "<", "Locale", ",", "SortedProperties", ">", "entry", ":", "m_localizations", ".", "entrySet", "(", ")", ")", "{", "SortedProperties", "localization", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "localization", ".", "containsKey", "(", "oldKey", ")", ")", "{", "String", "value", "=", "localization", ".", "getProperty", "(", "oldKey", ")", ";", "localization", ".", "remove", "(", "oldKey", ")", ";", "localization", ".", "put", "(", "newKey", ",", "value", ")", ";", "m_changedTranslations", ".", "add", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "}", "if", "(", "hasDescriptor", "(", ")", ")", "{", "CmsXmlContentValueSequence", "messages", "=", "m_descContent", ".", "getValueSequence", "(", "Descriptor", ".", "N_MESSAGE", ",", "Descriptor", ".", "LOCALE", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "messages", ".", "getElementCount", "(", ")", ";", "i", "++", ")", "{", "String", "prefix", "=", "messages", ".", "getValue", "(", "i", ")", ".", "getPath", "(", ")", "+", "\"/\"", ";", "String", "key", "=", "m_descContent", ".", "getValue", "(", "prefix", "+", "Descriptor", ".", "N_KEY", ",", "Descriptor", ".", "LOCALE", ")", ".", "getStringValue", "(", "m_cms", ")", ";", "if", "(", "key", "==", "oldKey", ")", "{", "m_descContent", ".", "getValue", "(", "prefix", "+", "Descriptor", ".", "N_KEY", ",", "Descriptor", ".", "LOCALE", ")", ".", "setStringValue", "(", "m_cms", ",", "newKey", ")", ";", "break", ";", "}", "}", "m_descriptorHasChanges", "=", "true", ";", "}", "m_keyset", ".", "renameKey", "(", "oldKey", ",", "newKey", ")", ";", "return", "true", ";", "}" ]
Rename a key for all languages. @param oldKey the key to rename @param newKey the new key name @return <code>true</code> if renaming was successful, <code>false</code> otherwise.
[ "Rename", "a", "key", "for", "all", "languages", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1703-L1741
158,448
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.replaceValues
private boolean replaceValues(Locale locale) { try { SortedProperties localization = getLocalization(locale); if (hasDescriptor()) { for (Object itemId : m_container.getItemIds()) { Item item = m_container.getItem(itemId); String key = item.getItemProperty(TableProperty.KEY).getValue().toString(); Object value = localization.get(key); item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value); } } else { m_container.removeAllItems(); Set<Object> keyset = m_keyset.getKeySet(); for (Object key : keyset) { Object itemId = m_container.addItem(); Item item = m_container.getItem(itemId); item.getItemProperty(TableProperty.KEY).setValue(key); Object value = localization.get(key); item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value); } if (m_container.getItemIds().isEmpty()) { m_container.addItem(); } } return true; } catch (IOException | CmsException e) { // The problem should typically be a problem with locking or reading the file containing the translation. // This should be reported in the editor, if false is returned here. return false; } }
java
private boolean replaceValues(Locale locale) { try { SortedProperties localization = getLocalization(locale); if (hasDescriptor()) { for (Object itemId : m_container.getItemIds()) { Item item = m_container.getItem(itemId); String key = item.getItemProperty(TableProperty.KEY).getValue().toString(); Object value = localization.get(key); item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value); } } else { m_container.removeAllItems(); Set<Object> keyset = m_keyset.getKeySet(); for (Object key : keyset) { Object itemId = m_container.addItem(); Item item = m_container.getItem(itemId); item.getItemProperty(TableProperty.KEY).setValue(key); Object value = localization.get(key); item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value); } if (m_container.getItemIds().isEmpty()) { m_container.addItem(); } } return true; } catch (IOException | CmsException e) { // The problem should typically be a problem with locking or reading the file containing the translation. // This should be reported in the editor, if false is returned here. return false; } }
[ "private", "boolean", "replaceValues", "(", "Locale", "locale", ")", "{", "try", "{", "SortedProperties", "localization", "=", "getLocalization", "(", "locale", ")", ";", "if", "(", "hasDescriptor", "(", ")", ")", "{", "for", "(", "Object", "itemId", ":", "m_container", ".", "getItemIds", "(", ")", ")", "{", "Item", "item", "=", "m_container", ".", "getItem", "(", "itemId", ")", ";", "String", "key", "=", "item", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ".", "getValue", "(", ")", ".", "toString", "(", ")", ";", "Object", "value", "=", "localization", ".", "get", "(", "key", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "TRANSLATION", ")", ".", "setValue", "(", "null", "==", "value", "?", "\"\"", ":", "value", ")", ";", "}", "}", "else", "{", "m_container", ".", "removeAllItems", "(", ")", ";", "Set", "<", "Object", ">", "keyset", "=", "m_keyset", ".", "getKeySet", "(", ")", ";", "for", "(", "Object", "key", ":", "keyset", ")", "{", "Object", "itemId", "=", "m_container", ".", "addItem", "(", ")", ";", "Item", "item", "=", "m_container", ".", "getItem", "(", "itemId", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ".", "setValue", "(", "key", ")", ";", "Object", "value", "=", "localization", ".", "get", "(", "key", ")", ";", "item", ".", "getItemProperty", "(", "TableProperty", ".", "TRANSLATION", ")", ".", "setValue", "(", "null", "==", "value", "?", "\"\"", ":", "value", ")", ";", "}", "if", "(", "m_container", ".", "getItemIds", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "m_container", ".", "addItem", "(", ")", ";", "}", "}", "return", "true", ";", "}", "catch", "(", "IOException", "|", "CmsException", "e", ")", "{", "// The problem should typically be a problem with locking or reading the file containing the translation.", "// This should be reported in the editor, if false is returned here.", "return", "false", ";", "}", "}" ]
Replaces the translations in an existing container with the translations for the provided locale. @param locale the locale for which translations should be loaded. @return <code>true</code> if replacing succeeded, <code>false</code> otherwise.
[ "Replaces", "the", "translations", "in", "an", "existing", "container", "with", "the", "translations", "for", "the", "provided", "locale", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1748-L1779
158,449
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.saveLocalization
private void saveLocalization() { SortedProperties localization = new SortedProperties(); for (Object itemId : m_container.getItemIds()) { Item item = m_container.getItem(itemId); String key = item.getItemProperty(TableProperty.KEY).getValue().toString(); String value = item.getItemProperty(TableProperty.TRANSLATION).getValue().toString(); if (!(key.isEmpty() || value.isEmpty())) { localization.put(key, value); } } m_keyset.updateKeySet(m_localizations.get(m_locale).keySet(), localization.keySet()); m_localizations.put(m_locale, localization); }
java
private void saveLocalization() { SortedProperties localization = new SortedProperties(); for (Object itemId : m_container.getItemIds()) { Item item = m_container.getItem(itemId); String key = item.getItemProperty(TableProperty.KEY).getValue().toString(); String value = item.getItemProperty(TableProperty.TRANSLATION).getValue().toString(); if (!(key.isEmpty() || value.isEmpty())) { localization.put(key, value); } } m_keyset.updateKeySet(m_localizations.get(m_locale).keySet(), localization.keySet()); m_localizations.put(m_locale, localization); }
[ "private", "void", "saveLocalization", "(", ")", "{", "SortedProperties", "localization", "=", "new", "SortedProperties", "(", ")", ";", "for", "(", "Object", "itemId", ":", "m_container", ".", "getItemIds", "(", ")", ")", "{", "Item", "item", "=", "m_container", ".", "getItem", "(", "itemId", ")", ";", "String", "key", "=", "item", ".", "getItemProperty", "(", "TableProperty", ".", "KEY", ")", ".", "getValue", "(", ")", ".", "toString", "(", ")", ";", "String", "value", "=", "item", ".", "getItemProperty", "(", "TableProperty", ".", "TRANSLATION", ")", ".", "getValue", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "!", "(", "key", ".", "isEmpty", "(", ")", "||", "value", ".", "isEmpty", "(", ")", ")", ")", "{", "localization", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}", "m_keyset", ".", "updateKeySet", "(", "m_localizations", ".", "get", "(", "m_locale", ")", ".", "keySet", "(", ")", ",", "localization", ".", "keySet", "(", ")", ")", ";", "m_localizations", ".", "put", "(", "m_locale", ",", "localization", ")", ";", "}" ]
Saves the current translations from the container to the respective localization.
[ "Saves", "the", "current", "translations", "from", "the", "container", "to", "the", "respective", "localization", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1795-L1809
158,450
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.saveToBundleDescriptor
private void saveToBundleDescriptor() throws CmsException { if (null != m_descFile) { m_removeDescriptorOnCancel = false; updateBundleDescriptorContent(); m_descFile.getFile().setContents(m_descContent.marshal()); m_cms.writeFile(m_descFile.getFile()); } }
java
private void saveToBundleDescriptor() throws CmsException { if (null != m_descFile) { m_removeDescriptorOnCancel = false; updateBundleDescriptorContent(); m_descFile.getFile().setContents(m_descContent.marshal()); m_cms.writeFile(m_descFile.getFile()); } }
[ "private", "void", "saveToBundleDescriptor", "(", ")", "throws", "CmsException", "{", "if", "(", "null", "!=", "m_descFile", ")", "{", "m_removeDescriptorOnCancel", "=", "false", ";", "updateBundleDescriptorContent", "(", ")", ";", "m_descFile", ".", "getFile", "(", ")", ".", "setContents", "(", "m_descContent", ".", "marshal", "(", ")", ")", ";", "m_cms", ".", "writeFile", "(", "m_descFile", ".", "getFile", "(", ")", ")", ";", "}", "}" ]
Save the values to the bundle descriptor. @throws CmsException thrown if saving fails.
[ "Save", "the", "values", "to", "the", "bundle", "descriptor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1815-L1823
158,451
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.saveToPropertyVfsBundle
private void saveToPropertyVfsBundle() throws CmsException { for (Locale l : m_changedTranslations) { SortedProperties props = m_localizations.get(l); LockedFile f = m_lockedBundleFiles.get(l); if ((null != props) && (null != f)) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Writer writer = new OutputStreamWriter(outputStream, f.getEncoding()); props.store(writer, null); byte[] contentBytes = outputStream.toByteArray(); CmsFile file = f.getFile(); file.setContents(contentBytes); String contentEncodingProperty = m_cms.readPropertyObject( file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, false).getValue(); if ((null == contentEncodingProperty) || !contentEncodingProperty.equals(f.getEncoding())) { m_cms.writePropertyObject( m_cms.getSitePath(file), new CmsProperty( CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, f.getEncoding(), f.getEncoding())); } m_cms.writeFile(file); } catch (IOException e) { LOG.error( Messages.get().getBundle().key( Messages.ERR_READING_FILE_UNSUPPORTED_ENCODING_2, f.getFile().getRootPath(), f.getEncoding()), e); } } } }
java
private void saveToPropertyVfsBundle() throws CmsException { for (Locale l : m_changedTranslations) { SortedProperties props = m_localizations.get(l); LockedFile f = m_lockedBundleFiles.get(l); if ((null != props) && (null != f)) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Writer writer = new OutputStreamWriter(outputStream, f.getEncoding()); props.store(writer, null); byte[] contentBytes = outputStream.toByteArray(); CmsFile file = f.getFile(); file.setContents(contentBytes); String contentEncodingProperty = m_cms.readPropertyObject( file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, false).getValue(); if ((null == contentEncodingProperty) || !contentEncodingProperty.equals(f.getEncoding())) { m_cms.writePropertyObject( m_cms.getSitePath(file), new CmsProperty( CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, f.getEncoding(), f.getEncoding())); } m_cms.writeFile(file); } catch (IOException e) { LOG.error( Messages.get().getBundle().key( Messages.ERR_READING_FILE_UNSUPPORTED_ENCODING_2, f.getFile().getRootPath(), f.getEncoding()), e); } } } }
[ "private", "void", "saveToPropertyVfsBundle", "(", ")", "throws", "CmsException", "{", "for", "(", "Locale", "l", ":", "m_changedTranslations", ")", "{", "SortedProperties", "props", "=", "m_localizations", ".", "get", "(", "l", ")", ";", "LockedFile", "f", "=", "m_lockedBundleFiles", ".", "get", "(", "l", ")", ";", "if", "(", "(", "null", "!=", "props", ")", "&&", "(", "null", "!=", "f", ")", ")", "{", "try", "{", "ByteArrayOutputStream", "outputStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "Writer", "writer", "=", "new", "OutputStreamWriter", "(", "outputStream", ",", "f", ".", "getEncoding", "(", ")", ")", ";", "props", ".", "store", "(", "writer", ",", "null", ")", ";", "byte", "[", "]", "contentBytes", "=", "outputStream", ".", "toByteArray", "(", ")", ";", "CmsFile", "file", "=", "f", ".", "getFile", "(", ")", ";", "file", ".", "setContents", "(", "contentBytes", ")", ";", "String", "contentEncodingProperty", "=", "m_cms", ".", "readPropertyObject", "(", "file", ",", "CmsPropertyDefinition", ".", "PROPERTY_CONTENT_ENCODING", ",", "false", ")", ".", "getValue", "(", ")", ";", "if", "(", "(", "null", "==", "contentEncodingProperty", ")", "||", "!", "contentEncodingProperty", ".", "equals", "(", "f", ".", "getEncoding", "(", ")", ")", ")", "{", "m_cms", ".", "writePropertyObject", "(", "m_cms", ".", "getSitePath", "(", "file", ")", ",", "new", "CmsProperty", "(", "CmsPropertyDefinition", ".", "PROPERTY_CONTENT_ENCODING", ",", "f", ".", "getEncoding", "(", ")", ",", "f", ".", "getEncoding", "(", ")", ")", ")", ";", "}", "m_cms", ".", "writeFile", "(", "file", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_READING_FILE_UNSUPPORTED_ENCODING_2", ",", "f", ".", "getFile", "(", ")", ".", "getRootPath", "(", ")", ",", "f", ".", "getEncoding", "(", ")", ")", ",", "e", ")", ";", "}", "}", "}", "}" ]
Saves messages to a propertyvfsbundle file. @throws CmsException thrown if writing to the file fails.
[ "Saves", "messages", "to", "a", "propertyvfsbundle", "file", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1830-L1867
158,452
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.saveToXmlVfsBundle
private void saveToXmlVfsBundle() throws CmsException { if (m_lockedBundleFiles.get(null) != null) { // If the file was not locked, no changes were made, i.e., storing is not necessary. for (Locale l : m_locales) { SortedProperties props = m_localizations.get(l); if (null != props) { if (m_xmlBundle.hasLocale(l)) { m_xmlBundle.removeLocale(l); } m_xmlBundle.addLocale(m_cms, l); int i = 0; List<Object> keys = new ArrayList<Object>(props.keySet()); Collections.sort(keys, CmsCaseInsensitiveStringComparator.getInstance()); for (Object key : keys) { if ((null != key) && !key.toString().isEmpty()) { String value = props.getProperty(key.toString()); if (!value.isEmpty()) { m_xmlBundle.addValue(m_cms, "Message", l, i); i++; m_xmlBundle.getValue("Message[" + i + "]/Key", l).setStringValue(m_cms, key.toString()); m_xmlBundle.getValue("Message[" + i + "]/Value", l).setStringValue(m_cms, value); } } } } CmsFile bundleFile = m_lockedBundleFiles.get(null).getFile(); bundleFile.setContents(m_xmlBundle.marshal()); m_cms.writeFile(bundleFile); } } }
java
private void saveToXmlVfsBundle() throws CmsException { if (m_lockedBundleFiles.get(null) != null) { // If the file was not locked, no changes were made, i.e., storing is not necessary. for (Locale l : m_locales) { SortedProperties props = m_localizations.get(l); if (null != props) { if (m_xmlBundle.hasLocale(l)) { m_xmlBundle.removeLocale(l); } m_xmlBundle.addLocale(m_cms, l); int i = 0; List<Object> keys = new ArrayList<Object>(props.keySet()); Collections.sort(keys, CmsCaseInsensitiveStringComparator.getInstance()); for (Object key : keys) { if ((null != key) && !key.toString().isEmpty()) { String value = props.getProperty(key.toString()); if (!value.isEmpty()) { m_xmlBundle.addValue(m_cms, "Message", l, i); i++; m_xmlBundle.getValue("Message[" + i + "]/Key", l).setStringValue(m_cms, key.toString()); m_xmlBundle.getValue("Message[" + i + "]/Value", l).setStringValue(m_cms, value); } } } } CmsFile bundleFile = m_lockedBundleFiles.get(null).getFile(); bundleFile.setContents(m_xmlBundle.marshal()); m_cms.writeFile(bundleFile); } } }
[ "private", "void", "saveToXmlVfsBundle", "(", ")", "throws", "CmsException", "{", "if", "(", "m_lockedBundleFiles", ".", "get", "(", "null", ")", "!=", "null", ")", "{", "// If the file was not locked, no changes were made, i.e., storing is not necessary.", "for", "(", "Locale", "l", ":", "m_locales", ")", "{", "SortedProperties", "props", "=", "m_localizations", ".", "get", "(", "l", ")", ";", "if", "(", "null", "!=", "props", ")", "{", "if", "(", "m_xmlBundle", ".", "hasLocale", "(", "l", ")", ")", "{", "m_xmlBundle", ".", "removeLocale", "(", "l", ")", ";", "}", "m_xmlBundle", ".", "addLocale", "(", "m_cms", ",", "l", ")", ";", "int", "i", "=", "0", ";", "List", "<", "Object", ">", "keys", "=", "new", "ArrayList", "<", "Object", ">", "(", "props", ".", "keySet", "(", ")", ")", ";", "Collections", ".", "sort", "(", "keys", ",", "CmsCaseInsensitiveStringComparator", ".", "getInstance", "(", ")", ")", ";", "for", "(", "Object", "key", ":", "keys", ")", "{", "if", "(", "(", "null", "!=", "key", ")", "&&", "!", "key", ".", "toString", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "String", "value", "=", "props", ".", "getProperty", "(", "key", ".", "toString", "(", ")", ")", ";", "if", "(", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "m_xmlBundle", ".", "addValue", "(", "m_cms", ",", "\"Message\"", ",", "l", ",", "i", ")", ";", "i", "++", ";", "m_xmlBundle", ".", "getValue", "(", "\"Message[\"", "+", "i", "+", "\"]/Key\"", ",", "l", ")", ".", "setStringValue", "(", "m_cms", ",", "key", ".", "toString", "(", ")", ")", ";", "m_xmlBundle", ".", "getValue", "(", "\"Message[\"", "+", "i", "+", "\"]/Value\"", ",", "l", ")", ".", "setStringValue", "(", "m_cms", ",", "value", ")", ";", "}", "}", "}", "}", "CmsFile", "bundleFile", "=", "m_lockedBundleFiles", ".", "get", "(", "null", ")", ".", "getFile", "(", ")", ";", "bundleFile", ".", "setContents", "(", "m_xmlBundle", ".", "marshal", "(", ")", ")", ";", "m_cms", ".", "writeFile", "(", "bundleFile", ")", ";", "}", "}", "}" ]
Saves messages to a xmlvfsbundle file. @throws CmsException thrown if writing to the file fails.
[ "Saves", "messages", "to", "a", "xmlvfsbundle", "file", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1874-L1904
158,453
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.setResourceInformation
private void setResourceInformation() { String sitePath = m_cms.getSitePath(m_resource); int pathEnd = sitePath.lastIndexOf('/') + 1; String baseName = sitePath.substring(pathEnd); m_sitepath = sitePath.substring(0, pathEnd); switch (CmsMessageBundleEditorTypes.BundleType.toBundleType( OpenCms.getResourceManager().getResourceType(m_resource).getTypeName())) { case PROPERTY: String localeSuffix = CmsStringUtil.getLocaleSuffixForName(baseName); if ((null != localeSuffix) && !localeSuffix.isEmpty()) { baseName = baseName.substring( 0, baseName.lastIndexOf(localeSuffix) - (1 /* cut off trailing underscore, too*/)); m_locale = CmsLocaleManager.getLocale(localeSuffix); } if ((null == m_locale) || !m_locales.contains(m_locale)) { m_switchedLocaleOnOpening = true; m_locale = m_locales.iterator().next(); } break; case XML: m_locale = OpenCms.getLocaleManager().getBestAvailableLocaleForXmlContent( m_cms, m_resource, m_xmlBundle); break; case DESCRIPTOR: m_basename = baseName.substring( 0, baseName.length() - CmsMessageBundleEditorTypes.Descriptor.POSTFIX.length()); m_locale = new Locale("en"); break; default: throw new IllegalArgumentException( Messages.get().container( Messages.ERR_UNSUPPORTED_BUNDLE_TYPE_1, CmsMessageBundleEditorTypes.BundleType.toBundleType( OpenCms.getResourceManager().getResourceType(m_resource).getTypeName())).toString()); } m_basename = baseName; }
java
private void setResourceInformation() { String sitePath = m_cms.getSitePath(m_resource); int pathEnd = sitePath.lastIndexOf('/') + 1; String baseName = sitePath.substring(pathEnd); m_sitepath = sitePath.substring(0, pathEnd); switch (CmsMessageBundleEditorTypes.BundleType.toBundleType( OpenCms.getResourceManager().getResourceType(m_resource).getTypeName())) { case PROPERTY: String localeSuffix = CmsStringUtil.getLocaleSuffixForName(baseName); if ((null != localeSuffix) && !localeSuffix.isEmpty()) { baseName = baseName.substring( 0, baseName.lastIndexOf(localeSuffix) - (1 /* cut off trailing underscore, too*/)); m_locale = CmsLocaleManager.getLocale(localeSuffix); } if ((null == m_locale) || !m_locales.contains(m_locale)) { m_switchedLocaleOnOpening = true; m_locale = m_locales.iterator().next(); } break; case XML: m_locale = OpenCms.getLocaleManager().getBestAvailableLocaleForXmlContent( m_cms, m_resource, m_xmlBundle); break; case DESCRIPTOR: m_basename = baseName.substring( 0, baseName.length() - CmsMessageBundleEditorTypes.Descriptor.POSTFIX.length()); m_locale = new Locale("en"); break; default: throw new IllegalArgumentException( Messages.get().container( Messages.ERR_UNSUPPORTED_BUNDLE_TYPE_1, CmsMessageBundleEditorTypes.BundleType.toBundleType( OpenCms.getResourceManager().getResourceType(m_resource).getTypeName())).toString()); } m_basename = baseName; }
[ "private", "void", "setResourceInformation", "(", ")", "{", "String", "sitePath", "=", "m_cms", ".", "getSitePath", "(", "m_resource", ")", ";", "int", "pathEnd", "=", "sitePath", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ";", "String", "baseName", "=", "sitePath", ".", "substring", "(", "pathEnd", ")", ";", "m_sitepath", "=", "sitePath", ".", "substring", "(", "0", ",", "pathEnd", ")", ";", "switch", "(", "CmsMessageBundleEditorTypes", ".", "BundleType", ".", "toBundleType", "(", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "m_resource", ")", ".", "getTypeName", "(", ")", ")", ")", "{", "case", "PROPERTY", ":", "String", "localeSuffix", "=", "CmsStringUtil", ".", "getLocaleSuffixForName", "(", "baseName", ")", ";", "if", "(", "(", "null", "!=", "localeSuffix", ")", "&&", "!", "localeSuffix", ".", "isEmpty", "(", ")", ")", "{", "baseName", "=", "baseName", ".", "substring", "(", "0", ",", "baseName", ".", "lastIndexOf", "(", "localeSuffix", ")", "-", "(", "1", "/* cut off trailing underscore, too*/", ")", ")", ";", "m_locale", "=", "CmsLocaleManager", ".", "getLocale", "(", "localeSuffix", ")", ";", "}", "if", "(", "(", "null", "==", "m_locale", ")", "||", "!", "m_locales", ".", "contains", "(", "m_locale", ")", ")", "{", "m_switchedLocaleOnOpening", "=", "true", ";", "m_locale", "=", "m_locales", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "}", "break", ";", "case", "XML", ":", "m_locale", "=", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getBestAvailableLocaleForXmlContent", "(", "m_cms", ",", "m_resource", ",", "m_xmlBundle", ")", ";", "break", ";", "case", "DESCRIPTOR", ":", "m_basename", "=", "baseName", ".", "substring", "(", "0", ",", "baseName", ".", "length", "(", ")", "-", "CmsMessageBundleEditorTypes", ".", "Descriptor", ".", "POSTFIX", ".", "length", "(", ")", ")", ";", "m_locale", "=", "new", "Locale", "(", "\"en\"", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_UNSUPPORTED_BUNDLE_TYPE_1", ",", "CmsMessageBundleEditorTypes", ".", "BundleType", ".", "toBundleType", "(", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "m_resource", ")", ".", "getTypeName", "(", ")", ")", ")", ".", "toString", "(", ")", ")", ";", "}", "m_basename", "=", "baseName", ";", "}" ]
Extract site path, base name and locale from the resource opened with the editor.
[ "Extract", "site", "path", "base", "name", "and", "locale", "from", "the", "resource", "opened", "with", "the", "editor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1907-L1949
158,454
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.unmarshalDescriptor
private void unmarshalDescriptor() throws CmsXmlException, CmsException { if (null != m_desc) { // unmarshal descriptor m_descContent = CmsXmlContentFactory.unmarshal(m_cms, m_cms.readFile(m_desc)); // configure messages if wanted CmsProperty bundleProp = m_cms.readPropertyObject(m_desc, PROPERTY_BUNDLE_DESCRIPTOR_LOCALIZATION, true); if (!(bundleProp.isNullProperty() || bundleProp.getValue().trim().isEmpty())) { m_configuredBundle = bundleProp.getValue(); } } }
java
private void unmarshalDescriptor() throws CmsXmlException, CmsException { if (null != m_desc) { // unmarshal descriptor m_descContent = CmsXmlContentFactory.unmarshal(m_cms, m_cms.readFile(m_desc)); // configure messages if wanted CmsProperty bundleProp = m_cms.readPropertyObject(m_desc, PROPERTY_BUNDLE_DESCRIPTOR_LOCALIZATION, true); if (!(bundleProp.isNullProperty() || bundleProp.getValue().trim().isEmpty())) { m_configuredBundle = bundleProp.getValue(); } } }
[ "private", "void", "unmarshalDescriptor", "(", ")", "throws", "CmsXmlException", ",", "CmsException", "{", "if", "(", "null", "!=", "m_desc", ")", "{", "// unmarshal descriptor", "m_descContent", "=", "CmsXmlContentFactory", ".", "unmarshal", "(", "m_cms", ",", "m_cms", ".", "readFile", "(", "m_desc", ")", ")", ";", "// configure messages if wanted", "CmsProperty", "bundleProp", "=", "m_cms", ".", "readPropertyObject", "(", "m_desc", ",", "PROPERTY_BUNDLE_DESCRIPTOR_LOCALIZATION", ",", "true", ")", ";", "if", "(", "!", "(", "bundleProp", ".", "isNullProperty", "(", ")", "||", "bundleProp", ".", "getValue", "(", ")", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", ")", "{", "m_configuredBundle", "=", "bundleProp", ".", "getValue", "(", ")", ";", "}", "}", "}" ]
Unmarshals the descriptor content. @throws CmsXmlException thrown if the XML structure of the descriptor is wrong. @throws CmsException thrown if reading the descriptor file fails.
[ "Unmarshals", "the", "descriptor", "content", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1957-L1971
158,455
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java
CmsMessageBundleEditorModel.updateBundleDescriptorContent
private void updateBundleDescriptorContent() throws CmsXmlException { if (m_descContent.hasLocale(Descriptor.LOCALE)) { m_descContent.removeLocale(Descriptor.LOCALE); } m_descContent.addLocale(m_cms, Descriptor.LOCALE); int i = 0; Property<Object> descProp; String desc; Property<Object> defaultValueProp; String defaultValue; Map<String, Item> keyItemMap = getKeyItemMap(); List<String> keys = new ArrayList<String>(keyItemMap.keySet()); Collections.sort(keys, CmsCaseInsensitiveStringComparator.getInstance()); for (Object key : keys) { if ((null != key) && !key.toString().isEmpty()) { m_descContent.addValue(m_cms, Descriptor.N_MESSAGE, Descriptor.LOCALE, i); i++; String messagePrefix = Descriptor.N_MESSAGE + "[" + i + "]/"; m_descContent.getValue(messagePrefix + Descriptor.N_KEY, Descriptor.LOCALE).setStringValue( m_cms, (String)key); descProp = keyItemMap.get(key).getItemProperty(TableProperty.DESCRIPTION); if ((null != descProp) && (null != descProp.getValue())) { desc = descProp.getValue().toString(); m_descContent.getValue(messagePrefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).setStringValue( m_cms, desc); } defaultValueProp = keyItemMap.get(key).getItemProperty(TableProperty.DEFAULT); if ((null != defaultValueProp) && (null != defaultValueProp.getValue())) { defaultValue = defaultValueProp.getValue().toString(); m_descContent.getValue(messagePrefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).setStringValue( m_cms, defaultValue); } } } }
java
private void updateBundleDescriptorContent() throws CmsXmlException { if (m_descContent.hasLocale(Descriptor.LOCALE)) { m_descContent.removeLocale(Descriptor.LOCALE); } m_descContent.addLocale(m_cms, Descriptor.LOCALE); int i = 0; Property<Object> descProp; String desc; Property<Object> defaultValueProp; String defaultValue; Map<String, Item> keyItemMap = getKeyItemMap(); List<String> keys = new ArrayList<String>(keyItemMap.keySet()); Collections.sort(keys, CmsCaseInsensitiveStringComparator.getInstance()); for (Object key : keys) { if ((null != key) && !key.toString().isEmpty()) { m_descContent.addValue(m_cms, Descriptor.N_MESSAGE, Descriptor.LOCALE, i); i++; String messagePrefix = Descriptor.N_MESSAGE + "[" + i + "]/"; m_descContent.getValue(messagePrefix + Descriptor.N_KEY, Descriptor.LOCALE).setStringValue( m_cms, (String)key); descProp = keyItemMap.get(key).getItemProperty(TableProperty.DESCRIPTION); if ((null != descProp) && (null != descProp.getValue())) { desc = descProp.getValue().toString(); m_descContent.getValue(messagePrefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).setStringValue( m_cms, desc); } defaultValueProp = keyItemMap.get(key).getItemProperty(TableProperty.DEFAULT); if ((null != defaultValueProp) && (null != defaultValueProp.getValue())) { defaultValue = defaultValueProp.getValue().toString(); m_descContent.getValue(messagePrefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).setStringValue( m_cms, defaultValue); } } } }
[ "private", "void", "updateBundleDescriptorContent", "(", ")", "throws", "CmsXmlException", "{", "if", "(", "m_descContent", ".", "hasLocale", "(", "Descriptor", ".", "LOCALE", ")", ")", "{", "m_descContent", ".", "removeLocale", "(", "Descriptor", ".", "LOCALE", ")", ";", "}", "m_descContent", ".", "addLocale", "(", "m_cms", ",", "Descriptor", ".", "LOCALE", ")", ";", "int", "i", "=", "0", ";", "Property", "<", "Object", ">", "descProp", ";", "String", "desc", ";", "Property", "<", "Object", ">", "defaultValueProp", ";", "String", "defaultValue", ";", "Map", "<", "String", ",", "Item", ">", "keyItemMap", "=", "getKeyItemMap", "(", ")", ";", "List", "<", "String", ">", "keys", "=", "new", "ArrayList", "<", "String", ">", "(", "keyItemMap", ".", "keySet", "(", ")", ")", ";", "Collections", ".", "sort", "(", "keys", ",", "CmsCaseInsensitiveStringComparator", ".", "getInstance", "(", ")", ")", ";", "for", "(", "Object", "key", ":", "keys", ")", "{", "if", "(", "(", "null", "!=", "key", ")", "&&", "!", "key", ".", "toString", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "m_descContent", ".", "addValue", "(", "m_cms", ",", "Descriptor", ".", "N_MESSAGE", ",", "Descriptor", ".", "LOCALE", ",", "i", ")", ";", "i", "++", ";", "String", "messagePrefix", "=", "Descriptor", ".", "N_MESSAGE", "+", "\"[\"", "+", "i", "+", "\"]/\"", ";", "m_descContent", ".", "getValue", "(", "messagePrefix", "+", "Descriptor", ".", "N_KEY", ",", "Descriptor", ".", "LOCALE", ")", ".", "setStringValue", "(", "m_cms", ",", "(", "String", ")", "key", ")", ";", "descProp", "=", "keyItemMap", ".", "get", "(", "key", ")", ".", "getItemProperty", "(", "TableProperty", ".", "DESCRIPTION", ")", ";", "if", "(", "(", "null", "!=", "descProp", ")", "&&", "(", "null", "!=", "descProp", ".", "getValue", "(", ")", ")", ")", "{", "desc", "=", "descProp", ".", "getValue", "(", ")", ".", "toString", "(", ")", ";", "m_descContent", ".", "getValue", "(", "messagePrefix", "+", "Descriptor", ".", "N_DESCRIPTION", ",", "Descriptor", ".", "LOCALE", ")", ".", "setStringValue", "(", "m_cms", ",", "desc", ")", ";", "}", "defaultValueProp", "=", "keyItemMap", ".", "get", "(", "key", ")", ".", "getItemProperty", "(", "TableProperty", ".", "DEFAULT", ")", ";", "if", "(", "(", "null", "!=", "defaultValueProp", ")", "&&", "(", "null", "!=", "defaultValueProp", ".", "getValue", "(", ")", ")", ")", "{", "defaultValue", "=", "defaultValueProp", ".", "getValue", "(", ")", ".", "toString", "(", ")", ";", "m_descContent", ".", "getValue", "(", "messagePrefix", "+", "Descriptor", ".", "N_DEFAULT", ",", "Descriptor", ".", "LOCALE", ")", ".", "setStringValue", "(", "m_cms", ",", "defaultValue", ")", ";", "}", "}", "}", "}" ]
Update the descriptor content with values from the editor. @throws CmsXmlException thrown if update fails due to a wrong XML structure (should never happen)
[ "Update", "the", "descriptor", "content", "with", "values", "from", "the", "editor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1977-L2021
158,456
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java
CmsSitemapTreeItem.removeInvalidChildren
protected void removeInvalidChildren() { if (getLoadState() == LoadState.LOADED) { List<CmsSitemapTreeItem> toDelete = new ArrayList<CmsSitemapTreeItem>(); for (int i = 0; i < getChildCount(); i++) { CmsSitemapTreeItem item = (CmsSitemapTreeItem)getChild(i); CmsUUID id = item.getEntryId(); if ((id != null) && (CmsSitemapView.getInstance().getController().getEntryById(id) == null)) { toDelete.add(item); } } for (CmsSitemapTreeItem deleteItem : toDelete) { m_children.removeItem(deleteItem); } } }
java
protected void removeInvalidChildren() { if (getLoadState() == LoadState.LOADED) { List<CmsSitemapTreeItem> toDelete = new ArrayList<CmsSitemapTreeItem>(); for (int i = 0; i < getChildCount(); i++) { CmsSitemapTreeItem item = (CmsSitemapTreeItem)getChild(i); CmsUUID id = item.getEntryId(); if ((id != null) && (CmsSitemapView.getInstance().getController().getEntryById(id) == null)) { toDelete.add(item); } } for (CmsSitemapTreeItem deleteItem : toDelete) { m_children.removeItem(deleteItem); } } }
[ "protected", "void", "removeInvalidChildren", "(", ")", "{", "if", "(", "getLoadState", "(", ")", "==", "LoadState", ".", "LOADED", ")", "{", "List", "<", "CmsSitemapTreeItem", ">", "toDelete", "=", "new", "ArrayList", "<", "CmsSitemapTreeItem", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getChildCount", "(", ")", ";", "i", "++", ")", "{", "CmsSitemapTreeItem", "item", "=", "(", "CmsSitemapTreeItem", ")", "getChild", "(", "i", ")", ";", "CmsUUID", "id", "=", "item", ".", "getEntryId", "(", ")", ";", "if", "(", "(", "id", "!=", "null", ")", "&&", "(", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "getController", "(", ")", ".", "getEntryById", "(", "id", ")", "==", "null", ")", ")", "{", "toDelete", ".", "add", "(", "item", ")", ";", "}", "}", "for", "(", "CmsSitemapTreeItem", "deleteItem", ":", "toDelete", ")", "{", "m_children", ".", "removeItem", "(", "deleteItem", ")", ";", "}", "}", "}" ]
Helper method to remove invalid children that don't have a corresponding CmsSitemapClientEntry.
[ "Helper", "method", "to", "remove", "invalid", "children", "that", "don", "t", "have", "a", "corresponding", "CmsSitemapClientEntry", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java#L829-L844
158,457
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelDailyView.java
CmsPatternPanelDailyView.onEveryDayChange
@UiHandler("m_everyDay") void onEveryDayChange(ValueChangeEvent<String> event) { if (handleChange()) { m_controller.setInterval(m_everyDay.getFormValueAsString()); } }
java
@UiHandler("m_everyDay") void onEveryDayChange(ValueChangeEvent<String> event) { if (handleChange()) { m_controller.setInterval(m_everyDay.getFormValueAsString()); } }
[ "@", "UiHandler", "(", "\"m_everyDay\"", ")", "void", "onEveryDayChange", "(", "ValueChangeEvent", "<", "String", ">", "event", ")", "{", "if", "(", "handleChange", "(", ")", ")", "{", "m_controller", ".", "setInterval", "(", "m_everyDay", ".", "getFormValueAsString", "(", ")", ")", ";", "}", "}" ]
Handle interval change. @param event the change event.
[ "Handle", "interval", "change", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelDailyView.java#L168-L175
158,458
alkacon/opencms-core
src/org/opencms/widgets/CmsLocationPickerWidget.java
CmsLocationPickerWidget.getApiKey
private String getApiKey(CmsObject cms, String sitePath) throws CmsException { String res = cms.readPropertyObject( sitePath, CmsPropertyDefinition.PROPERTY_GOOGLE_API_KEY_WORKPLACE, true).getValue(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(res)) { res = cms.readPropertyObject(sitePath, CmsPropertyDefinition.PROPERTY_GOOGLE_API_KEY, true).getValue(); } return res; }
java
private String getApiKey(CmsObject cms, String sitePath) throws CmsException { String res = cms.readPropertyObject( sitePath, CmsPropertyDefinition.PROPERTY_GOOGLE_API_KEY_WORKPLACE, true).getValue(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(res)) { res = cms.readPropertyObject(sitePath, CmsPropertyDefinition.PROPERTY_GOOGLE_API_KEY, true).getValue(); } return res; }
[ "private", "String", "getApiKey", "(", "CmsObject", "cms", ",", "String", "sitePath", ")", "throws", "CmsException", "{", "String", "res", "=", "cms", ".", "readPropertyObject", "(", "sitePath", ",", "CmsPropertyDefinition", ".", "PROPERTY_GOOGLE_API_KEY_WORKPLACE", ",", "true", ")", ".", "getValue", "(", ")", ";", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "res", ")", ")", "{", "res", "=", "cms", ".", "readPropertyObject", "(", "sitePath", ",", "CmsPropertyDefinition", ".", "PROPERTY_GOOGLE_API_KEY", ",", "true", ")", ".", "getValue", "(", ")", ";", "}", "return", "res", ";", "}" ]
Get the correct google api key. Tries to read a workplace key first. @param cms CmsObject @param sitePath site path @return key value @throws CmsException exception
[ "Get", "the", "correct", "google", "api", "key", ".", "Tries", "to", "read", "a", "workplace", "key", "first", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsLocationPickerWidget.java#L309-L321
158,459
alkacon/opencms-core
src/org/opencms/jsp/search/config/CmsSearchConfiguration.java
CmsSearchConfiguration.propagateFacetNames
private void propagateFacetNames() { // collect all names and configurations Collection<String> facetNames = new ArrayList<String>(); Collection<I_CmsSearchConfigurationFacet> facetConfigs = new ArrayList<I_CmsSearchConfigurationFacet>(); facetNames.addAll(m_fieldFacets.keySet()); facetConfigs.addAll(m_fieldFacets.values()); facetNames.addAll(m_rangeFacets.keySet()); facetConfigs.addAll(m_rangeFacets.values()); if (null != m_queryFacet) { facetNames.add(m_queryFacet.getName()); facetConfigs.add(m_queryFacet); } // propagate all names for (I_CmsSearchConfigurationFacet facetConfig : facetConfigs) { facetConfig.propagateAllFacetNames(facetNames); } }
java
private void propagateFacetNames() { // collect all names and configurations Collection<String> facetNames = new ArrayList<String>(); Collection<I_CmsSearchConfigurationFacet> facetConfigs = new ArrayList<I_CmsSearchConfigurationFacet>(); facetNames.addAll(m_fieldFacets.keySet()); facetConfigs.addAll(m_fieldFacets.values()); facetNames.addAll(m_rangeFacets.keySet()); facetConfigs.addAll(m_rangeFacets.values()); if (null != m_queryFacet) { facetNames.add(m_queryFacet.getName()); facetConfigs.add(m_queryFacet); } // propagate all names for (I_CmsSearchConfigurationFacet facetConfig : facetConfigs) { facetConfig.propagateAllFacetNames(facetNames); } }
[ "private", "void", "propagateFacetNames", "(", ")", "{", "// collect all names and configurations", "Collection", "<", "String", ">", "facetNames", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "Collection", "<", "I_CmsSearchConfigurationFacet", ">", "facetConfigs", "=", "new", "ArrayList", "<", "I_CmsSearchConfigurationFacet", ">", "(", ")", ";", "facetNames", ".", "addAll", "(", "m_fieldFacets", ".", "keySet", "(", ")", ")", ";", "facetConfigs", ".", "addAll", "(", "m_fieldFacets", ".", "values", "(", ")", ")", ";", "facetNames", ".", "addAll", "(", "m_rangeFacets", ".", "keySet", "(", ")", ")", ";", "facetConfigs", ".", "addAll", "(", "m_rangeFacets", ".", "values", "(", ")", ")", ";", "if", "(", "null", "!=", "m_queryFacet", ")", "{", "facetNames", ".", "add", "(", "m_queryFacet", ".", "getName", "(", ")", ")", ";", "facetConfigs", ".", "add", "(", "m_queryFacet", ")", ";", "}", "// propagate all names", "for", "(", "I_CmsSearchConfigurationFacet", "facetConfig", ":", "facetConfigs", ")", "{", "facetConfig", ".", "propagateAllFacetNames", "(", "facetNames", ")", ";", "}", "}" ]
Propagates the names of all facets to each single facet.
[ "Propagates", "the", "names", "of", "all", "facets", "to", "each", "single", "facet", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/CmsSearchConfiguration.java#L156-L174
158,460
alkacon/opencms-core
src/org/opencms/widgets/serialdate/CmsSerialDateBeanWeekly.java
CmsSerialDateBeanWeekly.getDaysToNextMatch
private int getDaysToNextMatch(WeekDay weekDay) { for (WeekDay wd : m_weekDays) { if (wd.compareTo(weekDay) > 0) { return wd.toInt() - weekDay.toInt(); } } return (m_weekDays.iterator().next().toInt() + (m_interval * I_CmsSerialDateValue.NUM_OF_WEEKDAYS)) - weekDay.toInt(); }
java
private int getDaysToNextMatch(WeekDay weekDay) { for (WeekDay wd : m_weekDays) { if (wd.compareTo(weekDay) > 0) { return wd.toInt() - weekDay.toInt(); } } return (m_weekDays.iterator().next().toInt() + (m_interval * I_CmsSerialDateValue.NUM_OF_WEEKDAYS)) - weekDay.toInt(); }
[ "private", "int", "getDaysToNextMatch", "(", "WeekDay", "weekDay", ")", "{", "for", "(", "WeekDay", "wd", ":", "m_weekDays", ")", "{", "if", "(", "wd", ".", "compareTo", "(", "weekDay", ")", ">", "0", ")", "{", "return", "wd", ".", "toInt", "(", ")", "-", "weekDay", ".", "toInt", "(", ")", ";", "}", "}", "return", "(", "m_weekDays", ".", "iterator", "(", ")", ".", "next", "(", ")", ".", "toInt", "(", ")", "+", "(", "m_interval", "*", "I_CmsSerialDateValue", ".", "NUM_OF_WEEKDAYS", ")", ")", "-", "weekDay", ".", "toInt", "(", ")", ";", "}" ]
Returns the number of days from the given weekday to the next weekday the event should occur. @param weekDay the current weekday. @return the number of days to the next weekday an event could occur.
[ "Returns", "the", "number", "of", "days", "from", "the", "given", "weekday", "to", "the", "next", "weekday", "the", "event", "should", "occur", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateBeanWeekly.java#L118-L127
158,461
alkacon/opencms-core
src/org/opencms/util/CmsMacroResolver.java
CmsMacroResolver.newWorkplaceLocaleResolver
public static I_CmsMacroResolver newWorkplaceLocaleResolver(final CmsObject cms) { // Resolve macros in the property configuration CmsMacroResolver resolver = new CmsMacroResolver(); resolver.setCmsObject(cms); CmsUserSettings userSettings = new CmsUserSettings(cms.getRequestContext().getCurrentUser()); CmsMultiMessages multimessages = new CmsMultiMessages(userSettings.getLocale()); multimessages.addMessages(OpenCms.getWorkplaceManager().getMessages(userSettings.getLocale())); resolver.setMessages(multimessages); resolver.setKeepEmptyMacros(true); return resolver; }
java
public static I_CmsMacroResolver newWorkplaceLocaleResolver(final CmsObject cms) { // Resolve macros in the property configuration CmsMacroResolver resolver = new CmsMacroResolver(); resolver.setCmsObject(cms); CmsUserSettings userSettings = new CmsUserSettings(cms.getRequestContext().getCurrentUser()); CmsMultiMessages multimessages = new CmsMultiMessages(userSettings.getLocale()); multimessages.addMessages(OpenCms.getWorkplaceManager().getMessages(userSettings.getLocale())); resolver.setMessages(multimessages); resolver.setKeepEmptyMacros(true); return resolver; }
[ "public", "static", "I_CmsMacroResolver", "newWorkplaceLocaleResolver", "(", "final", "CmsObject", "cms", ")", "{", "// Resolve macros in the property configuration", "CmsMacroResolver", "resolver", "=", "new", "CmsMacroResolver", "(", ")", ";", "resolver", ".", "setCmsObject", "(", "cms", ")", ";", "CmsUserSettings", "userSettings", "=", "new", "CmsUserSettings", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentUser", "(", ")", ")", ";", "CmsMultiMessages", "multimessages", "=", "new", "CmsMultiMessages", "(", "userSettings", ".", "getLocale", "(", ")", ")", ";", "multimessages", ".", "addMessages", "(", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getMessages", "(", "userSettings", ".", "getLocale", "(", ")", ")", ")", ";", "resolver", ".", "setMessages", "(", "multimessages", ")", ";", "resolver", ".", "setKeepEmptyMacros", "(", "true", ")", ";", "return", "resolver", ";", "}" ]
Returns a new macro resolver that loads message keys from the workplace bundle in the user setting's language. @param cms the CmsObject. @return a new macro resolver with messages from the workplace bundle in the current users locale.
[ "Returns", "a", "new", "macro", "resolver", "that", "loads", "message", "keys", "from", "the", "workplace", "bundle", "in", "the", "user", "setting", "s", "language", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsMacroResolver.java#L495-L507
158,462
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.parseMandatoryStringValues
protected static List<String> parseMandatoryStringValues(JSONObject json, String key) throws JSONException { List<String> list = null; JSONArray array = json.getJSONArray(key); list = new ArrayList<String>(array.length()); for (int i = 0; i < array.length(); i++) { try { String entry = array.getString(i); list.add(entry); } catch (JSONException e) { LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_STRING_ENTRY_UNPARSABLE_1, key), e); } } return list; }
java
protected static List<String> parseMandatoryStringValues(JSONObject json, String key) throws JSONException { List<String> list = null; JSONArray array = json.getJSONArray(key); list = new ArrayList<String>(array.length()); for (int i = 0; i < array.length(); i++) { try { String entry = array.getString(i); list.add(entry); } catch (JSONException e) { LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_STRING_ENTRY_UNPARSABLE_1, key), e); } } return list; }
[ "protected", "static", "List", "<", "String", ">", "parseMandatoryStringValues", "(", "JSONObject", "json", ",", "String", "key", ")", "throws", "JSONException", "{", "List", "<", "String", ">", "list", "=", "null", ";", "JSONArray", "array", "=", "json", ".", "getJSONArray", "(", "key", ")", ";", "list", "=", "new", "ArrayList", "<", "String", ">", "(", "array", ".", "length", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", "(", ")", ";", "i", "++", ")", "{", "try", "{", "String", "entry", "=", "array", ".", "getString", "(", "i", ")", ";", "list", ".", "add", "(", "entry", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "LOG", ".", "info", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_OPTIONAL_STRING_ENTRY_UNPARSABLE_1", ",", "key", ")", ",", "e", ")", ";", "}", "}", "return", "list", ";", "}" ]
Helper for reading a mandatory String value list - throwing an Exception if parsing fails. @param json The JSON object where the list should be read from. @param key The key of the value to read. @return The value from the JSON. @throws JSONException thrown when parsing fails.
[ "Helper", "for", "reading", "a", "mandatory", "String", "value", "list", "-", "throwing", "an", "Exception", "if", "parsing", "fails", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L248-L262
158,463
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getEscapeQueryChars
protected Boolean getEscapeQueryChars() { Boolean isEscape = parseOptionalBooleanValue(m_configObject, JSON_KEY_ESCAPE_QUERY_CHARACTERS); return (null == isEscape) && (m_baseConfig != null) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getEscapeQueryChars()) : isEscape; }
java
protected Boolean getEscapeQueryChars() { Boolean isEscape = parseOptionalBooleanValue(m_configObject, JSON_KEY_ESCAPE_QUERY_CHARACTERS); return (null == isEscape) && (m_baseConfig != null) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getEscapeQueryChars()) : isEscape; }
[ "protected", "Boolean", "getEscapeQueryChars", "(", ")", "{", "Boolean", "isEscape", "=", "parseOptionalBooleanValue", "(", "m_configObject", ",", "JSON_KEY_ESCAPE_QUERY_CHARACTERS", ")", ";", "return", "(", "null", "==", "isEscape", ")", "&&", "(", "m_baseConfig", "!=", "null", ")", "?", "Boolean", ".", "valueOf", "(", "m_baseConfig", ".", "getGeneralConfig", "(", ")", ".", "getEscapeQueryChars", "(", ")", ")", ":", "isEscape", ";", "}" ]
Returns the flag, indicating if the characters in the query string that are commands to Solr should be escaped. @return the flag, indicating if the characters in the query string that are commands to Solr should be escaped.
[ "Returns", "the", "flag", "indicating", "if", "the", "characters", "in", "the", "query", "string", "that", "are", "commands", "to", "Solr", "should", "be", "escaped", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L588-L594
158,464
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getExtraSolrParams
protected String getExtraSolrParams() { try { return m_configObject.getString(JSON_KEY_EXTRASOLRPARAMS); } catch (JSONException e) { if (null == m_baseConfig) { if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_EXTRA_PARAMETERS_0), e); } return ""; } else { return m_baseConfig.getGeneralConfig().getExtraSolrParams(); } } }
java
protected String getExtraSolrParams() { try { return m_configObject.getString(JSON_KEY_EXTRASOLRPARAMS); } catch (JSONException e) { if (null == m_baseConfig) { if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_EXTRA_PARAMETERS_0), e); } return ""; } else { return m_baseConfig.getGeneralConfig().getExtraSolrParams(); } } }
[ "protected", "String", "getExtraSolrParams", "(", ")", "{", "try", "{", "return", "m_configObject", ".", "getString", "(", "JSON_KEY_EXTRASOLRPARAMS", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "if", "(", "null", "==", "m_baseConfig", ")", "{", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_NO_EXTRA_PARAMETERS_0", ")", ",", "e", ")", ";", "}", "return", "\"\"", ";", "}", "else", "{", "return", "m_baseConfig", ".", "getGeneralConfig", "(", ")", ".", "getExtraSolrParams", "(", ")", ";", "}", "}", "}" ]
Returns the configured extra parameters that should be given to Solr, or the empty string if no parameters are configured. @return The configured extra parameters that should be given to Solr, or the empty string if no parameters are configured.
[ "Returns", "the", "configured", "extra", "parameters", "that", "should", "be", "given", "to", "Solr", "or", "the", "empty", "string", "if", "no", "parameters", "are", "configured", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L599-L613
158,465
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getIgnoreExpirationDate
protected Boolean getIgnoreExpirationDate() { Boolean isIgnoreExpirationDate = parseOptionalBooleanValue(m_configObject, JSON_KEY_IGNORE_EXPIRATION_DATE); return (null == isIgnoreExpirationDate) && (m_baseConfig != null) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getIgnoreExpirationDate()) : isIgnoreExpirationDate; }
java
protected Boolean getIgnoreExpirationDate() { Boolean isIgnoreExpirationDate = parseOptionalBooleanValue(m_configObject, JSON_KEY_IGNORE_EXPIRATION_DATE); return (null == isIgnoreExpirationDate) && (m_baseConfig != null) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getIgnoreExpirationDate()) : isIgnoreExpirationDate; }
[ "protected", "Boolean", "getIgnoreExpirationDate", "(", ")", "{", "Boolean", "isIgnoreExpirationDate", "=", "parseOptionalBooleanValue", "(", "m_configObject", ",", "JSON_KEY_IGNORE_EXPIRATION_DATE", ")", ";", "return", "(", "null", "==", "isIgnoreExpirationDate", ")", "&&", "(", "m_baseConfig", "!=", "null", ")", "?", "Boolean", ".", "valueOf", "(", "m_baseConfig", ".", "getGeneralConfig", "(", ")", ".", "getIgnoreExpirationDate", "(", ")", ")", ":", "isIgnoreExpirationDate", ";", "}" ]
Returns a flag indicating if also expired resources should be found. @return A flag indicating if also expired resources should be found.
[ "Returns", "a", "flag", "indicating", "if", "also", "expired", "resources", "should", "be", "found", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L631-L637
158,466
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getIgnoreQuery
protected Boolean getIgnoreQuery() { Boolean isIgnoreQuery = parseOptionalBooleanValue(m_configObject, JSON_KEY_IGNORE_QUERY); return (null == isIgnoreQuery) && (m_baseConfig != null) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getIgnoreQueryParam()) : isIgnoreQuery; }
java
protected Boolean getIgnoreQuery() { Boolean isIgnoreQuery = parseOptionalBooleanValue(m_configObject, JSON_KEY_IGNORE_QUERY); return (null == isIgnoreQuery) && (m_baseConfig != null) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getIgnoreQueryParam()) : isIgnoreQuery; }
[ "protected", "Boolean", "getIgnoreQuery", "(", ")", "{", "Boolean", "isIgnoreQuery", "=", "parseOptionalBooleanValue", "(", "m_configObject", ",", "JSON_KEY_IGNORE_QUERY", ")", ";", "return", "(", "null", "==", "isIgnoreQuery", ")", "&&", "(", "m_baseConfig", "!=", "null", ")", "?", "Boolean", ".", "valueOf", "(", "m_baseConfig", ".", "getGeneralConfig", "(", ")", ".", "getIgnoreQueryParam", "(", ")", ")", ":", "isIgnoreQuery", ";", "}" ]
Returns a flag indicating if the query given by the parameters should be ignored. @return A flag indicating if the query given by the parameters should be ignored.
[ "Returns", "a", "flag", "indicating", "if", "the", "query", "given", "by", "the", "parameters", "should", "be", "ignored", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L642-L648
158,467
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getIgnoreReleaseDate
protected Boolean getIgnoreReleaseDate() { Boolean isIgnoreReleaseDate = parseOptionalBooleanValue(m_configObject, JSON_KEY_IGNORE_RELEASE_DATE); return (null == isIgnoreReleaseDate) && (m_baseConfig != null) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getIgnoreReleaseDate()) : isIgnoreReleaseDate; }
java
protected Boolean getIgnoreReleaseDate() { Boolean isIgnoreReleaseDate = parseOptionalBooleanValue(m_configObject, JSON_KEY_IGNORE_RELEASE_DATE); return (null == isIgnoreReleaseDate) && (m_baseConfig != null) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getIgnoreReleaseDate()) : isIgnoreReleaseDate; }
[ "protected", "Boolean", "getIgnoreReleaseDate", "(", ")", "{", "Boolean", "isIgnoreReleaseDate", "=", "parseOptionalBooleanValue", "(", "m_configObject", ",", "JSON_KEY_IGNORE_RELEASE_DATE", ")", ";", "return", "(", "null", "==", "isIgnoreReleaseDate", ")", "&&", "(", "m_baseConfig", "!=", "null", ")", "?", "Boolean", ".", "valueOf", "(", "m_baseConfig", ".", "getGeneralConfig", "(", ")", ".", "getIgnoreReleaseDate", "(", ")", ")", ":", "isIgnoreReleaseDate", ";", "}" ]
Returns a flag indicating if also unreleased resources should be found. @return A flag indicating if also unreleased resources should be found.
[ "Returns", "a", "flag", "indicating", "if", "also", "unreleased", "resources", "should", "be", "found", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L653-L659
158,468
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getPageSizes
protected List<Integer> getPageSizes() { try { return Collections.singletonList(Integer.valueOf(m_configObject.getInt(JSON_KEY_PAGESIZE))); } catch (JSONException e) { List<Integer> result = null; String pageSizesString = null; try { pageSizesString = m_configObject.getString(JSON_KEY_PAGESIZE); String[] pageSizesArray = pageSizesString.split("-"); if (pageSizesArray.length > 0) { result = new ArrayList<>(pageSizesArray.length); for (int i = 0; i < pageSizesArray.length; i++) { result.add(Integer.valueOf(pageSizesArray[i])); } } return result; } catch (NumberFormatException | JSONException e1) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_PARSING_PAGE_SIZES_FAILED_1, pageSizesString), e); } if (null == m_baseConfig) { if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_PAGESIZE_SPECIFIED_0), e); } return null; } else { return m_baseConfig.getPaginationConfig().getPageSizes(); } } }
java
protected List<Integer> getPageSizes() { try { return Collections.singletonList(Integer.valueOf(m_configObject.getInt(JSON_KEY_PAGESIZE))); } catch (JSONException e) { List<Integer> result = null; String pageSizesString = null; try { pageSizesString = m_configObject.getString(JSON_KEY_PAGESIZE); String[] pageSizesArray = pageSizesString.split("-"); if (pageSizesArray.length > 0) { result = new ArrayList<>(pageSizesArray.length); for (int i = 0; i < pageSizesArray.length; i++) { result.add(Integer.valueOf(pageSizesArray[i])); } } return result; } catch (NumberFormatException | JSONException e1) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_PARSING_PAGE_SIZES_FAILED_1, pageSizesString), e); } if (null == m_baseConfig) { if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_PAGESIZE_SPECIFIED_0), e); } return null; } else { return m_baseConfig.getPaginationConfig().getPageSizes(); } } }
[ "protected", "List", "<", "Integer", ">", "getPageSizes", "(", ")", "{", "try", "{", "return", "Collections", ".", "singletonList", "(", "Integer", ".", "valueOf", "(", "m_configObject", ".", "getInt", "(", "JSON_KEY_PAGESIZE", ")", ")", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "List", "<", "Integer", ">", "result", "=", "null", ";", "String", "pageSizesString", "=", "null", ";", "try", "{", "pageSizesString", "=", "m_configObject", ".", "getString", "(", "JSON_KEY_PAGESIZE", ")", ";", "String", "[", "]", "pageSizesArray", "=", "pageSizesString", ".", "split", "(", "\"-\"", ")", ";", "if", "(", "pageSizesArray", ".", "length", ">", "0", ")", "{", "result", "=", "new", "ArrayList", "<>", "(", "pageSizesArray", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pageSizesArray", ".", "length", ";", "i", "++", ")", "{", "result", ".", "add", "(", "Integer", ".", "valueOf", "(", "pageSizesArray", "[", "i", "]", ")", ")", ";", "}", "}", "return", "result", ";", "}", "catch", "(", "NumberFormatException", "|", "JSONException", "e1", ")", "{", "LOG", ".", "warn", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_PARSING_PAGE_SIZES_FAILED_1", ",", "pageSizesString", ")", ",", "e", ")", ";", "}", "if", "(", "null", "==", "m_baseConfig", ")", "{", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_NO_PAGESIZE_SPECIFIED_0", ")", ",", "e", ")", ";", "}", "return", "null", ";", "}", "else", "{", "return", "m_baseConfig", ".", "getPaginationConfig", "(", ")", ".", "getPageSizes", "(", ")", ";", "}", "}", "}" ]
Returns the configured page sizes, or the default page size if no core is configured. @return The configured page sizes, or the default page size if no core is configured.
[ "Returns", "the", "configured", "page", "sizes", "or", "the", "default", "page", "size", "if", "no", "core", "is", "configured", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L714-L743
158,469
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getQueryModifier
protected String getQueryModifier() { String queryModifier = parseOptionalStringValue(m_configObject, JSON_KEY_QUERY_MODIFIER); return (null == queryModifier) && (null != m_baseConfig) ? m_baseConfig.getGeneralConfig().getQueryModifier() : queryModifier; }
java
protected String getQueryModifier() { String queryModifier = parseOptionalStringValue(m_configObject, JSON_KEY_QUERY_MODIFIER); return (null == queryModifier) && (null != m_baseConfig) ? m_baseConfig.getGeneralConfig().getQueryModifier() : queryModifier; }
[ "protected", "String", "getQueryModifier", "(", ")", "{", "String", "queryModifier", "=", "parseOptionalStringValue", "(", "m_configObject", ",", "JSON_KEY_QUERY_MODIFIER", ")", ";", "return", "(", "null", "==", "queryModifier", ")", "&&", "(", "null", "!=", "m_baseConfig", ")", "?", "m_baseConfig", ".", "getGeneralConfig", "(", ")", ".", "getQueryModifier", "(", ")", ":", "queryModifier", ";", "}" ]
Returns the optional query modifier. @return the optional query modifier.
[ "Returns", "the", "optional", "query", "modifier", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L748-L754
158,470
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getQueryParam
protected String getQueryParam() { String param = parseOptionalStringValue(m_configObject, JSON_KEY_QUERYPARAM); if (param == null) { return null != m_baseConfig ? m_baseConfig.getGeneralConfig().getQueryParam() : DEFAULT_QUERY_PARAM; } else { return param; } }
java
protected String getQueryParam() { String param = parseOptionalStringValue(m_configObject, JSON_KEY_QUERYPARAM); if (param == null) { return null != m_baseConfig ? m_baseConfig.getGeneralConfig().getQueryParam() : DEFAULT_QUERY_PARAM; } else { return param; } }
[ "protected", "String", "getQueryParam", "(", ")", "{", "String", "param", "=", "parseOptionalStringValue", "(", "m_configObject", ",", "JSON_KEY_QUERYPARAM", ")", ";", "if", "(", "param", "==", "null", ")", "{", "return", "null", "!=", "m_baseConfig", "?", "m_baseConfig", ".", "getGeneralConfig", "(", ")", ".", "getQueryParam", "(", ")", ":", "DEFAULT_QUERY_PARAM", ";", "}", "else", "{", "return", "param", ";", "}", "}" ]
Returns the configured request parameter for the query string, or the default parameter if no core is configured. @return The configured request parameter for the query string, or the default parameter if no core is configured.
[ "Returns", "the", "configured", "request", "parameter", "for", "the", "query", "string", "or", "the", "default", "parameter", "if", "no", "core", "is", "configured", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L759-L767
158,471
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getSearchForEmptyQuery
protected Boolean getSearchForEmptyQuery() { Boolean isSearchForEmptyQuery = parseOptionalBooleanValue(m_configObject, JSON_KEY_SEARCH_FOR_EMPTY_QUERY); return (isSearchForEmptyQuery == null) && (null != m_baseConfig) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getSearchForEmptyQueryParam()) : isSearchForEmptyQuery; }
java
protected Boolean getSearchForEmptyQuery() { Boolean isSearchForEmptyQuery = parseOptionalBooleanValue(m_configObject, JSON_KEY_SEARCH_FOR_EMPTY_QUERY); return (isSearchForEmptyQuery == null) && (null != m_baseConfig) ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getSearchForEmptyQueryParam()) : isSearchForEmptyQuery; }
[ "protected", "Boolean", "getSearchForEmptyQuery", "(", ")", "{", "Boolean", "isSearchForEmptyQuery", "=", "parseOptionalBooleanValue", "(", "m_configObject", ",", "JSON_KEY_SEARCH_FOR_EMPTY_QUERY", ")", ";", "return", "(", "isSearchForEmptyQuery", "==", "null", ")", "&&", "(", "null", "!=", "m_baseConfig", ")", "?", "Boolean", ".", "valueOf", "(", "m_baseConfig", ".", "getGeneralConfig", "(", ")", ".", "getSearchForEmptyQueryParam", "(", ")", ")", ":", "isSearchForEmptyQuery", ";", "}" ]
Returns a flag, indicating if search should be performed using a wildcard if the empty query is given. @return A flag, indicating if search should be performed using a wildcard if the empty query is given.
[ "Returns", "a", "flag", "indicating", "if", "search", "should", "be", "performed", "using", "a", "wildcard", "if", "the", "empty", "query", "is", "given", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L772-L778
158,472
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.getSortOptions
protected List<I_CmsSearchConfigurationSortOption> getSortOptions() { List<I_CmsSearchConfigurationSortOption> options = new LinkedList<I_CmsSearchConfigurationSortOption>(); try { JSONArray sortOptions = m_configObject.getJSONArray(JSON_KEY_SORTOPTIONS); for (int i = 0; i < sortOptions.length(); i++) { I_CmsSearchConfigurationSortOption option = parseSortOption(sortOptions.getJSONObject(i)); if (option != null) { options.add(option); } } } catch (JSONException e) { if (null == m_baseConfig) { if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_SORT_CONFIG_0), e); } } else { options = m_baseConfig.getSortConfig().getSortOptions(); } } return options; }
java
protected List<I_CmsSearchConfigurationSortOption> getSortOptions() { List<I_CmsSearchConfigurationSortOption> options = new LinkedList<I_CmsSearchConfigurationSortOption>(); try { JSONArray sortOptions = m_configObject.getJSONArray(JSON_KEY_SORTOPTIONS); for (int i = 0; i < sortOptions.length(); i++) { I_CmsSearchConfigurationSortOption option = parseSortOption(sortOptions.getJSONObject(i)); if (option != null) { options.add(option); } } } catch (JSONException e) { if (null == m_baseConfig) { if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_SORT_CONFIG_0), e); } } else { options = m_baseConfig.getSortConfig().getSortOptions(); } } return options; }
[ "protected", "List", "<", "I_CmsSearchConfigurationSortOption", ">", "getSortOptions", "(", ")", "{", "List", "<", "I_CmsSearchConfigurationSortOption", ">", "options", "=", "new", "LinkedList", "<", "I_CmsSearchConfigurationSortOption", ">", "(", ")", ";", "try", "{", "JSONArray", "sortOptions", "=", "m_configObject", ".", "getJSONArray", "(", "JSON_KEY_SORTOPTIONS", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sortOptions", ".", "length", "(", ")", ";", "i", "++", ")", "{", "I_CmsSearchConfigurationSortOption", "option", "=", "parseSortOption", "(", "sortOptions", ".", "getJSONObject", "(", "i", ")", ")", ";", "if", "(", "option", "!=", "null", ")", "{", "options", ".", "add", "(", "option", ")", ";", "}", "}", "}", "catch", "(", "JSONException", "e", ")", "{", "if", "(", "null", "==", "m_baseConfig", ")", "{", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_NO_SORT_CONFIG_0", ")", ",", "e", ")", ";", "}", "}", "else", "{", "options", "=", "m_baseConfig", ".", "getSortConfig", "(", ")", ".", "getSortOptions", "(", ")", ";", "}", "}", "return", "options", ";", "}" ]
Returns the list of the configured sort options, or the empty list if no sort options are configured. @return The list of the configured sort options, or the empty list if no sort options are configured.
[ "Returns", "the", "list", "of", "the", "configured", "sort", "options", "or", "the", "empty", "list", "if", "no", "sort", "options", "are", "configured", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L783-L804
158,473
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.init
protected void init(String configString, I_CmsSearchConfiguration baseConfig) throws JSONException { m_configObject = new JSONObject(configString); m_baseConfig = baseConfig; }
java
protected void init(String configString, I_CmsSearchConfiguration baseConfig) throws JSONException { m_configObject = new JSONObject(configString); m_baseConfig = baseConfig; }
[ "protected", "void", "init", "(", "String", "configString", ",", "I_CmsSearchConfiguration", "baseConfig", ")", "throws", "JSONException", "{", "m_configObject", "=", "new", "JSONObject", "(", "configString", ")", ";", "m_baseConfig", "=", "baseConfig", ";", "}" ]
Initialization that parses the String to a JSON object. @param configString The JSON as string. @param baseConfig The optional basic search configuration to overwrite (partly) by the JSON configuration. @throws JSONException thrown if parsing fails.
[ "Initialization", "that", "parses", "the", "String", "to", "a", "JSON", "object", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L819-L823
158,474
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.parseFacetQueryItem
protected I_CmsFacetQueryItem parseFacetQueryItem(JSONObject item) { String query; try { query = item.getString(JSON_KEY_QUERY_FACET_QUERY_QUERY); } catch (JSONException e) { // TODO: Log return null; } String label = parseOptionalStringValue(item, JSON_KEY_QUERY_FACET_QUERY_LABEL); return new CmsFacetQueryItem(query, label); }
java
protected I_CmsFacetQueryItem parseFacetQueryItem(JSONObject item) { String query; try { query = item.getString(JSON_KEY_QUERY_FACET_QUERY_QUERY); } catch (JSONException e) { // TODO: Log return null; } String label = parseOptionalStringValue(item, JSON_KEY_QUERY_FACET_QUERY_LABEL); return new CmsFacetQueryItem(query, label); }
[ "protected", "I_CmsFacetQueryItem", "parseFacetQueryItem", "(", "JSONObject", "item", ")", "{", "String", "query", ";", "try", "{", "query", "=", "item", ".", "getString", "(", "JSON_KEY_QUERY_FACET_QUERY_QUERY", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "// TODO: Log", "return", "null", ";", "}", "String", "label", "=", "parseOptionalStringValue", "(", "item", ",", "JSON_KEY_QUERY_FACET_QUERY_LABEL", ")", ";", "return", "new", "CmsFacetQueryItem", "(", "query", ",", "label", ")", ";", "}" ]
Parses a single query item for the query facet. @param item JSON object of the query item. @return the parsed query item, or <code>null</code> if parsing failed.
[ "Parses", "a", "single", "query", "item", "for", "the", "query", "facet", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L829-L840
158,475
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.parseFacetQueryItems
protected List<I_CmsFacetQueryItem> parseFacetQueryItems(JSONObject queryFacetObject) throws JSONException { JSONArray items = queryFacetObject.getJSONArray(JSON_KEY_QUERY_FACET_QUERY); List<I_CmsFacetQueryItem> result = new ArrayList<I_CmsFacetQueryItem>(items.length()); for (int i = 0; i < items.length(); i++) { I_CmsFacetQueryItem item = parseFacetQueryItem(items.getJSONObject(i)); if (item != null) { result.add(item); } } return result; }
java
protected List<I_CmsFacetQueryItem> parseFacetQueryItems(JSONObject queryFacetObject) throws JSONException { JSONArray items = queryFacetObject.getJSONArray(JSON_KEY_QUERY_FACET_QUERY); List<I_CmsFacetQueryItem> result = new ArrayList<I_CmsFacetQueryItem>(items.length()); for (int i = 0; i < items.length(); i++) { I_CmsFacetQueryItem item = parseFacetQueryItem(items.getJSONObject(i)); if (item != null) { result.add(item); } } return result; }
[ "protected", "List", "<", "I_CmsFacetQueryItem", ">", "parseFacetQueryItems", "(", "JSONObject", "queryFacetObject", ")", "throws", "JSONException", "{", "JSONArray", "items", "=", "queryFacetObject", ".", "getJSONArray", "(", "JSON_KEY_QUERY_FACET_QUERY", ")", ";", "List", "<", "I_CmsFacetQueryItem", ">", "result", "=", "new", "ArrayList", "<", "I_CmsFacetQueryItem", ">", "(", "items", ".", "length", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "items", ".", "length", "(", ")", ";", "i", "++", ")", "{", "I_CmsFacetQueryItem", "item", "=", "parseFacetQueryItem", "(", "items", ".", "getJSONObject", "(", "i", ")", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "result", ".", "add", "(", "item", ")", ";", "}", "}", "return", "result", ";", "}" ]
Parses the list of query items for the query facet. @param queryFacetObject JSON object representing the node with the query facet. @return list of query options @throws JSONException if the list cannot be parsed.
[ "Parses", "the", "list", "of", "query", "items", "for", "the", "query", "facet", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L847-L858
158,476
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.parseFieldFacet
protected I_CmsSearchConfigurationFacetField parseFieldFacet(JSONObject fieldFacetObject) { try { String field = fieldFacetObject.getString(JSON_KEY_FACET_FIELD); String name = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_NAME); String label = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_LABEL); Integer minCount = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_MINCOUNT); Integer limit = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_LIMIT); String prefix = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_PREFIX); String sorder = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_ORDER); I_CmsSearchConfigurationFacet.SortOrder order; try { order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder); } catch (Exception e) { order = null; } String filterQueryModifier = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_FILTERQUERYMODIFIER); Boolean isAndFacet = parseOptionalBooleanValue(fieldFacetObject, JSON_KEY_FACET_ISANDFACET); List<String> preselection = parseOptionalStringValues(fieldFacetObject, JSON_KEY_FACET_PRESELECTION); Boolean ignoreFilterAllFacetFilters = parseOptionalBooleanValue( fieldFacetObject, JSON_KEY_FACET_IGNOREALLFACETFILTERS); return new CmsSearchConfigurationFacetField( field, name, minCount, limit, prefix, label, order, filterQueryModifier, isAndFacet, preselection, ignoreFilterAllFacetFilters); } catch (JSONException e) { LOG.error( Messages.get().getBundle().key(Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1, JSON_KEY_FACET_FIELD), e); return null; } }
java
protected I_CmsSearchConfigurationFacetField parseFieldFacet(JSONObject fieldFacetObject) { try { String field = fieldFacetObject.getString(JSON_KEY_FACET_FIELD); String name = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_NAME); String label = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_LABEL); Integer minCount = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_MINCOUNT); Integer limit = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_LIMIT); String prefix = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_PREFIX); String sorder = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_ORDER); I_CmsSearchConfigurationFacet.SortOrder order; try { order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder); } catch (Exception e) { order = null; } String filterQueryModifier = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_FILTERQUERYMODIFIER); Boolean isAndFacet = parseOptionalBooleanValue(fieldFacetObject, JSON_KEY_FACET_ISANDFACET); List<String> preselection = parseOptionalStringValues(fieldFacetObject, JSON_KEY_FACET_PRESELECTION); Boolean ignoreFilterAllFacetFilters = parseOptionalBooleanValue( fieldFacetObject, JSON_KEY_FACET_IGNOREALLFACETFILTERS); return new CmsSearchConfigurationFacetField( field, name, minCount, limit, prefix, label, order, filterQueryModifier, isAndFacet, preselection, ignoreFilterAllFacetFilters); } catch (JSONException e) { LOG.error( Messages.get().getBundle().key(Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1, JSON_KEY_FACET_FIELD), e); return null; } }
[ "protected", "I_CmsSearchConfigurationFacetField", "parseFieldFacet", "(", "JSONObject", "fieldFacetObject", ")", "{", "try", "{", "String", "field", "=", "fieldFacetObject", ".", "getString", "(", "JSON_KEY_FACET_FIELD", ")", ";", "String", "name", "=", "parseOptionalStringValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_NAME", ")", ";", "String", "label", "=", "parseOptionalStringValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_LABEL", ")", ";", "Integer", "minCount", "=", "parseOptionalIntValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_MINCOUNT", ")", ";", "Integer", "limit", "=", "parseOptionalIntValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_LIMIT", ")", ";", "String", "prefix", "=", "parseOptionalStringValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_PREFIX", ")", ";", "String", "sorder", "=", "parseOptionalStringValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_ORDER", ")", ";", "I_CmsSearchConfigurationFacet", ".", "SortOrder", "order", ";", "try", "{", "order", "=", "I_CmsSearchConfigurationFacet", ".", "SortOrder", ".", "valueOf", "(", "sorder", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "order", "=", "null", ";", "}", "String", "filterQueryModifier", "=", "parseOptionalStringValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_FILTERQUERYMODIFIER", ")", ";", "Boolean", "isAndFacet", "=", "parseOptionalBooleanValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_ISANDFACET", ")", ";", "List", "<", "String", ">", "preselection", "=", "parseOptionalStringValues", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_PRESELECTION", ")", ";", "Boolean", "ignoreFilterAllFacetFilters", "=", "parseOptionalBooleanValue", "(", "fieldFacetObject", ",", "JSON_KEY_FACET_IGNOREALLFACETFILTERS", ")", ";", "return", "new", "CmsSearchConfigurationFacetField", "(", "field", ",", "name", ",", "minCount", ",", "limit", ",", "prefix", ",", "label", ",", "order", ",", "filterQueryModifier", ",", "isAndFacet", ",", "preselection", ",", "ignoreFilterAllFacetFilters", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1", ",", "JSON_KEY_FACET_FIELD", ")", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Parses the field facet configurations. @param fieldFacetObject The JSON sub-node with the field facet configurations. @return The field facet configurations.
[ "Parses", "the", "field", "facet", "configurations", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L864-L904
158,477
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.parseRangeFacet
protected I_CmsSearchConfigurationFacetRange parseRangeFacet(JSONObject rangeFacetObject) { try { String range = rangeFacetObject.getString(JSON_KEY_RANGE_FACET_RANGE); String name = parseOptionalStringValue(rangeFacetObject, JSON_KEY_FACET_NAME); String label = parseOptionalStringValue(rangeFacetObject, JSON_KEY_FACET_LABEL); Integer minCount = parseOptionalIntValue(rangeFacetObject, JSON_KEY_FACET_MINCOUNT); String start = rangeFacetObject.getString(JSON_KEY_RANGE_FACET_START); String end = rangeFacetObject.getString(JSON_KEY_RANGE_FACET_END); String gap = rangeFacetObject.getString(JSON_KEY_RANGE_FACET_GAP); List<String> sother = parseOptionalStringValues(rangeFacetObject, JSON_KEY_RANGE_FACET_OTHER); Boolean hardEnd = parseOptionalBooleanValue(rangeFacetObject, JSON_KEY_RANGE_FACET_HARDEND); List<I_CmsSearchConfigurationFacetRange.Other> other = null; if (sother != null) { other = new ArrayList<I_CmsSearchConfigurationFacetRange.Other>(sother.size()); for (String so : sother) { try { I_CmsSearchConfigurationFacetRange.Other o = I_CmsSearchConfigurationFacetRange.Other.valueOf( so); other.add(o); } catch (Exception e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_INVALID_OTHER_OPTION_1, so), e); } } } Boolean isAndFacet = parseOptionalBooleanValue(rangeFacetObject, JSON_KEY_FACET_ISANDFACET); List<String> preselection = parseOptionalStringValues(rangeFacetObject, JSON_KEY_FACET_PRESELECTION); Boolean ignoreAllFacetFilters = parseOptionalBooleanValue( rangeFacetObject, JSON_KEY_FACET_IGNOREALLFACETFILTERS); return new CmsSearchConfigurationFacetRange( range, start, end, gap, other, hardEnd, name, minCount, label, isAndFacet, preselection, ignoreAllFacetFilters); } catch (JSONException e) { LOG.error( Messages.get().getBundle().key( Messages.ERR_RANGE_FACET_MANDATORY_KEY_MISSING_1, JSON_KEY_RANGE_FACET_RANGE + ", " + JSON_KEY_RANGE_FACET_START + ", " + JSON_KEY_RANGE_FACET_END + ", " + JSON_KEY_RANGE_FACET_GAP), e); return null; } }
java
protected I_CmsSearchConfigurationFacetRange parseRangeFacet(JSONObject rangeFacetObject) { try { String range = rangeFacetObject.getString(JSON_KEY_RANGE_FACET_RANGE); String name = parseOptionalStringValue(rangeFacetObject, JSON_KEY_FACET_NAME); String label = parseOptionalStringValue(rangeFacetObject, JSON_KEY_FACET_LABEL); Integer minCount = parseOptionalIntValue(rangeFacetObject, JSON_KEY_FACET_MINCOUNT); String start = rangeFacetObject.getString(JSON_KEY_RANGE_FACET_START); String end = rangeFacetObject.getString(JSON_KEY_RANGE_FACET_END); String gap = rangeFacetObject.getString(JSON_KEY_RANGE_FACET_GAP); List<String> sother = parseOptionalStringValues(rangeFacetObject, JSON_KEY_RANGE_FACET_OTHER); Boolean hardEnd = parseOptionalBooleanValue(rangeFacetObject, JSON_KEY_RANGE_FACET_HARDEND); List<I_CmsSearchConfigurationFacetRange.Other> other = null; if (sother != null) { other = new ArrayList<I_CmsSearchConfigurationFacetRange.Other>(sother.size()); for (String so : sother) { try { I_CmsSearchConfigurationFacetRange.Other o = I_CmsSearchConfigurationFacetRange.Other.valueOf( so); other.add(o); } catch (Exception e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_INVALID_OTHER_OPTION_1, so), e); } } } Boolean isAndFacet = parseOptionalBooleanValue(rangeFacetObject, JSON_KEY_FACET_ISANDFACET); List<String> preselection = parseOptionalStringValues(rangeFacetObject, JSON_KEY_FACET_PRESELECTION); Boolean ignoreAllFacetFilters = parseOptionalBooleanValue( rangeFacetObject, JSON_KEY_FACET_IGNOREALLFACETFILTERS); return new CmsSearchConfigurationFacetRange( range, start, end, gap, other, hardEnd, name, minCount, label, isAndFacet, preselection, ignoreAllFacetFilters); } catch (JSONException e) { LOG.error( Messages.get().getBundle().key( Messages.ERR_RANGE_FACET_MANDATORY_KEY_MISSING_1, JSON_KEY_RANGE_FACET_RANGE + ", " + JSON_KEY_RANGE_FACET_START + ", " + JSON_KEY_RANGE_FACET_END + ", " + JSON_KEY_RANGE_FACET_GAP), e); return null; } }
[ "protected", "I_CmsSearchConfigurationFacetRange", "parseRangeFacet", "(", "JSONObject", "rangeFacetObject", ")", "{", "try", "{", "String", "range", "=", "rangeFacetObject", ".", "getString", "(", "JSON_KEY_RANGE_FACET_RANGE", ")", ";", "String", "name", "=", "parseOptionalStringValue", "(", "rangeFacetObject", ",", "JSON_KEY_FACET_NAME", ")", ";", "String", "label", "=", "parseOptionalStringValue", "(", "rangeFacetObject", ",", "JSON_KEY_FACET_LABEL", ")", ";", "Integer", "minCount", "=", "parseOptionalIntValue", "(", "rangeFacetObject", ",", "JSON_KEY_FACET_MINCOUNT", ")", ";", "String", "start", "=", "rangeFacetObject", ".", "getString", "(", "JSON_KEY_RANGE_FACET_START", ")", ";", "String", "end", "=", "rangeFacetObject", ".", "getString", "(", "JSON_KEY_RANGE_FACET_END", ")", ";", "String", "gap", "=", "rangeFacetObject", ".", "getString", "(", "JSON_KEY_RANGE_FACET_GAP", ")", ";", "List", "<", "String", ">", "sother", "=", "parseOptionalStringValues", "(", "rangeFacetObject", ",", "JSON_KEY_RANGE_FACET_OTHER", ")", ";", "Boolean", "hardEnd", "=", "parseOptionalBooleanValue", "(", "rangeFacetObject", ",", "JSON_KEY_RANGE_FACET_HARDEND", ")", ";", "List", "<", "I_CmsSearchConfigurationFacetRange", ".", "Other", ">", "other", "=", "null", ";", "if", "(", "sother", "!=", "null", ")", "{", "other", "=", "new", "ArrayList", "<", "I_CmsSearchConfigurationFacetRange", ".", "Other", ">", "(", "sother", ".", "size", "(", ")", ")", ";", "for", "(", "String", "so", ":", "sother", ")", "{", "try", "{", "I_CmsSearchConfigurationFacetRange", ".", "Other", "o", "=", "I_CmsSearchConfigurationFacetRange", ".", "Other", ".", "valueOf", "(", "so", ")", ";", "other", ".", "add", "(", "o", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_INVALID_OTHER_OPTION_1", ",", "so", ")", ",", "e", ")", ";", "}", "}", "}", "Boolean", "isAndFacet", "=", "parseOptionalBooleanValue", "(", "rangeFacetObject", ",", "JSON_KEY_FACET_ISANDFACET", ")", ";", "List", "<", "String", ">", "preselection", "=", "parseOptionalStringValues", "(", "rangeFacetObject", ",", "JSON_KEY_FACET_PRESELECTION", ")", ";", "Boolean", "ignoreAllFacetFilters", "=", "parseOptionalBooleanValue", "(", "rangeFacetObject", ",", "JSON_KEY_FACET_IGNOREALLFACETFILTERS", ")", ";", "return", "new", "CmsSearchConfigurationFacetRange", "(", "range", ",", "start", ",", "end", ",", "gap", ",", "other", ",", "hardEnd", ",", "name", ",", "minCount", ",", "label", ",", "isAndFacet", ",", "preselection", ",", "ignoreAllFacetFilters", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_RANGE_FACET_MANDATORY_KEY_MISSING_1", ",", "JSON_KEY_RANGE_FACET_RANGE", "+", "\", \"", "+", "JSON_KEY_RANGE_FACET_START", "+", "\", \"", "+", "JSON_KEY_RANGE_FACET_END", "+", "\", \"", "+", "JSON_KEY_RANGE_FACET_GAP", ")", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Parses the query facet configurations. @param rangeFacetObject The JSON sub-node with the query facet configurations. @return The query facet configurations.
[ "Parses", "the", "query", "facet", "configurations", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L910-L968
158,478
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.parseSortOption
protected I_CmsSearchConfigurationSortOption parseSortOption(JSONObject json) { try { String solrValue = json.getString(JSON_KEY_SORTOPTION_SOLRVALUE); String paramValue = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_PARAMVALUE); paramValue = (paramValue == null) ? solrValue : paramValue; String label = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_LABEL); label = (label == null) ? paramValue : label; return new CmsSearchConfigurationSortOption(label, paramValue, solrValue); } catch (JSONException e) { LOG.error( Messages.get().getBundle().key(Messages.ERR_SORT_OPTION_NOT_PARSABLE_1, JSON_KEY_SORTOPTION_SOLRVALUE), e); return null; } }
java
protected I_CmsSearchConfigurationSortOption parseSortOption(JSONObject json) { try { String solrValue = json.getString(JSON_KEY_SORTOPTION_SOLRVALUE); String paramValue = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_PARAMVALUE); paramValue = (paramValue == null) ? solrValue : paramValue; String label = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_LABEL); label = (label == null) ? paramValue : label; return new CmsSearchConfigurationSortOption(label, paramValue, solrValue); } catch (JSONException e) { LOG.error( Messages.get().getBundle().key(Messages.ERR_SORT_OPTION_NOT_PARSABLE_1, JSON_KEY_SORTOPTION_SOLRVALUE), e); return null; } }
[ "protected", "I_CmsSearchConfigurationSortOption", "parseSortOption", "(", "JSONObject", "json", ")", "{", "try", "{", "String", "solrValue", "=", "json", ".", "getString", "(", "JSON_KEY_SORTOPTION_SOLRVALUE", ")", ";", "String", "paramValue", "=", "parseOptionalStringValue", "(", "json", ",", "JSON_KEY_SORTOPTION_PARAMVALUE", ")", ";", "paramValue", "=", "(", "paramValue", "==", "null", ")", "?", "solrValue", ":", "paramValue", ";", "String", "label", "=", "parseOptionalStringValue", "(", "json", ",", "JSON_KEY_SORTOPTION_LABEL", ")", ";", "label", "=", "(", "label", "==", "null", ")", "?", "paramValue", ":", "label", ";", "return", "new", "CmsSearchConfigurationSortOption", "(", "label", ",", "paramValue", ",", "solrValue", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_SORT_OPTION_NOT_PARSABLE_1", ",", "JSON_KEY_SORTOPTION_SOLRVALUE", ")", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Returns a single sort option configuration as configured via the methods parameter, or null if the parameter does not specify a sort option. @param json The JSON sort option configuration. @return The sort option configuration, or null if the JSON could not be read.
[ "Returns", "a", "single", "sort", "option", "configuration", "as", "configured", "via", "the", "methods", "parameter", "or", "null", "if", "the", "parameter", "does", "not", "specify", "a", "sort", "option", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L974-L989
158,479
alkacon/opencms-core
src/org/opencms/search/extractors/CmsExtractionResult.java
CmsExtractionResult.mergeItem
private Map<String, String> mergeItem( String item, Map<String, String> localeValues, Map<String, String> resultLocaleValues) { if (resultLocaleValues.get(item) != null) { if (localeValues.get(item) != null) { localeValues.put(item, localeValues.get(item) + " " + resultLocaleValues.get(item)); } else { localeValues.put(item, resultLocaleValues.get(item)); } } return localeValues; }
java
private Map<String, String> mergeItem( String item, Map<String, String> localeValues, Map<String, String> resultLocaleValues) { if (resultLocaleValues.get(item) != null) { if (localeValues.get(item) != null) { localeValues.put(item, localeValues.get(item) + " " + resultLocaleValues.get(item)); } else { localeValues.put(item, resultLocaleValues.get(item)); } } return localeValues; }
[ "private", "Map", "<", "String", ",", "String", ">", "mergeItem", "(", "String", "item", ",", "Map", "<", "String", ",", "String", ">", "localeValues", ",", "Map", "<", "String", ",", "String", ">", "resultLocaleValues", ")", "{", "if", "(", "resultLocaleValues", ".", "get", "(", "item", ")", "!=", "null", ")", "{", "if", "(", "localeValues", ".", "get", "(", "item", ")", "!=", "null", ")", "{", "localeValues", ".", "put", "(", "item", ",", "localeValues", ".", "get", "(", "item", ")", "+", "\" \"", "+", "resultLocaleValues", ".", "get", "(", "item", ")", ")", ";", "}", "else", "{", "localeValues", ".", "put", "(", "item", ",", "resultLocaleValues", ".", "get", "(", "item", ")", ")", ";", "}", "}", "return", "localeValues", ";", "}" ]
Merges the item from the resultLocaleValues into the corresponding item of the localeValues. @param item the item to merge @param localeValues the values where the item gets merged into @param resultLocaleValues the values where the item to merge is read from @return the modified localeValues with the merged item
[ "Merges", "the", "item", "from", "the", "resultLocaleValues", "into", "the", "corresponding", "item", "of", "the", "localeValues", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/extractors/CmsExtractionResult.java#L320-L334
158,480
alkacon/opencms-core
src/org/opencms/ade/galleries/shared/CmsGalleryTabConfiguration.java
CmsGalleryTabConfiguration.resolve
public static CmsGalleryTabConfiguration resolve(String configStr) { CmsGalleryTabConfiguration tabConfig; if (CmsStringUtil.isEmptyOrWhitespaceOnly(configStr)) { configStr = "*sitemap,types,galleries,categories,vfstree,search,results"; } if (DEFAULT_CONFIGURATIONS != null) { tabConfig = DEFAULT_CONFIGURATIONS.get(configStr); if (tabConfig != null) { return tabConfig; } } return parse(configStr); }
java
public static CmsGalleryTabConfiguration resolve(String configStr) { CmsGalleryTabConfiguration tabConfig; if (CmsStringUtil.isEmptyOrWhitespaceOnly(configStr)) { configStr = "*sitemap,types,galleries,categories,vfstree,search,results"; } if (DEFAULT_CONFIGURATIONS != null) { tabConfig = DEFAULT_CONFIGURATIONS.get(configStr); if (tabConfig != null) { return tabConfig; } } return parse(configStr); }
[ "public", "static", "CmsGalleryTabConfiguration", "resolve", "(", "String", "configStr", ")", "{", "CmsGalleryTabConfiguration", "tabConfig", ";", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "configStr", ")", ")", "{", "configStr", "=", "\"*sitemap,types,galleries,categories,vfstree,search,results\"", ";", "}", "if", "(", "DEFAULT_CONFIGURATIONS", "!=", "null", ")", "{", "tabConfig", "=", "DEFAULT_CONFIGURATIONS", ".", "get", "(", "configStr", ")", ";", "if", "(", "tabConfig", "!=", "null", ")", "{", "return", "tabConfig", ";", "}", "}", "return", "parse", "(", "configStr", ")", ";", "}" ]
Given a string which is either the name of a predefined tab configuration or a configuration string, returns the corresponding tab configuration. @param configStr a configuration string or predefined configuration name @return the gallery tab configuration
[ "Given", "a", "string", "which", "is", "either", "the", "name", "of", "a", "predefined", "tab", "configuration", "or", "a", "configuration", "string", "returns", "the", "corresponding", "tab", "configuration", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/shared/CmsGalleryTabConfiguration.java#L181-L195
158,481
alkacon/opencms-core
src-setup/org/opencms/setup/ui/CmsSetupStep04Modules.java
CmsSetupStep04Modules.forward
private void forward() { Set<String> selected = new HashSet<>(); for (CheckBox checkbox : m_componentCheckboxes) { CmsSetupComponent component = (CmsSetupComponent)(checkbox.getData()); if (checkbox.getValue().booleanValue()) { selected.add(component.getId()); } } String error = null; for (String compId : selected) { CmsSetupComponent component = m_componentMap.get(compId); for (String dep : component.getDependencies()) { if (!selected.contains(dep)) { error = "Unfulfilled dependency: The component " + component.getName() + " can not be installed because its dependency " + m_componentMap.get(dep).getName() + " is not selected"; break; } } } if (error == null) { Set<String> modules = new HashSet<>(); for (CmsSetupComponent component : m_componentMap.values()) { if (selected.contains(component.getId())) { for (CmsModule module : m_context.getSetupBean().getAvailableModules().values()) { if (component.match(module.getName())) { modules.add(module.getName()); } } } } List<String> moduleList = new ArrayList<>(modules); m_context.getSetupBean().setInstallModules(CmsStringUtil.listAsString(moduleList, "|")); m_context.stepForward(); } else { CmsSetupErrorDialog.showErrorDialog(error, error); } }
java
private void forward() { Set<String> selected = new HashSet<>(); for (CheckBox checkbox : m_componentCheckboxes) { CmsSetupComponent component = (CmsSetupComponent)(checkbox.getData()); if (checkbox.getValue().booleanValue()) { selected.add(component.getId()); } } String error = null; for (String compId : selected) { CmsSetupComponent component = m_componentMap.get(compId); for (String dep : component.getDependencies()) { if (!selected.contains(dep)) { error = "Unfulfilled dependency: The component " + component.getName() + " can not be installed because its dependency " + m_componentMap.get(dep).getName() + " is not selected"; break; } } } if (error == null) { Set<String> modules = new HashSet<>(); for (CmsSetupComponent component : m_componentMap.values()) { if (selected.contains(component.getId())) { for (CmsModule module : m_context.getSetupBean().getAvailableModules().values()) { if (component.match(module.getName())) { modules.add(module.getName()); } } } } List<String> moduleList = new ArrayList<>(modules); m_context.getSetupBean().setInstallModules(CmsStringUtil.listAsString(moduleList, "|")); m_context.stepForward(); } else { CmsSetupErrorDialog.showErrorDialog(error, error); } }
[ "private", "void", "forward", "(", ")", "{", "Set", "<", "String", ">", "selected", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "CheckBox", "checkbox", ":", "m_componentCheckboxes", ")", "{", "CmsSetupComponent", "component", "=", "(", "CmsSetupComponent", ")", "(", "checkbox", ".", "getData", "(", ")", ")", ";", "if", "(", "checkbox", ".", "getValue", "(", ")", ".", "booleanValue", "(", ")", ")", "{", "selected", ".", "add", "(", "component", ".", "getId", "(", ")", ")", ";", "}", "}", "String", "error", "=", "null", ";", "for", "(", "String", "compId", ":", "selected", ")", "{", "CmsSetupComponent", "component", "=", "m_componentMap", ".", "get", "(", "compId", ")", ";", "for", "(", "String", "dep", ":", "component", ".", "getDependencies", "(", ")", ")", "{", "if", "(", "!", "selected", ".", "contains", "(", "dep", ")", ")", "{", "error", "=", "\"Unfulfilled dependency: The component \"", "+", "component", ".", "getName", "(", ")", "+", "\" can not be installed because its dependency \"", "+", "m_componentMap", ".", "get", "(", "dep", ")", ".", "getName", "(", ")", "+", "\" is not selected\"", ";", "break", ";", "}", "}", "}", "if", "(", "error", "==", "null", ")", "{", "Set", "<", "String", ">", "modules", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "CmsSetupComponent", "component", ":", "m_componentMap", ".", "values", "(", ")", ")", "{", "if", "(", "selected", ".", "contains", "(", "component", ".", "getId", "(", ")", ")", ")", "{", "for", "(", "CmsModule", "module", ":", "m_context", ".", "getSetupBean", "(", ")", ".", "getAvailableModules", "(", ")", ".", "values", "(", ")", ")", "{", "if", "(", "component", ".", "match", "(", "module", ".", "getName", "(", ")", ")", ")", "{", "modules", ".", "add", "(", "module", ".", "getName", "(", ")", ")", ";", "}", "}", "}", "}", "List", "<", "String", ">", "moduleList", "=", "new", "ArrayList", "<>", "(", "modules", ")", ";", "m_context", ".", "getSetupBean", "(", ")", ".", "setInstallModules", "(", "CmsStringUtil", ".", "listAsString", "(", "moduleList", ",", "\"|\"", ")", ")", ";", "m_context", ".", "stepForward", "(", ")", ";", "}", "else", "{", "CmsSetupErrorDialog", ".", "showErrorDialog", "(", "error", ",", "error", ")", ";", "}", "}" ]
Moves to the next step.
[ "Moves", "to", "the", "next", "step", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsSetupStep04Modules.java#L90-L134
158,482
alkacon/opencms-core
src-setup/org/opencms/setup/ui/CmsSetupStep04Modules.java
CmsSetupStep04Modules.initComponents
private void initComponents(List<CmsSetupComponent> components) { for (CmsSetupComponent component : components) { CheckBox checkbox = new CheckBox(); checkbox.setValue(component.isChecked()); checkbox.setCaption(component.getName() + " - " + component.getDescription()); checkbox.setDescription(component.getDescription()); checkbox.setData(component); checkbox.setWidth("100%"); m_components.addComponent(checkbox); m_componentCheckboxes.add(checkbox); m_componentMap.put(component.getId(), component); } }
java
private void initComponents(List<CmsSetupComponent> components) { for (CmsSetupComponent component : components) { CheckBox checkbox = new CheckBox(); checkbox.setValue(component.isChecked()); checkbox.setCaption(component.getName() + " - " + component.getDescription()); checkbox.setDescription(component.getDescription()); checkbox.setData(component); checkbox.setWidth("100%"); m_components.addComponent(checkbox); m_componentCheckboxes.add(checkbox); m_componentMap.put(component.getId(), component); } }
[ "private", "void", "initComponents", "(", "List", "<", "CmsSetupComponent", ">", "components", ")", "{", "for", "(", "CmsSetupComponent", "component", ":", "components", ")", "{", "CheckBox", "checkbox", "=", "new", "CheckBox", "(", ")", ";", "checkbox", ".", "setValue", "(", "component", ".", "isChecked", "(", ")", ")", ";", "checkbox", ".", "setCaption", "(", "component", ".", "getName", "(", ")", "+", "\" - \"", "+", "component", ".", "getDescription", "(", ")", ")", ";", "checkbox", ".", "setDescription", "(", "component", ".", "getDescription", "(", ")", ")", ";", "checkbox", ".", "setData", "(", "component", ")", ";", "checkbox", ".", "setWidth", "(", "\"100%\"", ")", ";", "m_components", ".", "addComponent", "(", "checkbox", ")", ";", "m_componentCheckboxes", ".", "add", "(", "checkbox", ")", ";", "m_componentMap", ".", "put", "(", "component", ".", "getId", "(", ")", ",", "component", ")", ";", "}", "}" ]
Initializes the components. @param components the components
[ "Initializes", "the", "components", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsSetupStep04Modules.java#L141-L155
158,483
alkacon/opencms-core
src/org/opencms/jsp/search/controller/CmsSearchControllerFacetQuery.java
CmsSearchControllerFacetQuery.addFacetPart
protected void addFacetPart(CmsSolrQuery query) { query.set("facet", "true"); String excludes = ""; if (m_config.getIgnoreAllFacetFilters() || (!m_state.getCheckedEntries().isEmpty() && !m_config.getIsAndFacet())) { excludes = "{!ex=" + m_config.getIgnoreTags() + "}"; } for (I_CmsFacetQueryItem q : m_config.getQueryList()) { query.add("facet.query", excludes + q.getQuery()); } }
java
protected void addFacetPart(CmsSolrQuery query) { query.set("facet", "true"); String excludes = ""; if (m_config.getIgnoreAllFacetFilters() || (!m_state.getCheckedEntries().isEmpty() && !m_config.getIsAndFacet())) { excludes = "{!ex=" + m_config.getIgnoreTags() + "}"; } for (I_CmsFacetQueryItem q : m_config.getQueryList()) { query.add("facet.query", excludes + q.getQuery()); } }
[ "protected", "void", "addFacetPart", "(", "CmsSolrQuery", "query", ")", "{", "query", ".", "set", "(", "\"facet\"", ",", "\"true\"", ")", ";", "String", "excludes", "=", "\"\"", ";", "if", "(", "m_config", ".", "getIgnoreAllFacetFilters", "(", ")", "||", "(", "!", "m_state", ".", "getCheckedEntries", "(", ")", ".", "isEmpty", "(", ")", "&&", "!", "m_config", ".", "getIsAndFacet", "(", ")", ")", ")", "{", "excludes", "=", "\"{!ex=\"", "+", "m_config", ".", "getIgnoreTags", "(", ")", "+", "\"}\"", ";", "}", "for", "(", "I_CmsFacetQueryItem", "q", ":", "m_config", ".", "getQueryList", "(", ")", ")", "{", "query", ".", "add", "(", "\"facet.query\"", ",", "excludes", "+", "q", ".", "getQuery", "(", ")", ")", ";", "}", "}" ]
Add query part for the facet, without filters. @param query The query part that is extended for the facet
[ "Add", "query", "part", "for", "the", "facet", "without", "filters", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/controller/CmsSearchControllerFacetQuery.java#L140-L152
158,484
alkacon/opencms-core
src/org/opencms/jsp/search/result/CmsSearchResultWrapper.java
CmsSearchResultWrapper.convertSearchResults
protected void convertSearchResults(final Collection<CmsSearchResource> searchResults) { m_foundResources = new ArrayList<I_CmsSearchResourceBean>(); for (final CmsSearchResource searchResult : searchResults) { m_foundResources.add(new CmsSearchResourceBean(searchResult, m_cmsObject)); } }
java
protected void convertSearchResults(final Collection<CmsSearchResource> searchResults) { m_foundResources = new ArrayList<I_CmsSearchResourceBean>(); for (final CmsSearchResource searchResult : searchResults) { m_foundResources.add(new CmsSearchResourceBean(searchResult, m_cmsObject)); } }
[ "protected", "void", "convertSearchResults", "(", "final", "Collection", "<", "CmsSearchResource", ">", "searchResults", ")", "{", "m_foundResources", "=", "new", "ArrayList", "<", "I_CmsSearchResourceBean", ">", "(", ")", ";", "for", "(", "final", "CmsSearchResource", "searchResult", ":", "searchResults", ")", "{", "m_foundResources", ".", "add", "(", "new", "CmsSearchResourceBean", "(", "searchResult", ",", "m_cmsObject", ")", ")", ";", "}", "}" ]
Converts the search results from CmsSearchResource to CmsSearchResourceBean. @param searchResults The collection of search results to transform.
[ "Converts", "the", "search", "results", "from", "CmsSearchResource", "to", "CmsSearchResourceBean", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/result/CmsSearchResultWrapper.java#L487-L493
158,485
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.addAliasToConfigSite
public void addAliasToConfigSite(String alias, String redirect, String offset) { long timeOffset = 0; try { timeOffset = Long.parseLong(offset); } catch (Throwable e) { // ignore } CmsSiteMatcher siteMatcher = new CmsSiteMatcher(alias, timeOffset); boolean redirectVal = new Boolean(redirect).booleanValue(); siteMatcher.setRedirect(redirectVal); m_aliases.add(siteMatcher); }
java
public void addAliasToConfigSite(String alias, String redirect, String offset) { long timeOffset = 0; try { timeOffset = Long.parseLong(offset); } catch (Throwable e) { // ignore } CmsSiteMatcher siteMatcher = new CmsSiteMatcher(alias, timeOffset); boolean redirectVal = new Boolean(redirect).booleanValue(); siteMatcher.setRedirect(redirectVal); m_aliases.add(siteMatcher); }
[ "public", "void", "addAliasToConfigSite", "(", "String", "alias", ",", "String", "redirect", ",", "String", "offset", ")", "{", "long", "timeOffset", "=", "0", ";", "try", "{", "timeOffset", "=", "Long", ".", "parseLong", "(", "offset", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "// ignore", "}", "CmsSiteMatcher", "siteMatcher", "=", "new", "CmsSiteMatcher", "(", "alias", ",", "timeOffset", ")", ";", "boolean", "redirectVal", "=", "new", "Boolean", "(", "redirect", ")", ".", "booleanValue", "(", ")", ";", "siteMatcher", ".", "setRedirect", "(", "redirectVal", ")", ";", "m_aliases", ".", "add", "(", "siteMatcher", ")", ";", "}" ]
Adds an alias to the currently configured site. @param alias the URL of the alias server @param redirect <code>true</code> to always redirect to main URL @param offset the optional time offset for this alias
[ "Adds", "an", "alias", "to", "the", "currently", "configured", "site", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L207-L219
158,486
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.addServer
private void addServer(CmsSiteMatcher matcher, CmsSite site) { Map<CmsSiteMatcher, CmsSite> siteMatcherSites = new HashMap<CmsSiteMatcher, CmsSite>(m_siteMatcherSites); siteMatcherSites.put(matcher, site); setSiteMatcherSites(siteMatcherSites); }
java
private void addServer(CmsSiteMatcher matcher, CmsSite site) { Map<CmsSiteMatcher, CmsSite> siteMatcherSites = new HashMap<CmsSiteMatcher, CmsSite>(m_siteMatcherSites); siteMatcherSites.put(matcher, site); setSiteMatcherSites(siteMatcherSites); }
[ "private", "void", "addServer", "(", "CmsSiteMatcher", "matcher", ",", "CmsSite", "site", ")", "{", "Map", "<", "CmsSiteMatcher", ",", "CmsSite", ">", "siteMatcherSites", "=", "new", "HashMap", "<", "CmsSiteMatcher", ",", "CmsSite", ">", "(", "m_siteMatcherSites", ")", ";", "siteMatcherSites", ".", "put", "(", "matcher", ",", "site", ")", ";", "setSiteMatcherSites", "(", "siteMatcherSites", ")", ";", "}" ]
Adds a new Site matcher object to the map of server names. @param matcher the SiteMatcher of the server @param site the site to add
[ "Adds", "a", "new", "Site", "matcher", "object", "to", "the", "map", "of", "server", "names", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L1632-L1637
158,487
alkacon/opencms-core
src/org/opencms/ui/apps/sitemanager/CmsSitesWebserverThread.java
CmsSitesWebserverThread.updateLetsEncrypt
private void updateLetsEncrypt() { getReport().println(Messages.get().container(Messages.RPT_STARTING_LETSENCRYPT_UPDATE_0)); CmsLetsEncryptConfiguration config = OpenCms.getLetsEncryptConfig(); if ((config == null) || !config.isValidAndEnabled()) { return; } CmsSiteConfigToLetsEncryptConfigConverter converter = new CmsSiteConfigToLetsEncryptConfigConverter(config); boolean ok = converter.run(getReport(), OpenCms.getSiteManager()); if (ok) { getReport().println( org.opencms.ui.apps.Messages.get().container(org.opencms.ui.apps.Messages.RPT_LETSENCRYPT_FINISHED_0), I_CmsReport.FORMAT_OK); } }
java
private void updateLetsEncrypt() { getReport().println(Messages.get().container(Messages.RPT_STARTING_LETSENCRYPT_UPDATE_0)); CmsLetsEncryptConfiguration config = OpenCms.getLetsEncryptConfig(); if ((config == null) || !config.isValidAndEnabled()) { return; } CmsSiteConfigToLetsEncryptConfigConverter converter = new CmsSiteConfigToLetsEncryptConfigConverter(config); boolean ok = converter.run(getReport(), OpenCms.getSiteManager()); if (ok) { getReport().println( org.opencms.ui.apps.Messages.get().container(org.opencms.ui.apps.Messages.RPT_LETSENCRYPT_FINISHED_0), I_CmsReport.FORMAT_OK); } }
[ "private", "void", "updateLetsEncrypt", "(", ")", "{", "getReport", "(", ")", ".", "println", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "RPT_STARTING_LETSENCRYPT_UPDATE_0", ")", ")", ";", "CmsLetsEncryptConfiguration", "config", "=", "OpenCms", ".", "getLetsEncryptConfig", "(", ")", ";", "if", "(", "(", "config", "==", "null", ")", "||", "!", "config", ".", "isValidAndEnabled", "(", ")", ")", "{", "return", ";", "}", "CmsSiteConfigToLetsEncryptConfigConverter", "converter", "=", "new", "CmsSiteConfigToLetsEncryptConfigConverter", "(", "config", ")", ";", "boolean", "ok", "=", "converter", ".", "run", "(", "getReport", "(", ")", ",", "OpenCms", ".", "getSiteManager", "(", ")", ")", ";", "if", "(", "ok", ")", "{", "getReport", "(", ")", ".", "println", "(", "org", ".", "opencms", ".", "ui", ".", "apps", ".", "Messages", ".", "get", "(", ")", ".", "container", "(", "org", ".", "opencms", ".", "ui", ".", "apps", ".", "Messages", ".", "RPT_LETSENCRYPT_FINISHED_0", ")", ",", "I_CmsReport", ".", "FORMAT_OK", ")", ";", "}", "}" ]
Updates LetsEncrypt configuration.
[ "Updates", "LetsEncrypt", "configuration", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sitemanager/CmsSitesWebserverThread.java#L330-L346
158,488
alkacon/opencms-core
src/org/opencms/ade/contenteditor/CmsContentService.java
CmsContentService.getDynamicAttributeValue
private String getDynamicAttributeValue( CmsFile file, I_CmsXmlContentValue value, String attributeName, CmsEntity editedLocalEntity) { if ((null != editedLocalEntity) && (editedLocalEntity.getAttribute(attributeName) != null)) { getSessionCache().setDynamicValue( attributeName, editedLocalEntity.getAttribute(attributeName).getSimpleValue()); } String currentValue = getSessionCache().getDynamicValue(attributeName); if (null != currentValue) { return currentValue; } if (null != file) { if (value.getTypeName().equals(CmsXmlDynamicCategoryValue.TYPE_NAME)) { List<CmsCategory> categories = new ArrayList<CmsCategory>(0); try { categories = CmsCategoryService.getInstance().readResourceCategories(getCmsObject(), file); } catch (CmsException e) { LOG.error(Messages.get().getBundle().key(Messages.ERROR_FAILED_READING_CATEGORIES_1), e); } I_CmsWidget widget = null; widget = CmsWidgetUtil.collectWidgetInfo(value).getWidget(); if ((null != widget) && (widget instanceof CmsCategoryWidget)) { String mainCategoryPath = ((CmsCategoryWidget)widget).getStartingCategory( getCmsObject(), getCmsObject().getSitePath(file)); StringBuffer pathes = new StringBuffer(); for (CmsCategory category : categories) { if (category.getPath().startsWith(mainCategoryPath)) { String path = category.getBasePath() + category.getPath(); path = getCmsObject().getRequestContext().removeSiteRoot(path); pathes.append(path).append(','); } } String dynamicConfigString = pathes.length() > 0 ? pathes.substring(0, pathes.length() - 1) : ""; getSessionCache().setDynamicValue(attributeName, dynamicConfigString); return dynamicConfigString; } } } return ""; }
java
private String getDynamicAttributeValue( CmsFile file, I_CmsXmlContentValue value, String attributeName, CmsEntity editedLocalEntity) { if ((null != editedLocalEntity) && (editedLocalEntity.getAttribute(attributeName) != null)) { getSessionCache().setDynamicValue( attributeName, editedLocalEntity.getAttribute(attributeName).getSimpleValue()); } String currentValue = getSessionCache().getDynamicValue(attributeName); if (null != currentValue) { return currentValue; } if (null != file) { if (value.getTypeName().equals(CmsXmlDynamicCategoryValue.TYPE_NAME)) { List<CmsCategory> categories = new ArrayList<CmsCategory>(0); try { categories = CmsCategoryService.getInstance().readResourceCategories(getCmsObject(), file); } catch (CmsException e) { LOG.error(Messages.get().getBundle().key(Messages.ERROR_FAILED_READING_CATEGORIES_1), e); } I_CmsWidget widget = null; widget = CmsWidgetUtil.collectWidgetInfo(value).getWidget(); if ((null != widget) && (widget instanceof CmsCategoryWidget)) { String mainCategoryPath = ((CmsCategoryWidget)widget).getStartingCategory( getCmsObject(), getCmsObject().getSitePath(file)); StringBuffer pathes = new StringBuffer(); for (CmsCategory category : categories) { if (category.getPath().startsWith(mainCategoryPath)) { String path = category.getBasePath() + category.getPath(); path = getCmsObject().getRequestContext().removeSiteRoot(path); pathes.append(path).append(','); } } String dynamicConfigString = pathes.length() > 0 ? pathes.substring(0, pathes.length() - 1) : ""; getSessionCache().setDynamicValue(attributeName, dynamicConfigString); return dynamicConfigString; } } } return ""; }
[ "private", "String", "getDynamicAttributeValue", "(", "CmsFile", "file", ",", "I_CmsXmlContentValue", "value", ",", "String", "attributeName", ",", "CmsEntity", "editedLocalEntity", ")", "{", "if", "(", "(", "null", "!=", "editedLocalEntity", ")", "&&", "(", "editedLocalEntity", ".", "getAttribute", "(", "attributeName", ")", "!=", "null", ")", ")", "{", "getSessionCache", "(", ")", ".", "setDynamicValue", "(", "attributeName", ",", "editedLocalEntity", ".", "getAttribute", "(", "attributeName", ")", ".", "getSimpleValue", "(", ")", ")", ";", "}", "String", "currentValue", "=", "getSessionCache", "(", ")", ".", "getDynamicValue", "(", "attributeName", ")", ";", "if", "(", "null", "!=", "currentValue", ")", "{", "return", "currentValue", ";", "}", "if", "(", "null", "!=", "file", ")", "{", "if", "(", "value", ".", "getTypeName", "(", ")", ".", "equals", "(", "CmsXmlDynamicCategoryValue", ".", "TYPE_NAME", ")", ")", "{", "List", "<", "CmsCategory", ">", "categories", "=", "new", "ArrayList", "<", "CmsCategory", ">", "(", "0", ")", ";", "try", "{", "categories", "=", "CmsCategoryService", ".", "getInstance", "(", ")", ".", "readResourceCategories", "(", "getCmsObject", "(", ")", ",", "file", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERROR_FAILED_READING_CATEGORIES_1", ")", ",", "e", ")", ";", "}", "I_CmsWidget", "widget", "=", "null", ";", "widget", "=", "CmsWidgetUtil", ".", "collectWidgetInfo", "(", "value", ")", ".", "getWidget", "(", ")", ";", "if", "(", "(", "null", "!=", "widget", ")", "&&", "(", "widget", "instanceof", "CmsCategoryWidget", ")", ")", "{", "String", "mainCategoryPath", "=", "(", "(", "CmsCategoryWidget", ")", "widget", ")", ".", "getStartingCategory", "(", "getCmsObject", "(", ")", ",", "getCmsObject", "(", ")", ".", "getSitePath", "(", "file", ")", ")", ";", "StringBuffer", "pathes", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "CmsCategory", "category", ":", "categories", ")", "{", "if", "(", "category", ".", "getPath", "(", ")", ".", "startsWith", "(", "mainCategoryPath", ")", ")", "{", "String", "path", "=", "category", ".", "getBasePath", "(", ")", "+", "category", ".", "getPath", "(", ")", ";", "path", "=", "getCmsObject", "(", ")", ".", "getRequestContext", "(", ")", ".", "removeSiteRoot", "(", "path", ")", ";", "pathes", ".", "append", "(", "path", ")", ".", "append", "(", "'", "'", ")", ";", "}", "}", "String", "dynamicConfigString", "=", "pathes", ".", "length", "(", ")", ">", "0", "?", "pathes", ".", "substring", "(", "0", ",", "pathes", ".", "length", "(", ")", "-", "1", ")", ":", "\"\"", ";", "getSessionCache", "(", ")", ".", "setDynamicValue", "(", "attributeName", ",", "dynamicConfigString", ")", ";", "return", "dynamicConfigString", ";", "}", "}", "}", "return", "\"\"", ";", "}" ]
Returns the value that has to be set for the dynamic attribute. @param file the file where the current content is stored @param value the content value that is represented by the attribute @param attributeName the attribute's name @param editedLocalEntity the entities that where edited last @return the value that has to be set for the dynamic attribute.
[ "Returns", "the", "value", "that", "has", "to", "be", "set", "for", "the", "dynamic", "attribute", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentService.java#L1784-L1829
158,489
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyController.java
CmsPatternPanelYearlyController.setMonth
public void setMonth(String monthStr) { final Month month = Month.valueOf(monthStr); if ((m_model.getMonth() == null) || !m_model.getMonth().equals(monthStr)) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setMonth(month); onValueChange(); } }); } }
java
public void setMonth(String monthStr) { final Month month = Month.valueOf(monthStr); if ((m_model.getMonth() == null) || !m_model.getMonth().equals(monthStr)) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setMonth(month); onValueChange(); } }); } }
[ "public", "void", "setMonth", "(", "String", "monthStr", ")", "{", "final", "Month", "month", "=", "Month", ".", "valueOf", "(", "monthStr", ")", ";", "if", "(", "(", "m_model", ".", "getMonth", "(", ")", "==", "null", ")", "||", "!", "m_model", ".", "getMonth", "(", ")", ".", "equals", "(", "monthStr", ")", ")", "{", "removeExceptionsOnChange", "(", "new", "Command", "(", ")", "{", "public", "void", "execute", "(", ")", "{", "m_model", ".", "setMonth", "(", "month", ")", ";", "onValueChange", "(", ")", ";", "}", "}", ")", ";", "}", "}" ]
Set the month. @param monthStr the month to set.
[ "Set", "the", "month", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyController.java#L65-L79
158,490
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyController.java
CmsPatternPanelYearlyController.setPatternScheme
public void setPatternScheme(final boolean isWeekDayBased) { if (isWeekDayBased ^ (null != m_model.getWeekDay())) { removeExceptionsOnChange(new Command() { public void execute() { if (isWeekDayBased) { m_model.setWeekDay(getPatternDefaultValues().getWeekDay()); m_model.setWeekOfMonth(getPatternDefaultValues().getWeekOfMonth()); } else { m_model.setWeekDay(null); m_model.setWeekOfMonth(null); } m_model.setMonth(getPatternDefaultValues().getMonth()); m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth()); m_model.setInterval(getPatternDefaultValues().getInterval()); onValueChange(); } }); } }
java
public void setPatternScheme(final boolean isWeekDayBased) { if (isWeekDayBased ^ (null != m_model.getWeekDay())) { removeExceptionsOnChange(new Command() { public void execute() { if (isWeekDayBased) { m_model.setWeekDay(getPatternDefaultValues().getWeekDay()); m_model.setWeekOfMonth(getPatternDefaultValues().getWeekOfMonth()); } else { m_model.setWeekDay(null); m_model.setWeekOfMonth(null); } m_model.setMonth(getPatternDefaultValues().getMonth()); m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth()); m_model.setInterval(getPatternDefaultValues().getInterval()); onValueChange(); } }); } }
[ "public", "void", "setPatternScheme", "(", "final", "boolean", "isWeekDayBased", ")", "{", "if", "(", "isWeekDayBased", "^", "(", "null", "!=", "m_model", ".", "getWeekDay", "(", ")", ")", ")", "{", "removeExceptionsOnChange", "(", "new", "Command", "(", ")", "{", "public", "void", "execute", "(", ")", "{", "if", "(", "isWeekDayBased", ")", "{", "m_model", ".", "setWeekDay", "(", "getPatternDefaultValues", "(", ")", ".", "getWeekDay", "(", ")", ")", ";", "m_model", ".", "setWeekOfMonth", "(", "getPatternDefaultValues", "(", ")", ".", "getWeekOfMonth", "(", ")", ")", ";", "}", "else", "{", "m_model", ".", "setWeekDay", "(", "null", ")", ";", "m_model", ".", "setWeekOfMonth", "(", "null", ")", ";", "}", "m_model", ".", "setMonth", "(", "getPatternDefaultValues", "(", ")", ".", "getMonth", "(", ")", ")", ";", "m_model", ".", "setDayOfMonth", "(", "getPatternDefaultValues", "(", ")", ".", "getDayOfMonth", "(", ")", ")", ";", "m_model", ".", "setInterval", "(", "getPatternDefaultValues", "(", ")", ".", "getInterval", "(", ")", ")", ";", "onValueChange", "(", ")", ";", "}", "}", ")", ";", "}", "}" ]
Set the pattern scheme. @param isWeekDayBased flag, indicating if the week day based scheme should be set.
[ "Set", "the", "pattern", "scheme", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyController.java#L85-L106
158,491
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyController.java
CmsPatternPanelYearlyController.setWeekDay
public void setWeekDay(String weekDayStr) { final WeekDay weekDay = WeekDay.valueOf(weekDayStr); if ((m_model.getWeekDay() != null) || !m_model.getWeekDay().equals(weekDay)) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setWeekDay(weekDay); onValueChange(); } }); } }
java
public void setWeekDay(String weekDayStr) { final WeekDay weekDay = WeekDay.valueOf(weekDayStr); if ((m_model.getWeekDay() != null) || !m_model.getWeekDay().equals(weekDay)) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setWeekDay(weekDay); onValueChange(); } }); } }
[ "public", "void", "setWeekDay", "(", "String", "weekDayStr", ")", "{", "final", "WeekDay", "weekDay", "=", "WeekDay", ".", "valueOf", "(", "weekDayStr", ")", ";", "if", "(", "(", "m_model", ".", "getWeekDay", "(", ")", "!=", "null", ")", "||", "!", "m_model", ".", "getWeekDay", "(", ")", ".", "equals", "(", "weekDay", ")", ")", "{", "removeExceptionsOnChange", "(", "new", "Command", "(", ")", "{", "public", "void", "execute", "(", ")", "{", "m_model", ".", "setWeekDay", "(", "weekDay", ")", ";", "onValueChange", "(", ")", ";", "}", "}", ")", ";", "}", "}" ]
Set the week day. @param weekDayStr the week day to set.
[ "Set", "the", "week", "day", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyController.java#L112-L127
158,492
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyController.java
CmsPatternPanelYearlyController.setWeekOfMonth
public void setWeekOfMonth(String weekOfMonthStr) { final WeekOfMonth weekOfMonth = WeekOfMonth.valueOf(weekOfMonthStr); if ((null == m_model.getWeekOfMonth()) || !m_model.getWeekOfMonth().equals(weekOfMonth)) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setWeekOfMonth(weekOfMonth); onValueChange(); } }); } }
java
public void setWeekOfMonth(String weekOfMonthStr) { final WeekOfMonth weekOfMonth = WeekOfMonth.valueOf(weekOfMonthStr); if ((null == m_model.getWeekOfMonth()) || !m_model.getWeekOfMonth().equals(weekOfMonth)) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setWeekOfMonth(weekOfMonth); onValueChange(); } }); } }
[ "public", "void", "setWeekOfMonth", "(", "String", "weekOfMonthStr", ")", "{", "final", "WeekOfMonth", "weekOfMonth", "=", "WeekOfMonth", ".", "valueOf", "(", "weekOfMonthStr", ")", ";", "if", "(", "(", "null", "==", "m_model", ".", "getWeekOfMonth", "(", ")", ")", "||", "!", "m_model", ".", "getWeekOfMonth", "(", ")", ".", "equals", "(", "weekOfMonth", ")", ")", "{", "removeExceptionsOnChange", "(", "new", "Command", "(", ")", "{", "public", "void", "execute", "(", ")", "{", "m_model", ".", "setWeekOfMonth", "(", "weekOfMonth", ")", ";", "onValueChange", "(", ")", ";", "}", "}", ")", ";", "}", "}" ]
Set the week of month. @param weekOfMonthStr the week of month to set.
[ "Set", "the", "week", "of", "month", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelYearlyController.java#L133-L147
158,493
alkacon/opencms-core
src/org/opencms/file/CmsProperty.java
CmsProperty.getLocalizedKey
public static String getLocalizedKey(Map<String, ?> propertiesMap, String key, Locale locale) { List<String> localizedKeys = CmsLocaleManager.getLocaleVariants(key, locale, true, false); for (String localizedKey : localizedKeys) { if (propertiesMap.containsKey(localizedKey)) { return localizedKey; } } return key; }
java
public static String getLocalizedKey(Map<String, ?> propertiesMap, String key, Locale locale) { List<String> localizedKeys = CmsLocaleManager.getLocaleVariants(key, locale, true, false); for (String localizedKey : localizedKeys) { if (propertiesMap.containsKey(localizedKey)) { return localizedKey; } } return key; }
[ "public", "static", "String", "getLocalizedKey", "(", "Map", "<", "String", ",", "?", ">", "propertiesMap", ",", "String", "key", ",", "Locale", "locale", ")", "{", "List", "<", "String", ">", "localizedKeys", "=", "CmsLocaleManager", ".", "getLocaleVariants", "(", "key", ",", "locale", ",", "true", ",", "false", ")", ";", "for", "(", "String", "localizedKey", ":", "localizedKeys", ")", "{", "if", "(", "propertiesMap", ".", "containsKey", "(", "localizedKey", ")", ")", "{", "return", "localizedKey", ";", "}", "}", "return", "key", ";", "}" ]
Returns the key for the best matching local-specific property version. @param propertiesMap the "raw" property map @param key the name of the property to search for @param locale the locale to search for @return the key for the best matching local-specific property version.
[ "Returns", "the", "key", "for", "the", "best", "matching", "local", "-", "specific", "property", "version", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsProperty.java#L328-L337
158,494
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/searchindex/CmsFieldsList.java
CmsFieldsList.getFields
private List<CmsSearchField> getFields() { CmsSearchManager manager = OpenCms.getSearchManager(); I_CmsSearchFieldConfiguration fieldConfig = manager.getFieldConfiguration(getParamFieldconfiguration()); List<CmsSearchField> result; if (fieldConfig != null) { result = fieldConfig.getFields(); } else { result = Collections.emptyList(); if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key( Messages.ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1, A_CmsFieldConfigurationDialog.PARAM_FIELDCONFIGURATION)); } } return result; }
java
private List<CmsSearchField> getFields() { CmsSearchManager manager = OpenCms.getSearchManager(); I_CmsSearchFieldConfiguration fieldConfig = manager.getFieldConfiguration(getParamFieldconfiguration()); List<CmsSearchField> result; if (fieldConfig != null) { result = fieldConfig.getFields(); } else { result = Collections.emptyList(); if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key( Messages.ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1, A_CmsFieldConfigurationDialog.PARAM_FIELDCONFIGURATION)); } } return result; }
[ "private", "List", "<", "CmsSearchField", ">", "getFields", "(", ")", "{", "CmsSearchManager", "manager", "=", "OpenCms", ".", "getSearchManager", "(", ")", ";", "I_CmsSearchFieldConfiguration", "fieldConfig", "=", "manager", ".", "getFieldConfiguration", "(", "getParamFieldconfiguration", "(", ")", ")", ";", "List", "<", "CmsSearchField", ">", "result", ";", "if", "(", "fieldConfig", "!=", "null", ")", "{", "result", "=", "fieldConfig", ".", "getFields", "(", ")", ";", "}", "else", "{", "result", "=", "Collections", ".", "emptyList", "(", ")", ";", "if", "(", "LOG", ".", "isErrorEnabled", "(", ")", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1", ",", "A_CmsFieldConfigurationDialog", ".", "PARAM_FIELDCONFIGURATION", ")", ")", ";", "}", "}", "return", "result", ";", "}" ]
Returns the configured fields of the current field configuration. @return the configured fields of the current field configuration
[ "Returns", "the", "configured", "fields", "of", "the", "current", "field", "configuration", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsFieldsList.java#L720-L737
158,495
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsElementUtil.java
CmsElementUtil.createStringTemplateSource
public static Function<String, String> createStringTemplateSource( I_CmsFormatterBean formatter, Supplier<CmsXmlContent> contentSupplier) { return key -> { String result = null; if (formatter != null) { result = formatter.getAttributes().get(key); } if (result == null) { CmsXmlContent content = contentSupplier.get(); if (content != null) { result = content.getHandler().getParameter(key); } } return result; }; }
java
public static Function<String, String> createStringTemplateSource( I_CmsFormatterBean formatter, Supplier<CmsXmlContent> contentSupplier) { return key -> { String result = null; if (formatter != null) { result = formatter.getAttributes().get(key); } if (result == null) { CmsXmlContent content = contentSupplier.get(); if (content != null) { result = content.getHandler().getParameter(key); } } return result; }; }
[ "public", "static", "Function", "<", "String", ",", "String", ">", "createStringTemplateSource", "(", "I_CmsFormatterBean", "formatter", ",", "Supplier", "<", "CmsXmlContent", ">", "contentSupplier", ")", "{", "return", "key", "->", "{", "String", "result", "=", "null", ";", "if", "(", "formatter", "!=", "null", ")", "{", "result", "=", "formatter", ".", "getAttributes", "(", ")", ".", "get", "(", "key", ")", ";", "}", "if", "(", "result", "==", "null", ")", "{", "CmsXmlContent", "content", "=", "contentSupplier", ".", "get", "(", ")", ";", "if", "(", "content", "!=", "null", ")", "{", "result", "=", "content", ".", "getHandler", "(", ")", ".", "getParameter", "(", "key", ")", ";", "}", "}", "return", "result", ";", "}", ";", "}" ]
Helper method to create a string template source for a given formatter and content. @param formatter the formatter @param contentSupplier the content supplier @return the string template provider
[ "Helper", "method", "to", "create", "a", "string", "template", "source", "for", "a", "given", "formatter", "and", "content", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsElementUtil.java#L297-L314
158,496
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsElementUtil.java
CmsElementUtil.getContentsByContainerName
private Map<String, String> getContentsByContainerName( CmsContainerElementBean element, Collection<CmsContainer> containers) { CmsFormatterConfiguration configs = getFormatterConfiguration(element.getResource()); Map<String, String> result = new HashMap<String, String>(); for (CmsContainer container : containers) { String content = getContentByContainer(element, container, configs); if (content != null) { content = removeScriptTags(content); } result.put(container.getName(), content); } return result; }
java
private Map<String, String> getContentsByContainerName( CmsContainerElementBean element, Collection<CmsContainer> containers) { CmsFormatterConfiguration configs = getFormatterConfiguration(element.getResource()); Map<String, String> result = new HashMap<String, String>(); for (CmsContainer container : containers) { String content = getContentByContainer(element, container, configs); if (content != null) { content = removeScriptTags(content); } result.put(container.getName(), content); } return result; }
[ "private", "Map", "<", "String", ",", "String", ">", "getContentsByContainerName", "(", "CmsContainerElementBean", "element", ",", "Collection", "<", "CmsContainer", ">", "containers", ")", "{", "CmsFormatterConfiguration", "configs", "=", "getFormatterConfiguration", "(", "element", ".", "getResource", "(", ")", ")", ";", "Map", "<", "String", ",", "String", ">", "result", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "CmsContainer", "container", ":", "containers", ")", "{", "String", "content", "=", "getContentByContainer", "(", "element", ",", "container", ",", "configs", ")", ";", "if", "(", "content", "!=", "null", ")", "{", "content", "=", "removeScriptTags", "(", "content", ")", ";", "}", "result", ".", "put", "(", "container", ".", "getName", "(", ")", ",", "content", ")", ";", "}", "return", "result", ";", "}" ]
Returns the rendered element content for all the given containers. @param element the element to render @param containers the containers the element appears in @return a map from container names to rendered page contents
[ "Returns", "the", "rendered", "element", "content", "for", "all", "the", "given", "containers", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsElementUtil.java#L1007-L1021
158,497
alkacon/opencms-core
src-setup/org/opencms/setup/ui/CmsSetupStep03Database.java
CmsSetupStep03Database.setWorkConnection
public void setWorkConnection(CmsSetupDb db) { db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbWorkConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbWorkUser(), m_setupBean.getDbWorkPwd()); }
java
public void setWorkConnection(CmsSetupDb db) { db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbWorkConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbWorkUser(), m_setupBean.getDbWorkPwd()); }
[ "public", "void", "setWorkConnection", "(", "CmsSetupDb", "db", ")", "{", "db", ".", "setConnection", "(", "m_setupBean", ".", "getDbDriver", "(", ")", ",", "m_setupBean", ".", "getDbWorkConStr", "(", ")", ",", "m_setupBean", ".", "getDbConStrParams", "(", ")", ",", "m_setupBean", ".", "getDbWorkUser", "(", ")", ",", "m_setupBean", ".", "getDbWorkPwd", "(", ")", ")", ";", "}" ]
Set work connection. @param db the db setup bean
[ "Set", "work", "connection", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsSetupStep03Database.java#L297-L305
158,498
alkacon/opencms-core
src-setup/org/opencms/setup/ui/CmsSetupStep03Database.java
CmsSetupStep03Database.updateDb
private void updateDb(String dbName, String webapp) { m_mainLayout.removeAllComponents(); m_setupBean.setDatabase(dbName); CmsDbSettingsPanel panel = new CmsDbSettingsPanel(m_setupBean); m_panel[0] = panel; panel.initFromSetupBean(webapp); m_mainLayout.addComponent(panel); }
java
private void updateDb(String dbName, String webapp) { m_mainLayout.removeAllComponents(); m_setupBean.setDatabase(dbName); CmsDbSettingsPanel panel = new CmsDbSettingsPanel(m_setupBean); m_panel[0] = panel; panel.initFromSetupBean(webapp); m_mainLayout.addComponent(panel); }
[ "private", "void", "updateDb", "(", "String", "dbName", ",", "String", "webapp", ")", "{", "m_mainLayout", ".", "removeAllComponents", "(", ")", ";", "m_setupBean", ".", "setDatabase", "(", "dbName", ")", ";", "CmsDbSettingsPanel", "panel", "=", "new", "CmsDbSettingsPanel", "(", "m_setupBean", ")", ";", "m_panel", "[", "0", "]", "=", "panel", ";", "panel", ".", "initFromSetupBean", "(", "webapp", ")", ";", "m_mainLayout", ".", "addComponent", "(", "panel", ")", ";", "}" ]
Switches DB type. @param dbName the database type @param webapp the webapp name
[ "Switches", "DB", "type", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsSetupStep03Database.java#L334-L342
158,499
alkacon/opencms-core
src/org/opencms/search/solr/CmsSolrQuery.java
CmsSolrQuery.removeExpiration
public void removeExpiration() { if (getFilterQueries() != null) { for (String fq : getFilterQueries()) { if (fq.startsWith(CmsSearchField.FIELD_DATE_EXPIRED + ":") || fq.startsWith(CmsSearchField.FIELD_DATE_RELEASED + ":")) { removeFilterQuery(fq); } } } m_ignoreExpiration = true; }
java
public void removeExpiration() { if (getFilterQueries() != null) { for (String fq : getFilterQueries()) { if (fq.startsWith(CmsSearchField.FIELD_DATE_EXPIRED + ":") || fq.startsWith(CmsSearchField.FIELD_DATE_RELEASED + ":")) { removeFilterQuery(fq); } } } m_ignoreExpiration = true; }
[ "public", "void", "removeExpiration", "(", ")", "{", "if", "(", "getFilterQueries", "(", ")", "!=", "null", ")", "{", "for", "(", "String", "fq", ":", "getFilterQueries", "(", ")", ")", "{", "if", "(", "fq", ".", "startsWith", "(", "CmsSearchField", ".", "FIELD_DATE_EXPIRED", "+", "\":\"", ")", "||", "fq", ".", "startsWith", "(", "CmsSearchField", ".", "FIELD_DATE_RELEASED", "+", "\":\"", ")", ")", "{", "removeFilterQuery", "(", "fq", ")", ";", "}", "}", "}", "m_ignoreExpiration", "=", "true", ";", "}" ]
Removes the expiration flag.
[ "Removes", "the", "expiration", "flag", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrQuery.java#L272-L283