List of usage examples for com.liferay.portal.kernel.util StringPool SPACE
String SPACE
To view the source code for com.liferay.portal.kernel.util StringPool SPACE.
Click Source Link
From source file:com.liferay.portlet.wiki.translators.MediaWikiToCreoleTranslator.java
License:Open Source License
@Override protected String postProcess(String content) { // LEP-6118//ww w . j a v a 2 s .com Matcher matcher = Pattern.compile("^=([^=]+)=", Pattern.MULTILINE).matcher(content); if (matcher.find()) { content = runRegexp(content, "^===([^=]+)===", "====$1===="); content = runRegexp(content, "^==([^=]+)==", "===$1==="); content = runRegexp(content, "^=([^=]+)=", "==$1=="); } // Remove HTML tags for (int i = 0; i < _HTML_TAGS.length; i++) { content = content.replaceAll(_HTML_TAGS[i], StringPool.BLANK); } // Images matcher = Pattern.compile("\\[{2}Image:([^\\]]*)\\]{2}", Pattern.DOTALL).matcher(content); StringBuffer sb = new StringBuffer(content); int offset = 0; while (matcher.find()) { String image = "{{" + MediaWikiImporter.SHARED_IMAGES_TITLE + "/" + matcher.group(1).toLowerCase() + "}}"; sb.replace(matcher.start(0) + offset, matcher.end(0) + offset, image); offset += MediaWikiImporter.SHARED_IMAGES_TITLE.length() - 5; } content = sb.toString(); // Remove underscores from links matcher = Pattern.compile("\\[{2}([^\\]]*)\\]{2}", Pattern.DOTALL).matcher(content); sb = new StringBuffer(content); while (matcher.find()) { String link = matcher.group(1).replace(StringPool.UNDERLINE, StringPool.SPACE); sb.replace(matcher.start(1), matcher.end(1), link); } return TABLE_OF_CONTENTS + super.postProcess(sb.toString()); }
From source file:com.liferay.portletbox.ServiceUtil.java
License:BSD License
public static Group addActiveOpenGroup(long userId, String name) throws Exception { boolean active = true; String description = name;/* www . j ava2s. c o m*/ String friendlyURL = StringPool.FORWARD_SLASH + name.toLowerCase().replaceAll(StringPool.SPACE, StringPool.DASH); boolean siteFlag = true; int type = GroupConstants.TYPE_SITE_OPEN; return GroupLocalServiceUtil.addGroup(userId, (String) null, 0L, name, description, type, friendlyURL, siteFlag, active, new ServiceContext()); }
From source file:com.liferay.projects.dashboard.business.unit.service.persistence.ProjectBUPK.java
License:Open Source License
@Override public String toString() { StringBundler sb = new StringBundler(10); sb.append(StringPool.OPEN_CURLY_BRACE); sb.append("businessUnitId"); sb.append(StringPool.EQUAL);/*from w w w . j a va 2s. c om*/ sb.append(businessUnitId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("projectId"); sb.append(StringPool.EQUAL); sb.append(projectId); sb.append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); }
From source file:com.liferay.resourcesimporter.util.FileSystemImporter.java
License:Open Source License
protected String getJournalId(String fileName) { String id = FileUtil.stripExtension(fileName); id = StringUtil.toUpperCase(id);/* w w w. ja v a 2 s. co m*/ return StringUtil.replace(id, StringPool.SPACE, StringPool.DASH); }
From source file:com.liferay.resourcesimporter.util.FileSystemImporter.java
License:Open Source License
protected String getKey(String name) { name = StringUtil.replace(name, StringPool.SPACE, StringPool.DASH); name = StringUtil.toUpperCase(name); if (appendVersion) { name = name + StringPool.DASH + version; }/*from w ww . j ava 2 s . c om*/ return name; }
From source file:com.liferay.salesforce.query.ConditionGroup.java
License:Open Source License
@Override public String toString() { StringBundler sb = new StringBundler(); for (int i = 0; i < _conditions.size(); i++) { Condition condition = _conditions.get(i); if (condition.isGroup()) { sb.append(StringPool.OPEN_PARENTHESIS); }//ww w .ja v a 2 s . c o m sb.append(condition); if (condition.isGroup()) { sb.append(StringPool.CLOSE_PARENTHESIS); } if ((i + 1) != _conditions.size()) { sb.append(StringPool.SPACE); } } return sb.toString(); }
From source file:com.liferay.sample.service.persistence.AddressPK.java
License:Open Source License
@Override public String toString() { StringBundler sb = new StringBundler(10); sb.append(StringPool.OPEN_CURLY_BRACE); sb.append("addressId"); sb.append(StringPool.EQUAL);// ww w. j a v a2s . c o m sb.append(addressId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("employeeId"); sb.append(StringPool.EQUAL); sb.append(employeeId); sb.append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); }
From source file:com.liferay.socialcoding.jira.social.JIRAActivityInterpreter.java
License:Open Source License
protected String interpretJIRAChangeItem(JSONObject jiraChangeItem, ServiceContext serviceContext) { String field = jiraChangeItem.getString("field"); field = StringUtil.replace(StringUtil.toLowerCase(field), StringPool.SPACE, StringPool.DASH); String newString = jiraChangeItem.getString("newString"); String newValue = jiraChangeItem.getString("newValue"); if (Validator.isNull(newString)) { return StringPool.BLANK; }//from ww w. ja v a2 s . c o m StringBundler sb = new StringBundler(2); if (field.equals("description") || field.equals("summary")) { sb.append(serviceContext.translate("activity-social-coding-jira-add-change-" + field)); sb.append("<br />"); } else if (field.equals("assignee") || field.equals("attachment") || field.equals("fix-version") || field.equals("issuetype") || field.equals("priority") || field.equals("resolution") || field.equals("status") || field.equals("version")) { sb.append(serviceContext.translate("activity-social-coding-jira-add-change-" + field, new Object[] { HtmlUtil.escape(newString) })); sb.append("<br />"); } else if (field.equals("link") && newValue.startsWith("LEP-")) { sb.append(serviceContext.translate("activity-social-coding-jira-add-change-" + field, new Object[] { HtmlUtil.escape(newValue) })); sb.append("<br />"); } return sb.toString(); }
From source file:com.liferay.socialcoding.model.impl.SVNRevisionImpl.java
License:Open Source License
public Object[] getJIRAIssueAndComments() { JIRAIssue jiraIssue = null;//from ww w.j ava2s. co m String comments = getComments(); if ( // LEP comments.startsWith(_LEP_PREFIX_1) || comments.startsWith(_LEP_PREFIX_2) || comments.startsWith(_LEP_PREFIX_3) || // LPE comments.startsWith(_LPE_PREFIX_1) || comments.startsWith(_LPE_PREFIX_2) || comments.startsWith(_LPE_PREFIX_3) || // LPS comments.startsWith(_LPS_PREFIX_1) || comments.startsWith(_LPS_PREFIX_2) || comments.startsWith(_LPS_PREFIX_3)) { comments = StringUtil.replace(comments, StringPool.NEW_LINE, StringPool.SPACE); int pos = comments.indexOf(StringPool.SPACE); if (pos == -1) { pos = comments.length(); } String keyPrefix = null; String keyId = null; // LPE if (comments.startsWith(_LEP_PREFIX_1)) { keyPrefix = "LEP"; keyId = comments.substring(_LEP_PREFIX_1.length(), pos); } else if (comments.startsWith(_LEP_PREFIX_2)) { keyPrefix = "LEP"; keyId = comments.substring(_LEP_PREFIX_2.length(), pos); } else if (comments.startsWith(_LEP_PREFIX_3)) { keyPrefix = "LEP"; keyId = comments.substring(_LEP_PREFIX_3.length(), pos); } // LPE if (comments.startsWith(_LPE_PREFIX_1)) { keyPrefix = "LPE"; keyId = comments.substring(_LPE_PREFIX_1.length(), pos); } else if (comments.startsWith(_LPE_PREFIX_2)) { keyPrefix = "LPE"; keyId = comments.substring(_LPE_PREFIX_2.length(), pos); } else if (comments.startsWith(_LPE_PREFIX_3)) { keyPrefix = "LPE"; keyId = comments.substring(_LPE_PREFIX_3.length(), pos); } // LPS if (comments.startsWith(_LPS_PREFIX_1)) { keyPrefix = "LPS"; keyId = comments.substring(_LPS_PREFIX_1.length(), pos); } else if (comments.startsWith(_LPS_PREFIX_2)) { keyPrefix = "LPS"; keyId = comments.substring(_LPS_PREFIX_2.length(), pos); } else if (comments.startsWith(_LPS_PREFIX_3)) { keyPrefix = "LPS"; keyId = comments.substring(_LPS_PREFIX_3.length(), pos); } comments = comments.substring(pos).trim(); if (Validator.isNumber(keyId)) { try { jiraIssue = JIRAIssueLocalServiceUtil.getJIRAIssue(keyPrefix + StringPool.DASH + keyId); } catch (Exception e) { } } if (jiraIssue != null) { return new Object[] { jiraIssue, comments }; } } return null; }
From source file:com.liferay.staging.bar.web.internal.theme.contributor.StagingBarTemplateContextContributor.java
License:Open Source License
@Override public void prepare(Map<String, Object> contextObjects, HttpServletRequest request) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); try {/*from ww w.ja v a 2s. c o m*/ if (_stagingProductNavigationControlMenuEntry.isShow(request)) { StringBuilder sb = new StringBuilder(); sb.append(GetterUtil.getString(contextObjects.get("bodyCssClass"))); sb.append(StringPool.SPACE); sb.append("has-staging-bar"); Group group = themeDisplay.getScopeGroup(); if (group.isStagingGroup()) { sb.append(StringPool.SPACE); sb.append("staging local-staging"); } else if (themeDisplay.isShowStagingIcon() && group.hasStagingGroup()) { sb.append(StringPool.SPACE); sb.append("live-view"); } else if (themeDisplay.isShowStagingIcon() && group.isStagedRemotely()) { sb.append(StringPool.SPACE); sb.append("staging remote-staging"); } contextObjects.put("bodyCssClass", sb.toString()); } } catch (PortalException pe) { _log.error(pe, pe); } contextObjects.put("show_staging", themeDisplay.isShowStagingIcon()); if (themeDisplay.isShowStagingIcon()) { contextObjects.put("staging_text", LanguageUtil.get(request, "staging")); } }