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,500
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getReadAllSubCategories
public Map<String, CmsJspCategoryAccessBean> getReadAllSubCategories() { if (null == m_allSubCategories) { m_allSubCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { @Override public Object transform(Object categoryPath) { try { List<CmsCategory> categories = CmsCategoryService.getInstance().readCategories( m_cms, (String)categoryPath, true, m_cms.getRequestContext().getUri()); CmsJspCategoryAccessBean result = new CmsJspCategoryAccessBean( m_cms, categories, (String)categoryPath); return result; } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } } }); } return m_allSubCategories; }
java
public Map<String, CmsJspCategoryAccessBean> getReadAllSubCategories() { if (null == m_allSubCategories) { m_allSubCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { @Override public Object transform(Object categoryPath) { try { List<CmsCategory> categories = CmsCategoryService.getInstance().readCategories( m_cms, (String)categoryPath, true, m_cms.getRequestContext().getUri()); CmsJspCategoryAccessBean result = new CmsJspCategoryAccessBean( m_cms, categories, (String)categoryPath); return result; } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } } }); } return m_allSubCategories; }
[ "public", "Map", "<", "String", ",", "CmsJspCategoryAccessBean", ">", "getReadAllSubCategories", "(", ")", "{", "if", "(", "null", "==", "m_allSubCategories", ")", "{", "m_allSubCategories", "=", "CmsCollectionsGenericWrapper", ".", "createLazyMap", "(", "new", "Transformer", "(", ")", "{", "@", "Override", "public", "Object", "transform", "(", "Object", "categoryPath", ")", "{", "try", "{", "List", "<", "CmsCategory", ">", "categories", "=", "CmsCategoryService", ".", "getInstance", "(", ")", ".", "readCategories", "(", "m_cms", ",", "(", "String", ")", "categoryPath", ",", "true", ",", "m_cms", ".", "getRequestContext", "(", ")", ".", "getUri", "(", ")", ")", ";", "CmsJspCategoryAccessBean", "result", "=", "new", "CmsJspCategoryAccessBean", "(", "m_cms", ",", "categories", ",", "(", "String", ")", "categoryPath", ")", ";", "return", "result", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "warn", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "return", "null", ";", "}", "}", "}", ")", ";", "}", "return", "m_allSubCategories", ";", "}" ]
Reads all sub-categories below the provided category. @return The map from the provided category to it's sub-categories in a {@link CmsJspCategoryAccessBean}.
[ "Reads", "all", "sub", "-", "categories", "below", "the", "provided", "category", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1409-L1437
158,501
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getReadCategory
public Map<String, CmsCategory> getReadCategory() { if (null == m_categories) { m_categories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object categoryPath) { try { CmsCategoryService catService = CmsCategoryService.getInstance(); return catService.localizeCategory( m_cms, catService.readCategory(m_cms, (String)categoryPath, getRequestContext().getUri()), m_cms.getRequestContext().getLocale()); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } } }); } return m_categories; }
java
public Map<String, CmsCategory> getReadCategory() { if (null == m_categories) { m_categories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object categoryPath) { try { CmsCategoryService catService = CmsCategoryService.getInstance(); return catService.localizeCategory( m_cms, catService.readCategory(m_cms, (String)categoryPath, getRequestContext().getUri()), m_cms.getRequestContext().getLocale()); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } } }); } return m_categories; }
[ "public", "Map", "<", "String", ",", "CmsCategory", ">", "getReadCategory", "(", ")", "{", "if", "(", "null", "==", "m_categories", ")", "{", "m_categories", "=", "CmsCollectionsGenericWrapper", ".", "createLazyMap", "(", "new", "Transformer", "(", ")", "{", "public", "Object", "transform", "(", "Object", "categoryPath", ")", "{", "try", "{", "CmsCategoryService", "catService", "=", "CmsCategoryService", ".", "getInstance", "(", ")", ";", "return", "catService", ".", "localizeCategory", "(", "m_cms", ",", "catService", ".", "readCategory", "(", "m_cms", ",", "(", "String", ")", "categoryPath", ",", "getRequestContext", "(", ")", ".", "getUri", "(", ")", ")", ",", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "warn", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "return", "null", ";", "}", "}", "}", ")", ";", "}", "return", "m_categories", ";", "}" ]
Transforms the category path of a category to the category. @return a map from root or site path to category.
[ "Transforms", "the", "category", "path", "of", "a", "category", "to", "the", "category", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1452-L1474
158,502
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getReadResourceCategories
public Map<String, CmsJspCategoryAccessBean> getReadResourceCategories() { if (null == m_resourceCategories) { m_resourceCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object resourceName) { try { CmsResource resource = m_cms.readResource( getRequestContext().removeSiteRoot((String)resourceName)); return new CmsJspCategoryAccessBean(m_cms, resource); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } } }); } return m_resourceCategories; }
java
public Map<String, CmsJspCategoryAccessBean> getReadResourceCategories() { if (null == m_resourceCategories) { m_resourceCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object resourceName) { try { CmsResource resource = m_cms.readResource( getRequestContext().removeSiteRoot((String)resourceName)); return new CmsJspCategoryAccessBean(m_cms, resource); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } } }); } return m_resourceCategories; }
[ "public", "Map", "<", "String", ",", "CmsJspCategoryAccessBean", ">", "getReadResourceCategories", "(", ")", "{", "if", "(", "null", "==", "m_resourceCategories", ")", "{", "m_resourceCategories", "=", "CmsCollectionsGenericWrapper", ".", "createLazyMap", "(", "new", "Transformer", "(", ")", "{", "public", "Object", "transform", "(", "Object", "resourceName", ")", "{", "try", "{", "CmsResource", "resource", "=", "m_cms", ".", "readResource", "(", "getRequestContext", "(", ")", ".", "removeSiteRoot", "(", "(", "String", ")", "resourceName", ")", ")", ";", "return", "new", "CmsJspCategoryAccessBean", "(", "m_cms", ",", "resource", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "warn", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "return", "null", ";", "}", "}", "}", ")", ";", "}", "return", "m_resourceCategories", ";", "}" ]
Reads the categories assigned to a resource. @return map from the resource path (root path) to the assigned categories
[ "Reads", "the", "categories", "assigned", "to", "a", "resource", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1528-L1547
158,503
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getSitePath
public Map<String, String> getSitePath() { if (m_sitePaths == null) { m_sitePaths = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object rootPath) { if (rootPath instanceof String) { return getRequestContext().removeSiteRoot((String)rootPath); } return null; } }); } return m_sitePaths; }
java
public Map<String, String> getSitePath() { if (m_sitePaths == null) { m_sitePaths = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object rootPath) { if (rootPath instanceof String) { return getRequestContext().removeSiteRoot((String)rootPath); } return null; } }); } return m_sitePaths; }
[ "public", "Map", "<", "String", ",", "String", ">", "getSitePath", "(", ")", "{", "if", "(", "m_sitePaths", "==", "null", ")", "{", "m_sitePaths", "=", "CmsCollectionsGenericWrapper", ".", "createLazyMap", "(", "new", "Transformer", "(", ")", "{", "public", "Object", "transform", "(", "Object", "rootPath", ")", "{", "if", "(", "rootPath", "instanceof", "String", ")", "{", "return", "getRequestContext", "(", ")", ".", "removeSiteRoot", "(", "(", "String", ")", "rootPath", ")", ";", "}", "return", "null", ";", "}", "}", ")", ";", "}", "return", "m_sitePaths", ";", "}" ]
Transforms root paths to site paths. @return lazy map from root paths to site paths. @see CmsRequestContext#removeSiteRoot(String)
[ "Transforms", "root", "paths", "to", "site", "paths", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1591-L1606
158,504
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getTitleLocale
public Map<String, String> getTitleLocale() { if (m_localeTitles == null) { m_localeTitles = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object inputLocale) { Locale locale = null; if (null != inputLocale) { if (inputLocale instanceof Locale) { locale = (Locale)inputLocale; } else if (inputLocale instanceof String) { try { locale = LocaleUtils.toLocale((String)inputLocale); } catch (IllegalArgumentException | NullPointerException e) { // do nothing, just go on without locale } } } return getLocaleSpecificTitle(locale); } }); } return m_localeTitles; }
java
public Map<String, String> getTitleLocale() { if (m_localeTitles == null) { m_localeTitles = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object inputLocale) { Locale locale = null; if (null != inputLocale) { if (inputLocale instanceof Locale) { locale = (Locale)inputLocale; } else if (inputLocale instanceof String) { try { locale = LocaleUtils.toLocale((String)inputLocale); } catch (IllegalArgumentException | NullPointerException e) { // do nothing, just go on without locale } } } return getLocaleSpecificTitle(locale); } }); } return m_localeTitles; }
[ "public", "Map", "<", "String", ",", "String", ">", "getTitleLocale", "(", ")", "{", "if", "(", "m_localeTitles", "==", "null", ")", "{", "m_localeTitles", "=", "CmsCollectionsGenericWrapper", ".", "createLazyMap", "(", "new", "Transformer", "(", ")", "{", "public", "Object", "transform", "(", "Object", "inputLocale", ")", "{", "Locale", "locale", "=", "null", ";", "if", "(", "null", "!=", "inputLocale", ")", "{", "if", "(", "inputLocale", "instanceof", "Locale", ")", "{", "locale", "=", "(", "Locale", ")", "inputLocale", ";", "}", "else", "if", "(", "inputLocale", "instanceof", "String", ")", "{", "try", "{", "locale", "=", "LocaleUtils", ".", "toLocale", "(", "(", "String", ")", "inputLocale", ")", ";", "}", "catch", "(", "IllegalArgumentException", "|", "NullPointerException", "e", ")", "{", "// do nothing, just go on without locale", "}", "}", "}", "return", "getLocaleSpecificTitle", "(", "locale", ")", ";", "}", "}", ")", ";", "}", "return", "m_localeTitles", ";", "}" ]
Get the title and read the Title property according the provided locale. @return The map from locales to the locale specific titles.
[ "Get", "the", "title", "and", "read", "the", "Title", "property", "according", "the", "provided", "locale", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1661-L1686
158,505
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getLocaleSpecificTitle
protected String getLocaleSpecificTitle(Locale locale) { String result = null; try { if (isDetailRequest()) { // this is a request to a detail page CmsResource res = getDetailContent(); CmsFile file = m_cms.readFile(res); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file); result = content.getHandler().getTitleMapping(m_cms, content, m_cms.getRequestContext().getLocale()); if (result == null) { // title not found, maybe no mapping OR not available in the current locale // read the title of the detail resource as fall back (may contain mapping from another locale) result = m_cms.readPropertyObject( res, CmsPropertyDefinition.PROPERTY_TITLE, false, locale).getValue(); } } if (result == null) { // read the title of the requested resource as fall back result = m_cms.readPropertyObject( m_cms.getRequestContext().getUri(), CmsPropertyDefinition.PROPERTY_TITLE, true, locale).getValue(); } } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(result)) { result = ""; } return result; }
java
protected String getLocaleSpecificTitle(Locale locale) { String result = null; try { if (isDetailRequest()) { // this is a request to a detail page CmsResource res = getDetailContent(); CmsFile file = m_cms.readFile(res); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file); result = content.getHandler().getTitleMapping(m_cms, content, m_cms.getRequestContext().getLocale()); if (result == null) { // title not found, maybe no mapping OR not available in the current locale // read the title of the detail resource as fall back (may contain mapping from another locale) result = m_cms.readPropertyObject( res, CmsPropertyDefinition.PROPERTY_TITLE, false, locale).getValue(); } } if (result == null) { // read the title of the requested resource as fall back result = m_cms.readPropertyObject( m_cms.getRequestContext().getUri(), CmsPropertyDefinition.PROPERTY_TITLE, true, locale).getValue(); } } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(result)) { result = ""; } return result; }
[ "protected", "String", "getLocaleSpecificTitle", "(", "Locale", "locale", ")", "{", "String", "result", "=", "null", ";", "try", "{", "if", "(", "isDetailRequest", "(", ")", ")", "{", "// this is a request to a detail page", "CmsResource", "res", "=", "getDetailContent", "(", ")", ";", "CmsFile", "file", "=", "m_cms", ".", "readFile", "(", "res", ")", ";", "CmsXmlContent", "content", "=", "CmsXmlContentFactory", ".", "unmarshal", "(", "m_cms", ",", "file", ")", ";", "result", "=", "content", ".", "getHandler", "(", ")", ".", "getTitleMapping", "(", "m_cms", ",", "content", ",", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ";", "if", "(", "result", "==", "null", ")", "{", "// title not found, maybe no mapping OR not available in the current locale", "// read the title of the detail resource as fall back (may contain mapping from another locale)", "result", "=", "m_cms", ".", "readPropertyObject", "(", "res", ",", "CmsPropertyDefinition", ".", "PROPERTY_TITLE", ",", "false", ",", "locale", ")", ".", "getValue", "(", ")", ";", "}", "}", "if", "(", "result", "==", "null", ")", "{", "// read the title of the requested resource as fall back", "result", "=", "m_cms", ".", "readPropertyObject", "(", "m_cms", ".", "getRequestContext", "(", ")", ".", "getUri", "(", ")", ",", "CmsPropertyDefinition", ".", "PROPERTY_TITLE", ",", "true", ",", "locale", ")", ".", "getValue", "(", ")", ";", "}", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "debug", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "result", ")", ")", "{", "result", "=", "\"\"", ";", "}", "return", "result", ";", "}" ]
Returns the title according to the given locale. @param locale the locale for which the title should be read. @return the title according to the given locale
[ "Returns", "the", "title", "according", "to", "the", "given", "locale", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L2010-L2048
158,506
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/location/CmsLocationController.java
CmsLocationController.setStringValue
public void setStringValue(String value) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { try { m_editValue = CmsLocationValue.parse(value); m_currentValue = m_editValue.cloneValue(); displayValue(); if ((m_popup != null) && m_popup.isVisible()) { m_popupContent.displayValues(m_editValue); updateMarkerPosition(); } } catch (Exception e) { CmsLog.log(e.getLocalizedMessage() + "\n" + CmsClientStringUtil.getStackTrace(e, "\n")); } } else { m_currentValue = null; displayValue(); } }
java
public void setStringValue(String value) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { try { m_editValue = CmsLocationValue.parse(value); m_currentValue = m_editValue.cloneValue(); displayValue(); if ((m_popup != null) && m_popup.isVisible()) { m_popupContent.displayValues(m_editValue); updateMarkerPosition(); } } catch (Exception e) { CmsLog.log(e.getLocalizedMessage() + "\n" + CmsClientStringUtil.getStackTrace(e, "\n")); } } else { m_currentValue = null; displayValue(); } }
[ "public", "void", "setStringValue", "(", "String", "value", ")", "{", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "value", ")", ")", "{", "try", "{", "m_editValue", "=", "CmsLocationValue", ".", "parse", "(", "value", ")", ";", "m_currentValue", "=", "m_editValue", ".", "cloneValue", "(", ")", ";", "displayValue", "(", ")", ";", "if", "(", "(", "m_popup", "!=", "null", ")", "&&", "m_popup", ".", "isVisible", "(", ")", ")", "{", "m_popupContent", ".", "displayValues", "(", "m_editValue", ")", ";", "updateMarkerPosition", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "CmsLog", ".", "log", "(", "e", ".", "getLocalizedMessage", "(", ")", "+", "\"\\n\"", "+", "CmsClientStringUtil", ".", "getStackTrace", "(", "e", ",", "\"\\n\"", ")", ")", ";", "}", "}", "else", "{", "m_currentValue", "=", "null", ";", "displayValue", "(", ")", ";", "}", "}" ]
Sets the location value as string. @param value the string representation of the location value (JSON)
[ "Sets", "the", "location", "value", "as", "string", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/location/CmsLocationController.java#L235-L253
158,507
alkacon/opencms-core
src/org/opencms/jlan/CmsJlanUsers.java
CmsJlanUsers.hashPassword
public static byte[] hashPassword(String password) throws InvalidKeyException, NoSuchAlgorithmException { PasswordEncryptor encryptor = new PasswordEncryptor(); return encryptor.generateEncryptedPassword(password, null, PasswordEncryptor.MD4, null, null); }
java
public static byte[] hashPassword(String password) throws InvalidKeyException, NoSuchAlgorithmException { PasswordEncryptor encryptor = new PasswordEncryptor(); return encryptor.generateEncryptedPassword(password, null, PasswordEncryptor.MD4, null, null); }
[ "public", "static", "byte", "[", "]", "hashPassword", "(", "String", "password", ")", "throws", "InvalidKeyException", ",", "NoSuchAlgorithmException", "{", "PasswordEncryptor", "encryptor", "=", "new", "PasswordEncryptor", "(", ")", ";", "return", "encryptor", ".", "generateEncryptedPassword", "(", "password", ",", "null", ",", "PasswordEncryptor", ".", "MD4", ",", "null", ",", "null", ")", ";", "}" ]
Computes an MD4 hash for the password. @param password the password for which to compute the hash @throws NoSuchAlgorithmException @throws InvalidKeyException @return the password hash
[ "Computes", "an", "MD4", "hash", "for", "the", "password", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jlan/CmsJlanUsers.java#L81-L85
158,508
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/http/client/RequestBuilder.java
RequestBuilder.setHeader
public void setHeader(String header, String value) { StringValidator.throwIfEmptyOrNull("header", header); StringValidator.throwIfEmptyOrNull("value", value); if (headers == null) { headers = new HashMap<String, String>(); } headers.put(header, value); }
java
public void setHeader(String header, String value) { StringValidator.throwIfEmptyOrNull("header", header); StringValidator.throwIfEmptyOrNull("value", value); if (headers == null) { headers = new HashMap<String, String>(); } headers.put(header, value); }
[ "public", "void", "setHeader", "(", "String", "header", ",", "String", "value", ")", "{", "StringValidator", ".", "throwIfEmptyOrNull", "(", "\"header\"", ",", "header", ")", ";", "StringValidator", ".", "throwIfEmptyOrNull", "(", "\"value\"", ",", "value", ")", ";", "if", "(", "headers", "==", "null", ")", "{", "headers", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "}", "headers", ".", "put", "(", "header", ",", "value", ")", ";", "}" ]
Sets a request header with the given name and value. If a header with the specified name has already been set then the new value overwrites the current value. @param header the name of the header @param value the value of the header @throws NullPointerException if header or value are null @throws IllegalArgumentException if header or value are the empty string
[ "Sets", "a", "request", "header", "with", "the", "given", "name", "and", "value", ".", "If", "a", "header", "with", "the", "specified", "name", "has", "already", "been", "set", "then", "the", "new", "value", "overwrites", "the", "current", "value", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/http/client/RequestBuilder.java#L283-L292
158,509
alkacon/opencms-core
src/org/opencms/db/CmsPublishList.java
CmsPublishList.getTopFolders
protected List<CmsResource> getTopFolders(List<CmsResource> folders) { List<String> folderPaths = new ArrayList<String>(); List<CmsResource> topFolders = new ArrayList<CmsResource>(); Map<String, CmsResource> foldersByPath = new HashMap<String, CmsResource>(); for (CmsResource folder : folders) { folderPaths.add(folder.getRootPath()); foldersByPath.put(folder.getRootPath(), folder); } Collections.sort(folderPaths); Set<String> topFolderPaths = new HashSet<String>(folderPaths); for (int i = 0; i < folderPaths.size(); i++) { for (int j = i + 1; j < folderPaths.size(); j++) { if (folderPaths.get(j).startsWith((folderPaths.get(i)))) { topFolderPaths.remove(folderPaths.get(j)); } else { break; } } } for (String path : topFolderPaths) { topFolders.add(foldersByPath.get(path)); } return topFolders; }
java
protected List<CmsResource> getTopFolders(List<CmsResource> folders) { List<String> folderPaths = new ArrayList<String>(); List<CmsResource> topFolders = new ArrayList<CmsResource>(); Map<String, CmsResource> foldersByPath = new HashMap<String, CmsResource>(); for (CmsResource folder : folders) { folderPaths.add(folder.getRootPath()); foldersByPath.put(folder.getRootPath(), folder); } Collections.sort(folderPaths); Set<String> topFolderPaths = new HashSet<String>(folderPaths); for (int i = 0; i < folderPaths.size(); i++) { for (int j = i + 1; j < folderPaths.size(); j++) { if (folderPaths.get(j).startsWith((folderPaths.get(i)))) { topFolderPaths.remove(folderPaths.get(j)); } else { break; } } } for (String path : topFolderPaths) { topFolders.add(foldersByPath.get(path)); } return topFolders; }
[ "protected", "List", "<", "CmsResource", ">", "getTopFolders", "(", "List", "<", "CmsResource", ">", "folders", ")", "{", "List", "<", "String", ">", "folderPaths", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "List", "<", "CmsResource", ">", "topFolders", "=", "new", "ArrayList", "<", "CmsResource", ">", "(", ")", ";", "Map", "<", "String", ",", "CmsResource", ">", "foldersByPath", "=", "new", "HashMap", "<", "String", ",", "CmsResource", ">", "(", ")", ";", "for", "(", "CmsResource", "folder", ":", "folders", ")", "{", "folderPaths", ".", "add", "(", "folder", ".", "getRootPath", "(", ")", ")", ";", "foldersByPath", ".", "put", "(", "folder", ".", "getRootPath", "(", ")", ",", "folder", ")", ";", "}", "Collections", ".", "sort", "(", "folderPaths", ")", ";", "Set", "<", "String", ">", "topFolderPaths", "=", "new", "HashSet", "<", "String", ">", "(", "folderPaths", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "folderPaths", ".", "size", "(", ")", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "i", "+", "1", ";", "j", "<", "folderPaths", ".", "size", "(", ")", ";", "j", "++", ")", "{", "if", "(", "folderPaths", ".", "get", "(", "j", ")", ".", "startsWith", "(", "(", "folderPaths", ".", "get", "(", "i", ")", ")", ")", ")", "{", "topFolderPaths", ".", "remove", "(", "folderPaths", ".", "get", "(", "j", ")", ")", ";", "}", "else", "{", "break", ";", "}", "}", "}", "for", "(", "String", "path", ":", "topFolderPaths", ")", "{", "topFolders", ".", "add", "(", "foldersByPath", ".", "get", "(", "path", ")", ")", ";", "}", "return", "topFolders", ";", "}" ]
Gives the "roots" of a list of folders, i.e. the list of folders which are not descendants of any other folders in the original list @param folders the original list of folders @return the root folders of the list
[ "Gives", "the", "roots", "of", "a", "list", "of", "folders", "i", ".", "e", ".", "the", "list", "of", "folders", "which", "are", "not", "descendants", "of", "any", "other", "folders", "in", "the", "original", "list" ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsPublishList.java#L698-L722
158,510
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualController.java
CmsPatternPanelIndividualController.setDates
public void setDates(SortedSet<Date> dates) { if (!m_model.getIndividualDates().equals(dates)) { m_model.setIndividualDates(dates); onValueChange(); } }
java
public void setDates(SortedSet<Date> dates) { if (!m_model.getIndividualDates().equals(dates)) { m_model.setIndividualDates(dates); onValueChange(); } }
[ "public", "void", "setDates", "(", "SortedSet", "<", "Date", ">", "dates", ")", "{", "if", "(", "!", "m_model", ".", "getIndividualDates", "(", ")", ".", "equals", "(", "dates", ")", ")", "{", "m_model", ".", "setIndividualDates", "(", "dates", ")", ";", "onValueChange", "(", ")", ";", "}", "}" ]
Set the individual dates. @param dates the dates to set.
[ "Set", "the", "individual", "dates", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelIndividualController.java#L62-L69
158,511
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.getInstance
public static CmsSolrSpellchecker getInstance(CoreContainer container) { if (null == instance) { synchronized (CmsSolrSpellchecker.class) { if (null == instance) { @SuppressWarnings("resource") SolrCore spellcheckCore = container.getCore(CmsSolrSpellchecker.SPELLCHECKER_INDEX_CORE); if (spellcheckCore == null) { LOG.error( Messages.get().getBundle().key( Messages.ERR_SPELLCHECK_CORE_NOT_AVAILABLE_1, CmsSolrSpellchecker.SPELLCHECKER_INDEX_CORE)); return null; } instance = new CmsSolrSpellchecker(container, spellcheckCore); } } } return instance; }
java
public static CmsSolrSpellchecker getInstance(CoreContainer container) { if (null == instance) { synchronized (CmsSolrSpellchecker.class) { if (null == instance) { @SuppressWarnings("resource") SolrCore spellcheckCore = container.getCore(CmsSolrSpellchecker.SPELLCHECKER_INDEX_CORE); if (spellcheckCore == null) { LOG.error( Messages.get().getBundle().key( Messages.ERR_SPELLCHECK_CORE_NOT_AVAILABLE_1, CmsSolrSpellchecker.SPELLCHECKER_INDEX_CORE)); return null; } instance = new CmsSolrSpellchecker(container, spellcheckCore); } } } return instance; }
[ "public", "static", "CmsSolrSpellchecker", "getInstance", "(", "CoreContainer", "container", ")", "{", "if", "(", "null", "==", "instance", ")", "{", "synchronized", "(", "CmsSolrSpellchecker", ".", "class", ")", "{", "if", "(", "null", "==", "instance", ")", "{", "@", "SuppressWarnings", "(", "\"resource\"", ")", "SolrCore", "spellcheckCore", "=", "container", ".", "getCore", "(", "CmsSolrSpellchecker", ".", "SPELLCHECKER_INDEX_CORE", ")", ";", "if", "(", "spellcheckCore", "==", "null", ")", "{", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_SPELLCHECK_CORE_NOT_AVAILABLE_1", ",", "CmsSolrSpellchecker", ".", "SPELLCHECKER_INDEX_CORE", ")", ")", ";", "return", "null", ";", "}", "instance", "=", "new", "CmsSolrSpellchecker", "(", "container", ",", "spellcheckCore", ")", ";", "}", "}", "}", "return", "instance", ";", "}" ]
Return an instance of this class. @param container Solr CoreContainer container object in order to create a server object. @return instance of CmsSolrSpellchecker
[ "Return", "an", "instance", "of", "this", "class", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L155-L175
158,512
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.getSpellcheckingResult
public void getSpellcheckingResult( final HttpServletResponse res, final ServletRequest servletRequest, final CmsObject cms) throws CmsPermissionViolationException, IOException { // Perform a permission check performPermissionCheck(cms); // Set the appropriate response headers setResponeHeaders(res); // Figure out whether a JSON or HTTP request has been sent CmsSpellcheckingRequest cmsSpellcheckingRequest = null; try { String requestBody = getRequestBody(servletRequest); final JSONObject jsonRequest = new JSONObject(requestBody); cmsSpellcheckingRequest = parseJsonRequest(jsonRequest); } catch (Exception e) { LOG.debug(e.getMessage(), e); cmsSpellcheckingRequest = parseHttpRequest(servletRequest, cms); } if ((null != cmsSpellcheckingRequest) && cmsSpellcheckingRequest.isInitialized()) { // Perform the actual spellchecking final SpellCheckResponse spellCheckResponse = performSpellcheckQuery(cmsSpellcheckingRequest); /* * The field spellCheckResponse is null when exactly one correctly spelled word is passed to the spellchecker. * In this case it's safe to return an empty JSON formatted map, as the passed word is correct. Otherwise, * convert the spellchecker response into a new JSON formatted map. */ if (null == spellCheckResponse) { cmsSpellcheckingRequest.m_wordSuggestions = new JSONObject(); } else { cmsSpellcheckingRequest.m_wordSuggestions = getConvertedResponseAsJson(spellCheckResponse); } } // Send response back to the client sendResponse(res, cmsSpellcheckingRequest); }
java
public void getSpellcheckingResult( final HttpServletResponse res, final ServletRequest servletRequest, final CmsObject cms) throws CmsPermissionViolationException, IOException { // Perform a permission check performPermissionCheck(cms); // Set the appropriate response headers setResponeHeaders(res); // Figure out whether a JSON or HTTP request has been sent CmsSpellcheckingRequest cmsSpellcheckingRequest = null; try { String requestBody = getRequestBody(servletRequest); final JSONObject jsonRequest = new JSONObject(requestBody); cmsSpellcheckingRequest = parseJsonRequest(jsonRequest); } catch (Exception e) { LOG.debug(e.getMessage(), e); cmsSpellcheckingRequest = parseHttpRequest(servletRequest, cms); } if ((null != cmsSpellcheckingRequest) && cmsSpellcheckingRequest.isInitialized()) { // Perform the actual spellchecking final SpellCheckResponse spellCheckResponse = performSpellcheckQuery(cmsSpellcheckingRequest); /* * The field spellCheckResponse is null when exactly one correctly spelled word is passed to the spellchecker. * In this case it's safe to return an empty JSON formatted map, as the passed word is correct. Otherwise, * convert the spellchecker response into a new JSON formatted map. */ if (null == spellCheckResponse) { cmsSpellcheckingRequest.m_wordSuggestions = new JSONObject(); } else { cmsSpellcheckingRequest.m_wordSuggestions = getConvertedResponseAsJson(spellCheckResponse); } } // Send response back to the client sendResponse(res, cmsSpellcheckingRequest); }
[ "public", "void", "getSpellcheckingResult", "(", "final", "HttpServletResponse", "res", ",", "final", "ServletRequest", "servletRequest", ",", "final", "CmsObject", "cms", ")", "throws", "CmsPermissionViolationException", ",", "IOException", "{", "// Perform a permission check", "performPermissionCheck", "(", "cms", ")", ";", "// Set the appropriate response headers", "setResponeHeaders", "(", "res", ")", ";", "// Figure out whether a JSON or HTTP request has been sent", "CmsSpellcheckingRequest", "cmsSpellcheckingRequest", "=", "null", ";", "try", "{", "String", "requestBody", "=", "getRequestBody", "(", "servletRequest", ")", ";", "final", "JSONObject", "jsonRequest", "=", "new", "JSONObject", "(", "requestBody", ")", ";", "cmsSpellcheckingRequest", "=", "parseJsonRequest", "(", "jsonRequest", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "debug", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "cmsSpellcheckingRequest", "=", "parseHttpRequest", "(", "servletRequest", ",", "cms", ")", ";", "}", "if", "(", "(", "null", "!=", "cmsSpellcheckingRequest", ")", "&&", "cmsSpellcheckingRequest", ".", "isInitialized", "(", ")", ")", "{", "// Perform the actual spellchecking", "final", "SpellCheckResponse", "spellCheckResponse", "=", "performSpellcheckQuery", "(", "cmsSpellcheckingRequest", ")", ";", "/*\n * The field spellCheckResponse is null when exactly one correctly spelled word is passed to the spellchecker.\n * In this case it's safe to return an empty JSON formatted map, as the passed word is correct. Otherwise,\n * convert the spellchecker response into a new JSON formatted map.\n */", "if", "(", "null", "==", "spellCheckResponse", ")", "{", "cmsSpellcheckingRequest", ".", "m_wordSuggestions", "=", "new", "JSONObject", "(", ")", ";", "}", "else", "{", "cmsSpellcheckingRequest", ".", "m_wordSuggestions", "=", "getConvertedResponseAsJson", "(", "spellCheckResponse", ")", ";", "}", "}", "// Send response back to the client", "sendResponse", "(", "res", ",", "cmsSpellcheckingRequest", ")", ";", "}" ]
Performs spellchecking using Solr and returns the spellchecking results using JSON. @param res The HttpServletResponse object. @param servletRequest The ServletRequest object. @param cms The CmsObject object. @throws CmsPermissionViolationException in case of the anonymous guest user @throws IOException if writing the response fails
[ "Performs", "spellchecking", "using", "Solr", "and", "returns", "the", "spellchecking", "results", "using", "JSON", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L187-L228
158,513
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.parseAndAddDictionaries
public void parseAndAddDictionaries(CmsObject cms) throws CmsRoleViolationException { OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN); CmsSpellcheckDictionaryIndexer.parseAndAddZippedDictionaries(m_solrClient, cms); CmsSpellcheckDictionaryIndexer.parseAndAddDictionaries(m_solrClient, cms); }
java
public void parseAndAddDictionaries(CmsObject cms) throws CmsRoleViolationException { OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN); CmsSpellcheckDictionaryIndexer.parseAndAddZippedDictionaries(m_solrClient, cms); CmsSpellcheckDictionaryIndexer.parseAndAddDictionaries(m_solrClient, cms); }
[ "public", "void", "parseAndAddDictionaries", "(", "CmsObject", "cms", ")", "throws", "CmsRoleViolationException", "{", "OpenCms", ".", "getRoleManager", "(", ")", ".", "checkRole", "(", "cms", ",", "CmsRole", ".", "ROOT_ADMIN", ")", ";", "CmsSpellcheckDictionaryIndexer", ".", "parseAndAddZippedDictionaries", "(", "m_solrClient", ",", "cms", ")", ";", "CmsSpellcheckDictionaryIndexer", ".", "parseAndAddDictionaries", "(", "m_solrClient", ",", "cms", ")", ";", "}" ]
Parses and adds dictionaries to the Solr index. @param cms the OpenCms object. @throws CmsRoleViolationException in case the user does not have the required role ROOT_ADMIN
[ "Parses", "and", "adds", "dictionaries", "to", "the", "Solr", "index", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L237-L242
158,514
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.getConvertedResponseAsJson
private JSONObject getConvertedResponseAsJson(SpellCheckResponse response) { if (null == response) { return null; } final JSONObject suggestions = new JSONObject(); final Map<String, Suggestion> solrSuggestions = response.getSuggestionMap(); // Add suggestions to the response for (final String key : solrSuggestions.keySet()) { // Indicator to ignore words that are erroneously marked as misspelled. boolean ignoreWord = false; // Suggestions that are in the form "Xxxx" -> "xxxx" should be ignored. if (Character.isUpperCase(key.codePointAt(0))) { final String lowercaseKey = key.toLowerCase(); // If the suggestion map doesn't contain the lowercased word, ignore this entry. if (!solrSuggestions.containsKey(lowercaseKey)) { ignoreWord = true; } } if (!ignoreWord) { try { // Get suggestions as List final List<String> l = solrSuggestions.get(key).getAlternatives(); suggestions.put(key, l); } catch (JSONException e) { LOG.debug("Exception while converting Solr spellcheckresponse to JSON. ", e); } } } return suggestions; }
java
private JSONObject getConvertedResponseAsJson(SpellCheckResponse response) { if (null == response) { return null; } final JSONObject suggestions = new JSONObject(); final Map<String, Suggestion> solrSuggestions = response.getSuggestionMap(); // Add suggestions to the response for (final String key : solrSuggestions.keySet()) { // Indicator to ignore words that are erroneously marked as misspelled. boolean ignoreWord = false; // Suggestions that are in the form "Xxxx" -> "xxxx" should be ignored. if (Character.isUpperCase(key.codePointAt(0))) { final String lowercaseKey = key.toLowerCase(); // If the suggestion map doesn't contain the lowercased word, ignore this entry. if (!solrSuggestions.containsKey(lowercaseKey)) { ignoreWord = true; } } if (!ignoreWord) { try { // Get suggestions as List final List<String> l = solrSuggestions.get(key).getAlternatives(); suggestions.put(key, l); } catch (JSONException e) { LOG.debug("Exception while converting Solr spellcheckresponse to JSON. ", e); } } } return suggestions; }
[ "private", "JSONObject", "getConvertedResponseAsJson", "(", "SpellCheckResponse", "response", ")", "{", "if", "(", "null", "==", "response", ")", "{", "return", "null", ";", "}", "final", "JSONObject", "suggestions", "=", "new", "JSONObject", "(", ")", ";", "final", "Map", "<", "String", ",", "Suggestion", ">", "solrSuggestions", "=", "response", ".", "getSuggestionMap", "(", ")", ";", "// Add suggestions to the response", "for", "(", "final", "String", "key", ":", "solrSuggestions", ".", "keySet", "(", ")", ")", "{", "// Indicator to ignore words that are erroneously marked as misspelled.", "boolean", "ignoreWord", "=", "false", ";", "// Suggestions that are in the form \"Xxxx\" -> \"xxxx\" should be ignored.", "if", "(", "Character", ".", "isUpperCase", "(", "key", ".", "codePointAt", "(", "0", ")", ")", ")", "{", "final", "String", "lowercaseKey", "=", "key", ".", "toLowerCase", "(", ")", ";", "// If the suggestion map doesn't contain the lowercased word, ignore this entry.", "if", "(", "!", "solrSuggestions", ".", "containsKey", "(", "lowercaseKey", ")", ")", "{", "ignoreWord", "=", "true", ";", "}", "}", "if", "(", "!", "ignoreWord", ")", "{", "try", "{", "// Get suggestions as List", "final", "List", "<", "String", ">", "l", "=", "solrSuggestions", ".", "get", "(", "key", ")", ".", "getAlternatives", "(", ")", ";", "suggestions", ".", "put", "(", "key", ",", "l", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "LOG", ".", "debug", "(", "\"Exception while converting Solr spellcheckresponse to JSON. \"", ",", "e", ")", ";", "}", "}", "}", "return", "suggestions", ";", "}" ]
Converts the suggestions from the Solrj format to JSON format. @param response The SpellCheckResponse object containing the spellcheck results. @return The spellcheck suggestions as JSON object or null if something goes wrong.
[ "Converts", "the", "suggestions", "from", "the", "Solrj", "format", "to", "JSON", "format", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L250-L286
158,515
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.getJsonFormattedSpellcheckResult
private JSONObject getJsonFormattedSpellcheckResult(CmsSpellcheckingRequest request) { final JSONObject response = new JSONObject(); try { if (null != request.m_id) { response.put(JSON_ID, request.m_id); } response.put(JSON_RESULT, request.m_wordSuggestions); } catch (Exception e) { try { response.put(JSON_ERROR, true); LOG.debug("Error while assembling spellcheck response in JSON format.", e); } catch (JSONException ex) { LOG.debug("Error while assembling spellcheck response in JSON format.", ex); } } return response; }
java
private JSONObject getJsonFormattedSpellcheckResult(CmsSpellcheckingRequest request) { final JSONObject response = new JSONObject(); try { if (null != request.m_id) { response.put(JSON_ID, request.m_id); } response.put(JSON_RESULT, request.m_wordSuggestions); } catch (Exception e) { try { response.put(JSON_ERROR, true); LOG.debug("Error while assembling spellcheck response in JSON format.", e); } catch (JSONException ex) { LOG.debug("Error while assembling spellcheck response in JSON format.", ex); } } return response; }
[ "private", "JSONObject", "getJsonFormattedSpellcheckResult", "(", "CmsSpellcheckingRequest", "request", ")", "{", "final", "JSONObject", "response", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "if", "(", "null", "!=", "request", ".", "m_id", ")", "{", "response", ".", "put", "(", "JSON_ID", ",", "request", ".", "m_id", ")", ";", "}", "response", ".", "put", "(", "JSON_RESULT", ",", "request", ".", "m_wordSuggestions", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "try", "{", "response", ".", "put", "(", "JSON_ERROR", ",", "true", ")", ";", "LOG", ".", "debug", "(", "\"Error while assembling spellcheck response in JSON format.\"", ",", "e", ")", ";", "}", "catch", "(", "JSONException", "ex", ")", "{", "LOG", ".", "debug", "(", "\"Error while assembling spellcheck response in JSON format.\"", ",", "ex", ")", ";", "}", "}", "return", "response", ";", "}" ]
Returns the result of the performed spellcheck formatted in JSON. @param request The CmsSpellcheckingRequest. @return JSONObject that contains the result of the performed spellcheck.
[ "Returns", "the", "result", "of", "the", "performed", "spellcheck", "formatted", "in", "JSON", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L294-L315
158,516
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.getRequestBody
private String getRequestBody(ServletRequest request) throws IOException { final StringBuilder sb = new StringBuilder(); String line = request.getReader().readLine(); while (null != line) { sb.append(line); line = request.getReader().readLine(); } return sb.toString(); }
java
private String getRequestBody(ServletRequest request) throws IOException { final StringBuilder sb = new StringBuilder(); String line = request.getReader().readLine(); while (null != line) { sb.append(line); line = request.getReader().readLine(); } return sb.toString(); }
[ "private", "String", "getRequestBody", "(", "ServletRequest", "request", ")", "throws", "IOException", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "String", "line", "=", "request", ".", "getReader", "(", ")", ".", "readLine", "(", ")", ";", "while", "(", "null", "!=", "line", ")", "{", "sb", ".", "append", "(", "line", ")", ";", "line", "=", "request", ".", "getReader", "(", ")", ".", "readLine", "(", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the body of the request. This method is used to read posted JSON data. @param request The request. @return String representation of the request's body. @throws IOException in case reading the request fails
[ "Returns", "the", "body", "of", "the", "request", ".", "This", "method", "is", "used", "to", "read", "posted", "JSON", "data", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L326-L337
158,517
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.parseHttpRequest
private CmsSpellcheckingRequest parseHttpRequest(final ServletRequest req, final CmsObject cms) { if ((null != cms) && OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN)) { try { if (null != req.getParameter(HTTP_PARAMETER_CHECKREBUILD)) { if (CmsSpellcheckDictionaryIndexer.updatingIndexNecessesary(cms)) { parseAndAddDictionaries(cms); } } if (null != req.getParameter(HTTP_PARAMTER_REBUILD)) { parseAndAddDictionaries(cms); } } catch (CmsRoleViolationException e) { LOG.error(e.getLocalizedMessage(), e); } } final String q = req.getParameter(HTTP_PARAMETER_WORDS); if (null == q) { LOG.debug("Invalid HTTP request: No parameter \"" + HTTP_PARAMETER_WORDS + "\" defined. "); return null; } final StringTokenizer st = new StringTokenizer(q); final List<String> wordsToCheck = new ArrayList<String>(); while (st.hasMoreTokens()) { final String word = st.nextToken(); wordsToCheck.add(word); if (Character.isUpperCase(word.codePointAt(0))) { wordsToCheck.add(word.toLowerCase()); } } final String[] w = wordsToCheck.toArray(new String[wordsToCheck.size()]); final String dict = req.getParameter(HTTP_PARAMETER_LANG) == null ? LANG_DEFAULT : req.getParameter(HTTP_PARAMETER_LANG); return new CmsSpellcheckingRequest(w, dict); }
java
private CmsSpellcheckingRequest parseHttpRequest(final ServletRequest req, final CmsObject cms) { if ((null != cms) && OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN)) { try { if (null != req.getParameter(HTTP_PARAMETER_CHECKREBUILD)) { if (CmsSpellcheckDictionaryIndexer.updatingIndexNecessesary(cms)) { parseAndAddDictionaries(cms); } } if (null != req.getParameter(HTTP_PARAMTER_REBUILD)) { parseAndAddDictionaries(cms); } } catch (CmsRoleViolationException e) { LOG.error(e.getLocalizedMessage(), e); } } final String q = req.getParameter(HTTP_PARAMETER_WORDS); if (null == q) { LOG.debug("Invalid HTTP request: No parameter \"" + HTTP_PARAMETER_WORDS + "\" defined. "); return null; } final StringTokenizer st = new StringTokenizer(q); final List<String> wordsToCheck = new ArrayList<String>(); while (st.hasMoreTokens()) { final String word = st.nextToken(); wordsToCheck.add(word); if (Character.isUpperCase(word.codePointAt(0))) { wordsToCheck.add(word.toLowerCase()); } } final String[] w = wordsToCheck.toArray(new String[wordsToCheck.size()]); final String dict = req.getParameter(HTTP_PARAMETER_LANG) == null ? LANG_DEFAULT : req.getParameter(HTTP_PARAMETER_LANG); return new CmsSpellcheckingRequest(w, dict); }
[ "private", "CmsSpellcheckingRequest", "parseHttpRequest", "(", "final", "ServletRequest", "req", ",", "final", "CmsObject", "cms", ")", "{", "if", "(", "(", "null", "!=", "cms", ")", "&&", "OpenCms", ".", "getRoleManager", "(", ")", ".", "hasRole", "(", "cms", ",", "CmsRole", ".", "ROOT_ADMIN", ")", ")", "{", "try", "{", "if", "(", "null", "!=", "req", ".", "getParameter", "(", "HTTP_PARAMETER_CHECKREBUILD", ")", ")", "{", "if", "(", "CmsSpellcheckDictionaryIndexer", ".", "updatingIndexNecessesary", "(", "cms", ")", ")", "{", "parseAndAddDictionaries", "(", "cms", ")", ";", "}", "}", "if", "(", "null", "!=", "req", ".", "getParameter", "(", "HTTP_PARAMTER_REBUILD", ")", ")", "{", "parseAndAddDictionaries", "(", "cms", ")", ";", "}", "}", "catch", "(", "CmsRoleViolationException", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "}", "final", "String", "q", "=", "req", ".", "getParameter", "(", "HTTP_PARAMETER_WORDS", ")", ";", "if", "(", "null", "==", "q", ")", "{", "LOG", ".", "debug", "(", "\"Invalid HTTP request: No parameter \\\"\"", "+", "HTTP_PARAMETER_WORDS", "+", "\"\\\" defined. \"", ")", ";", "return", "null", ";", "}", "final", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "q", ")", ";", "final", "List", "<", "String", ">", "wordsToCheck", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "while", "(", "st", ".", "hasMoreTokens", "(", ")", ")", "{", "final", "String", "word", "=", "st", ".", "nextToken", "(", ")", ";", "wordsToCheck", ".", "add", "(", "word", ")", ";", "if", "(", "Character", ".", "isUpperCase", "(", "word", ".", "codePointAt", "(", "0", ")", ")", ")", "{", "wordsToCheck", ".", "add", "(", "word", ".", "toLowerCase", "(", ")", ")", ";", "}", "}", "final", "String", "[", "]", "w", "=", "wordsToCheck", ".", "toArray", "(", "new", "String", "[", "wordsToCheck", ".", "size", "(", ")", "]", ")", ";", "final", "String", "dict", "=", "req", ".", "getParameter", "(", "HTTP_PARAMETER_LANG", ")", "==", "null", "?", "LANG_DEFAULT", ":", "req", ".", "getParameter", "(", "HTTP_PARAMETER_LANG", ")", ";", "return", "new", "CmsSpellcheckingRequest", "(", "w", ",", "dict", ")", ";", "}" ]
Parse parameters from this request using HTTP. @param req The ServletRequest containing all request parameters. @param cms The OpenCms object. @return CmsSpellcheckingRequest object that contains parsed parameters.
[ "Parse", "parameters", "from", "this", "request", "using", "HTTP", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L346-L390
158,518
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.parseJsonRequest
private CmsSpellcheckingRequest parseJsonRequest(JSONObject jsonRequest) { final String id = jsonRequest.optString(JSON_ID); final JSONObject params = jsonRequest.optJSONObject(JSON_PARAMS); if (null == params) { LOG.debug("Invalid JSON request: No field \"params\" defined. "); return null; } final JSONArray words = params.optJSONArray(JSON_WORDS); final String lang = params.optString(JSON_LANG, LANG_DEFAULT); if (null == words) { LOG.debug("Invalid JSON request: No field \"words\" defined. "); return null; } // Convert JSON array to array of type String final List<String> wordsToCheck = new LinkedList<String>(); for (int i = 0; i < words.length(); i++) { final String word = words.opt(i).toString(); wordsToCheck.add(word); if (Character.isUpperCase(word.codePointAt(0))) { wordsToCheck.add(word.toLowerCase()); } } return new CmsSpellcheckingRequest(wordsToCheck.toArray(new String[wordsToCheck.size()]), lang, id); }
java
private CmsSpellcheckingRequest parseJsonRequest(JSONObject jsonRequest) { final String id = jsonRequest.optString(JSON_ID); final JSONObject params = jsonRequest.optJSONObject(JSON_PARAMS); if (null == params) { LOG.debug("Invalid JSON request: No field \"params\" defined. "); return null; } final JSONArray words = params.optJSONArray(JSON_WORDS); final String lang = params.optString(JSON_LANG, LANG_DEFAULT); if (null == words) { LOG.debug("Invalid JSON request: No field \"words\" defined. "); return null; } // Convert JSON array to array of type String final List<String> wordsToCheck = new LinkedList<String>(); for (int i = 0; i < words.length(); i++) { final String word = words.opt(i).toString(); wordsToCheck.add(word); if (Character.isUpperCase(word.codePointAt(0))) { wordsToCheck.add(word.toLowerCase()); } } return new CmsSpellcheckingRequest(wordsToCheck.toArray(new String[wordsToCheck.size()]), lang, id); }
[ "private", "CmsSpellcheckingRequest", "parseJsonRequest", "(", "JSONObject", "jsonRequest", ")", "{", "final", "String", "id", "=", "jsonRequest", ".", "optString", "(", "JSON_ID", ")", ";", "final", "JSONObject", "params", "=", "jsonRequest", ".", "optJSONObject", "(", "JSON_PARAMS", ")", ";", "if", "(", "null", "==", "params", ")", "{", "LOG", ".", "debug", "(", "\"Invalid JSON request: No field \\\"params\\\" defined. \"", ")", ";", "return", "null", ";", "}", "final", "JSONArray", "words", "=", "params", ".", "optJSONArray", "(", "JSON_WORDS", ")", ";", "final", "String", "lang", "=", "params", ".", "optString", "(", "JSON_LANG", ",", "LANG_DEFAULT", ")", ";", "if", "(", "null", "==", "words", ")", "{", "LOG", ".", "debug", "(", "\"Invalid JSON request: No field \\\"words\\\" defined. \"", ")", ";", "return", "null", ";", "}", "// Convert JSON array to array of type String", "final", "List", "<", "String", ">", "wordsToCheck", "=", "new", "LinkedList", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "words", ".", "length", "(", ")", ";", "i", "++", ")", "{", "final", "String", "word", "=", "words", ".", "opt", "(", "i", ")", ".", "toString", "(", ")", ";", "wordsToCheck", ".", "add", "(", "word", ")", ";", "if", "(", "Character", ".", "isUpperCase", "(", "word", ".", "codePointAt", "(", "0", ")", ")", ")", "{", "wordsToCheck", ".", "add", "(", "word", ".", "toLowerCase", "(", ")", ")", ";", "}", "}", "return", "new", "CmsSpellcheckingRequest", "(", "wordsToCheck", ".", "toArray", "(", "new", "String", "[", "wordsToCheck", ".", "size", "(", ")", "]", ")", ",", "lang", ",", "id", ")", ";", "}" ]
Parse JSON parameters from this request. @param jsonRequest The request in the JSON format. @return CmsSpellcheckingRequest object that contains parsed parameters or null, if JSON input is not well defined.
[ "Parse", "JSON", "parameters", "from", "this", "request", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L399-L428
158,519
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.performPermissionCheck
private void performPermissionCheck(CmsObject cms) throws CmsPermissionViolationException { if (cms.getRequestContext().getCurrentUser().isGuestUser()) { throw new CmsPermissionViolationException(null); } }
java
private void performPermissionCheck(CmsObject cms) throws CmsPermissionViolationException { if (cms.getRequestContext().getCurrentUser().isGuestUser()) { throw new CmsPermissionViolationException(null); } }
[ "private", "void", "performPermissionCheck", "(", "CmsObject", "cms", ")", "throws", "CmsPermissionViolationException", "{", "if", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentUser", "(", ")", ".", "isGuestUser", "(", ")", ")", "{", "throw", "new", "CmsPermissionViolationException", "(", "null", ")", ";", "}", "}" ]
Perform a security check against OpenCms. @param cms The OpenCms object. @throws CmsPermissionViolationException in case of the anonymous guest user
[ "Perform", "a", "security", "check", "against", "OpenCms", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L437-L442
158,520
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.performSpellcheckQuery
private SpellCheckResponse performSpellcheckQuery(CmsSpellcheckingRequest request) { if ((null == request) || !request.isInitialized()) { return null; } final String[] wordsToCheck = request.m_wordsToCheck; final ModifiableSolrParams params = new ModifiableSolrParams(); params.set("spellcheck", "true"); params.set("spellcheck.dictionary", request.m_dictionaryToUse); params.set("spellcheck.extendedResults", "true"); // Build one string from array of words and use it as query. final StringBuilder builder = new StringBuilder(); for (int i = 0; i < wordsToCheck.length; i++) { builder.append(wordsToCheck[i] + " "); } params.set("spellcheck.q", builder.toString()); final SolrQuery query = new SolrQuery(); query.setRequestHandler("/spell"); query.add(params); try { QueryResponse qres = m_solrClient.query(query); return qres.getSpellCheckResponse(); } catch (Exception e) { LOG.debug("Exception while performing spellcheck query...", e); } return null; }
java
private SpellCheckResponse performSpellcheckQuery(CmsSpellcheckingRequest request) { if ((null == request) || !request.isInitialized()) { return null; } final String[] wordsToCheck = request.m_wordsToCheck; final ModifiableSolrParams params = new ModifiableSolrParams(); params.set("spellcheck", "true"); params.set("spellcheck.dictionary", request.m_dictionaryToUse); params.set("spellcheck.extendedResults", "true"); // Build one string from array of words and use it as query. final StringBuilder builder = new StringBuilder(); for (int i = 0; i < wordsToCheck.length; i++) { builder.append(wordsToCheck[i] + " "); } params.set("spellcheck.q", builder.toString()); final SolrQuery query = new SolrQuery(); query.setRequestHandler("/spell"); query.add(params); try { QueryResponse qres = m_solrClient.query(query); return qres.getSpellCheckResponse(); } catch (Exception e) { LOG.debug("Exception while performing spellcheck query...", e); } return null; }
[ "private", "SpellCheckResponse", "performSpellcheckQuery", "(", "CmsSpellcheckingRequest", "request", ")", "{", "if", "(", "(", "null", "==", "request", ")", "||", "!", "request", ".", "isInitialized", "(", ")", ")", "{", "return", "null", ";", "}", "final", "String", "[", "]", "wordsToCheck", "=", "request", ".", "m_wordsToCheck", ";", "final", "ModifiableSolrParams", "params", "=", "new", "ModifiableSolrParams", "(", ")", ";", "params", ".", "set", "(", "\"spellcheck\"", ",", "\"true\"", ")", ";", "params", ".", "set", "(", "\"spellcheck.dictionary\"", ",", "request", ".", "m_dictionaryToUse", ")", ";", "params", ".", "set", "(", "\"spellcheck.extendedResults\"", ",", "\"true\"", ")", ";", "// Build one string from array of words and use it as query.", "final", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "wordsToCheck", ".", "length", ";", "i", "++", ")", "{", "builder", ".", "append", "(", "wordsToCheck", "[", "i", "]", "+", "\" \"", ")", ";", "}", "params", ".", "set", "(", "\"spellcheck.q\"", ",", "builder", ".", "toString", "(", ")", ")", ";", "final", "SolrQuery", "query", "=", "new", "SolrQuery", "(", ")", ";", "query", ".", "setRequestHandler", "(", "\"/spell\"", ")", ";", "query", ".", "add", "(", "params", ")", ";", "try", "{", "QueryResponse", "qres", "=", "m_solrClient", ".", "query", "(", "query", ")", ";", "return", "qres", ".", "getSpellCheckResponse", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "debug", "(", "\"Exception while performing spellcheck query...\"", ",", "e", ")", ";", "}", "return", "null", ";", "}" ]
Performs the actual spell check query using Solr. @param request the spell check request @return Results of the Solr spell check of type SpellCheckResponse or null if something goes wrong.
[ "Performs", "the", "actual", "spell", "check", "query", "using", "Solr", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L451-L484
158,521
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.sendResponse
private void sendResponse(final HttpServletResponse res, final CmsSpellcheckingRequest request) throws IOException { final PrintWriter pw = res.getWriter(); final JSONObject response = getJsonFormattedSpellcheckResult(request); pw.println(response.toString()); pw.close(); }
java
private void sendResponse(final HttpServletResponse res, final CmsSpellcheckingRequest request) throws IOException { final PrintWriter pw = res.getWriter(); final JSONObject response = getJsonFormattedSpellcheckResult(request); pw.println(response.toString()); pw.close(); }
[ "private", "void", "sendResponse", "(", "final", "HttpServletResponse", "res", ",", "final", "CmsSpellcheckingRequest", "request", ")", "throws", "IOException", "{", "final", "PrintWriter", "pw", "=", "res", ".", "getWriter", "(", ")", ";", "final", "JSONObject", "response", "=", "getJsonFormattedSpellcheckResult", "(", "request", ")", ";", "pw", ".", "println", "(", "response", ".", "toString", "(", ")", ")", ";", "pw", ".", "close", "(", ")", ";", "}" ]
Sends the JSON-formatted spellchecking results to the client. @param res The HttpServletResponse object. @param request The spellchecking request object. @throws IOException in case writing the response fails
[ "Sends", "the", "JSON", "-", "formatted", "spellchecking", "results", "to", "the", "client", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L494-L500
158,522
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.setResponeHeaders
private void setResponeHeaders(HttpServletResponse response) { response.setHeader("Cache-Control", "no-store, no-cache"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", System.currentTimeMillis()); response.setContentType("text/plain; charset=utf-8"); response.setCharacterEncoding("utf-8"); }
java
private void setResponeHeaders(HttpServletResponse response) { response.setHeader("Cache-Control", "no-store, no-cache"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", System.currentTimeMillis()); response.setContentType("text/plain; charset=utf-8"); response.setCharacterEncoding("utf-8"); }
[ "private", "void", "setResponeHeaders", "(", "HttpServletResponse", "response", ")", "{", "response", ".", "setHeader", "(", "\"Cache-Control\"", ",", "\"no-store, no-cache\"", ")", ";", "response", ".", "setHeader", "(", "\"Pragma\"", ",", "\"no-cache\"", ")", ";", "response", ".", "setDateHeader", "(", "\"Expires\"", ",", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "response", ".", "setContentType", "(", "\"text/plain; charset=utf-8\"", ")", ";", "response", ".", "setCharacterEncoding", "(", "\"utf-8\"", ")", ";", "}" ]
Sets the appropriate headers to response of this request. @param response The HttpServletResponse response object.
[ "Sets", "the", "appropriate", "headers", "to", "response", "of", "this", "request", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L507-L514
158,523
alkacon/opencms-core
src/org/opencms/acacia/shared/CmsSerialDateUtil.java
CmsSerialDateUtil.toIntWithDefault
public static int toIntWithDefault(String value, int defaultValue) { int result = defaultValue; try { result = Integer.parseInt(value); } catch (@SuppressWarnings("unused") Exception e) { // Do nothing, return default. } return result; }
java
public static int toIntWithDefault(String value, int defaultValue) { int result = defaultValue; try { result = Integer.parseInt(value); } catch (@SuppressWarnings("unused") Exception e) { // Do nothing, return default. } return result; }
[ "public", "static", "int", "toIntWithDefault", "(", "String", "value", ",", "int", "defaultValue", ")", "{", "int", "result", "=", "defaultValue", ";", "try", "{", "result", "=", "Integer", ".", "parseInt", "(", "value", ")", ";", "}", "catch", "(", "@", "SuppressWarnings", "(", "\"unused\"", ")", "Exception", "e", ")", "{", "// Do nothing, return default.", "}", "return", "result", ";", "}" ]
Parses int value and returns the provided default if the value can't be parsed. @param value the int to parse. @param defaultValue the default value. @return the parsed int, or the default value if parsing fails.
[ "Parses", "int", "value", "and", "returns", "the", "provided", "default", "if", "the", "value", "can", "t", "be", "parsed", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsSerialDateUtil.java#L48-L57
158,524
alkacon/opencms-core
src/org/opencms/search/solr/updateprocessors/CmsSolrCopyModifiedUpateProcessorFactory.java
CmsSolrCopyModifiedUpateProcessorFactory.init
@Override public void init(NamedList args) { Object regex = args.remove(PARAM_REGEX); if (null == regex) { throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required init parameter: " + PARAM_REGEX); } try { m_regex = Pattern.compile(regex.toString()); } catch (PatternSyntaxException e) { throw new SolrException(ErrorCode.SERVER_ERROR, "Invalid regex: " + regex, e); } Object replacement = args.remove(PARAM_REPLACEMENT); if (null == replacement) { throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required init parameter: " + PARAM_REPLACEMENT); } m_replacement = replacement.toString(); Object source = args.remove(PARAM_SOURCE); if (null == source) { throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required init parameter: " + PARAM_SOURCE); } m_source = source.toString(); Object target = args.remove(PARAM_TARGET); if (null == target) { throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required init parameter: " + PARAM_TARGET); } m_target = target.toString(); }
java
@Override public void init(NamedList args) { Object regex = args.remove(PARAM_REGEX); if (null == regex) { throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required init parameter: " + PARAM_REGEX); } try { m_regex = Pattern.compile(regex.toString()); } catch (PatternSyntaxException e) { throw new SolrException(ErrorCode.SERVER_ERROR, "Invalid regex: " + regex, e); } Object replacement = args.remove(PARAM_REPLACEMENT); if (null == replacement) { throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required init parameter: " + PARAM_REPLACEMENT); } m_replacement = replacement.toString(); Object source = args.remove(PARAM_SOURCE); if (null == source) { throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required init parameter: " + PARAM_SOURCE); } m_source = source.toString(); Object target = args.remove(PARAM_TARGET); if (null == target) { throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required init parameter: " + PARAM_TARGET); } m_target = target.toString(); }
[ "@", "Override", "public", "void", "init", "(", "NamedList", "args", ")", "{", "Object", "regex", "=", "args", ".", "remove", "(", "PARAM_REGEX", ")", ";", "if", "(", "null", "==", "regex", ")", "{", "throw", "new", "SolrException", "(", "ErrorCode", ".", "SERVER_ERROR", ",", "\"Missing required init parameter: \"", "+", "PARAM_REGEX", ")", ";", "}", "try", "{", "m_regex", "=", "Pattern", ".", "compile", "(", "regex", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "PatternSyntaxException", "e", ")", "{", "throw", "new", "SolrException", "(", "ErrorCode", ".", "SERVER_ERROR", ",", "\"Invalid regex: \"", "+", "regex", ",", "e", ")", ";", "}", "Object", "replacement", "=", "args", ".", "remove", "(", "PARAM_REPLACEMENT", ")", ";", "if", "(", "null", "==", "replacement", ")", "{", "throw", "new", "SolrException", "(", "ErrorCode", ".", "SERVER_ERROR", ",", "\"Missing required init parameter: \"", "+", "PARAM_REPLACEMENT", ")", ";", "}", "m_replacement", "=", "replacement", ".", "toString", "(", ")", ";", "Object", "source", "=", "args", ".", "remove", "(", "PARAM_SOURCE", ")", ";", "if", "(", "null", "==", "source", ")", "{", "throw", "new", "SolrException", "(", "ErrorCode", ".", "SERVER_ERROR", ",", "\"Missing required init parameter: \"", "+", "PARAM_SOURCE", ")", ";", "}", "m_source", "=", "source", ".", "toString", "(", ")", ";", "Object", "target", "=", "args", ".", "remove", "(", "PARAM_TARGET", ")", ";", "if", "(", "null", "==", "target", ")", "{", "throw", "new", "SolrException", "(", "ErrorCode", ".", "SERVER_ERROR", ",", "\"Missing required init parameter: \"", "+", "PARAM_TARGET", ")", ";", "}", "m_target", "=", "target", ".", "toString", "(", ")", ";", "}" ]
Read the parameters on initialization. @see org.apache.solr.update.processor.UpdateRequestProcessorFactory#init(org.apache.solr.common.util.NamedList)
[ "Read", "the", "parameters", "on", "initialization", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/updateprocessors/CmsSolrCopyModifiedUpateProcessorFactory.java#L124-L155
158,525
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java
CmsSimpleSearchConfigurationParser.getDefaultReturnFields
String getDefaultReturnFields() { StringBuffer fields = new StringBuffer(""); fields.append(CmsSearchField.FIELD_PATH); fields.append(','); fields.append(CmsSearchField.FIELD_INSTANCEDATE).append('_').append(getSearchLocale().toString()).append("_dt"); fields.append(','); fields.append(CmsSearchField.FIELD_INSTANCEDATE_END).append('_').append(getSearchLocale().toString()).append( "_dt"); fields.append(','); fields.append(CmsSearchField.FIELD_INSTANCEDATE_CURRENT_TILL).append('_').append( getSearchLocale().toString()).append("_dt"); fields.append(','); fields.append(CmsSearchField.FIELD_ID); fields.append(','); fields.append(CmsSearchField.FIELD_SOLR_ID); fields.append(','); fields.append(CmsSearchField.FIELD_DISPTITLE).append('_').append(getSearchLocale().toString()).append("_sort"); fields.append(','); fields.append(CmsSearchField.FIELD_LINK); return fields.toString(); }
java
String getDefaultReturnFields() { StringBuffer fields = new StringBuffer(""); fields.append(CmsSearchField.FIELD_PATH); fields.append(','); fields.append(CmsSearchField.FIELD_INSTANCEDATE).append('_').append(getSearchLocale().toString()).append("_dt"); fields.append(','); fields.append(CmsSearchField.FIELD_INSTANCEDATE_END).append('_').append(getSearchLocale().toString()).append( "_dt"); fields.append(','); fields.append(CmsSearchField.FIELD_INSTANCEDATE_CURRENT_TILL).append('_').append( getSearchLocale().toString()).append("_dt"); fields.append(','); fields.append(CmsSearchField.FIELD_ID); fields.append(','); fields.append(CmsSearchField.FIELD_SOLR_ID); fields.append(','); fields.append(CmsSearchField.FIELD_DISPTITLE).append('_').append(getSearchLocale().toString()).append("_sort"); fields.append(','); fields.append(CmsSearchField.FIELD_LINK); return fields.toString(); }
[ "String", "getDefaultReturnFields", "(", ")", "{", "StringBuffer", "fields", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "fields", ".", "append", "(", "CmsSearchField", ".", "FIELD_PATH", ")", ";", "fields", ".", "append", "(", "'", "'", ")", ";", "fields", ".", "append", "(", "CmsSearchField", ".", "FIELD_INSTANCEDATE", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "getSearchLocale", "(", ")", ".", "toString", "(", ")", ")", ".", "append", "(", "\"_dt\"", ")", ";", "fields", ".", "append", "(", "'", "'", ")", ";", "fields", ".", "append", "(", "CmsSearchField", ".", "FIELD_INSTANCEDATE_END", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "getSearchLocale", "(", ")", ".", "toString", "(", ")", ")", ".", "append", "(", "\"_dt\"", ")", ";", "fields", ".", "append", "(", "'", "'", ")", ";", "fields", ".", "append", "(", "CmsSearchField", ".", "FIELD_INSTANCEDATE_CURRENT_TILL", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "getSearchLocale", "(", ")", ".", "toString", "(", ")", ")", ".", "append", "(", "\"_dt\"", ")", ";", "fields", ".", "append", "(", "'", "'", ")", ";", "fields", ".", "append", "(", "CmsSearchField", ".", "FIELD_ID", ")", ";", "fields", ".", "append", "(", "'", "'", ")", ";", "fields", ".", "append", "(", "CmsSearchField", ".", "FIELD_SOLR_ID", ")", ";", "fields", ".", "append", "(", "'", "'", ")", ";", "fields", ".", "append", "(", "CmsSearchField", ".", "FIELD_DISPTITLE", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "getSearchLocale", "(", ")", ".", "toString", "(", ")", ")", ".", "append", "(", "\"_sort\"", ")", ";", "fields", ".", "append", "(", "'", "'", ")", ";", "fields", ".", "append", "(", "CmsSearchField", ".", "FIELD_LINK", ")", ";", "return", "fields", ".", "toString", "(", ")", ";", "}" ]
The fields returned by default. Typically the output is done via display formatters and hence nearly no field is necessary. Returning all fields might cause performance problems. @return the default return fields.
[ "The", "fields", "returned", "by", "default", ".", "Typically", "the", "output", "is", "done", "via", "display", "formatters", "and", "hence", "nearly", "no", "field", "is", "necessary", ".", "Returning", "all", "fields", "might", "cause", "performance", "problems", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java#L534-L555
158,526
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java
CmsSimpleSearchConfigurationParser.getDefaultFieldFacets
private Map<String, I_CmsSearchConfigurationFacetField> getDefaultFieldFacets(boolean categoryConjunction) { Map<String, I_CmsSearchConfigurationFacetField> fieldFacets = new HashMap<String, I_CmsSearchConfigurationFacetField>(); fieldFacets.put( CmsListManager.FIELD_CATEGORIES, new CmsSearchConfigurationFacetField( CmsListManager.FIELD_CATEGORIES, null, Integer.valueOf(1), Integer.valueOf(200), null, "Category", SortOrder.index, null, Boolean.valueOf(categoryConjunction), null, Boolean.TRUE)); fieldFacets.put( CmsListManager.FIELD_PARENT_FOLDERS, new CmsSearchConfigurationFacetField( CmsListManager.FIELD_PARENT_FOLDERS, null, Integer.valueOf(1), Integer.valueOf(200), null, "Folders", SortOrder.index, null, Boolean.FALSE, null, Boolean.TRUE)); return Collections.unmodifiableMap(fieldFacets); }
java
private Map<String, I_CmsSearchConfigurationFacetField> getDefaultFieldFacets(boolean categoryConjunction) { Map<String, I_CmsSearchConfigurationFacetField> fieldFacets = new HashMap<String, I_CmsSearchConfigurationFacetField>(); fieldFacets.put( CmsListManager.FIELD_CATEGORIES, new CmsSearchConfigurationFacetField( CmsListManager.FIELD_CATEGORIES, null, Integer.valueOf(1), Integer.valueOf(200), null, "Category", SortOrder.index, null, Boolean.valueOf(categoryConjunction), null, Boolean.TRUE)); fieldFacets.put( CmsListManager.FIELD_PARENT_FOLDERS, new CmsSearchConfigurationFacetField( CmsListManager.FIELD_PARENT_FOLDERS, null, Integer.valueOf(1), Integer.valueOf(200), null, "Folders", SortOrder.index, null, Boolean.FALSE, null, Boolean.TRUE)); return Collections.unmodifiableMap(fieldFacets); }
[ "private", "Map", "<", "String", ",", "I_CmsSearchConfigurationFacetField", ">", "getDefaultFieldFacets", "(", "boolean", "categoryConjunction", ")", "{", "Map", "<", "String", ",", "I_CmsSearchConfigurationFacetField", ">", "fieldFacets", "=", "new", "HashMap", "<", "String", ",", "I_CmsSearchConfigurationFacetField", ">", "(", ")", ";", "fieldFacets", ".", "put", "(", "CmsListManager", ".", "FIELD_CATEGORIES", ",", "new", "CmsSearchConfigurationFacetField", "(", "CmsListManager", ".", "FIELD_CATEGORIES", ",", "null", ",", "Integer", ".", "valueOf", "(", "1", ")", ",", "Integer", ".", "valueOf", "(", "200", ")", ",", "null", ",", "\"Category\"", ",", "SortOrder", ".", "index", ",", "null", ",", "Boolean", ".", "valueOf", "(", "categoryConjunction", ")", ",", "null", ",", "Boolean", ".", "TRUE", ")", ")", ";", "fieldFacets", ".", "put", "(", "CmsListManager", ".", "FIELD_PARENT_FOLDERS", ",", "new", "CmsSearchConfigurationFacetField", "(", "CmsListManager", ".", "FIELD_PARENT_FOLDERS", ",", "null", ",", "Integer", ".", "valueOf", "(", "1", ")", ",", "Integer", ".", "valueOf", "(", "200", ")", ",", "null", ",", "\"Folders\"", ",", "SortOrder", ".", "index", ",", "null", ",", "Boolean", ".", "FALSE", ",", "null", ",", "Boolean", ".", "TRUE", ")", ")", ";", "return", "Collections", ".", "unmodifiableMap", "(", "fieldFacets", ")", ";", "}" ]
The default field facets. @param categoryConjunction flag, indicating if category selections in the facet should be "AND" combined. @return the default field facets.
[ "The", "default", "field", "facets", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java#L637-L670
158,527
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java
CmsDomUtil.stripHtml
public static String stripHtml(String html) { if (html == null) { return null; } Element el = DOM.createDiv(); el.setInnerHTML(html); return el.getInnerText(); }
java
public static String stripHtml(String html) { if (html == null) { return null; } Element el = DOM.createDiv(); el.setInnerHTML(html); return el.getInnerText(); }
[ "public", "static", "String", "stripHtml", "(", "String", "html", ")", "{", "if", "(", "html", "==", "null", ")", "{", "return", "null", ";", "}", "Element", "el", "=", "DOM", ".", "createDiv", "(", ")", ";", "el", ".", "setInnerHTML", "(", "html", ")", ";", "return", "el", ".", "getInnerText", "(", ")", ";", "}" ]
Returns the text content to any HTML. @param html the HTML @return the text content
[ "Returns", "the", "text", "content", "to", "any", "HTML", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L2081-L2089
158,528
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.setUserInfo
public void setUserInfo(String username, String infoName, String value) throws CmsException { CmsUser user = m_cms.readUser(username); user.setAdditionalInfo(infoName, value); m_cms.writeUser(user); }
java
public void setUserInfo(String username, String infoName, String value) throws CmsException { CmsUser user = m_cms.readUser(username); user.setAdditionalInfo(infoName, value); m_cms.writeUser(user); }
[ "public", "void", "setUserInfo", "(", "String", "username", ",", "String", "infoName", ",", "String", "value", ")", "throws", "CmsException", "{", "CmsUser", "user", "=", "m_cms", ".", "readUser", "(", "username", ")", ";", "user", ".", "setAdditionalInfo", "(", "infoName", ",", "value", ")", ";", "m_cms", ".", "writeUser", "(", "user", ")", ";", "}" ]
Sets a string-valued additional info entry on the user. @param username the name of the user @param infoName the additional info key @param value the additional info value @throws CmsException if something goes wrong
[ "Sets", "a", "string", "-", "valued", "additional", "info", "entry", "on", "the", "user", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1589-L1594
158,529
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.setTimewarpInt
public void setTimewarpInt(String timewarp) { try { m_userSettings.setTimeWarp(Long.valueOf(timewarp).longValue()); } catch (Exception e) { m_userSettings.setTimeWarp(-1); } }
java
public void setTimewarpInt(String timewarp) { try { m_userSettings.setTimeWarp(Long.valueOf(timewarp).longValue()); } catch (Exception e) { m_userSettings.setTimeWarp(-1); } }
[ "public", "void", "setTimewarpInt", "(", "String", "timewarp", ")", "{", "try", "{", "m_userSettings", ".", "setTimeWarp", "(", "Long", ".", "valueOf", "(", "timewarp", ")", ".", "longValue", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "m_userSettings", ".", "setTimeWarp", "(", "-", "1", ")", ";", "}", "}" ]
Sets the timewarp setting from a numeric string @param timewarp a numeric string containing the number of milliseconds since the epoch
[ "Sets", "the", "timewarp", "setting", "from", "a", "numeric", "string" ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L2131-L2138
158,530
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.buildSelect
String buildSelect(String htmlAttributes, SelectOptions options) { return buildSelect(htmlAttributes, options.getOptions(), options.getValues(), options.getSelectedIndex()); }
java
String buildSelect(String htmlAttributes, SelectOptions options) { return buildSelect(htmlAttributes, options.getOptions(), options.getValues(), options.getSelectedIndex()); }
[ "String", "buildSelect", "(", "String", "htmlAttributes", ",", "SelectOptions", "options", ")", "{", "return", "buildSelect", "(", "htmlAttributes", ",", "options", ".", "getOptions", "(", ")", ",", "options", ".", "getValues", "(", ")", ",", "options", ".", "getSelectedIndex", "(", ")", ")", ";", "}" ]
Builds the HTML code for a select widget given a bean containing the select options @param htmlAttributes html attributes for the select widget @param options the bean containing the select options @return the HTML for the select box
[ "Builds", "the", "HTML", "code", "for", "a", "select", "widget", "given", "a", "bean", "containing", "the", "select", "options" ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L2257-L2260
158,531
alkacon/opencms-core
src/org/opencms/ui/apps/git/CmsGitConfiguration.java
CmsGitConfiguration.getValueFromProp
private String getValueFromProp(final String propValue) { String value = propValue; // remove quotes value = value.trim(); if ((value.startsWith("\"") && value.endsWith("\"")) || (value.startsWith("'") && value.endsWith("'"))) { value = value.substring(1, value.length() - 1); } return value; }
java
private String getValueFromProp(final String propValue) { String value = propValue; // remove quotes value = value.trim(); if ((value.startsWith("\"") && value.endsWith("\"")) || (value.startsWith("'") && value.endsWith("'"))) { value = value.substring(1, value.length() - 1); } return value; }
[ "private", "String", "getValueFromProp", "(", "final", "String", "propValue", ")", "{", "String", "value", "=", "propValue", ";", "// remove quotes", "value", "=", "value", ".", "trim", "(", ")", ";", "if", "(", "(", "value", ".", "startsWith", "(", "\"\\\"\"", ")", "&&", "value", ".", "endsWith", "(", "\"\\\"\"", ")", ")", "||", "(", "value", ".", "startsWith", "(", "\"'\"", ")", "&&", "value", ".", "endsWith", "(", "\"'\"", ")", ")", ")", "{", "value", "=", "value", ".", "substring", "(", "1", ",", "value", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "value", ";", "}" ]
Helper to read a line from the config file. @param propValue the property value @return the value of the variable set at this line.
[ "Helper", "to", "read", "a", "line", "from", "the", "config", "file", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitConfiguration.java#L304-L313
158,532
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsADESessionCache.java
CmsADESessionCache.getDynamicValue
public String getDynamicValue(String attribute) { return null == m_dynamicValues ? null : m_dynamicValues.get(attribute); }
java
public String getDynamicValue(String attribute) { return null == m_dynamicValues ? null : m_dynamicValues.get(attribute); }
[ "public", "String", "getDynamicValue", "(", "String", "attribute", ")", "{", "return", "null", "==", "m_dynamicValues", "?", "null", ":", "m_dynamicValues", ".", "get", "(", "attribute", ")", ";", "}" ]
Get cached value that is dynamically loaded by the Acacia content editor. @param attribute the attribute to load the value to @return the cached value
[ "Get", "cached", "value", "that", "is", "dynamically", "loaded", "by", "the", "Acacia", "content", "editor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADESessionCache.java#L289-L292
158,533
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsADESessionCache.java
CmsADESessionCache.setDynamicValue
public void setDynamicValue(String attribute, String value) { if (null == m_dynamicValues) { m_dynamicValues = new ConcurrentHashMap<String, String>(); } m_dynamicValues.put(attribute, value); }
java
public void setDynamicValue(String attribute, String value) { if (null == m_dynamicValues) { m_dynamicValues = new ConcurrentHashMap<String, String>(); } m_dynamicValues.put(attribute, value); }
[ "public", "void", "setDynamicValue", "(", "String", "attribute", ",", "String", "value", ")", "{", "if", "(", "null", "==", "m_dynamicValues", ")", "{", "m_dynamicValues", "=", "new", "ConcurrentHashMap", "<", "String", ",", "String", ">", "(", ")", ";", "}", "m_dynamicValues", ".", "put", "(", "attribute", ",", "value", ")", ";", "}" ]
Set cached value for the attribute. Used for dynamically loaded values in the Acacia content editor. @param attribute the attribute for which the value should be cached @param value the value to cache
[ "Set", "cached", "value", "for", "the", "attribute", ".", "Used", "for", "dynamically", "loaded", "values", "in", "the", "Acacia", "content", "editor", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADESessionCache.java#L429-L435
158,534
alkacon/opencms-core
src/org/opencms/widgets/CmsHtmlWidgetOption.java
CmsHtmlWidgetOption.parseEmbeddedGalleryOptions
public static CmsPair<String, Map<String, String>> parseEmbeddedGalleryOptions(String configuration) { final Map<String, String> galleryOptions = Maps.newHashMap(); String resultConfig = CmsStringUtil.substitute( PATTERN_EMBEDDED_GALLERY_CONFIG, configuration, new I_CmsRegexSubstitution() { public String substituteMatch(String string, Matcher matcher) { String galleryName = string.substring(matcher.start(1), matcher.end(1)); String embeddedConfig = string.substring(matcher.start(2), matcher.end(2)); galleryOptions.put(galleryName, embeddedConfig); return galleryName; } }); return CmsPair.create(resultConfig, galleryOptions); }
java
public static CmsPair<String, Map<String, String>> parseEmbeddedGalleryOptions(String configuration) { final Map<String, String> galleryOptions = Maps.newHashMap(); String resultConfig = CmsStringUtil.substitute( PATTERN_EMBEDDED_GALLERY_CONFIG, configuration, new I_CmsRegexSubstitution() { public String substituteMatch(String string, Matcher matcher) { String galleryName = string.substring(matcher.start(1), matcher.end(1)); String embeddedConfig = string.substring(matcher.start(2), matcher.end(2)); galleryOptions.put(galleryName, embeddedConfig); return galleryName; } }); return CmsPair.create(resultConfig, galleryOptions); }
[ "public", "static", "CmsPair", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "parseEmbeddedGalleryOptions", "(", "String", "configuration", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "galleryOptions", "=", "Maps", ".", "newHashMap", "(", ")", ";", "String", "resultConfig", "=", "CmsStringUtil", ".", "substitute", "(", "PATTERN_EMBEDDED_GALLERY_CONFIG", ",", "configuration", ",", "new", "I_CmsRegexSubstitution", "(", ")", "{", "public", "String", "substituteMatch", "(", "String", "string", ",", "Matcher", "matcher", ")", "{", "String", "galleryName", "=", "string", ".", "substring", "(", "matcher", ".", "start", "(", "1", ")", ",", "matcher", ".", "end", "(", "1", ")", ")", ";", "String", "embeddedConfig", "=", "string", ".", "substring", "(", "matcher", ".", "start", "(", "2", ")", ",", "matcher", ".", "end", "(", "2", ")", ")", ";", "galleryOptions", ".", "put", "(", "galleryName", ",", "embeddedConfig", ")", ";", "return", "galleryName", ";", "}", "}", ")", ";", "return", "CmsPair", ".", "create", "(", "resultConfig", ",", "galleryOptions", ")", ";", "}" ]
Parses and removes embedded gallery configuration strings. @param configuration the configuration string to parse @return a map containing both the string resulting from removing the embedded configurations, and the embedded configurations as a a map
[ "Parses", "and", "removes", "embedded", "gallery", "configuration", "strings", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsHtmlWidgetOption.java#L497-L514
158,535
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java
CmsFocalPointController.updateScaling
private void updateScaling() { List<I_CmsTransform> transforms = new ArrayList<>(); CmsCroppingParamBean crop = m_croppingProvider.get(); CmsImageInfoBean info = m_imageInfoProvider.get(); double wv = m_image.getElement().getParentElement().getOffsetWidth(); double hv = m_image.getElement().getParentElement().getOffsetHeight(); if (crop == null) { transforms.add( new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, info.getWidth(), info.getHeight())); } else { int wt, ht; wt = crop.getTargetWidth() >= 0 ? crop.getTargetWidth() : info.getWidth(); ht = crop.getTargetHeight() >= 0 ? crop.getTargetHeight() : info.getHeight(); transforms.add(new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, wt, ht)); if (crop.isCropped()) { transforms.add( new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getCropWidth(), crop.getCropHeight())); transforms.add(new CmsTranslate(crop.getCropX(), crop.getCropY())); } else { transforms.add( new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getOrgWidth(), crop.getOrgHeight())); } } CmsCompositeTransform chain = new CmsCompositeTransform(transforms); m_coordinateTransform = chain; if ((crop == null) || !crop.isCropped()) { m_region = transformRegionBack( m_coordinateTransform, CmsRectangle.fromLeftTopWidthHeight(0, 0, info.getWidth(), info.getHeight())); } else { m_region = transformRegionBack( m_coordinateTransform, CmsRectangle.fromLeftTopWidthHeight( crop.getCropX(), crop.getCropY(), crop.getCropWidth(), crop.getCropHeight())); } }
java
private void updateScaling() { List<I_CmsTransform> transforms = new ArrayList<>(); CmsCroppingParamBean crop = m_croppingProvider.get(); CmsImageInfoBean info = m_imageInfoProvider.get(); double wv = m_image.getElement().getParentElement().getOffsetWidth(); double hv = m_image.getElement().getParentElement().getOffsetHeight(); if (crop == null) { transforms.add( new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, info.getWidth(), info.getHeight())); } else { int wt, ht; wt = crop.getTargetWidth() >= 0 ? crop.getTargetWidth() : info.getWidth(); ht = crop.getTargetHeight() >= 0 ? crop.getTargetHeight() : info.getHeight(); transforms.add(new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, wt, ht)); if (crop.isCropped()) { transforms.add( new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getCropWidth(), crop.getCropHeight())); transforms.add(new CmsTranslate(crop.getCropX(), crop.getCropY())); } else { transforms.add( new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getOrgWidth(), crop.getOrgHeight())); } } CmsCompositeTransform chain = new CmsCompositeTransform(transforms); m_coordinateTransform = chain; if ((crop == null) || !crop.isCropped()) { m_region = transformRegionBack( m_coordinateTransform, CmsRectangle.fromLeftTopWidthHeight(0, 0, info.getWidth(), info.getHeight())); } else { m_region = transformRegionBack( m_coordinateTransform, CmsRectangle.fromLeftTopWidthHeight( crop.getCropX(), crop.getCropY(), crop.getCropWidth(), crop.getCropHeight())); } }
[ "private", "void", "updateScaling", "(", ")", "{", "List", "<", "I_CmsTransform", ">", "transforms", "=", "new", "ArrayList", "<>", "(", ")", ";", "CmsCroppingParamBean", "crop", "=", "m_croppingProvider", ".", "get", "(", ")", ";", "CmsImageInfoBean", "info", "=", "m_imageInfoProvider", ".", "get", "(", ")", ";", "double", "wv", "=", "m_image", ".", "getElement", "(", ")", ".", "getParentElement", "(", ")", ".", "getOffsetWidth", "(", ")", ";", "double", "hv", "=", "m_image", ".", "getElement", "(", ")", ".", "getParentElement", "(", ")", ".", "getOffsetHeight", "(", ")", ";", "if", "(", "crop", "==", "null", ")", "{", "transforms", ".", "add", "(", "new", "CmsBoxFit", "(", "CmsBoxFit", ".", "Mode", ".", "scaleOnlyIfNecessary", ",", "wv", ",", "hv", ",", "info", ".", "getWidth", "(", ")", ",", "info", ".", "getHeight", "(", ")", ")", ")", ";", "}", "else", "{", "int", "wt", ",", "ht", ";", "wt", "=", "crop", ".", "getTargetWidth", "(", ")", ">=", "0", "?", "crop", ".", "getTargetWidth", "(", ")", ":", "info", ".", "getWidth", "(", ")", ";", "ht", "=", "crop", ".", "getTargetHeight", "(", ")", ">=", "0", "?", "crop", ".", "getTargetHeight", "(", ")", ":", "info", ".", "getHeight", "(", ")", ";", "transforms", ".", "add", "(", "new", "CmsBoxFit", "(", "CmsBoxFit", ".", "Mode", ".", "scaleOnlyIfNecessary", ",", "wv", ",", "hv", ",", "wt", ",", "ht", ")", ")", ";", "if", "(", "crop", ".", "isCropped", "(", ")", ")", "{", "transforms", ".", "add", "(", "new", "CmsBoxFit", "(", "CmsBoxFit", ".", "Mode", ".", "scaleAlways", ",", "wt", ",", "ht", ",", "crop", ".", "getCropWidth", "(", ")", ",", "crop", ".", "getCropHeight", "(", ")", ")", ")", ";", "transforms", ".", "add", "(", "new", "CmsTranslate", "(", "crop", ".", "getCropX", "(", ")", ",", "crop", ".", "getCropY", "(", ")", ")", ")", ";", "}", "else", "{", "transforms", ".", "add", "(", "new", "CmsBoxFit", "(", "CmsBoxFit", ".", "Mode", ".", "scaleAlways", ",", "wt", ",", "ht", ",", "crop", ".", "getOrgWidth", "(", ")", ",", "crop", ".", "getOrgHeight", "(", ")", ")", ")", ";", "}", "}", "CmsCompositeTransform", "chain", "=", "new", "CmsCompositeTransform", "(", "transforms", ")", ";", "m_coordinateTransform", "=", "chain", ";", "if", "(", "(", "crop", "==", "null", ")", "||", "!", "crop", ".", "isCropped", "(", ")", ")", "{", "m_region", "=", "transformRegionBack", "(", "m_coordinateTransform", ",", "CmsRectangle", ".", "fromLeftTopWidthHeight", "(", "0", ",", "0", ",", "info", ".", "getWidth", "(", ")", ",", "info", ".", "getHeight", "(", ")", ")", ")", ";", "}", "else", "{", "m_region", "=", "transformRegionBack", "(", "m_coordinateTransform", ",", "CmsRectangle", ".", "fromLeftTopWidthHeight", "(", "crop", ".", "getCropX", "(", ")", ",", "crop", ".", "getCropY", "(", ")", ",", "crop", ".", "getCropWidth", "(", ")", ",", "crop", ".", "getCropHeight", "(", ")", ")", ")", ";", "}", "}" ]
Sets up the coordinate transformations between the coordinate system of the parent element of the image element and the native coordinate system of the original image.
[ "Sets", "up", "the", "coordinate", "transformations", "between", "the", "coordinate", "system", "of", "the", "parent", "element", "of", "the", "image", "element", "and", "the", "native", "coordinate", "system", "of", "the", "original", "image", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java#L439-L479
158,536
alkacon/opencms-core
src/org/opencms/util/CmsFileUtil.java
CmsFileUtil.getEncoding
public static String getEncoding(CmsObject cms, CmsResource file) { CmsProperty encodingProperty = CmsProperty.getNullProperty(); try { encodingProperty = cms.readPropertyObject(file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true); } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); } return CmsEncoder.lookupEncoding(encodingProperty.getValue(""), OpenCms.getSystemInfo().getDefaultEncoding()); }
java
public static String getEncoding(CmsObject cms, CmsResource file) { CmsProperty encodingProperty = CmsProperty.getNullProperty(); try { encodingProperty = cms.readPropertyObject(file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true); } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); } return CmsEncoder.lookupEncoding(encodingProperty.getValue(""), OpenCms.getSystemInfo().getDefaultEncoding()); }
[ "public", "static", "String", "getEncoding", "(", "CmsObject", "cms", ",", "CmsResource", "file", ")", "{", "CmsProperty", "encodingProperty", "=", "CmsProperty", ".", "getNullProperty", "(", ")", ";", "try", "{", "encodingProperty", "=", "cms", ".", "readPropertyObject", "(", "file", ",", "CmsPropertyDefinition", ".", "PROPERTY_CONTENT_ENCODING", ",", "true", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "debug", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "return", "CmsEncoder", ".", "lookupEncoding", "(", "encodingProperty", ".", "getValue", "(", "\"\"", ")", ",", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "getDefaultEncoding", "(", ")", ")", ";", "}" ]
Returns the encoding of the file. Encoding is read from the content-encoding property and defaults to the systems default encoding. Since properties can change without rewriting content, the actual encoding can differ. @param cms {@link CmsObject} used to read properties of the given file. @param file the file for which the encoding is requested @return the file's encoding according to the content-encoding property, or the system's default encoding as default.
[ "Returns", "the", "encoding", "of", "the", "file", ".", "Encoding", "is", "read", "from", "the", "content", "-", "encoding", "property", "and", "defaults", "to", "the", "systems", "default", "encoding", ".", "Since", "properties", "can", "change", "without", "rewriting", "content", "the", "actual", "encoding", "can", "differ", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L293-L302
158,537
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsWorkplaceEditorManager.java
CmsWorkplaceEditorManager.getEditorParameter
public String getEditorParameter(CmsObject cms, String editor, String param) { String path = OpenCms.getSystemInfo().getConfigFilePath(cms, "editors/" + editor + ".properties"); CmsVfsMemoryObjectCache cache = CmsVfsMemoryObjectCache.getVfsMemoryObjectCache(); CmsParameterConfiguration config = (CmsParameterConfiguration)cache.getCachedObject(cms, path); if (config == null) { try { CmsFile file = cms.readFile(path); try (ByteArrayInputStream input = new ByteArrayInputStream(file.getContents())) { config = new CmsParameterConfiguration(input); // Uses ISO-8859-1, should be OK for config parameters cache.putCachedObject(cms, path, config); } } catch (CmsVfsResourceNotFoundException e) { return null; } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return null; } } return config.getString(param, null); }
java
public String getEditorParameter(CmsObject cms, String editor, String param) { String path = OpenCms.getSystemInfo().getConfigFilePath(cms, "editors/" + editor + ".properties"); CmsVfsMemoryObjectCache cache = CmsVfsMemoryObjectCache.getVfsMemoryObjectCache(); CmsParameterConfiguration config = (CmsParameterConfiguration)cache.getCachedObject(cms, path); if (config == null) { try { CmsFile file = cms.readFile(path); try (ByteArrayInputStream input = new ByteArrayInputStream(file.getContents())) { config = new CmsParameterConfiguration(input); // Uses ISO-8859-1, should be OK for config parameters cache.putCachedObject(cms, path, config); } } catch (CmsVfsResourceNotFoundException e) { return null; } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return null; } } return config.getString(param, null); }
[ "public", "String", "getEditorParameter", "(", "CmsObject", "cms", ",", "String", "editor", ",", "String", "param", ")", "{", "String", "path", "=", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "getConfigFilePath", "(", "cms", ",", "\"editors/\"", "+", "editor", "+", "\".properties\"", ")", ";", "CmsVfsMemoryObjectCache", "cache", "=", "CmsVfsMemoryObjectCache", ".", "getVfsMemoryObjectCache", "(", ")", ";", "CmsParameterConfiguration", "config", "=", "(", "CmsParameterConfiguration", ")", "cache", ".", "getCachedObject", "(", "cms", ",", "path", ")", ";", "if", "(", "config", "==", "null", ")", "{", "try", "{", "CmsFile", "file", "=", "cms", ".", "readFile", "(", "path", ")", ";", "try", "(", "ByteArrayInputStream", "input", "=", "new", "ByteArrayInputStream", "(", "file", ".", "getContents", "(", ")", ")", ")", "{", "config", "=", "new", "CmsParameterConfiguration", "(", "input", ")", ";", "// Uses ISO-8859-1, should be OK for config parameters", "cache", ".", "putCachedObject", "(", "cms", ",", "path", ",", "config", ")", ";", "}", "}", "catch", "(", "CmsVfsResourceNotFoundException", "e", ")", "{", "return", "null", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "return", "null", ";", "}", "}", "return", "config", ".", "getString", "(", "param", ",", "null", ")", ";", "}" ]
Gets the value of a global editor configuration parameter. @param cms the CMS context @param editor the editor name @param param the name of the parameter @return the editor parameter value
[ "Gets", "the", "value", "of", "a", "global", "editor", "configuration", "parameter", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsWorkplaceEditorManager.java#L250-L270
158,538
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspInstanceDateBean.java
CmsJspInstanceDateBean.getEnd
public Date getEnd() { if (null != m_explicitEnd) { return isWholeDay() ? adjustForWholeDay(m_explicitEnd, true) : m_explicitEnd; } if ((null == m_end) && (m_series.getInstanceDuration() != null)) { m_end = new Date(m_start.getTime() + m_series.getInstanceDuration().longValue()); } return isWholeDay() && !m_series.isWholeDay() ? adjustForWholeDay(m_end, true) : m_end; }
java
public Date getEnd() { if (null != m_explicitEnd) { return isWholeDay() ? adjustForWholeDay(m_explicitEnd, true) : m_explicitEnd; } if ((null == m_end) && (m_series.getInstanceDuration() != null)) { m_end = new Date(m_start.getTime() + m_series.getInstanceDuration().longValue()); } return isWholeDay() && !m_series.isWholeDay() ? adjustForWholeDay(m_end, true) : m_end; }
[ "public", "Date", "getEnd", "(", ")", "{", "if", "(", "null", "!=", "m_explicitEnd", ")", "{", "return", "isWholeDay", "(", ")", "?", "adjustForWholeDay", "(", "m_explicitEnd", ",", "true", ")", ":", "m_explicitEnd", ";", "}", "if", "(", "(", "null", "==", "m_end", ")", "&&", "(", "m_series", ".", "getInstanceDuration", "(", ")", "!=", "null", ")", ")", "{", "m_end", "=", "new", "Date", "(", "m_start", ".", "getTime", "(", ")", "+", "m_series", ".", "getInstanceDuration", "(", ")", ".", "longValue", "(", ")", ")", ";", "}", "return", "isWholeDay", "(", ")", "&&", "!", "m_series", ".", "isWholeDay", "(", ")", "?", "adjustForWholeDay", "(", "m_end", ",", "true", ")", ":", "m_end", ";", "}" ]
Returns the end time of the event. @return the end time of the event.
[ "Returns", "the", "end", "time", "of", "the", "event", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspInstanceDateBean.java#L239-L248
158,539
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspInstanceDateBean.java
CmsJspInstanceDateBean.setEnd
public void setEnd(Date endDate) { if ((null == endDate) || getStart().after(endDate)) { m_explicitEnd = null; } else { m_explicitEnd = endDate; } }
java
public void setEnd(Date endDate) { if ((null == endDate) || getStart().after(endDate)) { m_explicitEnd = null; } else { m_explicitEnd = endDate; } }
[ "public", "void", "setEnd", "(", "Date", "endDate", ")", "{", "if", "(", "(", "null", "==", "endDate", ")", "||", "getStart", "(", ")", ".", "after", "(", "endDate", ")", ")", "{", "m_explicitEnd", "=", "null", ";", "}", "else", "{", "m_explicitEnd", "=", "endDate", ";", "}", "}" ]
Explicitly set the end time of the event. If the provided date is <code>null</code> or a date before the start date, the end date defaults to the start date. @param endDate the end time of the event.
[ "Explicitly", "set", "the", "end", "time", "of", "the", "event", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspInstanceDateBean.java#L363-L370
158,540
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspInstanceDateBean.java
CmsJspInstanceDateBean.adjustForWholeDay
private Date adjustForWholeDay(Date date, boolean isEnd) { Calendar result = new GregorianCalendar(); result.setTime(date); result.set(Calendar.HOUR_OF_DAY, 0); result.set(Calendar.MINUTE, 0); result.set(Calendar.SECOND, 0); result.set(Calendar.MILLISECOND, 0); if (isEnd) { result.add(Calendar.DATE, 1); } return result.getTime(); }
java
private Date adjustForWholeDay(Date date, boolean isEnd) { Calendar result = new GregorianCalendar(); result.setTime(date); result.set(Calendar.HOUR_OF_DAY, 0); result.set(Calendar.MINUTE, 0); result.set(Calendar.SECOND, 0); result.set(Calendar.MILLISECOND, 0); if (isEnd) { result.add(Calendar.DATE, 1); } return result.getTime(); }
[ "private", "Date", "adjustForWholeDay", "(", "Date", "date", ",", "boolean", "isEnd", ")", "{", "Calendar", "result", "=", "new", "GregorianCalendar", "(", ")", ";", "result", ".", "setTime", "(", "date", ")", ";", "result", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "result", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "result", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "result", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "if", "(", "isEnd", ")", "{", "result", ".", "add", "(", "Calendar", ".", "DATE", ",", "1", ")", ";", "}", "return", "result", ".", "getTime", "(", ")", ";", "}" ]
Adjust the date according to the whole day options. @param date the date to adjust. @param isEnd flag, indicating if the date is the end of the event (in contrast to the beginning) @return the adjusted date, which will be exactly the beginning or the end of the provide date's day.
[ "Adjust", "the", "date", "according", "to", "the", "whole", "day", "options", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspInstanceDateBean.java#L428-L441
158,541
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspInstanceDateBean.java
CmsJspInstanceDateBean.isSingleMultiDay
private boolean isSingleMultiDay() { long duration = getEnd().getTime() - getStart().getTime(); if (duration > I_CmsSerialDateValue.DAY_IN_MILLIS) { return true; } if (isWholeDay() && (duration <= I_CmsSerialDateValue.DAY_IN_MILLIS)) { return false; } Calendar start = new GregorianCalendar(); start.setTime(getStart()); Calendar end = new GregorianCalendar(); end.setTime(getEnd()); if (start.get(Calendar.DAY_OF_MONTH) == end.get(Calendar.DAY_OF_MONTH)) { return false; } return true; }
java
private boolean isSingleMultiDay() { long duration = getEnd().getTime() - getStart().getTime(); if (duration > I_CmsSerialDateValue.DAY_IN_MILLIS) { return true; } if (isWholeDay() && (duration <= I_CmsSerialDateValue.DAY_IN_MILLIS)) { return false; } Calendar start = new GregorianCalendar(); start.setTime(getStart()); Calendar end = new GregorianCalendar(); end.setTime(getEnd()); if (start.get(Calendar.DAY_OF_MONTH) == end.get(Calendar.DAY_OF_MONTH)) { return false; } return true; }
[ "private", "boolean", "isSingleMultiDay", "(", ")", "{", "long", "duration", "=", "getEnd", "(", ")", ".", "getTime", "(", ")", "-", "getStart", "(", ")", ".", "getTime", "(", ")", ";", "if", "(", "duration", ">", "I_CmsSerialDateValue", ".", "DAY_IN_MILLIS", ")", "{", "return", "true", ";", "}", "if", "(", "isWholeDay", "(", ")", "&&", "(", "duration", "<=", "I_CmsSerialDateValue", ".", "DAY_IN_MILLIS", ")", ")", "{", "return", "false", ";", "}", "Calendar", "start", "=", "new", "GregorianCalendar", "(", ")", ";", "start", ".", "setTime", "(", "getStart", "(", ")", ")", ";", "Calendar", "end", "=", "new", "GregorianCalendar", "(", ")", ";", "end", ".", "setTime", "(", "getEnd", "(", ")", ")", ";", "if", "(", "start", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", "==", "end", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Returns a flag, indicating if the current event is a multi-day event. The method is only called if the single event has an explicitely set end date or an explicitely changed whole day option. @return a flag, indicating if the current event takes lasts over more than one day.
[ "Returns", "a", "flag", "indicating", "if", "the", "current", "event", "is", "a", "multi", "-", "day", "event", ".", "The", "method", "is", "only", "called", "if", "the", "single", "event", "has", "an", "explicitely", "set", "end", "date", "or", "an", "explicitely", "changed", "whole", "day", "option", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspInstanceDateBean.java#L481-L499
158,542
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcSessionSecurityUtil.java
CmsUgcSessionSecurityUtil.checkCreateUpload
public static void checkCreateUpload(CmsObject cms, CmsUgcConfiguration config, String name, long size) throws CmsUgcException { if (!config.getUploadParentFolder().isPresent()) { String message = Messages.get().container(Messages.ERR_NO_UPLOADS_ALLOWED_0).key( cms.getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errNoUploadAllowed, message); } if (config.getMaxUploadSize().isPresent()) { if (config.getMaxUploadSize().get().longValue() < size) { String message = Messages.get().container(Messages.ERR_UPLOAD_TOO_BIG_1, name).key( cms.getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errMaxUploadSizeExceeded, message); } } if (config.getValidExtensions().isPresent()) { List<String> validExtensions = config.getValidExtensions().get(); boolean foundExtension = false; for (String extension : validExtensions) { if (name.toLowerCase().endsWith(extension.toLowerCase())) { foundExtension = true; break; } } if (!foundExtension) { String message = Messages.get().container(Messages.ERR_UPLOAD_FILE_EXTENSION_NOT_ALLOWED_1, name).key( cms.getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errInvalidExtension, message); } } }
java
public static void checkCreateUpload(CmsObject cms, CmsUgcConfiguration config, String name, long size) throws CmsUgcException { if (!config.getUploadParentFolder().isPresent()) { String message = Messages.get().container(Messages.ERR_NO_UPLOADS_ALLOWED_0).key( cms.getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errNoUploadAllowed, message); } if (config.getMaxUploadSize().isPresent()) { if (config.getMaxUploadSize().get().longValue() < size) { String message = Messages.get().container(Messages.ERR_UPLOAD_TOO_BIG_1, name).key( cms.getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errMaxUploadSizeExceeded, message); } } if (config.getValidExtensions().isPresent()) { List<String> validExtensions = config.getValidExtensions().get(); boolean foundExtension = false; for (String extension : validExtensions) { if (name.toLowerCase().endsWith(extension.toLowerCase())) { foundExtension = true; break; } } if (!foundExtension) { String message = Messages.get().container(Messages.ERR_UPLOAD_FILE_EXTENSION_NOT_ALLOWED_1, name).key( cms.getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errInvalidExtension, message); } } }
[ "public", "static", "void", "checkCreateUpload", "(", "CmsObject", "cms", ",", "CmsUgcConfiguration", "config", ",", "String", "name", ",", "long", "size", ")", "throws", "CmsUgcException", "{", "if", "(", "!", "config", ".", "getUploadParentFolder", "(", ")", ".", "isPresent", "(", ")", ")", "{", "String", "message", "=", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_NO_UPLOADS_ALLOWED_0", ")", ".", "key", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ";", "throw", "new", "CmsUgcException", "(", "CmsUgcConstants", ".", "ErrorCode", ".", "errNoUploadAllowed", ",", "message", ")", ";", "}", "if", "(", "config", ".", "getMaxUploadSize", "(", ")", ".", "isPresent", "(", ")", ")", "{", "if", "(", "config", ".", "getMaxUploadSize", "(", ")", ".", "get", "(", ")", ".", "longValue", "(", ")", "<", "size", ")", "{", "String", "message", "=", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_UPLOAD_TOO_BIG_1", ",", "name", ")", ".", "key", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ";", "throw", "new", "CmsUgcException", "(", "CmsUgcConstants", ".", "ErrorCode", ".", "errMaxUploadSizeExceeded", ",", "message", ")", ";", "}", "}", "if", "(", "config", ".", "getValidExtensions", "(", ")", ".", "isPresent", "(", ")", ")", "{", "List", "<", "String", ">", "validExtensions", "=", "config", ".", "getValidExtensions", "(", ")", ".", "get", "(", ")", ";", "boolean", "foundExtension", "=", "false", ";", "for", "(", "String", "extension", ":", "validExtensions", ")", "{", "if", "(", "name", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "extension", ".", "toLowerCase", "(", ")", ")", ")", "{", "foundExtension", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "foundExtension", ")", "{", "String", "message", "=", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_UPLOAD_FILE_EXTENSION_NOT_ALLOWED_1", ",", "name", ")", ".", "key", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ";", "throw", "new", "CmsUgcException", "(", "CmsUgcConstants", ".", "ErrorCode", ".", "errInvalidExtension", ",", "message", ")", ";", "}", "}", "}" ]
Checks whether an uploaded file can be created in the VFS, and throws an exception otherwise. @param cms the current CMS context @param config the form configuration @param name the file name of the uploaded file @param size the size of the uploaded file @throws CmsUgcException if something goes wrong
[ "Checks", "whether", "an", "uploaded", "file", "can", "be", "created", "in", "the", "VFS", "and", "throws", "an", "exception", "otherwise", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSessionSecurityUtil.java#L95-L127
158,543
alkacon/opencms-core
src/org/opencms/jsp/search/controller/CmsSearchControllerFacetRange.java
CmsSearchControllerFacetRange.addFacetPart
protected void addFacetPart(CmsSolrQuery query) { StringBuffer value = new StringBuffer(); value.append("{!key=").append(m_config.getName()); addFacetOptions(value); if (m_config.getIgnoreAllFacetFilters() || (!m_state.getCheckedEntries().isEmpty() && !m_config.getIsAndFacet())) { value.append(" ex=").append(m_config.getIgnoreTags()); } value.append("}"); value.append(m_config.getRange()); query.add("facet.range", value.toString()); }
java
protected void addFacetPart(CmsSolrQuery query) { StringBuffer value = new StringBuffer(); value.append("{!key=").append(m_config.getName()); addFacetOptions(value); if (m_config.getIgnoreAllFacetFilters() || (!m_state.getCheckedEntries().isEmpty() && !m_config.getIsAndFacet())) { value.append(" ex=").append(m_config.getIgnoreTags()); } value.append("}"); value.append(m_config.getRange()); query.add("facet.range", value.toString()); }
[ "protected", "void", "addFacetPart", "(", "CmsSolrQuery", "query", ")", "{", "StringBuffer", "value", "=", "new", "StringBuffer", "(", ")", ";", "value", ".", "append", "(", "\"{!key=\"", ")", ".", "append", "(", "m_config", ".", "getName", "(", ")", ")", ";", "addFacetOptions", "(", "value", ")", ";", "if", "(", "m_config", ".", "getIgnoreAllFacetFilters", "(", ")", "||", "(", "!", "m_state", ".", "getCheckedEntries", "(", ")", ".", "isEmpty", "(", ")", "&&", "!", "m_config", ".", "getIsAndFacet", "(", ")", ")", ")", "{", "value", ".", "append", "(", "\" ex=\"", ")", ".", "append", "(", "m_config", ".", "getIgnoreTags", "(", ")", ")", ";", "}", "value", ".", "append", "(", "\"}\"", ")", ";", "value", ".", "append", "(", "m_config", ".", "getRange", "(", ")", ")", ";", "query", ".", "add", "(", "\"facet.range\"", ",", "value", ".", "toString", "(", ")", ")", ";", "}" ]
Generate query part for the facet, without filters. @param query The query, where the facet part should be added
[ "Generate", "query", "part", "for", "the", "facet", "without", "filters", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/controller/CmsSearchControllerFacetRange.java#L162-L174
158,544
alkacon/opencms-core
src/org/opencms/widgets/serialdate/CmsSerialDateBeanYearlyWeekday.java
CmsSerialDateBeanYearlyWeekday.setFittingWeekDay
private void setFittingWeekDay(Calendar date) { date.set(Calendar.DAY_OF_MONTH, 1); int weekDayFirst = date.get(Calendar.DAY_OF_WEEK); int firstFittingWeekDay = (((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS) - weekDayFirst) % I_CmsSerialDateValue.NUM_OF_WEEKDAYS) + 1; int fittingWeekDay = firstFittingWeekDay + (I_CmsSerialDateValue.NUM_OF_WEEKDAYS * m_weekOfMonth.ordinal()); if (fittingWeekDay > date.getActualMaximum(Calendar.DAY_OF_MONTH)) { fittingWeekDay -= I_CmsSerialDateValue.NUM_OF_WEEKDAYS; } date.set(Calendar.DAY_OF_MONTH, fittingWeekDay); }
java
private void setFittingWeekDay(Calendar date) { date.set(Calendar.DAY_OF_MONTH, 1); int weekDayFirst = date.get(Calendar.DAY_OF_WEEK); int firstFittingWeekDay = (((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS) - weekDayFirst) % I_CmsSerialDateValue.NUM_OF_WEEKDAYS) + 1; int fittingWeekDay = firstFittingWeekDay + (I_CmsSerialDateValue.NUM_OF_WEEKDAYS * m_weekOfMonth.ordinal()); if (fittingWeekDay > date.getActualMaximum(Calendar.DAY_OF_MONTH)) { fittingWeekDay -= I_CmsSerialDateValue.NUM_OF_WEEKDAYS; } date.set(Calendar.DAY_OF_MONTH, fittingWeekDay); }
[ "private", "void", "setFittingWeekDay", "(", "Calendar", "date", ")", "{", "date", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "int", "weekDayFirst", "=", "date", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", ";", "int", "firstFittingWeekDay", "=", "(", "(", "(", "m_weekDay", ".", "toInt", "(", ")", "+", "I_CmsSerialDateValue", ".", "NUM_OF_WEEKDAYS", ")", "-", "weekDayFirst", ")", "%", "I_CmsSerialDateValue", ".", "NUM_OF_WEEKDAYS", ")", "+", "1", ";", "int", "fittingWeekDay", "=", "firstFittingWeekDay", "+", "(", "I_CmsSerialDateValue", ".", "NUM_OF_WEEKDAYS", "*", "m_weekOfMonth", ".", "ordinal", "(", ")", ")", ";", "if", "(", "fittingWeekDay", ">", "date", ".", "getActualMaximum", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", "{", "fittingWeekDay", "-=", "I_CmsSerialDateValue", ".", "NUM_OF_WEEKDAYS", ";", "}", "date", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "fittingWeekDay", ")", ";", "}" ]
Adjusts the day in the provided month, that it fits the specified week day. If there's no match for that provided month, the next possible month is checked. @param date the date to adjust, with the correct year and month already set.
[ "Adjusts", "the", "day", "in", "the", "provided", "month", "that", "it", "fits", "the", "specified", "week", "day", ".", "If", "there", "s", "no", "match", "for", "that", "provided", "month", "the", "next", "possible", "month", "is", "checked", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateBeanYearlyWeekday.java#L134-L145
158,545
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsUserTable.java
CmsUserTable.getEmptyLayout
public VerticalLayout getEmptyLayout() { m_emptyLayout = CmsVaadinUtils.getInfoLayout(CmsOuTreeType.USER.getEmptyMessageKey()); setVisible(size() > 0); m_emptyLayout.setVisible(size() == 0); return m_emptyLayout; }
java
public VerticalLayout getEmptyLayout() { m_emptyLayout = CmsVaadinUtils.getInfoLayout(CmsOuTreeType.USER.getEmptyMessageKey()); setVisible(size() > 0); m_emptyLayout.setVisible(size() == 0); return m_emptyLayout; }
[ "public", "VerticalLayout", "getEmptyLayout", "(", ")", "{", "m_emptyLayout", "=", "CmsVaadinUtils", ".", "getInfoLayout", "(", "CmsOuTreeType", ".", "USER", ".", "getEmptyMessageKey", "(", ")", ")", ";", "setVisible", "(", "size", "(", ")", ">", "0", ")", ";", "m_emptyLayout", ".", "setVisible", "(", "size", "(", ")", "==", "0", ")", ";", "return", "m_emptyLayout", ";", "}" ]
Layout which gets displayed if table is empty. @see org.opencms.ui.apps.user.I_CmsFilterableTable#getEmptyLayout()
[ "Layout", "which", "gets", "displayed", "if", "table", "is", "empty", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L964-L970
158,546
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsUserTable.java
CmsUserTable.getVisibleUser
public List<CmsUser> getVisibleUser() { if (!m_fullyLoaded) { return m_users; } if (size() == m_users.size()) { return m_users; } List<CmsUser> directs = new ArrayList<CmsUser>(); for (CmsUser user : m_users) { if (!m_indirects.contains(user)) { directs.add(user); } } return directs; }
java
public List<CmsUser> getVisibleUser() { if (!m_fullyLoaded) { return m_users; } if (size() == m_users.size()) { return m_users; } List<CmsUser> directs = new ArrayList<CmsUser>(); for (CmsUser user : m_users) { if (!m_indirects.contains(user)) { directs.add(user); } } return directs; }
[ "public", "List", "<", "CmsUser", ">", "getVisibleUser", "(", ")", "{", "if", "(", "!", "m_fullyLoaded", ")", "{", "return", "m_users", ";", "}", "if", "(", "size", "(", ")", "==", "m_users", ".", "size", "(", ")", ")", "{", "return", "m_users", ";", "}", "List", "<", "CmsUser", ">", "directs", "=", "new", "ArrayList", "<", "CmsUser", ">", "(", ")", ";", "for", "(", "CmsUser", "user", ":", "m_users", ")", "{", "if", "(", "!", "m_indirects", ".", "contains", "(", "user", ")", ")", "{", "directs", ".", "add", "(", "user", ")", ";", "}", "}", "return", "directs", ";", "}" ]
Gets currently visible user. @return List of user
[ "Gets", "currently", "visible", "user", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L977-L992
158,547
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsUserTable.java
CmsUserTable.getStatus
String getStatus(CmsUser user, boolean disabled, boolean newUser) { if (disabled) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_0); } if (newUser) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_0); } if (OpenCms.getLoginManager().isUserTempDisabled(user.getName())) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_UNLOCK_USER_STATUS_0); } if (isUserPasswordReset(user)) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_0); } return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_ACTIVE_0); }
java
String getStatus(CmsUser user, boolean disabled, boolean newUser) { if (disabled) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_0); } if (newUser) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_0); } if (OpenCms.getLoginManager().isUserTempDisabled(user.getName())) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_UNLOCK_USER_STATUS_0); } if (isUserPasswordReset(user)) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_0); } return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_ACTIVE_0); }
[ "String", "getStatus", "(", "CmsUser", "user", ",", "boolean", "disabled", ",", "boolean", "newUser", ")", "{", "if", "(", "disabled", ")", "{", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_DISABLED_0", ")", ";", "}", "if", "(", "newUser", ")", "{", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_INACTIVE_0", ")", ";", "}", "if", "(", "OpenCms", ".", "getLoginManager", "(", ")", ".", "isUserTempDisabled", "(", "user", ".", "getName", "(", ")", ")", ")", "{", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_UNLOCK_USER_STATUS_0", ")", ";", "}", "if", "(", "isUserPasswordReset", "(", "user", ")", ")", "{", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_PASSWORT_RESET_0", ")", ";", "}", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_ACTIVE_0", ")", ";", "}" ]
Returns status message. @param user CmsUser @param disabled boolean @param newUser boolean @return String
[ "Returns", "status", "message", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L1351-L1366
158,548
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsUserTable.java
CmsUserTable.getStatusHelp
String getStatusHelp(CmsUser user, boolean disabled, boolean newUser) { if (disabled) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_HELP_0); } if (newUser) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_HELP_0); } if (isUserPasswordReset(user)) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_HELP_0); } long lastLogin = user.getLastlogin(); return CmsVaadinUtils.getMessageText( Messages.GUI_USERMANAGEMENT_USER_ACTIVE_HELP_1, CmsDateUtil.getDateTime(new Date(lastLogin), DateFormat.SHORT, A_CmsUI.get().getLocale())); }
java
String getStatusHelp(CmsUser user, boolean disabled, boolean newUser) { if (disabled) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_HELP_0); } if (newUser) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_HELP_0); } if (isUserPasswordReset(user)) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_HELP_0); } long lastLogin = user.getLastlogin(); return CmsVaadinUtils.getMessageText( Messages.GUI_USERMANAGEMENT_USER_ACTIVE_HELP_1, CmsDateUtil.getDateTime(new Date(lastLogin), DateFormat.SHORT, A_CmsUI.get().getLocale())); }
[ "String", "getStatusHelp", "(", "CmsUser", "user", ",", "boolean", "disabled", ",", "boolean", "newUser", ")", "{", "if", "(", "disabled", ")", "{", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_DISABLED_HELP_0", ")", ";", "}", "if", "(", "newUser", ")", "{", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_INACTIVE_HELP_0", ")", ";", "}", "if", "(", "isUserPasswordReset", "(", "user", ")", ")", "{", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_PASSWORT_RESET_HELP_0", ")", ";", "}", "long", "lastLogin", "=", "user", ".", "getLastlogin", "(", ")", ";", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_ACTIVE_HELP_1", ",", "CmsDateUtil", ".", "getDateTime", "(", "new", "Date", "(", "lastLogin", ")", ",", "DateFormat", ".", "SHORT", ",", "A_CmsUI", ".", "get", "(", ")", ".", "getLocale", "(", ")", ")", ")", ";", "}" ]
Returns status help message. @param user CmsUser @param disabled boolean @param newUser boolean @return String
[ "Returns", "status", "help", "message", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L1376-L1391
158,549
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsUserTable.java
CmsUserTable.isUserPasswordReset
boolean isUserPasswordReset(CmsUser user) { if (USER_PASSWORD_STATUS.containsKey(user.getId())) { //Check if user was checked before if (!USER_PASSWORD_STATUS.get(user.getId()).booleanValue()) { // was false before, false->true is never done without changing map return false; } if (m_checkedUserPasswordReset.contains(user.getId())) { //was true before, true->false happens when user resets password. Only check one time per table load. return true; //Set gets flushed on reloading table } } CmsUser currentUser = user; if (user.getAdditionalInfo().size() < 3) { try { currentUser = m_cms.readUser(user.getId()); } catch (CmsException e) { LOG.error("Can not read user", e); } } if (currentUser.getAdditionalInfo(CmsUserSettings.ADDITIONAL_INFO_PASSWORD_RESET) != null) { USER_PASSWORD_STATUS.put(currentUser.getId(), new Boolean(true)); m_checkedUserPasswordReset.add(currentUser.getId()); return true; } USER_PASSWORD_STATUS.put(currentUser.getId(), new Boolean(false)); return false; }
java
boolean isUserPasswordReset(CmsUser user) { if (USER_PASSWORD_STATUS.containsKey(user.getId())) { //Check if user was checked before if (!USER_PASSWORD_STATUS.get(user.getId()).booleanValue()) { // was false before, false->true is never done without changing map return false; } if (m_checkedUserPasswordReset.contains(user.getId())) { //was true before, true->false happens when user resets password. Only check one time per table load. return true; //Set gets flushed on reloading table } } CmsUser currentUser = user; if (user.getAdditionalInfo().size() < 3) { try { currentUser = m_cms.readUser(user.getId()); } catch (CmsException e) { LOG.error("Can not read user", e); } } if (currentUser.getAdditionalInfo(CmsUserSettings.ADDITIONAL_INFO_PASSWORD_RESET) != null) { USER_PASSWORD_STATUS.put(currentUser.getId(), new Boolean(true)); m_checkedUserPasswordReset.add(currentUser.getId()); return true; } USER_PASSWORD_STATUS.put(currentUser.getId(), new Boolean(false)); return false; }
[ "boolean", "isUserPasswordReset", "(", "CmsUser", "user", ")", "{", "if", "(", "USER_PASSWORD_STATUS", ".", "containsKey", "(", "user", ".", "getId", "(", ")", ")", ")", "{", "//Check if user was checked before", "if", "(", "!", "USER_PASSWORD_STATUS", ".", "get", "(", "user", ".", "getId", "(", ")", ")", ".", "booleanValue", "(", ")", ")", "{", "// was false before, false->true is never done without changing map", "return", "false", ";", "}", "if", "(", "m_checkedUserPasswordReset", ".", "contains", "(", "user", ".", "getId", "(", ")", ")", ")", "{", "//was true before, true->false happens when user resets password. Only check one time per table load.", "return", "true", ";", "//Set gets flushed on reloading table", "}", "}", "CmsUser", "currentUser", "=", "user", ";", "if", "(", "user", ".", "getAdditionalInfo", "(", ")", ".", "size", "(", ")", "<", "3", ")", "{", "try", "{", "currentUser", "=", "m_cms", ".", "readUser", "(", "user", ".", "getId", "(", ")", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "error", "(", "\"Can not read user\"", ",", "e", ")", ";", "}", "}", "if", "(", "currentUser", ".", "getAdditionalInfo", "(", "CmsUserSettings", ".", "ADDITIONAL_INFO_PASSWORD_RESET", ")", "!=", "null", ")", "{", "USER_PASSWORD_STATUS", ".", "put", "(", "currentUser", ".", "getId", "(", ")", ",", "new", "Boolean", "(", "true", ")", ")", ";", "m_checkedUserPasswordReset", ".", "add", "(", "currentUser", ".", "getId", "(", ")", ")", ";", "return", "true", ";", "}", "USER_PASSWORD_STATUS", ".", "put", "(", "currentUser", ".", "getId", "(", ")", ",", "new", "Boolean", "(", "false", ")", ")", ";", "return", "false", ";", "}" ]
Is the user password reset? @param user User to check @return boolean
[ "Is", "the", "user", "password", "reset?" ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L1417-L1443
158,550
alkacon/opencms-core
src/org/opencms/search/galleries/CmsGallerySearchParameters.java
CmsGallerySearchParameters.getQuery
public CmsSolrQuery getQuery(CmsObject cms) { final CmsSolrQuery query = new CmsSolrQuery(); // set categories query.setCategories(m_categories); // set container types if (null != m_containerTypes) { query.addFilterQuery(CmsSearchField.FIELD_CONTAINER_TYPES, m_containerTypes, false, false); } // Set date created time filter query.addFilterQuery( CmsSearchUtil.getDateCreatedTimeRangeFilterQuery( CmsSearchField.FIELD_DATE_CREATED, getDateCreatedRange().m_startTime, getDateCreatedRange().m_endTime)); // Set date last modified time filter query.addFilterQuery( CmsSearchUtil.getDateCreatedTimeRangeFilterQuery( CmsSearchField.FIELD_DATE_LASTMODIFIED, getDateLastModifiedRange().m_startTime, getDateLastModifiedRange().m_endTime)); // set scope / folders to search in m_foldersToSearchIn = new ArrayList<String>(); addFoldersToSearchIn(m_folders); addFoldersToSearchIn(m_galleries); setSearchFolders(cms); query.addFilterQuery( CmsSearchField.FIELD_PARENT_FOLDERS, new ArrayList<String>(m_foldersToSearchIn), false, true); if (!m_ignoreSearchExclude) { // Reference for the values: CmsGallerySearchIndex.java, field EXCLUDE_PROPERTY_VALUES query.addFilterQuery( "-" + CmsSearchField.FIELD_SEARCH_EXCLUDE, Arrays.asList( new String[] { A_CmsSearchIndex.PROPERTY_SEARCH_EXCLUDE_VALUE_ALL, A_CmsSearchIndex.PROPERTY_SEARCH_EXCLUDE_VALUE_GALLERY}), false, true); } // set matches per page query.setRows(new Integer(m_matchesPerPage)); // set resource types if (null != m_resourceTypes) { List<String> resourceTypes = new ArrayList<>(m_resourceTypes); if (m_resourceTypes.contains(CmsResourceTypeFunctionConfig.TYPE_NAME) && !m_resourceTypes.contains(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION)) { resourceTypes.add(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION); } query.setResourceTypes(resourceTypes); } // set result page query.setStart(new Integer((m_resultPage - 1) * m_matchesPerPage)); // set search locale if (null != m_locale) { query.setLocales(CmsLocaleManager.getLocale(m_locale)); } // set search words if (null != m_words) { query.setQuery(m_words); } // set sort order query.setSort(getSort().getFirst(), getSort().getSecond()); // set result collapsing by id query.addFilterQuery("{!collapse field=id}"); query.setFields(CmsGallerySearchResult.getRequiredSolrFields()); if ((m_allowedFunctions != null) && !m_allowedFunctions.isEmpty()) { String functionFilter = "((-type:(" + CmsXmlDynamicFunctionHandler.TYPE_FUNCTION + " OR " + CmsResourceTypeFunctionConfig.TYPE_NAME + ")) OR (id:("; Iterator<CmsUUID> it = m_allowedFunctions.iterator(); while (it.hasNext()) { CmsUUID id = it.next(); functionFilter += id.toString(); if (it.hasNext()) { functionFilter += " OR "; } } functionFilter += ")))"; query.addFilterQuery(functionFilter); } return query; }
java
public CmsSolrQuery getQuery(CmsObject cms) { final CmsSolrQuery query = new CmsSolrQuery(); // set categories query.setCategories(m_categories); // set container types if (null != m_containerTypes) { query.addFilterQuery(CmsSearchField.FIELD_CONTAINER_TYPES, m_containerTypes, false, false); } // Set date created time filter query.addFilterQuery( CmsSearchUtil.getDateCreatedTimeRangeFilterQuery( CmsSearchField.FIELD_DATE_CREATED, getDateCreatedRange().m_startTime, getDateCreatedRange().m_endTime)); // Set date last modified time filter query.addFilterQuery( CmsSearchUtil.getDateCreatedTimeRangeFilterQuery( CmsSearchField.FIELD_DATE_LASTMODIFIED, getDateLastModifiedRange().m_startTime, getDateLastModifiedRange().m_endTime)); // set scope / folders to search in m_foldersToSearchIn = new ArrayList<String>(); addFoldersToSearchIn(m_folders); addFoldersToSearchIn(m_galleries); setSearchFolders(cms); query.addFilterQuery( CmsSearchField.FIELD_PARENT_FOLDERS, new ArrayList<String>(m_foldersToSearchIn), false, true); if (!m_ignoreSearchExclude) { // Reference for the values: CmsGallerySearchIndex.java, field EXCLUDE_PROPERTY_VALUES query.addFilterQuery( "-" + CmsSearchField.FIELD_SEARCH_EXCLUDE, Arrays.asList( new String[] { A_CmsSearchIndex.PROPERTY_SEARCH_EXCLUDE_VALUE_ALL, A_CmsSearchIndex.PROPERTY_SEARCH_EXCLUDE_VALUE_GALLERY}), false, true); } // set matches per page query.setRows(new Integer(m_matchesPerPage)); // set resource types if (null != m_resourceTypes) { List<String> resourceTypes = new ArrayList<>(m_resourceTypes); if (m_resourceTypes.contains(CmsResourceTypeFunctionConfig.TYPE_NAME) && !m_resourceTypes.contains(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION)) { resourceTypes.add(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION); } query.setResourceTypes(resourceTypes); } // set result page query.setStart(new Integer((m_resultPage - 1) * m_matchesPerPage)); // set search locale if (null != m_locale) { query.setLocales(CmsLocaleManager.getLocale(m_locale)); } // set search words if (null != m_words) { query.setQuery(m_words); } // set sort order query.setSort(getSort().getFirst(), getSort().getSecond()); // set result collapsing by id query.addFilterQuery("{!collapse field=id}"); query.setFields(CmsGallerySearchResult.getRequiredSolrFields()); if ((m_allowedFunctions != null) && !m_allowedFunctions.isEmpty()) { String functionFilter = "((-type:(" + CmsXmlDynamicFunctionHandler.TYPE_FUNCTION + " OR " + CmsResourceTypeFunctionConfig.TYPE_NAME + ")) OR (id:("; Iterator<CmsUUID> it = m_allowedFunctions.iterator(); while (it.hasNext()) { CmsUUID id = it.next(); functionFilter += id.toString(); if (it.hasNext()) { functionFilter += " OR "; } } functionFilter += ")))"; query.addFilterQuery(functionFilter); } return query; }
[ "public", "CmsSolrQuery", "getQuery", "(", "CmsObject", "cms", ")", "{", "final", "CmsSolrQuery", "query", "=", "new", "CmsSolrQuery", "(", ")", ";", "// set categories", "query", ".", "setCategories", "(", "m_categories", ")", ";", "// set container types", "if", "(", "null", "!=", "m_containerTypes", ")", "{", "query", ".", "addFilterQuery", "(", "CmsSearchField", ".", "FIELD_CONTAINER_TYPES", ",", "m_containerTypes", ",", "false", ",", "false", ")", ";", "}", "// Set date created time filter", "query", ".", "addFilterQuery", "(", "CmsSearchUtil", ".", "getDateCreatedTimeRangeFilterQuery", "(", "CmsSearchField", ".", "FIELD_DATE_CREATED", ",", "getDateCreatedRange", "(", ")", ".", "m_startTime", ",", "getDateCreatedRange", "(", ")", ".", "m_endTime", ")", ")", ";", "// Set date last modified time filter", "query", ".", "addFilterQuery", "(", "CmsSearchUtil", ".", "getDateCreatedTimeRangeFilterQuery", "(", "CmsSearchField", ".", "FIELD_DATE_LASTMODIFIED", ",", "getDateLastModifiedRange", "(", ")", ".", "m_startTime", ",", "getDateLastModifiedRange", "(", ")", ".", "m_endTime", ")", ")", ";", "// set scope / folders to search in", "m_foldersToSearchIn", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "addFoldersToSearchIn", "(", "m_folders", ")", ";", "addFoldersToSearchIn", "(", "m_galleries", ")", ";", "setSearchFolders", "(", "cms", ")", ";", "query", ".", "addFilterQuery", "(", "CmsSearchField", ".", "FIELD_PARENT_FOLDERS", ",", "new", "ArrayList", "<", "String", ">", "(", "m_foldersToSearchIn", ")", ",", "false", ",", "true", ")", ";", "if", "(", "!", "m_ignoreSearchExclude", ")", "{", "// Reference for the values: CmsGallerySearchIndex.java, field EXCLUDE_PROPERTY_VALUES", "query", ".", "addFilterQuery", "(", "\"-\"", "+", "CmsSearchField", ".", "FIELD_SEARCH_EXCLUDE", ",", "Arrays", ".", "asList", "(", "new", "String", "[", "]", "{", "A_CmsSearchIndex", ".", "PROPERTY_SEARCH_EXCLUDE_VALUE_ALL", ",", "A_CmsSearchIndex", ".", "PROPERTY_SEARCH_EXCLUDE_VALUE_GALLERY", "}", ")", ",", "false", ",", "true", ")", ";", "}", "// set matches per page", "query", ".", "setRows", "(", "new", "Integer", "(", "m_matchesPerPage", ")", ")", ";", "// set resource types", "if", "(", "null", "!=", "m_resourceTypes", ")", "{", "List", "<", "String", ">", "resourceTypes", "=", "new", "ArrayList", "<>", "(", "m_resourceTypes", ")", ";", "if", "(", "m_resourceTypes", ".", "contains", "(", "CmsResourceTypeFunctionConfig", ".", "TYPE_NAME", ")", "&&", "!", "m_resourceTypes", ".", "contains", "(", "CmsXmlDynamicFunctionHandler", ".", "TYPE_FUNCTION", ")", ")", "{", "resourceTypes", ".", "add", "(", "CmsXmlDynamicFunctionHandler", ".", "TYPE_FUNCTION", ")", ";", "}", "query", ".", "setResourceTypes", "(", "resourceTypes", ")", ";", "}", "// set result page", "query", ".", "setStart", "(", "new", "Integer", "(", "(", "m_resultPage", "-", "1", ")", "*", "m_matchesPerPage", ")", ")", ";", "// set search locale", "if", "(", "null", "!=", "m_locale", ")", "{", "query", ".", "setLocales", "(", "CmsLocaleManager", ".", "getLocale", "(", "m_locale", ")", ")", ";", "}", "// set search words", "if", "(", "null", "!=", "m_words", ")", "{", "query", ".", "setQuery", "(", "m_words", ")", ";", "}", "// set sort order", "query", ".", "setSort", "(", "getSort", "(", ")", ".", "getFirst", "(", ")", ",", "getSort", "(", ")", ".", "getSecond", "(", ")", ")", ";", "// set result collapsing by id", "query", ".", "addFilterQuery", "(", "\"{!collapse field=id}\"", ")", ";", "query", ".", "setFields", "(", "CmsGallerySearchResult", ".", "getRequiredSolrFields", "(", ")", ")", ";", "if", "(", "(", "m_allowedFunctions", "!=", "null", ")", "&&", "!", "m_allowedFunctions", ".", "isEmpty", "(", ")", ")", "{", "String", "functionFilter", "=", "\"((-type:(\"", "+", "CmsXmlDynamicFunctionHandler", ".", "TYPE_FUNCTION", "+", "\" OR \"", "+", "CmsResourceTypeFunctionConfig", ".", "TYPE_NAME", "+", "\")) OR (id:(\"", ";", "Iterator", "<", "CmsUUID", ">", "it", "=", "m_allowedFunctions", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "CmsUUID", "id", "=", "it", ".", "next", "(", ")", ";", "functionFilter", "+=", "id", ".", "toString", "(", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "functionFilter", "+=", "\" OR \"", ";", "}", "}", "functionFilter", "+=", "\")))\"", ";", "query", ".", "addFilterQuery", "(", "functionFilter", ")", ";", "}", "return", "query", ";", "}" ]
Returns a CmsSolrQuery representation of this class. @param cms the openCms object. @return CmsSolrQuery representation of this class.
[ "Returns", "a", "CmsSolrQuery", "representation", "of", "this", "class", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearchParameters.java#L361-L463
158,551
alkacon/opencms-core
src/org/opencms/search/galleries/CmsGallerySearchParameters.java
CmsGallerySearchParameters.addFoldersToSearchIn
private void addFoldersToSearchIn(final List<String> folders) { if (null == folders) { return; } for (String folder : folders) { if (!CmsResource.isFolder(folder)) { folder += "/"; } m_foldersToSearchIn.add(folder); } }
java
private void addFoldersToSearchIn(final List<String> folders) { if (null == folders) { return; } for (String folder : folders) { if (!CmsResource.isFolder(folder)) { folder += "/"; } m_foldersToSearchIn.add(folder); } }
[ "private", "void", "addFoldersToSearchIn", "(", "final", "List", "<", "String", ">", "folders", ")", "{", "if", "(", "null", "==", "folders", ")", "{", "return", ";", "}", "for", "(", "String", "folder", ":", "folders", ")", "{", "if", "(", "!", "CmsResource", ".", "isFolder", "(", "folder", ")", ")", "{", "folder", "+=", "\"/\"", ";", "}", "m_foldersToSearchIn", ".", "add", "(", "folder", ")", ";", "}", "}" ]
Adds folders to perform the search in. @param folders Folders to search in.
[ "Adds", "folders", "to", "perform", "the", "search", "in", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearchParameters.java#L757-L770
158,552
alkacon/opencms-core
src/org/opencms/search/galleries/CmsGallerySearchParameters.java
CmsGallerySearchParameters.setSearchScopeFilter
private void setSearchScopeFilter(CmsObject cms) { final List<String> searchRoots = CmsSearchUtil.computeScopeFolders(cms, this); // If the resource types contain the type "function" also // add "/system/modules/" to the search path if ((null != getResourceTypes()) && containsFunctionType(getResourceTypes())) { searchRoots.add("/system/modules/"); } addFoldersToSearchIn(searchRoots); }
java
private void setSearchScopeFilter(CmsObject cms) { final List<String> searchRoots = CmsSearchUtil.computeScopeFolders(cms, this); // If the resource types contain the type "function" also // add "/system/modules/" to the search path if ((null != getResourceTypes()) && containsFunctionType(getResourceTypes())) { searchRoots.add("/system/modules/"); } addFoldersToSearchIn(searchRoots); }
[ "private", "void", "setSearchScopeFilter", "(", "CmsObject", "cms", ")", "{", "final", "List", "<", "String", ">", "searchRoots", "=", "CmsSearchUtil", ".", "computeScopeFolders", "(", "cms", ",", "this", ")", ";", "// If the resource types contain the type \"function\" also", "// add \"/system/modules/\" to the search path", "if", "(", "(", "null", "!=", "getResourceTypes", "(", ")", ")", "&&", "containsFunctionType", "(", "getResourceTypes", "(", ")", ")", ")", "{", "searchRoots", ".", "add", "(", "\"/system/modules/\"", ")", ";", "}", "addFoldersToSearchIn", "(", "searchRoots", ")", ";", "}" ]
Sets the search scope. @param cms The current CmsObject object.
[ "Sets", "the", "search", "scope", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearchParameters.java#L875-L887
158,553
alkacon/opencms-core
src-setup/org/opencms/setup/ui/CmsDbSettingsPanel.java
CmsDbSettingsPanel.dbProp
private String dbProp(String name) { String dbType = m_setupBean.getDatabase(); Object prop = m_setupBean.getDatabaseProperties().get(dbType).get(dbType + "." + name); if (prop == null) { return ""; } return prop.toString(); }
java
private String dbProp(String name) { String dbType = m_setupBean.getDatabase(); Object prop = m_setupBean.getDatabaseProperties().get(dbType).get(dbType + "." + name); if (prop == null) { return ""; } return prop.toString(); }
[ "private", "String", "dbProp", "(", "String", "name", ")", "{", "String", "dbType", "=", "m_setupBean", ".", "getDatabase", "(", ")", ";", "Object", "prop", "=", "m_setupBean", ".", "getDatabaseProperties", "(", ")", ".", "get", "(", "dbType", ")", ".", "get", "(", "dbType", "+", "\".\"", "+", "name", ")", ";", "if", "(", "prop", "==", "null", ")", "{", "return", "\"\"", ";", "}", "return", "prop", ".", "toString", "(", ")", ";", "}" ]
Accesses a property from the DB configuration for the selected DB. @param name the name of the property @return the value of the property
[ "Accesses", "a", "property", "from", "the", "DB", "configuration", "for", "the", "selected", "DB", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsDbSettingsPanel.java#L326-L334
158,554
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsPopup.java
CmsPopup.add
protected void add(Widget child, Element container) { // Detach new child. child.removeFromParent(); // Logical attach. getChildren().add(child); // Physical attach. DOM.appendChild(container, child.getElement()); // Adopt. adopt(child); }
java
protected void add(Widget child, Element container) { // Detach new child. child.removeFromParent(); // Logical attach. getChildren().add(child); // Physical attach. DOM.appendChild(container, child.getElement()); // Adopt. adopt(child); }
[ "protected", "void", "add", "(", "Widget", "child", ",", "Element", "container", ")", "{", "// Detach new child.", "child", ".", "removeFromParent", "(", ")", ";", "// Logical attach.", "getChildren", "(", ")", ".", "add", "(", "child", ")", ";", "// Physical attach.", "DOM", ".", "appendChild", "(", "container", ",", "child", ".", "getElement", "(", ")", ")", ";", "// Adopt.", "adopt", "(", "child", ")", ";", "}" ]
Adds a new child widget to the panel, attaching its Element to the specified container Element. @param child the child widget to be added @param container the element within which the child will be contained
[ "Adds", "a", "new", "child", "widget", "to", "the", "panel", "attaching", "its", "Element", "to", "the", "specified", "container", "Element", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsPopup.java#L1058-L1071
158,555
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsPopup.java
CmsPopup.adjustIndex
protected int adjustIndex(Widget child, int beforeIndex) { checkIndexBoundsForInsertion(beforeIndex); // Check to see if this widget is already a direct child. if (child.getParent() == this) { // If the Widget's previous position was left of the desired new position // shift the desired position left to reflect the removal int idx = getWidgetIndex(child); if (idx < beforeIndex) { beforeIndex--; } } return beforeIndex; }
java
protected int adjustIndex(Widget child, int beforeIndex) { checkIndexBoundsForInsertion(beforeIndex); // Check to see if this widget is already a direct child. if (child.getParent() == this) { // If the Widget's previous position was left of the desired new position // shift the desired position left to reflect the removal int idx = getWidgetIndex(child); if (idx < beforeIndex) { beforeIndex--; } } return beforeIndex; }
[ "protected", "int", "adjustIndex", "(", "Widget", "child", ",", "int", "beforeIndex", ")", "{", "checkIndexBoundsForInsertion", "(", "beforeIndex", ")", ";", "// Check to see if this widget is already a direct child.", "if", "(", "child", ".", "getParent", "(", ")", "==", "this", ")", "{", "// If the Widget's previous position was left of the desired new position", "// shift the desired position left to reflect the removal", "int", "idx", "=", "getWidgetIndex", "(", "child", ")", ";", "if", "(", "idx", "<", "beforeIndex", ")", "{", "beforeIndex", "--", ";", "}", "}", "return", "beforeIndex", ";", "}" ]
Adjusts beforeIndex to account for the possibility that the given widget is already a child of this panel. @param child the widget that might be an existing child @param beforeIndex the index at which it will be added to this panel @return the modified index
[ "Adjusts", "beforeIndex", "to", "account", "for", "the", "possibility", "that", "the", "given", "widget", "is", "already", "a", "child", "of", "this", "panel", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsPopup.java#L1081-L1096
158,556
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsPopup.java
CmsPopup.beginDragging
protected void beginDragging(MouseDownEvent event) { m_dragging = true; m_windowWidth = Window.getClientWidth(); m_clientLeft = Document.get().getBodyOffsetLeft(); m_clientTop = Document.get().getBodyOffsetTop(); DOM.setCapture(getElement()); m_dragStartX = event.getX(); m_dragStartY = event.getY(); addStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().dragging()); }
java
protected void beginDragging(MouseDownEvent event) { m_dragging = true; m_windowWidth = Window.getClientWidth(); m_clientLeft = Document.get().getBodyOffsetLeft(); m_clientTop = Document.get().getBodyOffsetTop(); DOM.setCapture(getElement()); m_dragStartX = event.getX(); m_dragStartY = event.getY(); addStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().dragging()); }
[ "protected", "void", "beginDragging", "(", "MouseDownEvent", "event", ")", "{", "m_dragging", "=", "true", ";", "m_windowWidth", "=", "Window", ".", "getClientWidth", "(", ")", ";", "m_clientLeft", "=", "Document", ".", "get", "(", ")", ".", "getBodyOffsetLeft", "(", ")", ";", "m_clientTop", "=", "Document", ".", "get", "(", ")", ".", "getBodyOffsetTop", "(", ")", ";", "DOM", ".", "setCapture", "(", "getElement", "(", ")", ")", ";", "m_dragStartX", "=", "event", ".", "getX", "(", ")", ";", "m_dragStartY", "=", "event", ".", "getY", "(", ")", ";", "addStyleName", "(", "I_CmsLayoutBundle", ".", "INSTANCE", ".", "dialogCss", "(", ")", ".", "dragging", "(", ")", ")", ";", "}" ]
Called on mouse down in the caption area, begins the dragging loop by turning on event capture. @see DOM#setCapture @see #continueDragging @param event the mouse down event that triggered dragging
[ "Called", "on", "mouse", "down", "in", "the", "caption", "area", "begins", "the", "dragging", "loop", "by", "turning", "on", "event", "capture", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsPopup.java#L1106-L1116
158,557
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsPopup.java
CmsPopup.endDragging
protected void endDragging(MouseUpEvent event) { m_dragging = false; DOM.releaseCapture(getElement()); removeStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().dragging()); }
java
protected void endDragging(MouseUpEvent event) { m_dragging = false; DOM.releaseCapture(getElement()); removeStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().dragging()); }
[ "protected", "void", "endDragging", "(", "MouseUpEvent", "event", ")", "{", "m_dragging", "=", "false", ";", "DOM", ".", "releaseCapture", "(", "getElement", "(", ")", ")", ";", "removeStyleName", "(", "I_CmsLayoutBundle", ".", "INSTANCE", ".", "dialogCss", "(", ")", ".", "dragging", "(", ")", ")", ";", "}" ]
Called on mouse up in the caption area, ends dragging by ending event capture. @param event the mouse up event that ended dragging @see DOM#releaseCapture @see #beginDragging @see #endDragging
[ "Called", "on", "mouse", "up", "in", "the", "caption", "area", "ends", "dragging", "by", "ending", "event", "capture", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsPopup.java#L1228-L1233
158,558
alkacon/opencms-core
src/org/opencms/ui/actions/CmsCategoriesDialogAction.java
CmsCategoriesDialogAction.getParams
public Map<String, String> getParams() { Map<String, String> params = new HashMap<>(1); params.put(PARAM_COLLAPSED, Boolean.TRUE.toString()); return params; }
java
public Map<String, String> getParams() { Map<String, String> params = new HashMap<>(1); params.put(PARAM_COLLAPSED, Boolean.TRUE.toString()); return params; }
[ "public", "Map", "<", "String", ",", "String", ">", "getParams", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<>", "(", "1", ")", ";", "params", ".", "put", "(", "PARAM_COLLAPSED", ",", "Boolean", ".", "TRUE", ".", "toString", "(", ")", ")", ";", "return", "params", ";", "}" ]
Add the option specifying if the categories should be displayed collapsed when the dialog opens. @see org.opencms.ui.actions.I_CmsADEAction#getParams()
[ "Add", "the", "option", "specifying", "if", "the", "categories", "should", "be", "displayed", "collapsed", "when", "the", "dialog", "opens", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/actions/CmsCategoriesDialogAction.java#L117-L122
158,559
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java
CmsSpellcheckDictionaryIndexer.updatingIndexNecessesary
public static boolean updatingIndexNecessesary(CmsObject cms) { // Set request to the offline project. setCmsOfflineProject(cms); // Check whether the spellcheck index directories are empty. // If they are, the index has to be built obviously. if (isSolrSpellcheckIndexDirectoryEmpty()) { return true; } // Compare the most recent date of a dictionary with the oldest timestamp // that determines when an index has been built. long dateMostRecentDictionary = getMostRecentDate(cms); long dateOldestIndexWrite = getOldestIndexDate(cms); return dateMostRecentDictionary > dateOldestIndexWrite; }
java
public static boolean updatingIndexNecessesary(CmsObject cms) { // Set request to the offline project. setCmsOfflineProject(cms); // Check whether the spellcheck index directories are empty. // If they are, the index has to be built obviously. if (isSolrSpellcheckIndexDirectoryEmpty()) { return true; } // Compare the most recent date of a dictionary with the oldest timestamp // that determines when an index has been built. long dateMostRecentDictionary = getMostRecentDate(cms); long dateOldestIndexWrite = getOldestIndexDate(cms); return dateMostRecentDictionary > dateOldestIndexWrite; }
[ "public", "static", "boolean", "updatingIndexNecessesary", "(", "CmsObject", "cms", ")", "{", "// Set request to the offline project.", "setCmsOfflineProject", "(", "cms", ")", ";", "// Check whether the spellcheck index directories are empty.", "// If they are, the index has to be built obviously.", "if", "(", "isSolrSpellcheckIndexDirectoryEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "// Compare the most recent date of a dictionary with the oldest timestamp", "// that determines when an index has been built.", "long", "dateMostRecentDictionary", "=", "getMostRecentDate", "(", "cms", ")", ";", "long", "dateOldestIndexWrite", "=", "getOldestIndexDate", "(", "cms", ")", ";", "return", "dateMostRecentDictionary", ">", "dateOldestIndexWrite", ";", "}" ]
Checks whether a built of the indices is necessary. @param cms The appropriate CmsObject instance. @return true, if the spellcheck indices have to be rebuilt, otherwise false
[ "Checks", "whether", "a", "built", "of", "the", "indices", "is", "necessary", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java#L236-L253
158,560
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java
CmsSpellcheckDictionaryIndexer.getSolrSpellcheckRfsPath
private static String getSolrSpellcheckRfsPath() { String sPath = OpenCms.getSystemInfo().getWebInfRfsPath(); if (!OpenCms.getSystemInfo().getWebInfRfsPath().endsWith(File.separator)) { sPath += File.separator; } return sPath + "solr" + File.separator + "spellcheck" + File.separator + "data"; }
java
private static String getSolrSpellcheckRfsPath() { String sPath = OpenCms.getSystemInfo().getWebInfRfsPath(); if (!OpenCms.getSystemInfo().getWebInfRfsPath().endsWith(File.separator)) { sPath += File.separator; } return sPath + "solr" + File.separator + "spellcheck" + File.separator + "data"; }
[ "private", "static", "String", "getSolrSpellcheckRfsPath", "(", ")", "{", "String", "sPath", "=", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "getWebInfRfsPath", "(", ")", ";", "if", "(", "!", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "getWebInfRfsPath", "(", ")", ".", "endsWith", "(", "File", ".", "separator", ")", ")", "{", "sPath", "+=", "File", ".", "separator", ";", "}", "return", "sPath", "+", "\"solr\"", "+", "File", ".", "separator", "+", "\"spellcheck\"", "+", "File", ".", "separator", "+", "\"data\"", ";", "}" ]
Returns the path in the RFS where the Solr spellcheck files reside. @return String representation of Solrs spellcheck RFS path.
[ "Returns", "the", "path", "in", "the", "RFS", "where", "the", "Solr", "spellcheck", "files", "reside", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java#L395-L404
158,561
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java
CmsSpellcheckDictionaryIndexer.readAndAddDocumentsFromStream
private static void readAndAddDocumentsFromStream( final SolrClient client, final String lang, final InputStream is, final List<SolrInputDocument> documents, final boolean closeStream) { final BufferedReader br = new BufferedReader(new InputStreamReader(is)); try { String line = br.readLine(); while (null != line) { final SolrInputDocument document = new SolrInputDocument(); // Each field is named after the schema "entry_xx" where xx denotes // the two digit language code. See the file spellcheck/conf/schema.xml. document.addField("entry_" + lang, line); documents.add(document); // Prevent OutOfMemoryExceptions ... if (documents.size() >= MAX_LIST_SIZE) { addDocuments(client, documents, false); documents.clear(); } line = br.readLine(); } } catch (IOException e) { LOG.error("Could not read spellcheck dictionary from input stream."); } catch (SolrServerException e) { LOG.error("Error while adding documents to Solr server. "); } finally { try { if (closeStream) { br.close(); } } catch (Exception e) { // Nothing to do here anymore .... } } }
java
private static void readAndAddDocumentsFromStream( final SolrClient client, final String lang, final InputStream is, final List<SolrInputDocument> documents, final boolean closeStream) { final BufferedReader br = new BufferedReader(new InputStreamReader(is)); try { String line = br.readLine(); while (null != line) { final SolrInputDocument document = new SolrInputDocument(); // Each field is named after the schema "entry_xx" where xx denotes // the two digit language code. See the file spellcheck/conf/schema.xml. document.addField("entry_" + lang, line); documents.add(document); // Prevent OutOfMemoryExceptions ... if (documents.size() >= MAX_LIST_SIZE) { addDocuments(client, documents, false); documents.clear(); } line = br.readLine(); } } catch (IOException e) { LOG.error("Could not read spellcheck dictionary from input stream."); } catch (SolrServerException e) { LOG.error("Error while adding documents to Solr server. "); } finally { try { if (closeStream) { br.close(); } } catch (Exception e) { // Nothing to do here anymore .... } } }
[ "private", "static", "void", "readAndAddDocumentsFromStream", "(", "final", "SolrClient", "client", ",", "final", "String", "lang", ",", "final", "InputStream", "is", ",", "final", "List", "<", "SolrInputDocument", ">", "documents", ",", "final", "boolean", "closeStream", ")", "{", "final", "BufferedReader", "br", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "is", ")", ")", ";", "try", "{", "String", "line", "=", "br", ".", "readLine", "(", ")", ";", "while", "(", "null", "!=", "line", ")", "{", "final", "SolrInputDocument", "document", "=", "new", "SolrInputDocument", "(", ")", ";", "// Each field is named after the schema \"entry_xx\" where xx denotes", "// the two digit language code. See the file spellcheck/conf/schema.xml.", "document", ".", "addField", "(", "\"entry_\"", "+", "lang", ",", "line", ")", ";", "documents", ".", "add", "(", "document", ")", ";", "// Prevent OutOfMemoryExceptions ...", "if", "(", "documents", ".", "size", "(", ")", ">=", "MAX_LIST_SIZE", ")", "{", "addDocuments", "(", "client", ",", "documents", ",", "false", ")", ";", "documents", ".", "clear", "(", ")", ";", "}", "line", "=", "br", ".", "readLine", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "error", "(", "\"Could not read spellcheck dictionary from input stream.\"", ")", ";", "}", "catch", "(", "SolrServerException", "e", ")", "{", "LOG", ".", "error", "(", "\"Error while adding documents to Solr server. \"", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "closeStream", ")", "{", "br", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "// Nothing to do here anymore ....", "}", "}", "}" ]
Parses the dictionary from an InputStream. @param client The SolrClient instance object. @param lang The language of the dictionary. @param is The InputStream object. @param documents List to put the assembled SolrInputObjects into. @param closeStream boolean flag that determines whether to close the inputstream or not.
[ "Parses", "the", "dictionary", "from", "an", "InputStream", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java#L439-L479
158,562
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java
CmsSpellcheckDictionaryIndexer.setCmsOfflineProject
private static void setCmsOfflineProject(CmsObject cms) { if (null == cms) { return; } final CmsRequestContext cmsContext = cms.getRequestContext(); final CmsProject cmsProject = cmsContext.getCurrentProject(); if (cmsProject.isOnlineProject()) { CmsProject cmsOfflineProject; try { cmsOfflineProject = cms.readProject("Offline"); cmsContext.setCurrentProject(cmsOfflineProject); } catch (CmsException e) { LOG.warn("Could not set the current project to \"Offline\". "); } } }
java
private static void setCmsOfflineProject(CmsObject cms) { if (null == cms) { return; } final CmsRequestContext cmsContext = cms.getRequestContext(); final CmsProject cmsProject = cmsContext.getCurrentProject(); if (cmsProject.isOnlineProject()) { CmsProject cmsOfflineProject; try { cmsOfflineProject = cms.readProject("Offline"); cmsContext.setCurrentProject(cmsOfflineProject); } catch (CmsException e) { LOG.warn("Could not set the current project to \"Offline\". "); } } }
[ "private", "static", "void", "setCmsOfflineProject", "(", "CmsObject", "cms", ")", "{", "if", "(", "null", "==", "cms", ")", "{", "return", ";", "}", "final", "CmsRequestContext", "cmsContext", "=", "cms", ".", "getRequestContext", "(", ")", ";", "final", "CmsProject", "cmsProject", "=", "cmsContext", ".", "getCurrentProject", "(", ")", ";", "if", "(", "cmsProject", ".", "isOnlineProject", "(", ")", ")", "{", "CmsProject", "cmsOfflineProject", ";", "try", "{", "cmsOfflineProject", "=", "cms", ".", "readProject", "(", "\"Offline\"", ")", ";", "cmsContext", ".", "setCurrentProject", "(", "cmsOfflineProject", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Could not set the current project to \\\"Offline\\\". \"", ")", ";", "}", "}", "}" ]
Sets the appropriate OpenCms context. @param cms The OpenCms instance object.
[ "Sets", "the", "appropriate", "OpenCms", "context", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java#L485-L503
158,563
alkacon/opencms-core
src/org/opencms/ui/CmsUserIconHelper.java
CmsUserIconHelper.toPath
private String toPath(String name, IconSize size) { return CmsStringUtil.joinPaths(CmsWorkplace.getSkinUri(), ICON_FOLDER, "" + name.hashCode()) + size.getSuffix(); }
java
private String toPath(String name, IconSize size) { return CmsStringUtil.joinPaths(CmsWorkplace.getSkinUri(), ICON_FOLDER, "" + name.hashCode()) + size.getSuffix(); }
[ "private", "String", "toPath", "(", "String", "name", ",", "IconSize", "size", ")", "{", "return", "CmsStringUtil", ".", "joinPaths", "(", "CmsWorkplace", ".", "getSkinUri", "(", ")", ",", "ICON_FOLDER", ",", "\"\"", "+", "name", ".", "hashCode", "(", ")", ")", "+", "size", ".", "getSuffix", "(", ")", ";", "}" ]
Transforms user name and icon size into the image path. @param name the user name @param size IconSize to get icon for @return the path
[ "Transforms", "user", "name", "and", "icon", "size", "into", "the", "image", "path", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsUserIconHelper.java#L444-L447
158,564
alkacon/opencms-core
src/org/opencms/ui/CmsUserIconHelper.java
CmsUserIconHelper.toRfsName
private String toRfsName(String name, IconSize size) { return CmsStringUtil.joinPaths(m_cache.getRepositoryPath(), "" + name.hashCode()) + size.getSuffix(); }
java
private String toRfsName(String name, IconSize size) { return CmsStringUtil.joinPaths(m_cache.getRepositoryPath(), "" + name.hashCode()) + size.getSuffix(); }
[ "private", "String", "toRfsName", "(", "String", "name", ",", "IconSize", "size", ")", "{", "return", "CmsStringUtil", ".", "joinPaths", "(", "m_cache", ".", "getRepositoryPath", "(", ")", ",", "\"\"", "+", "name", ".", "hashCode", "(", ")", ")", "+", "size", ".", "getSuffix", "(", ")", ";", "}" ]
Transforms user name and icon size into the rfs image path. @param name the user name @param size IconSize to get icon for @return the path
[ "Transforms", "user", "name", "and", "icon", "size", "into", "the", "rfs", "image", "path", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsUserIconHelper.java#L457-L460
158,565
alkacon/opencms-core
src-modules/org/opencms/workplace/search/CmsSearchDialog.java
CmsSearchDialog.getIndex
private I_CmsSearchIndex getIndex() { I_CmsSearchIndex index = null; // get the configured index or the selected index if (isInitialCall()) { // the search form is in the initial state // get the configured index index = OpenCms.getSearchManager().getIndex(getSettings().getUserSettings().getWorkplaceSearchIndexName()); } else { // the search form is not in the inital state, the submit button was used already or the // search index was changed already // get the selected index in the search dialog index = OpenCms.getSearchManager().getIndex(getJsp().getRequest().getParameter("indexName.0")); } return index; }
java
private I_CmsSearchIndex getIndex() { I_CmsSearchIndex index = null; // get the configured index or the selected index if (isInitialCall()) { // the search form is in the initial state // get the configured index index = OpenCms.getSearchManager().getIndex(getSettings().getUserSettings().getWorkplaceSearchIndexName()); } else { // the search form is not in the inital state, the submit button was used already or the // search index was changed already // get the selected index in the search dialog index = OpenCms.getSearchManager().getIndex(getJsp().getRequest().getParameter("indexName.0")); } return index; }
[ "private", "I_CmsSearchIndex", "getIndex", "(", ")", "{", "I_CmsSearchIndex", "index", "=", "null", ";", "// get the configured index or the selected index", "if", "(", "isInitialCall", "(", ")", ")", "{", "// the search form is in the initial state", "// get the configured index", "index", "=", "OpenCms", ".", "getSearchManager", "(", ")", ".", "getIndex", "(", "getSettings", "(", ")", ".", "getUserSettings", "(", ")", ".", "getWorkplaceSearchIndexName", "(", ")", ")", ";", "}", "else", "{", "// the search form is not in the inital state, the submit button was used already or the", "// search index was changed already", "// get the selected index in the search dialog", "index", "=", "OpenCms", ".", "getSearchManager", "(", ")", ".", "getIndex", "(", "getJsp", "(", ")", ".", "getRequest", "(", ")", ".", "getParameter", "(", "\"indexName.0\"", ")", ")", ";", "}", "return", "index", ";", "}" ]
Gets the index to use in the search. @return the index to use in the search
[ "Gets", "the", "index", "to", "use", "in", "the", "search", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/search/CmsSearchDialog.java#L313-L328
158,566
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java
CmsXmlConfigUpdater.transform
public void transform(String name, String transform) throws Exception { File configFile = new File(m_configDir, name); File transformFile = new File(m_xsltDir, transform); try (InputStream stream = new FileInputStream(transformFile)) { StreamSource source = new StreamSource(stream); transform(configFile, source); } }
java
public void transform(String name, String transform) throws Exception { File configFile = new File(m_configDir, name); File transformFile = new File(m_xsltDir, transform); try (InputStream stream = new FileInputStream(transformFile)) { StreamSource source = new StreamSource(stream); transform(configFile, source); } }
[ "public", "void", "transform", "(", "String", "name", ",", "String", "transform", ")", "throws", "Exception", "{", "File", "configFile", "=", "new", "File", "(", "m_configDir", ",", "name", ")", ";", "File", "transformFile", "=", "new", "File", "(", "m_xsltDir", ",", "transform", ")", ";", "try", "(", "InputStream", "stream", "=", "new", "FileInputStream", "(", "transformFile", ")", ")", "{", "StreamSource", "source", "=", "new", "StreamSource", "(", "stream", ")", ";", "transform", "(", "configFile", ",", "source", ")", ";", "}", "}" ]
Transforms a config file with an XSLT transform. @param name file name of the config file @param transform file name of the XSLT file @throws Exception if something goes wrong
[ "Transforms", "a", "config", "file", "with", "an", "XSLT", "transform", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java#L214-L222
158,567
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java
CmsXmlConfigUpdater.transformConfig
public void transformConfig() throws Exception { List<TransformEntry> entries = readTransformEntries(new File(m_xsltDir, "transforms.xml")); for (TransformEntry entry : entries) { transform(entry.getConfigFile(), entry.getXslt()); } m_isDone = true; }
java
public void transformConfig() throws Exception { List<TransformEntry> entries = readTransformEntries(new File(m_xsltDir, "transforms.xml")); for (TransformEntry entry : entries) { transform(entry.getConfigFile(), entry.getXslt()); } m_isDone = true; }
[ "public", "void", "transformConfig", "(", ")", "throws", "Exception", "{", "List", "<", "TransformEntry", ">", "entries", "=", "readTransformEntries", "(", "new", "File", "(", "m_xsltDir", ",", "\"transforms.xml\"", ")", ")", ";", "for", "(", "TransformEntry", "entry", ":", "entries", ")", "{", "transform", "(", "entry", ".", "getConfigFile", "(", ")", ",", "entry", ".", "getXslt", "(", ")", ")", ";", "}", "m_isDone", "=", "true", ";", "}" ]
Transforms the configuration. @throws Exception if something goes wrong
[ "Transforms", "the", "configuration", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java#L229-L236
158,568
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java
CmsXmlConfigUpdater.validationErrors
public String validationErrors() { List<String> errors = new ArrayList<>(); for (File config : getConfigFiles()) { String filename = config.getName(); try (FileInputStream stream = new FileInputStream(config)) { CmsXmlUtils.unmarshalHelper(CmsFileUtil.readFully(stream, false), new CmsXmlEntityResolver(null), true); } catch (CmsXmlException e) { errors.add(filename + ":" + e.getCause().getMessage()); } catch (Exception e) { errors.add(filename + ":" + e.getMessage()); } } if (errors.size() == 0) { return null; } String errString = CmsStringUtil.listAsString(errors, "\n"); JSONObject obj = new JSONObject(); try { obj.put("err", errString); } catch (JSONException e) { } return obj.toString(); }
java
public String validationErrors() { List<String> errors = new ArrayList<>(); for (File config : getConfigFiles()) { String filename = config.getName(); try (FileInputStream stream = new FileInputStream(config)) { CmsXmlUtils.unmarshalHelper(CmsFileUtil.readFully(stream, false), new CmsXmlEntityResolver(null), true); } catch (CmsXmlException e) { errors.add(filename + ":" + e.getCause().getMessage()); } catch (Exception e) { errors.add(filename + ":" + e.getMessage()); } } if (errors.size() == 0) { return null; } String errString = CmsStringUtil.listAsString(errors, "\n"); JSONObject obj = new JSONObject(); try { obj.put("err", errString); } catch (JSONException e) { } return obj.toString(); }
[ "public", "String", "validationErrors", "(", ")", "{", "List", "<", "String", ">", "errors", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "File", "config", ":", "getConfigFiles", "(", ")", ")", "{", "String", "filename", "=", "config", ".", "getName", "(", ")", ";", "try", "(", "FileInputStream", "stream", "=", "new", "FileInputStream", "(", "config", ")", ")", "{", "CmsXmlUtils", ".", "unmarshalHelper", "(", "CmsFileUtil", ".", "readFully", "(", "stream", ",", "false", ")", ",", "new", "CmsXmlEntityResolver", "(", "null", ")", ",", "true", ")", ";", "}", "catch", "(", "CmsXmlException", "e", ")", "{", "errors", ".", "add", "(", "filename", "+", "\":\"", "+", "e", ".", "getCause", "(", ")", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "errors", ".", "add", "(", "filename", "+", "\":\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "if", "(", "errors", ".", "size", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "String", "errString", "=", "CmsStringUtil", ".", "listAsString", "(", "errors", ",", "\"\\n\"", ")", ";", "JSONObject", "obj", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "obj", ".", "put", "(", "\"err\"", ",", "errString", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "}", "return", "obj", ".", "toString", "(", ")", ";", "}" ]
Gets validation errors either as a JSON string, or null if there are no validation errors. @return the validation error JSON
[ "Gets", "validation", "errors", "either", "as", "a", "JSON", "string", "or", "null", "if", "there", "are", "no", "validation", "errors", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java#L243-L267
158,569
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java
CmsXmlConfigUpdater.getConfigFiles
private List<File> getConfigFiles() { String[] filenames = { "opencms-modules.xml", "opencms-system.xml", "opencms-vfs.xml", "opencms-importexport.xml", "opencms-sites.xml", "opencms-variables.xml", "opencms-scheduler.xml", "opencms-workplace.xml", "opencms-search.xml"}; List<File> result = new ArrayList<>(); for (String fn : filenames) { File file = new File(m_configDir, fn); if (file.exists()) { result.add(file); } } return result; }
java
private List<File> getConfigFiles() { String[] filenames = { "opencms-modules.xml", "opencms-system.xml", "opencms-vfs.xml", "opencms-importexport.xml", "opencms-sites.xml", "opencms-variables.xml", "opencms-scheduler.xml", "opencms-workplace.xml", "opencms-search.xml"}; List<File> result = new ArrayList<>(); for (String fn : filenames) { File file = new File(m_configDir, fn); if (file.exists()) { result.add(file); } } return result; }
[ "private", "List", "<", "File", ">", "getConfigFiles", "(", ")", "{", "String", "[", "]", "filenames", "=", "{", "\"opencms-modules.xml\"", ",", "\"opencms-system.xml\"", ",", "\"opencms-vfs.xml\"", ",", "\"opencms-importexport.xml\"", ",", "\"opencms-sites.xml\"", ",", "\"opencms-variables.xml\"", ",", "\"opencms-scheduler.xml\"", ",", "\"opencms-workplace.xml\"", ",", "\"opencms-search.xml\"", "}", ";", "List", "<", "File", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "fn", ":", "filenames", ")", "{", "File", "file", "=", "new", "File", "(", "m_configDir", ",", "fn", ")", ";", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "result", ".", "add", "(", "file", ")", ";", "}", "}", "return", "result", ";", "}" ]
Gets existing config files. @return the existing config files
[ "Gets", "existing", "config", "files", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java#L274-L294
158,570
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java
CmsXmlConfigUpdater.readTransformEntries
private List<TransformEntry> readTransformEntries(File file) throws Exception { List<TransformEntry> result = new ArrayList<>(); try (FileInputStream fis = new FileInputStream(file)) { byte[] data = CmsFileUtil.readFully(fis, false); Document doc = CmsXmlUtils.unmarshalHelper(data, null, false); for (Node node : doc.selectNodes("//transform")) { Element elem = ((Element)node); String xslt = elem.attributeValue("xslt"); String conf = elem.attributeValue("config"); TransformEntry entry = new TransformEntry(conf, xslt); result.add(entry); } } return result; }
java
private List<TransformEntry> readTransformEntries(File file) throws Exception { List<TransformEntry> result = new ArrayList<>(); try (FileInputStream fis = new FileInputStream(file)) { byte[] data = CmsFileUtil.readFully(fis, false); Document doc = CmsXmlUtils.unmarshalHelper(data, null, false); for (Node node : doc.selectNodes("//transform")) { Element elem = ((Element)node); String xslt = elem.attributeValue("xslt"); String conf = elem.attributeValue("config"); TransformEntry entry = new TransformEntry(conf, xslt); result.add(entry); } } return result; }
[ "private", "List", "<", "TransformEntry", ">", "readTransformEntries", "(", "File", "file", ")", "throws", "Exception", "{", "List", "<", "TransformEntry", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "(", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "file", ")", ")", "{", "byte", "[", "]", "data", "=", "CmsFileUtil", ".", "readFully", "(", "fis", ",", "false", ")", ";", "Document", "doc", "=", "CmsXmlUtils", ".", "unmarshalHelper", "(", "data", ",", "null", ",", "false", ")", ";", "for", "(", "Node", "node", ":", "doc", ".", "selectNodes", "(", "\"//transform\"", ")", ")", "{", "Element", "elem", "=", "(", "(", "Element", ")", "node", ")", ";", "String", "xslt", "=", "elem", ".", "attributeValue", "(", "\"xslt\"", ")", ";", "String", "conf", "=", "elem", ".", "attributeValue", "(", "\"config\"", ")", ";", "TransformEntry", "entry", "=", "new", "TransformEntry", "(", "conf", ",", "xslt", ")", ";", "result", ".", "add", "(", "entry", ")", ";", "}", "}", "return", "result", ";", "}" ]
Reads entries from transforms.xml. @param file the XML file @return the transform entries read from the file @throws Exception if something goes wrong
[ "Reads", "entries", "from", "transforms", ".", "xml", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java#L304-L319
158,571
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java
CmsXmlConfigUpdater.transform
private void transform(File file, Source transformSource) throws TransformerConfigurationException, IOException, SAXException, TransformerException, ParserConfigurationException { Transformer transformer = m_transformerFactory.newTransformer(transformSource); transformer.setOutputProperty(OutputKeys.ENCODING, "us-ascii"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); String configDirPath = m_configDir.getAbsolutePath(); configDirPath = configDirPath.replaceFirst("[/\\\\]$", ""); transformer.setParameter("configDir", configDirPath); XMLReader reader = m_parserFactory.newSAXParser().getXMLReader(); reader.setEntityResolver(NO_ENTITY_RESOLVER); Source source; if (file.exists()) { source = new SAXSource(reader, new InputSource(file.getCanonicalPath())); } else { source = new SAXSource(reader, new InputSource(new ByteArrayInputStream(DEFAULT_XML.getBytes("UTF-8")))); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); Result target = new StreamResult(baos); transformer.transform(source, target); byte[] transformedConfig = baos.toByteArray(); try (FileOutputStream output = new FileOutputStream(file)) { output.write(transformedConfig); } }
java
private void transform(File file, Source transformSource) throws TransformerConfigurationException, IOException, SAXException, TransformerException, ParserConfigurationException { Transformer transformer = m_transformerFactory.newTransformer(transformSource); transformer.setOutputProperty(OutputKeys.ENCODING, "us-ascii"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); String configDirPath = m_configDir.getAbsolutePath(); configDirPath = configDirPath.replaceFirst("[/\\\\]$", ""); transformer.setParameter("configDir", configDirPath); XMLReader reader = m_parserFactory.newSAXParser().getXMLReader(); reader.setEntityResolver(NO_ENTITY_RESOLVER); Source source; if (file.exists()) { source = new SAXSource(reader, new InputSource(file.getCanonicalPath())); } else { source = new SAXSource(reader, new InputSource(new ByteArrayInputStream(DEFAULT_XML.getBytes("UTF-8")))); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); Result target = new StreamResult(baos); transformer.transform(source, target); byte[] transformedConfig = baos.toByteArray(); try (FileOutputStream output = new FileOutputStream(file)) { output.write(transformedConfig); } }
[ "private", "void", "transform", "(", "File", "file", ",", "Source", "transformSource", ")", "throws", "TransformerConfigurationException", ",", "IOException", ",", "SAXException", ",", "TransformerException", ",", "ParserConfigurationException", "{", "Transformer", "transformer", "=", "m_transformerFactory", ".", "newTransformer", "(", "transformSource", ")", ";", "transformer", ".", "setOutputProperty", "(", "OutputKeys", ".", "ENCODING", ",", "\"us-ascii\"", ")", ";", "transformer", ".", "setOutputProperty", "(", "OutputKeys", ".", "INDENT", ",", "\"yes\"", ")", ";", "transformer", ".", "setOutputProperty", "(", "\"{http://xml.apache.org/xslt}indent-amount\"", ",", "\"4\"", ")", ";", "String", "configDirPath", "=", "m_configDir", ".", "getAbsolutePath", "(", ")", ";", "configDirPath", "=", "configDirPath", ".", "replaceFirst", "(", "\"[/\\\\\\\\]$\"", ",", "\"\"", ")", ";", "transformer", ".", "setParameter", "(", "\"configDir\"", ",", "configDirPath", ")", ";", "XMLReader", "reader", "=", "m_parserFactory", ".", "newSAXParser", "(", ")", ".", "getXMLReader", "(", ")", ";", "reader", ".", "setEntityResolver", "(", "NO_ENTITY_RESOLVER", ")", ";", "Source", "source", ";", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "source", "=", "new", "SAXSource", "(", "reader", ",", "new", "InputSource", "(", "file", ".", "getCanonicalPath", "(", ")", ")", ")", ";", "}", "else", "{", "source", "=", "new", "SAXSource", "(", "reader", ",", "new", "InputSource", "(", "new", "ByteArrayInputStream", "(", "DEFAULT_XML", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ")", ")", ";", "}", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "Result", "target", "=", "new", "StreamResult", "(", "baos", ")", ";", "transformer", ".", "transform", "(", "source", ",", "target", ")", ";", "byte", "[", "]", "transformedConfig", "=", "baos", ".", "toByteArray", "(", ")", ";", "try", "(", "FileOutputStream", "output", "=", "new", "FileOutputStream", "(", "file", ")", ")", "{", "output", ".", "write", "(", "transformedConfig", ")", ";", "}", "}" ]
Transforms a single configuration file using the given transformation source. @param file the configuration file @param transformSource the transform soruce @throws TransformerConfigurationException - @throws IOException - @throws SAXException - @throws TransformerException - @throws ParserConfigurationException -
[ "Transforms", "a", "single", "configuration", "file", "using", "the", "given", "transformation", "source", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java#L333-L362
158,572
alkacon/opencms-core
src/org/opencms/jsp/CmsJspNavElement.java
CmsJspNavElement.getSubNavigation
public List<CmsJspNavElement> getSubNavigation() { if (m_subNavigation == null) { if (m_resource.isFile()) { m_subNavigation = Collections.emptyList(); } else if (m_navContext == null) { try { throw new Exception("Can not get subnavigation because navigation context is not set."); } catch (Exception e) { LOG.warn(e.getLocalizedMessage(), e); m_subNavigation = Collections.emptyList(); } } else { CmsJspNavBuilder navBuilder = m_navContext.getNavBuilder(); m_subNavigation = navBuilder.getNavigationForFolder( navBuilder.getCmsObject().getSitePath(m_resource), m_navContext.getVisibility(), m_navContext.getFilter()); } } return m_subNavigation; }
java
public List<CmsJspNavElement> getSubNavigation() { if (m_subNavigation == null) { if (m_resource.isFile()) { m_subNavigation = Collections.emptyList(); } else if (m_navContext == null) { try { throw new Exception("Can not get subnavigation because navigation context is not set."); } catch (Exception e) { LOG.warn(e.getLocalizedMessage(), e); m_subNavigation = Collections.emptyList(); } } else { CmsJspNavBuilder navBuilder = m_navContext.getNavBuilder(); m_subNavigation = navBuilder.getNavigationForFolder( navBuilder.getCmsObject().getSitePath(m_resource), m_navContext.getVisibility(), m_navContext.getFilter()); } } return m_subNavigation; }
[ "public", "List", "<", "CmsJspNavElement", ">", "getSubNavigation", "(", ")", "{", "if", "(", "m_subNavigation", "==", "null", ")", "{", "if", "(", "m_resource", ".", "isFile", "(", ")", ")", "{", "m_subNavigation", "=", "Collections", ".", "emptyList", "(", ")", ";", "}", "else", "if", "(", "m_navContext", "==", "null", ")", "{", "try", "{", "throw", "new", "Exception", "(", "\"Can not get subnavigation because navigation context is not set.\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "warn", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "m_subNavigation", "=", "Collections", ".", "emptyList", "(", ")", ";", "}", "}", "else", "{", "CmsJspNavBuilder", "navBuilder", "=", "m_navContext", ".", "getNavBuilder", "(", ")", ";", "m_subNavigation", "=", "navBuilder", ".", "getNavigationForFolder", "(", "navBuilder", ".", "getCmsObject", "(", ")", ".", "getSitePath", "(", "m_resource", ")", ",", "m_navContext", ".", "getVisibility", "(", ")", ",", "m_navContext", ".", "getFilter", "(", ")", ")", ";", "}", "}", "return", "m_subNavigation", ";", "}" ]
Gets the sub-entries of the navigation entry. @return the sub-entries
[ "Gets", "the", "sub", "-", "entries", "of", "the", "navigation", "entry", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspNavElement.java#L442-L465
158,573
alkacon/opencms-core
src/org/opencms/jsp/CmsJspNavElement.java
CmsJspNavElement.getLocaleProperties
private Map<String, String> getLocaleProperties() { if (m_localeProperties == null) { m_localeProperties = CmsCollectionsGenericWrapper.createLazyMap( new CmsProperty.CmsPropertyLocaleTransformer(m_properties, m_locale)); } return m_localeProperties; }
java
private Map<String, String> getLocaleProperties() { if (m_localeProperties == null) { m_localeProperties = CmsCollectionsGenericWrapper.createLazyMap( new CmsProperty.CmsPropertyLocaleTransformer(m_properties, m_locale)); } return m_localeProperties; }
[ "private", "Map", "<", "String", ",", "String", ">", "getLocaleProperties", "(", ")", "{", "if", "(", "m_localeProperties", "==", "null", ")", "{", "m_localeProperties", "=", "CmsCollectionsGenericWrapper", ".", "createLazyMap", "(", "new", "CmsProperty", ".", "CmsPropertyLocaleTransformer", "(", "m_properties", ",", "m_locale", ")", ")", ";", "}", "return", "m_localeProperties", ";", "}" ]
Helper to get locale specific properties. @return the locale specific properties map.
[ "Helper", "to", "get", "locale", "specific", "properties", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspNavElement.java#L729-L736
158,574
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelDailyController.java
CmsPatternPanelDailyController.setEveryWorkingDay
public void setEveryWorkingDay(final boolean isEveryWorkingDay) { if (m_model.isEveryWorkingDay() != isEveryWorkingDay) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setEveryWorkingDay(Boolean.valueOf(isEveryWorkingDay)); m_model.setInterval(getPatternDefaultValues().getInterval()); onValueChange(); } }); } }
java
public void setEveryWorkingDay(final boolean isEveryWorkingDay) { if (m_model.isEveryWorkingDay() != isEveryWorkingDay) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setEveryWorkingDay(Boolean.valueOf(isEveryWorkingDay)); m_model.setInterval(getPatternDefaultValues().getInterval()); onValueChange(); } }); } }
[ "public", "void", "setEveryWorkingDay", "(", "final", "boolean", "isEveryWorkingDay", ")", "{", "if", "(", "m_model", ".", "isEveryWorkingDay", "(", ")", "!=", "isEveryWorkingDay", ")", "{", "removeExceptionsOnChange", "(", "new", "Command", "(", ")", "{", "public", "void", "execute", "(", ")", "{", "m_model", ".", "setEveryWorkingDay", "(", "Boolean", ".", "valueOf", "(", "isEveryWorkingDay", ")", ")", ";", "m_model", ".", "setInterval", "(", "getPatternDefaultValues", "(", ")", ".", "getInterval", "(", ")", ")", ";", "onValueChange", "(", ")", ";", "}", "}", ")", ";", "}", "}" ]
Set the "everyWorkingDay" flag. @param isEveryWorkingDay flag, indicating if the event should take place every working day.
[ "Set", "the", "everyWorkingDay", "flag", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelDailyController.java#L61-L74
158,575
alkacon/opencms-core
src/org/opencms/ade/upload/CmsUploadBean.java
CmsUploadBean.removeListener
private void removeListener(CmsUUID listenerId) { getRequest().getSession().removeAttribute(SESSION_ATTRIBUTE_LISTENER_ID); m_listeners.remove(listenerId); }
java
private void removeListener(CmsUUID listenerId) { getRequest().getSession().removeAttribute(SESSION_ATTRIBUTE_LISTENER_ID); m_listeners.remove(listenerId); }
[ "private", "void", "removeListener", "(", "CmsUUID", "listenerId", ")", "{", "getRequest", "(", ")", ".", "getSession", "(", ")", ".", "removeAttribute", "(", "SESSION_ATTRIBUTE_LISTENER_ID", ")", ";", "m_listeners", ".", "remove", "(", "listenerId", ")", ";", "}" ]
Remove the listener active in this session. @param listenerId the id of the listener to remove
[ "Remove", "the", "listener", "active", "in", "this", "session", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/upload/CmsUploadBean.java#L627-L631
158,576
alkacon/opencms-core
src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java
CmsFormatterBeanParser.parseAttributes
private Map<String, String> parseAttributes(I_CmsXmlContentLocation formatterLoc) { Map<String, String> result = new LinkedHashMap<>(); for (I_CmsXmlContentValueLocation mappingLoc : formatterLoc.getSubValues(N_ATTRIBUTE)) { String key = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_KEY)); String value = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_VALUE)); result.put(key, value); } return Collections.unmodifiableMap(result); }
java
private Map<String, String> parseAttributes(I_CmsXmlContentLocation formatterLoc) { Map<String, String> result = new LinkedHashMap<>(); for (I_CmsXmlContentValueLocation mappingLoc : formatterLoc.getSubValues(N_ATTRIBUTE)) { String key = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_KEY)); String value = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_VALUE)); result.put(key, value); } return Collections.unmodifiableMap(result); }
[ "private", "Map", "<", "String", ",", "String", ">", "parseAttributes", "(", "I_CmsXmlContentLocation", "formatterLoc", ")", "{", "Map", "<", "String", ",", "String", ">", "result", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "for", "(", "I_CmsXmlContentValueLocation", "mappingLoc", ":", "formatterLoc", ".", "getSubValues", "(", "N_ATTRIBUTE", ")", ")", "{", "String", "key", "=", "CmsConfigurationReader", ".", "getString", "(", "m_cms", ",", "mappingLoc", ".", "getSubValue", "(", "N_KEY", ")", ")", ";", "String", "value", "=", "CmsConfigurationReader", ".", "getString", "(", "m_cms", ",", "mappingLoc", ".", "getSubValue", "(", "N_VALUE", ")", ")", ";", "result", ".", "put", "(", "key", ",", "value", ")", ";", "}", "return", "Collections", ".", "unmodifiableMap", "(", "result", ")", ";", "}" ]
Parses formatter attributes. @param formatterLoc the node location @return the map of formatter attributes (unmodifiable)
[ "Parses", "formatter", "attributes", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java#L686-L695
158,577
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEManager.java
CmsADEManager.getConfiguredWorkplaceBundles
public Set<String> getConfiguredWorkplaceBundles() { CmsADEConfigData configData = internalLookupConfiguration(null, null); return configData.getConfiguredWorkplaceBundles(); }
java
public Set<String> getConfiguredWorkplaceBundles() { CmsADEConfigData configData = internalLookupConfiguration(null, null); return configData.getConfiguredWorkplaceBundles(); }
[ "public", "Set", "<", "String", ">", "getConfiguredWorkplaceBundles", "(", ")", "{", "CmsADEConfigData", "configData", "=", "internalLookupConfiguration", "(", "null", ",", "null", ")", ";", "return", "configData", ".", "getConfiguredWorkplaceBundles", "(", ")", ";", "}" ]
Returns the names of the bundles configured as workplace bundles in any module configuration. @return the names of the bundles configured as workplace bundles in any module configuration.
[ "Returns", "the", "names", "of", "the", "bundles", "configured", "as", "workplace", "bundles", "in", "any", "module", "configuration", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L366-L370
158,578
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkManager.java
CmsLinkManager.removeOpenCmsContext
public static String removeOpenCmsContext(final String path) { String context = OpenCms.getSystemInfo().getOpenCmsContext(); if (path.startsWith(context + "/")) { return path.substring(context.length()); } String renderPrefix = OpenCms.getStaticExportManager().getVfsPrefix(); if (path.startsWith(renderPrefix + "/")) { return path.substring(renderPrefix.length()); } return path; }
java
public static String removeOpenCmsContext(final String path) { String context = OpenCms.getSystemInfo().getOpenCmsContext(); if (path.startsWith(context + "/")) { return path.substring(context.length()); } String renderPrefix = OpenCms.getStaticExportManager().getVfsPrefix(); if (path.startsWith(renderPrefix + "/")) { return path.substring(renderPrefix.length()); } return path; }
[ "public", "static", "String", "removeOpenCmsContext", "(", "final", "String", "path", ")", "{", "String", "context", "=", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "getOpenCmsContext", "(", ")", ";", "if", "(", "path", ".", "startsWith", "(", "context", "+", "\"/\"", ")", ")", "{", "return", "path", ".", "substring", "(", "context", ".", "length", "(", ")", ")", ";", "}", "String", "renderPrefix", "=", "OpenCms", ".", "getStaticExportManager", "(", ")", ".", "getVfsPrefix", "(", ")", ";", "if", "(", "path", ".", "startsWith", "(", "renderPrefix", "+", "\"/\"", ")", ")", "{", "return", "path", ".", "substring", "(", "renderPrefix", ".", "length", "(", ")", ")", ";", "}", "return", "path", ";", "}" ]
Given a path to a VFS resource, the method removes the OpenCms context, in case the path is prefixed by that context. @param path the path where the OpenCms context should be removed @return the adjusted path
[ "Given", "a", "path", "to", "a", "VFS", "resource", "the", "method", "removes", "the", "OpenCms", "context", "in", "case", "the", "path", "is", "prefixed", "by", "that", "context", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L276-L287
158,579
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkManager.java
CmsLinkManager.getPermalink
public String getPermalink(CmsObject cms, String resourceName, CmsUUID detailContentId) { String permalink = ""; try { permalink = substituteLink(cms, CmsPermalinkResourceHandler.PERMALINK_HANDLER); String id = cms.readResource(resourceName, CmsResourceFilter.ALL).getStructureId().toString(); permalink += id; if (detailContentId != null) { permalink += ":" + detailContentId; } String ext = CmsFileUtil.getExtension(resourceName); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(ext)) { permalink += ext; } CmsSite currentSite = OpenCms.getSiteManager().getCurrentSite(cms); String serverPrefix = null; if (currentSite == OpenCms.getSiteManager().getDefaultSite()) { Optional<CmsSite> siteForDefaultUri = OpenCms.getSiteManager().getSiteForDefaultUri(); if (siteForDefaultUri.isPresent()) { serverPrefix = siteForDefaultUri.get().getServerPrefix(cms, resourceName); } else { serverPrefix = OpenCms.getSiteManager().getWorkplaceServer(); } } else { serverPrefix = currentSite.getServerPrefix(cms, resourceName); } if (!permalink.startsWith(serverPrefix)) { permalink = serverPrefix + permalink; } } catch (CmsException e) { // if something wrong permalink = e.getLocalizedMessage(); if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return permalink; }
java
public String getPermalink(CmsObject cms, String resourceName, CmsUUID detailContentId) { String permalink = ""; try { permalink = substituteLink(cms, CmsPermalinkResourceHandler.PERMALINK_HANDLER); String id = cms.readResource(resourceName, CmsResourceFilter.ALL).getStructureId().toString(); permalink += id; if (detailContentId != null) { permalink += ":" + detailContentId; } String ext = CmsFileUtil.getExtension(resourceName); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(ext)) { permalink += ext; } CmsSite currentSite = OpenCms.getSiteManager().getCurrentSite(cms); String serverPrefix = null; if (currentSite == OpenCms.getSiteManager().getDefaultSite()) { Optional<CmsSite> siteForDefaultUri = OpenCms.getSiteManager().getSiteForDefaultUri(); if (siteForDefaultUri.isPresent()) { serverPrefix = siteForDefaultUri.get().getServerPrefix(cms, resourceName); } else { serverPrefix = OpenCms.getSiteManager().getWorkplaceServer(); } } else { serverPrefix = currentSite.getServerPrefix(cms, resourceName); } if (!permalink.startsWith(serverPrefix)) { permalink = serverPrefix + permalink; } } catch (CmsException e) { // if something wrong permalink = e.getLocalizedMessage(); if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return permalink; }
[ "public", "String", "getPermalink", "(", "CmsObject", "cms", ",", "String", "resourceName", ",", "CmsUUID", "detailContentId", ")", "{", "String", "permalink", "=", "\"\"", ";", "try", "{", "permalink", "=", "substituteLink", "(", "cms", ",", "CmsPermalinkResourceHandler", ".", "PERMALINK_HANDLER", ")", ";", "String", "id", "=", "cms", ".", "readResource", "(", "resourceName", ",", "CmsResourceFilter", ".", "ALL", ")", ".", "getStructureId", "(", ")", ".", "toString", "(", ")", ";", "permalink", "+=", "id", ";", "if", "(", "detailContentId", "!=", "null", ")", "{", "permalink", "+=", "\":\"", "+", "detailContentId", ";", "}", "String", "ext", "=", "CmsFileUtil", ".", "getExtension", "(", "resourceName", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "ext", ")", ")", "{", "permalink", "+=", "ext", ";", "}", "CmsSite", "currentSite", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getCurrentSite", "(", "cms", ")", ";", "String", "serverPrefix", "=", "null", ";", "if", "(", "currentSite", "==", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getDefaultSite", "(", ")", ")", "{", "Optional", "<", "CmsSite", ">", "siteForDefaultUri", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getSiteForDefaultUri", "(", ")", ";", "if", "(", "siteForDefaultUri", ".", "isPresent", "(", ")", ")", "{", "serverPrefix", "=", "siteForDefaultUri", ".", "get", "(", ")", ".", "getServerPrefix", "(", "cms", ",", "resourceName", ")", ";", "}", "else", "{", "serverPrefix", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getWorkplaceServer", "(", ")", ";", "}", "}", "else", "{", "serverPrefix", "=", "currentSite", ".", "getServerPrefix", "(", "cms", ",", "resourceName", ")", ";", "}", "if", "(", "!", "permalink", ".", "startsWith", "(", "serverPrefix", ")", ")", "{", "permalink", "=", "serverPrefix", "+", "permalink", ";", "}", "}", "catch", "(", "CmsException", "e", ")", "{", "// if something wrong", "permalink", "=", "e", ".", "getLocalizedMessage", "(", ")", ";", "if", "(", "LOG", ".", "isErrorEnabled", "(", ")", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "}", "return", "permalink", ";", "}" ]
Returns the perma link for the given resource and optional detail content.<p< @param cms the CMS context to use @param resourceName the page to generate the perma link for @param detailContentId the structure id of the detail content (may be null) @return the perma link
[ "Returns", "the", "perma", "link", "for", "the", "given", "resource", "and", "optional", "detail", "content", ".", "<p<" ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L423-L461
158,580
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkManager.java
CmsLinkManager.getPermalinkForCurrentPage
public String getPermalinkForCurrentPage(CmsObject cms) { return getPermalink(cms, cms.getRequestContext().getUri(), cms.getRequestContext().getDetailContentId()); }
java
public String getPermalinkForCurrentPage(CmsObject cms) { return getPermalink(cms, cms.getRequestContext().getUri(), cms.getRequestContext().getDetailContentId()); }
[ "public", "String", "getPermalinkForCurrentPage", "(", "CmsObject", "cms", ")", "{", "return", "getPermalink", "(", "cms", ",", "cms", ".", "getRequestContext", "(", ")", ".", "getUri", "(", ")", ",", "cms", ".", "getRequestContext", "(", ")", ".", "getDetailContentId", "(", ")", ")", ";", "}" ]
Returns the perma link for the current page based on the URI and detail content id stored in the CmsObject passed as a parameter.<p< @param cms the CMS context to use to generate the permalink @return the permalink
[ "Returns", "the", "perma", "link", "for", "the", "current", "page", "based", "on", "the", "URI", "and", "detail", "content", "id", "stored", "in", "the", "CmsObject", "passed", "as", "a", "parameter", ".", "<p<" ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L470-L473
158,581
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkManager.java
CmsLinkManager.getWorkplaceLink
public String getWorkplaceLink(CmsObject cms, String resourceName, boolean forceSecure) { String result = substituteLinkForUnknownTarget(cms, resourceName, forceSecure); return appendServerPrefix(cms, result, resourceName, true); }
java
public String getWorkplaceLink(CmsObject cms, String resourceName, boolean forceSecure) { String result = substituteLinkForUnknownTarget(cms, resourceName, forceSecure); return appendServerPrefix(cms, result, resourceName, true); }
[ "public", "String", "getWorkplaceLink", "(", "CmsObject", "cms", ",", "String", "resourceName", ",", "boolean", "forceSecure", ")", "{", "String", "result", "=", "substituteLinkForUnknownTarget", "(", "cms", ",", "resourceName", ",", "forceSecure", ")", ";", "return", "appendServerPrefix", "(", "cms", ",", "result", ",", "resourceName", ",", "true", ")", ";", "}" ]
Returns the link for the given workplace resource. This should only be used for resources under /system or /shared.<p< @param cms the current OpenCms user context @param resourceName the resource to generate the online link for @param forceSecure forces the secure server prefix @return the link for the given resource
[ "Returns", "the", "link", "for", "the", "given", "workplace", "resource", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L599-L604
158,582
alkacon/opencms-core
src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleResultsForm.java
CmsSqlConsoleResultsForm.buildTable
private Table buildTable(CmsSqlConsoleResults results) { IndexedContainer container = new IndexedContainer(); int numCols = results.getColumns().size(); for (int c = 0; c < numCols; c++) { container.addContainerProperty(Integer.valueOf(c), results.getColumnType(c), null); } int r = 0; for (List<Object> row : results.getData()) { Item item = container.addItem(Integer.valueOf(r)); for (int c = 0; c < numCols; c++) { item.getItemProperty(Integer.valueOf(c)).setValue(row.get(c)); } r += 1; } Table table = new Table(); table.setContainerDataSource(container); for (int c = 0; c < numCols; c++) { String col = (results.getColumns().get(c)); table.setColumnHeader(Integer.valueOf(c), col); } table.setWidth("100%"); table.setHeight("100%"); table.setColumnCollapsingAllowed(true); return table; }
java
private Table buildTable(CmsSqlConsoleResults results) { IndexedContainer container = new IndexedContainer(); int numCols = results.getColumns().size(); for (int c = 0; c < numCols; c++) { container.addContainerProperty(Integer.valueOf(c), results.getColumnType(c), null); } int r = 0; for (List<Object> row : results.getData()) { Item item = container.addItem(Integer.valueOf(r)); for (int c = 0; c < numCols; c++) { item.getItemProperty(Integer.valueOf(c)).setValue(row.get(c)); } r += 1; } Table table = new Table(); table.setContainerDataSource(container); for (int c = 0; c < numCols; c++) { String col = (results.getColumns().get(c)); table.setColumnHeader(Integer.valueOf(c), col); } table.setWidth("100%"); table.setHeight("100%"); table.setColumnCollapsingAllowed(true); return table; }
[ "private", "Table", "buildTable", "(", "CmsSqlConsoleResults", "results", ")", "{", "IndexedContainer", "container", "=", "new", "IndexedContainer", "(", ")", ";", "int", "numCols", "=", "results", ".", "getColumns", "(", ")", ".", "size", "(", ")", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "numCols", ";", "c", "++", ")", "{", "container", ".", "addContainerProperty", "(", "Integer", ".", "valueOf", "(", "c", ")", ",", "results", ".", "getColumnType", "(", "c", ")", ",", "null", ")", ";", "}", "int", "r", "=", "0", ";", "for", "(", "List", "<", "Object", ">", "row", ":", "results", ".", "getData", "(", ")", ")", "{", "Item", "item", "=", "container", ".", "addItem", "(", "Integer", ".", "valueOf", "(", "r", ")", ")", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "numCols", ";", "c", "++", ")", "{", "item", ".", "getItemProperty", "(", "Integer", ".", "valueOf", "(", "c", ")", ")", ".", "setValue", "(", "row", ".", "get", "(", "c", ")", ")", ";", "}", "r", "+=", "1", ";", "}", "Table", "table", "=", "new", "Table", "(", ")", ";", "table", ".", "setContainerDataSource", "(", "container", ")", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "numCols", ";", "c", "++", ")", "{", "String", "col", "=", "(", "results", ".", "getColumns", "(", ")", ".", "get", "(", "c", ")", ")", ";", "table", ".", "setColumnHeader", "(", "Integer", ".", "valueOf", "(", "c", ")", ",", "col", ")", ";", "}", "table", ".", "setWidth", "(", "\"100%\"", ")", ";", "table", ".", "setHeight", "(", "\"100%\"", ")", ";", "table", ".", "setColumnCollapsingAllowed", "(", "true", ")", ";", "return", "table", ";", "}" ]
Builds the table for the database results. @param results the database results @return the table
[ "Builds", "the", "table", "for", "the", "database", "results", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleResultsForm.java#L136-L161
158,583
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsPropertiesTab.java
CmsPropertiesTab.updateImageInfo
private void updateImageInfo() { String crop = getCrop(); String point = getPoint(); m_imageInfoDisplay.fillContent(m_info, crop, point); }
java
private void updateImageInfo() { String crop = getCrop(); String point = getPoint(); m_imageInfoDisplay.fillContent(m_info, crop, point); }
[ "private", "void", "updateImageInfo", "(", ")", "{", "String", "crop", "=", "getCrop", "(", ")", ";", "String", "point", "=", "getPoint", "(", ")", ";", "m_imageInfoDisplay", ".", "fillContent", "(", "m_info", ",", "crop", ",", "point", ")", ";", "}" ]
Updates the image information.
[ "Updates", "the", "image", "information", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsPropertiesTab.java#L242-L247
158,584
alkacon/opencms-core
src/org/opencms/main/CmsShell.java
CmsShell.getTopShell
public static CmsShell getTopShell() { ArrayList<CmsShell> shells = SHELL_STACK.get(); if (shells.isEmpty()) { return null; } return shells.get(shells.size() - 1); }
java
public static CmsShell getTopShell() { ArrayList<CmsShell> shells = SHELL_STACK.get(); if (shells.isEmpty()) { return null; } return shells.get(shells.size() - 1); }
[ "public", "static", "CmsShell", "getTopShell", "(", ")", "{", "ArrayList", "<", "CmsShell", ">", "shells", "=", "SHELL_STACK", ".", "get", "(", ")", ";", "if", "(", "shells", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "shells", ".", "get", "(", "shells", ".", "size", "(", ")", "-", "1", ")", ";", "}" ]
Gets the top of thread-local shell stack, or null if it is empty. @return the top of the shell stack
[ "Gets", "the", "top", "of", "thread", "-", "local", "shell", "stack", "or", "null", "if", "it", "is", "empty", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShell.java#L581-L589
158,585
alkacon/opencms-core
src/org/opencms/main/CmsShell.java
CmsShell.popShell
public static void popShell() { ArrayList<CmsShell> shells = SHELL_STACK.get(); if (shells.size() > 0) { shells.remove(shells.size() - 1); } }
java
public static void popShell() { ArrayList<CmsShell> shells = SHELL_STACK.get(); if (shells.size() > 0) { shells.remove(shells.size() - 1); } }
[ "public", "static", "void", "popShell", "(", ")", "{", "ArrayList", "<", "CmsShell", ">", "shells", "=", "SHELL_STACK", ".", "get", "(", ")", ";", "if", "(", "shells", ".", "size", "(", ")", ">", "0", ")", "{", "shells", ".", "remove", "(", "shells", ".", "size", "(", ")", "-", "1", ")", ";", "}", "}" ]
Removes top of thread-local shell stack.
[ "Removes", "top", "of", "thread", "-", "local", "shell", "stack", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShell.java#L693-L700
158,586
alkacon/opencms-core
src/org/opencms/jsp/search/config/CmsSearchConfigurationSorting.java
CmsSearchConfigurationSorting.create
public static CmsSearchConfigurationSorting create( final String sortParam, final List<I_CmsSearchConfigurationSortOption> options, final I_CmsSearchConfigurationSortOption defaultOption) { return (null != sortParam) || ((null != options) && !options.isEmpty()) || (null != defaultOption) ? new CmsSearchConfigurationSorting(sortParam, options, defaultOption) : null; }
java
public static CmsSearchConfigurationSorting create( final String sortParam, final List<I_CmsSearchConfigurationSortOption> options, final I_CmsSearchConfigurationSortOption defaultOption) { return (null != sortParam) || ((null != options) && !options.isEmpty()) || (null != defaultOption) ? new CmsSearchConfigurationSorting(sortParam, options, defaultOption) : null; }
[ "public", "static", "CmsSearchConfigurationSorting", "create", "(", "final", "String", "sortParam", ",", "final", "List", "<", "I_CmsSearchConfigurationSortOption", ">", "options", ",", "final", "I_CmsSearchConfigurationSortOption", "defaultOption", ")", "{", "return", "(", "null", "!=", "sortParam", ")", "||", "(", "(", "null", "!=", "options", ")", "&&", "!", "options", ".", "isEmpty", "(", ")", ")", "||", "(", "null", "!=", "defaultOption", ")", "?", "new", "CmsSearchConfigurationSorting", "(", "sortParam", ",", "options", ",", "defaultOption", ")", ":", "null", ";", "}" ]
Creates a sort configuration iff at least one of the parameters is not null and the options list is not empty. @param sortParam The request parameter used to send the currently chosen search option. @param options The available sort options. @param defaultOption The default sort option. @return the sort configuration or null, depending on the arguments.
[ "Creates", "a", "sort", "configuration", "iff", "at", "least", "one", "of", "the", "parameters", "is", "not", "null", "and", "the", "options", "list", "is", "not", "empty", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/CmsSearchConfigurationSorting.java#L66-L74
158,587
alkacon/opencms-core
src/org/opencms/ui/apps/dbmanager/CmsResourceTypeStatResultList.java
CmsResourceTypeStatResultList.init
public static CmsResourceTypeStatResultList init(CmsResourceTypeStatResultList resList) { if (resList == null) { return new CmsResourceTypeStatResultList(); } resList.deleteOld(); return resList; }
java
public static CmsResourceTypeStatResultList init(CmsResourceTypeStatResultList resList) { if (resList == null) { return new CmsResourceTypeStatResultList(); } resList.deleteOld(); return resList; }
[ "public", "static", "CmsResourceTypeStatResultList", "init", "(", "CmsResourceTypeStatResultList", "resList", ")", "{", "if", "(", "resList", "==", "null", ")", "{", "return", "new", "CmsResourceTypeStatResultList", "(", ")", ";", "}", "resList", ".", "deleteOld", "(", ")", ";", "return", "resList", ";", "}" ]
Method to initialize the list. @param resList a given instance or null @return an instance
[ "Method", "to", "initialize", "the", "list", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/CmsResourceTypeStatResultList.java#L75-L83
158,588
alkacon/opencms-core
src/org/opencms/importexport/CmsExport.java
CmsExport.exportWithMinimalMetaData
protected boolean exportWithMinimalMetaData(String path) { String checkPath = path.startsWith("/") ? path + "/" : "/" + path + "/"; for (String p : m_parameters.getResourcesToExportWithMetaData()) { if (checkPath.startsWith(p)) { return false; } } return true; }
java
protected boolean exportWithMinimalMetaData(String path) { String checkPath = path.startsWith("/") ? path + "/" : "/" + path + "/"; for (String p : m_parameters.getResourcesToExportWithMetaData()) { if (checkPath.startsWith(p)) { return false; } } return true; }
[ "protected", "boolean", "exportWithMinimalMetaData", "(", "String", "path", ")", "{", "String", "checkPath", "=", "path", ".", "startsWith", "(", "\"/\"", ")", "?", "path", "+", "\"/\"", ":", "\"/\"", "+", "path", "+", "\"/\"", ";", "for", "(", "String", "p", ":", "m_parameters", ".", "getResourcesToExportWithMetaData", "(", ")", ")", "{", "if", "(", "checkPath", ".", "startsWith", "(", "p", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Check, if the resource should be exported with minimal meta-data. This holds for resources that are not part of the export, but must be exported as super-folders. @param path export-site relative path of the resource to check. @return flag, indicating if the resource should be exported with minimal meta data.
[ "Check", "if", "the", "resource", "should", "be", "exported", "with", "minimal", "meta", "-", "data", ".", "This", "holds", "for", "resources", "that", "are", "not", "part", "of", "the", "export", "but", "must", "be", "exported", "as", "super", "-", "folders", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsExport.java#L1365-L1374
158,589
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/dom/client/DOMImplWebkit.java
DOMImplWebkit.setDraggable
@Override public void setDraggable(Element elem, String draggable) { super.setDraggable(elem, draggable); if ("true".equals(draggable)) { elem.getStyle().setProperty("webkitUserDrag", "element"); } else { elem.getStyle().clearProperty("webkitUserDrag"); } }
java
@Override public void setDraggable(Element elem, String draggable) { super.setDraggable(elem, draggable); if ("true".equals(draggable)) { elem.getStyle().setProperty("webkitUserDrag", "element"); } else { elem.getStyle().clearProperty("webkitUserDrag"); } }
[ "@", "Override", "public", "void", "setDraggable", "(", "Element", "elem", ",", "String", "draggable", ")", "{", "super", ".", "setDraggable", "(", "elem", ",", "draggable", ")", ";", "if", "(", "\"true\"", ".", "equals", "(", "draggable", ")", ")", "{", "elem", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"webkitUserDrag\"", ",", "\"element\"", ")", ";", "}", "else", "{", "elem", ".", "getStyle", "(", ")", ".", "clearProperty", "(", "\"webkitUserDrag\"", ")", ";", "}", "}" ]
Webkit based browsers require that we set the webkit-user-drag style attribute to make an element draggable.
[ "Webkit", "based", "browsers", "require", "that", "we", "set", "the", "webkit", "-", "user", "-", "drag", "style", "attribute", "to", "make", "an", "element", "draggable", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/dom/client/DOMImplWebkit.java#L58-L66
158,590
alkacon/opencms-core
src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java
CmsNewResourceTypeDialog.createParentXmlElements
protected void createParentXmlElements(CmsXmlContent xmlContent, String xmlPath, Locale l) { if (CmsXmlUtils.isDeepXpath(xmlPath)) { String parentPath = CmsXmlUtils.removeLastXpathElement(xmlPath); if (null == xmlContent.getValue(parentPath, l)) { createParentXmlElements(xmlContent, parentPath, l); xmlContent.addValue(m_cms, parentPath, l, CmsXmlUtils.getXpathIndexInt(parentPath) - 1); } } }
java
protected void createParentXmlElements(CmsXmlContent xmlContent, String xmlPath, Locale l) { if (CmsXmlUtils.isDeepXpath(xmlPath)) { String parentPath = CmsXmlUtils.removeLastXpathElement(xmlPath); if (null == xmlContent.getValue(parentPath, l)) { createParentXmlElements(xmlContent, parentPath, l); xmlContent.addValue(m_cms, parentPath, l, CmsXmlUtils.getXpathIndexInt(parentPath) - 1); } } }
[ "protected", "void", "createParentXmlElements", "(", "CmsXmlContent", "xmlContent", ",", "String", "xmlPath", ",", "Locale", "l", ")", "{", "if", "(", "CmsXmlUtils", ".", "isDeepXpath", "(", "xmlPath", ")", ")", "{", "String", "parentPath", "=", "CmsXmlUtils", ".", "removeLastXpathElement", "(", "xmlPath", ")", ";", "if", "(", "null", "==", "xmlContent", ".", "getValue", "(", "parentPath", ",", "l", ")", ")", "{", "createParentXmlElements", "(", "xmlContent", ",", "parentPath", ",", "l", ")", ";", "xmlContent", ".", "addValue", "(", "m_cms", ",", "parentPath", ",", "l", ",", "CmsXmlUtils", ".", "getXpathIndexInt", "(", "parentPath", ")", "-", "1", ")", ";", "}", "}", "}" ]
Creates the parents of nested XML elements if necessary. @param xmlContent the XML content that is edited. @param xmlPath the path of the (nested) element, for which the parents should be created @param l the locale for which the XML content is edited.
[ "Creates", "the", "parents", "of", "nested", "XML", "elements", "if", "necessary", "." ]
bc104acc75d2277df5864da939a1f2de5fdee504
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java#L395-L405
158,591
codahale/shamir
src/main/java/com/codahale/shamir/Scheme.java
Scheme.join
public byte[] join(Map<Integer, byte[]> parts) { checkArgument(parts.size() > 0, "No parts provided"); final int[] lengths = parts.values().stream().mapToInt(v -> v.length).distinct().toArray(); checkArgument(lengths.length == 1, "Varying lengths of part values"); final byte[] secret = new byte[lengths[0]]; for (int i = 0; i < secret.length; i++) { final byte[][] points = new byte[parts.size()][2]; int j = 0; for (Map.Entry<Integer, byte[]> part : parts.entrySet()) { points[j][0] = part.getKey().byteValue(); points[j][1] = part.getValue()[i]; j++; } secret[i] = GF256.interpolate(points); } return secret; }
java
public byte[] join(Map<Integer, byte[]> parts) { checkArgument(parts.size() > 0, "No parts provided"); final int[] lengths = parts.values().stream().mapToInt(v -> v.length).distinct().toArray(); checkArgument(lengths.length == 1, "Varying lengths of part values"); final byte[] secret = new byte[lengths[0]]; for (int i = 0; i < secret.length; i++) { final byte[][] points = new byte[parts.size()][2]; int j = 0; for (Map.Entry<Integer, byte[]> part : parts.entrySet()) { points[j][0] = part.getKey().byteValue(); points[j][1] = part.getValue()[i]; j++; } secret[i] = GF256.interpolate(points); } return secret; }
[ "public", "byte", "[", "]", "join", "(", "Map", "<", "Integer", ",", "byte", "[", "]", ">", "parts", ")", "{", "checkArgument", "(", "parts", ".", "size", "(", ")", ">", "0", ",", "\"No parts provided\"", ")", ";", "final", "int", "[", "]", "lengths", "=", "parts", ".", "values", "(", ")", ".", "stream", "(", ")", ".", "mapToInt", "(", "v", "->", "v", ".", "length", ")", ".", "distinct", "(", ")", ".", "toArray", "(", ")", ";", "checkArgument", "(", "lengths", ".", "length", "==", "1", ",", "\"Varying lengths of part values\"", ")", ";", "final", "byte", "[", "]", "secret", "=", "new", "byte", "[", "lengths", "[", "0", "]", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "secret", ".", "length", ";", "i", "++", ")", "{", "final", "byte", "[", "]", "[", "]", "points", "=", "new", "byte", "[", "parts", ".", "size", "(", ")", "]", "[", "2", "]", ";", "int", "j", "=", "0", ";", "for", "(", "Map", ".", "Entry", "<", "Integer", ",", "byte", "[", "]", ">", "part", ":", "parts", ".", "entrySet", "(", ")", ")", "{", "points", "[", "j", "]", "[", "0", "]", "=", "part", ".", "getKey", "(", ")", ".", "byteValue", "(", ")", ";", "points", "[", "j", "]", "[", "1", "]", "=", "part", ".", "getValue", "(", ")", "[", "i", "]", ";", "j", "++", ";", "}", "secret", "[", "i", "]", "=", "GF256", ".", "interpolate", "(", "points", ")", ";", "}", "return", "secret", ";", "}" ]
Joins the given parts to recover the original secret. <p><b>N.B.:</b> There is no way to determine whether or not the returned value is actually the original secret. If the parts are incorrect, or are under the threshold value used to split the secret, a random value will be returned. @param parts a map of part IDs to part values @return the original secret @throws IllegalArgumentException if {@code parts} is empty or contains values of varying lengths
[ "Joins", "the", "given", "parts", "to", "recover", "the", "original", "secret", "." ]
58b9502bc96f8749a64d9ff81b5c35f0b0dde354
https://github.com/codahale/shamir/blob/58b9502bc96f8749a64d9ff81b5c35f0b0dde354/src/main/java/com/codahale/shamir/Scheme.java#L98-L114
158,592
gearpump/gearpump
streaming/src/main/java/io/gearpump/streaming/javaapi/Processor.java
Processor.sink
public static Processor<DataSinkTask> sink(DataSink dataSink, int parallelism, String description, UserConfig taskConf, ActorSystem system) { io.gearpump.streaming.Processor<DataSinkTask> p = DataSinkProcessor.apply(dataSink, parallelism, description, taskConf, system); return new Processor(p); }
java
public static Processor<DataSinkTask> sink(DataSink dataSink, int parallelism, String description, UserConfig taskConf, ActorSystem system) { io.gearpump.streaming.Processor<DataSinkTask> p = DataSinkProcessor.apply(dataSink, parallelism, description, taskConf, system); return new Processor(p); }
[ "public", "static", "Processor", "<", "DataSinkTask", ">", "sink", "(", "DataSink", "dataSink", ",", "int", "parallelism", ",", "String", "description", ",", "UserConfig", "taskConf", ",", "ActorSystem", "system", ")", "{", "io", ".", "gearpump", ".", "streaming", ".", "Processor", "<", "DataSinkTask", ">", "p", "=", "DataSinkProcessor", ".", "apply", "(", "dataSink", ",", "parallelism", ",", "description", ",", "taskConf", ",", "system", ")", ";", "return", "new", "Processor", "(", "p", ")", ";", "}" ]
Creates a Sink Processor @param dataSink the data sink itself @param parallelism the parallelism of this processor @param description the description for this processor @param taskConf the configuration for this processor @param system actor system @return the new created sink processor
[ "Creates", "a", "Sink", "Processor" ]
6f505aad25d5b8f54976867dbf4e752f13f9702e
https://github.com/gearpump/gearpump/blob/6f505aad25d5b8f54976867dbf4e752f13f9702e/streaming/src/main/java/io/gearpump/streaming/javaapi/Processor.java#L56-L59
158,593
gearpump/gearpump
streaming/src/main/java/io/gearpump/streaming/javaapi/Processor.java
Processor.source
public static Processor<DataSourceTask> source(DataSource source, int parallelism, String description, UserConfig taskConf, ActorSystem system) { io.gearpump.streaming.Processor<DataSourceTask<Object, Object>> p = DataSourceProcessor.apply(source, parallelism, description, taskConf, system); return new Processor(p); }
java
public static Processor<DataSourceTask> source(DataSource source, int parallelism, String description, UserConfig taskConf, ActorSystem system) { io.gearpump.streaming.Processor<DataSourceTask<Object, Object>> p = DataSourceProcessor.apply(source, parallelism, description, taskConf, system); return new Processor(p); }
[ "public", "static", "Processor", "<", "DataSourceTask", ">", "source", "(", "DataSource", "source", ",", "int", "parallelism", ",", "String", "description", ",", "UserConfig", "taskConf", ",", "ActorSystem", "system", ")", "{", "io", ".", "gearpump", ".", "streaming", ".", "Processor", "<", "DataSourceTask", "<", "Object", ",", "Object", ">", ">", "p", "=", "DataSourceProcessor", ".", "apply", "(", "source", ",", "parallelism", ",", "description", ",", "taskConf", ",", "system", ")", ";", "return", "new", "Processor", "(", "p", ")", ";", "}" ]
Creates a Source Processor @param source the data source itself @param parallelism the parallelism of this processor @param description the description of this processor @param taskConf the configuration of this processor @param system actor system @return the new created source processor
[ "Creates", "a", "Source", "Processor" ]
6f505aad25d5b8f54976867dbf4e752f13f9702e
https://github.com/gearpump/gearpump/blob/6f505aad25d5b8f54976867dbf4e752f13f9702e/streaming/src/main/java/io/gearpump/streaming/javaapi/Processor.java#L71-L75
158,594
javamonkey/beetl2.0
beetl-core/src/main/java/org/beetl/core/parser/BeetlAntlrErrorStrategy.java
BeetlAntlrErrorStrategy.recoverInline
@Override public Token recoverInline(Parser recognizer) throws RecognitionException { // SINGLE TOKEN DELETION Token matchedSymbol = singleTokenDeletion(recognizer); if (matchedSymbol != null) { // we have deleted the extra token. // now, move past ttype token as if all were ok recognizer.consume(); return matchedSymbol; } // SINGLE TOKEN INSERTION if (singleTokenInsertion(recognizer)) { return getMissingSymbol(recognizer); } // BeetlException exception = new BeetlParserException(BeetlException.PARSER_MISS_ERROR); // exception.pushToken(this.getGrammarToken(recognizer.getCurrentToken())); // throw exception; throw new InputMismatchException(recognizer); }
java
@Override public Token recoverInline(Parser recognizer) throws RecognitionException { // SINGLE TOKEN DELETION Token matchedSymbol = singleTokenDeletion(recognizer); if (matchedSymbol != null) { // we have deleted the extra token. // now, move past ttype token as if all were ok recognizer.consume(); return matchedSymbol; } // SINGLE TOKEN INSERTION if (singleTokenInsertion(recognizer)) { return getMissingSymbol(recognizer); } // BeetlException exception = new BeetlParserException(BeetlException.PARSER_MISS_ERROR); // exception.pushToken(this.getGrammarToken(recognizer.getCurrentToken())); // throw exception; throw new InputMismatchException(recognizer); }
[ "@", "Override", "public", "Token", "recoverInline", "(", "Parser", "recognizer", ")", "throws", "RecognitionException", "{", "// SINGLE TOKEN DELETION\r", "Token", "matchedSymbol", "=", "singleTokenDeletion", "(", "recognizer", ")", ";", "if", "(", "matchedSymbol", "!=", "null", ")", "{", "// we have deleted the extra token.\r", "// now, move past ttype token as if all were ok\r", "recognizer", ".", "consume", "(", ")", ";", "return", "matchedSymbol", ";", "}", "// SINGLE TOKEN INSERTION\r", "if", "(", "singleTokenInsertion", "(", "recognizer", ")", ")", "{", "return", "getMissingSymbol", "(", "recognizer", ")", ";", "}", "//\t\tBeetlException exception = new BeetlParserException(BeetlException.PARSER_MISS_ERROR);\r", "//\t\texception.pushToken(this.getGrammarToken(recognizer.getCurrentToken()));\r", "//\t\tthrow exception;\r", "throw", "new", "InputMismatchException", "(", "recognizer", ")", ";", "}" ]
Make sure we don't attempt to recover inline; if the parser successfully recovers, it won't throw an exception.
[ "Make", "sure", "we", "don", "t", "attempt", "to", "recover", "inline", ";", "if", "the", "parser", "successfully", "recovers", "it", "won", "t", "throw", "an", "exception", "." ]
f32f729ad238079df5aca6e38a3c3ba0a55c78d6
https://github.com/javamonkey/beetl2.0/blob/f32f729ad238079df5aca6e38a3c3ba0a55c78d6/beetl-core/src/main/java/org/beetl/core/parser/BeetlAntlrErrorStrategy.java#L186-L209
158,595
javamonkey/beetl2.0
beetl-core/src/main/java/org/beetl/core/AntlrProgramBuilder.java
AntlrProgramBuilder.parseDirectiveStatement
protected DirectiveStatement parseDirectiveStatement(DirectiveStContext node) { DirectiveStContext stContext = (DirectiveStContext) node; DirectiveExpContext direExp = stContext.directiveExp(); Token token = direExp.Identifier().getSymbol(); String directive = token.getText().toLowerCase().intern(); TerminalNode value = direExp.StringLiteral(); List<TerminalNode> idNodeList = null; DirectiveExpIDListContext directExpidLisCtx = direExp.directiveExpIDList(); if (directExpidLisCtx != null) { idNodeList = directExpidLisCtx.Identifier(); } Set<String> idList = null; DirectiveStatement ds = null; if (value != null) { String idListValue = this.getStringValue(value.getText()); idList = new HashSet(Arrays.asList(idListValue.split(","))); ds = new DirectiveStatement(directive, idList, this.getBTToken(token)); } else if (idNodeList != null) { idList = new HashSet<String>(); for (TerminalNode t : idNodeList) { idList.add(t.getText()); } ds = new DirectiveStatement(directive, idList, this.getBTToken(token)); } else { ds = new DirectiveStatement(directive, Collections.EMPTY_SET, this.getBTToken(token)); } if (directive.equals("dynamic")) { if (ds.getIdList().size() == 0) { data.allDynamic = true; } else { data.dynamicObjectSet = ds.getIdList(); } ds = new DirectiveStatement(directive, Collections.EMPTY_SET, this.getBTToken(token)); return ds; } else if (directive.equalsIgnoreCase("safe_output_open".intern())) { this.pbCtx.isSafeOutput = true; return ds; } else if (directive.equalsIgnoreCase("safe_output_close".intern())) { this.pbCtx.isSafeOutput = false; return ds; } else { return ds; } }
java
protected DirectiveStatement parseDirectiveStatement(DirectiveStContext node) { DirectiveStContext stContext = (DirectiveStContext) node; DirectiveExpContext direExp = stContext.directiveExp(); Token token = direExp.Identifier().getSymbol(); String directive = token.getText().toLowerCase().intern(); TerminalNode value = direExp.StringLiteral(); List<TerminalNode> idNodeList = null; DirectiveExpIDListContext directExpidLisCtx = direExp.directiveExpIDList(); if (directExpidLisCtx != null) { idNodeList = directExpidLisCtx.Identifier(); } Set<String> idList = null; DirectiveStatement ds = null; if (value != null) { String idListValue = this.getStringValue(value.getText()); idList = new HashSet(Arrays.asList(idListValue.split(","))); ds = new DirectiveStatement(directive, idList, this.getBTToken(token)); } else if (idNodeList != null) { idList = new HashSet<String>(); for (TerminalNode t : idNodeList) { idList.add(t.getText()); } ds = new DirectiveStatement(directive, idList, this.getBTToken(token)); } else { ds = new DirectiveStatement(directive, Collections.EMPTY_SET, this.getBTToken(token)); } if (directive.equals("dynamic")) { if (ds.getIdList().size() == 0) { data.allDynamic = true; } else { data.dynamicObjectSet = ds.getIdList(); } ds = new DirectiveStatement(directive, Collections.EMPTY_SET, this.getBTToken(token)); return ds; } else if (directive.equalsIgnoreCase("safe_output_open".intern())) { this.pbCtx.isSafeOutput = true; return ds; } else if (directive.equalsIgnoreCase("safe_output_close".intern())) { this.pbCtx.isSafeOutput = false; return ds; } else { return ds; } }
[ "protected", "DirectiveStatement", "parseDirectiveStatement", "(", "DirectiveStContext", "node", ")", "{", "DirectiveStContext", "stContext", "=", "(", "DirectiveStContext", ")", "node", ";", "DirectiveExpContext", "direExp", "=", "stContext", ".", "directiveExp", "(", ")", ";", "Token", "token", "=", "direExp", ".", "Identifier", "(", ")", ".", "getSymbol", "(", ")", ";", "String", "directive", "=", "token", ".", "getText", "(", ")", ".", "toLowerCase", "(", ")", ".", "intern", "(", ")", ";", "TerminalNode", "value", "=", "direExp", ".", "StringLiteral", "(", ")", ";", "List", "<", "TerminalNode", ">", "idNodeList", "=", "null", ";", "DirectiveExpIDListContext", "directExpidLisCtx", "=", "direExp", ".", "directiveExpIDList", "(", ")", ";", "if", "(", "directExpidLisCtx", "!=", "null", ")", "{", "idNodeList", "=", "directExpidLisCtx", ".", "Identifier", "(", ")", ";", "}", "Set", "<", "String", ">", "idList", "=", "null", ";", "DirectiveStatement", "ds", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "String", "idListValue", "=", "this", ".", "getStringValue", "(", "value", ".", "getText", "(", ")", ")", ";", "idList", "=", "new", "HashSet", "(", "Arrays", ".", "asList", "(", "idListValue", ".", "split", "(", "\",\"", ")", ")", ")", ";", "ds", "=", "new", "DirectiveStatement", "(", "directive", ",", "idList", ",", "this", ".", "getBTToken", "(", "token", ")", ")", ";", "}", "else", "if", "(", "idNodeList", "!=", "null", ")", "{", "idList", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "TerminalNode", "t", ":", "idNodeList", ")", "{", "idList", ".", "add", "(", "t", ".", "getText", "(", ")", ")", ";", "}", "ds", "=", "new", "DirectiveStatement", "(", "directive", ",", "idList", ",", "this", ".", "getBTToken", "(", "token", ")", ")", ";", "}", "else", "{", "ds", "=", "new", "DirectiveStatement", "(", "directive", ",", "Collections", ".", "EMPTY_SET", ",", "this", ".", "getBTToken", "(", "token", ")", ")", ";", "}", "if", "(", "directive", ".", "equals", "(", "\"dynamic\"", ")", ")", "{", "if", "(", "ds", ".", "getIdList", "(", ")", ".", "size", "(", ")", "==", "0", ")", "{", "data", ".", "allDynamic", "=", "true", ";", "}", "else", "{", "data", ".", "dynamicObjectSet", "=", "ds", ".", "getIdList", "(", ")", ";", "}", "ds", "=", "new", "DirectiveStatement", "(", "directive", ",", "Collections", ".", "EMPTY_SET", ",", "this", ".", "getBTToken", "(", "token", ")", ")", ";", "return", "ds", ";", "}", "else", "if", "(", "directive", ".", "equalsIgnoreCase", "(", "\"safe_output_open\"", ".", "intern", "(", ")", ")", ")", "{", "this", ".", "pbCtx", ".", "isSafeOutput", "=", "true", ";", "return", "ds", ";", "}", "else", "if", "(", "directive", ".", "equalsIgnoreCase", "(", "\"safe_output_close\"", ".", "intern", "(", ")", ")", ")", "{", "this", ".", "pbCtx", ".", "isSafeOutput", "=", "false", ";", "return", "ds", ";", "}", "else", "{", "return", "ds", ";", "}", "}" ]
directive dynamic xxx,yy @param node @return
[ "directive", "dynamic", "xxx", "yy" ]
f32f729ad238079df5aca6e38a3c3ba0a55c78d6
https://github.com/javamonkey/beetl2.0/blob/f32f729ad238079df5aca6e38a3c3ba0a55c78d6/beetl-core/src/main/java/org/beetl/core/AntlrProgramBuilder.java#L852-L921
158,596
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/naming/NamingConventions.java
NamingConventions.determineNamingConvention
public static NamingConvention determineNamingConvention( TypeElement type, Iterable<ExecutableElement> methods, Messager messager, Types types) { ExecutableElement beanMethod = null; ExecutableElement prefixlessMethod = null; for (ExecutableElement method : methods) { switch (methodNameConvention(method)) { case BEAN: beanMethod = firstNonNull(beanMethod, method); break; case PREFIXLESS: prefixlessMethod = firstNonNull(prefixlessMethod, method); break; default: break; } } if (prefixlessMethod != null) { if (beanMethod != null) { messager.printMessage( ERROR, "Type contains an illegal mix of get-prefixed and unprefixed getter methods, e.g. '" + beanMethod.getSimpleName() + "' and '" + prefixlessMethod.getSimpleName() + "'", type); } return new PrefixlessConvention(messager, types); } else { return new BeanConvention(messager, types); } }
java
public static NamingConvention determineNamingConvention( TypeElement type, Iterable<ExecutableElement> methods, Messager messager, Types types) { ExecutableElement beanMethod = null; ExecutableElement prefixlessMethod = null; for (ExecutableElement method : methods) { switch (methodNameConvention(method)) { case BEAN: beanMethod = firstNonNull(beanMethod, method); break; case PREFIXLESS: prefixlessMethod = firstNonNull(prefixlessMethod, method); break; default: break; } } if (prefixlessMethod != null) { if (beanMethod != null) { messager.printMessage( ERROR, "Type contains an illegal mix of get-prefixed and unprefixed getter methods, e.g. '" + beanMethod.getSimpleName() + "' and '" + prefixlessMethod.getSimpleName() + "'", type); } return new PrefixlessConvention(messager, types); } else { return new BeanConvention(messager, types); } }
[ "public", "static", "NamingConvention", "determineNamingConvention", "(", "TypeElement", "type", ",", "Iterable", "<", "ExecutableElement", ">", "methods", ",", "Messager", "messager", ",", "Types", "types", ")", "{", "ExecutableElement", "beanMethod", "=", "null", ";", "ExecutableElement", "prefixlessMethod", "=", "null", ";", "for", "(", "ExecutableElement", "method", ":", "methods", ")", "{", "switch", "(", "methodNameConvention", "(", "method", ")", ")", "{", "case", "BEAN", ":", "beanMethod", "=", "firstNonNull", "(", "beanMethod", ",", "method", ")", ";", "break", ";", "case", "PREFIXLESS", ":", "prefixlessMethod", "=", "firstNonNull", "(", "prefixlessMethod", ",", "method", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "if", "(", "prefixlessMethod", "!=", "null", ")", "{", "if", "(", "beanMethod", "!=", "null", ")", "{", "messager", ".", "printMessage", "(", "ERROR", ",", "\"Type contains an illegal mix of get-prefixed and unprefixed getter methods, e.g. '\"", "+", "beanMethod", ".", "getSimpleName", "(", ")", "+", "\"' and '\"", "+", "prefixlessMethod", ".", "getSimpleName", "(", ")", "+", "\"'\"", ",", "type", ")", ";", "}", "return", "new", "PrefixlessConvention", "(", "messager", ",", "types", ")", ";", "}", "else", "{", "return", "new", "BeanConvention", "(", "messager", ",", "types", ")", ";", "}", "}" ]
Determine whether the user has followed bean-like naming convention or not.
[ "Determine", "whether", "the", "user", "has", "followed", "bean", "-", "like", "naming", "convention", "or", "not", "." ]
d5a222f90648aece135da4b971c55a60afe8649c
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/naming/NamingConventions.java#L37-L68
158,597
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/source/SourceBuilder.java
SourceBuilder.add
public SourceBuilder add(String fmt, Object... args) { TemplateApplier.withParams(args).onText(source::append).onParam(this::add).parse(fmt); return this; }
java
public SourceBuilder add(String fmt, Object... args) { TemplateApplier.withParams(args).onText(source::append).onParam(this::add).parse(fmt); return this; }
[ "public", "SourceBuilder", "add", "(", "String", "fmt", ",", "Object", "...", "args", ")", "{", "TemplateApplier", ".", "withParams", "(", "args", ")", ".", "onText", "(", "source", "::", "append", ")", ".", "onParam", "(", "this", "::", "add", ")", ".", "parse", "(", "fmt", ")", ";", "return", "this", ";", "}" ]
Appends formatted text to the source. <p>Formatting supports {@code %s} and {@code %n$s}. Most args are converted according to their {@link Object#toString()} method, except that:<ul> <li> {@link Package} and {@link PackageElement} instances use their fully-qualified names (no "package " prefix). <li> {@link Class}, {@link TypeElement}, {@link DeclaredType} and {@link QualifiedName} instances use their qualified names where necessary, or shorter versions if a suitable import line can be added. <li> {@link Excerpt} instances have {@link Excerpt#addTo(SourceBuilder)} called. </ul>
[ "Appends", "formatted", "text", "to", "the", "source", "." ]
d5a222f90648aece135da4b971c55a60afe8649c
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/SourceBuilder.java#L103-L106
158,598
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/source/SourceBuilder.java
SourceBuilder.addLine
public SourceBuilder addLine(String fmt, Object... args) { add(fmt, args); source.append(LINE_SEPARATOR); return this; }
java
public SourceBuilder addLine(String fmt, Object... args) { add(fmt, args); source.append(LINE_SEPARATOR); return this; }
[ "public", "SourceBuilder", "addLine", "(", "String", "fmt", ",", "Object", "...", "args", ")", "{", "add", "(", "fmt", ",", "args", ")", ";", "source", ".", "append", "(", "LINE_SEPARATOR", ")", ";", "return", "this", ";", "}" ]
Appends a formatted line of code to the source. <p>Formatting supports {@code %s} and {@code %n$s}. Most args are converted according to their {@link Object#toString()} method, except that:<ul> <li> {@link Package} and {@link PackageElement} instances use their fully-qualified names (no "package " prefix). <li> {@link Class}, {@link TypeElement}, {@link DeclaredType} and {@link QualifiedName} instances use their qualified names where necessary, or shorter versions if a suitable import line can be added. <li> {@link Excerpt} instances have {@link Excerpt#addTo(SourceBuilder)} called. </ul>
[ "Appends", "a", "formatted", "line", "of", "code", "to", "the", "source", "." ]
d5a222f90648aece135da4b971c55a60afe8649c
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/SourceBuilder.java#L129-L133
158,599
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/Analyser.java
Analyser.findUnderriddenMethods
private Map<StandardMethod, UnderrideLevel> findUnderriddenMethods( Iterable<ExecutableElement> methods) { Map<StandardMethod, ExecutableElement> standardMethods = new LinkedHashMap<>(); for (ExecutableElement method : methods) { Optional<StandardMethod> standardMethod = maybeStandardMethod(method); if (standardMethod.isPresent() && isUnderride(method)) { standardMethods.put(standardMethod.get(), method); } } if (standardMethods.containsKey(StandardMethod.EQUALS) != standardMethods.containsKey(StandardMethod.HASH_CODE)) { ExecutableElement underriddenMethod = standardMethods.containsKey(StandardMethod.EQUALS) ? standardMethods.get(StandardMethod.EQUALS) : standardMethods.get(StandardMethod.HASH_CODE); messager.printMessage(ERROR, "hashCode and equals must be implemented together on FreeBuilder types", underriddenMethod); } ImmutableMap.Builder<StandardMethod, UnderrideLevel> result = ImmutableMap.builder(); for (StandardMethod standardMethod : standardMethods.keySet()) { if (standardMethods.get(standardMethod).getModifiers().contains(Modifier.FINAL)) { result.put(standardMethod, UnderrideLevel.FINAL); } else { result.put(standardMethod, UnderrideLevel.OVERRIDEABLE); } } return result.build(); }
java
private Map<StandardMethod, UnderrideLevel> findUnderriddenMethods( Iterable<ExecutableElement> methods) { Map<StandardMethod, ExecutableElement> standardMethods = new LinkedHashMap<>(); for (ExecutableElement method : methods) { Optional<StandardMethod> standardMethod = maybeStandardMethod(method); if (standardMethod.isPresent() && isUnderride(method)) { standardMethods.put(standardMethod.get(), method); } } if (standardMethods.containsKey(StandardMethod.EQUALS) != standardMethods.containsKey(StandardMethod.HASH_CODE)) { ExecutableElement underriddenMethod = standardMethods.containsKey(StandardMethod.EQUALS) ? standardMethods.get(StandardMethod.EQUALS) : standardMethods.get(StandardMethod.HASH_CODE); messager.printMessage(ERROR, "hashCode and equals must be implemented together on FreeBuilder types", underriddenMethod); } ImmutableMap.Builder<StandardMethod, UnderrideLevel> result = ImmutableMap.builder(); for (StandardMethod standardMethod : standardMethods.keySet()) { if (standardMethods.get(standardMethod).getModifiers().contains(Modifier.FINAL)) { result.put(standardMethod, UnderrideLevel.FINAL); } else { result.put(standardMethod, UnderrideLevel.OVERRIDEABLE); } } return result.build(); }
[ "private", "Map", "<", "StandardMethod", ",", "UnderrideLevel", ">", "findUnderriddenMethods", "(", "Iterable", "<", "ExecutableElement", ">", "methods", ")", "{", "Map", "<", "StandardMethod", ",", "ExecutableElement", ">", "standardMethods", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "for", "(", "ExecutableElement", "method", ":", "methods", ")", "{", "Optional", "<", "StandardMethod", ">", "standardMethod", "=", "maybeStandardMethod", "(", "method", ")", ";", "if", "(", "standardMethod", ".", "isPresent", "(", ")", "&&", "isUnderride", "(", "method", ")", ")", "{", "standardMethods", ".", "put", "(", "standardMethod", ".", "get", "(", ")", ",", "method", ")", ";", "}", "}", "if", "(", "standardMethods", ".", "containsKey", "(", "StandardMethod", ".", "EQUALS", ")", "!=", "standardMethods", ".", "containsKey", "(", "StandardMethod", ".", "HASH_CODE", ")", ")", "{", "ExecutableElement", "underriddenMethod", "=", "standardMethods", ".", "containsKey", "(", "StandardMethod", ".", "EQUALS", ")", "?", "standardMethods", ".", "get", "(", "StandardMethod", ".", "EQUALS", ")", ":", "standardMethods", ".", "get", "(", "StandardMethod", ".", "HASH_CODE", ")", ";", "messager", ".", "printMessage", "(", "ERROR", ",", "\"hashCode and equals must be implemented together on FreeBuilder types\"", ",", "underriddenMethod", ")", ";", "}", "ImmutableMap", ".", "Builder", "<", "StandardMethod", ",", "UnderrideLevel", ">", "result", "=", "ImmutableMap", ".", "builder", "(", ")", ";", "for", "(", "StandardMethod", "standardMethod", ":", "standardMethods", ".", "keySet", "(", ")", ")", "{", "if", "(", "standardMethods", ".", "get", "(", "standardMethod", ")", ".", "getModifiers", "(", ")", ".", "contains", "(", "Modifier", ".", "FINAL", ")", ")", "{", "result", ".", "put", "(", "standardMethod", ",", "UnderrideLevel", ".", "FINAL", ")", ";", "}", "else", "{", "result", ".", "put", "(", "standardMethod", ",", "UnderrideLevel", ".", "OVERRIDEABLE", ")", ";", "}", "}", "return", "result", ".", "build", "(", ")", ";", "}" ]
Find any standard methods the user has 'underridden' in their type.
[ "Find", "any", "standard", "methods", "the", "user", "has", "underridden", "in", "their", "type", "." ]
d5a222f90648aece135da4b971c55a60afe8649c
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/Analyser.java#L249-L276