List of usage examples for com.liferay.portal.kernel.util StringPool DASH
String DASH
To view the source code for com.liferay.portal.kernel.util StringPool DASH.
Click Source Link
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; }/*w w w . j a v a2 s . c o m*/ return name; }
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 . j a va 2 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.JIRAIssueImpl.java
License:Open Source License
public String getKey() { if (Validator.isNotNull(_key)) { return _key; }// w ww.j av a2s . c om try { JIRAProject jiraProject = JIRAProjectLocalServiceUtil.getJIRAProject(getProjectId()); _key = jiraProject.getKey() + StringPool.DASH + getIssueNumber(); } catch (Exception e) { } return _key; }
From source file:com.liferay.socialcoding.model.impl.SVNRevisionImpl.java
License:Open Source License
public Object[] getJIRAIssueAndComments() { JIRAIssue jiraIssue = null;/*from w ww. j av a 2s. c o 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.socialcoding.service.persistence.impl.JIRAIssueFinderImpl.java
License:Open Source License
public JIRAIssue findByKey(String jiraIssueKey) { String[] jiraIssueKeyArray = StringUtil.split(jiraIssueKey, StringPool.DASH); if (jiraIssueKeyArray.length != 2) { return null; }// ww w . j a va 2 s.c o m Session session = null; try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_KEY); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addEntity("jiraissue", JIRAIssueImpl.class); QueryPos qPos = QueryPos.getInstance(q); qPos.add(jiraIssueKeyArray[1]); qPos.add(jiraIssueKeyArray[0]); List<JIRAIssue> list = q.list(); if (list.isEmpty()) { return null; } return list.get(0); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.sync.util.JSONWebServiceActionParametersMap.java
License:Open Source License
@Override public Object put(String key, Object value) { int pos = key.indexOf(CharPool.COLON); if (key.startsWith(StringPool.DASH)) { key = key.substring(1);// www . ja v a 2 s . c om value = null; } else if (key.startsWith(StringPool.PLUS)) { key = key.substring(1); String typeName = null; if (pos != -1) { typeName = key.substring(pos); key = key.substring(0, pos - 1); } else { if (value != null) { typeName = value.toString(); value = Void.TYPE; } } if (typeName != null) { if (_parameterTypes == null) { _parameterTypes = new HashMap<>(); } _parameterTypes.put(key, typeName); } if (Validator.isNull(GetterUtil.getString(value))) { value = Void.TYPE; } } else if (pos != -1) { String typeName = key.substring(pos + 1); key = key.substring(0, pos); if (_parameterTypes == null) { _parameterTypes = new HashMap<>(); } _parameterTypes.put(key, typeName); if (Validator.isNull(GetterUtil.getString(value))) { value = Void.TYPE; } } pos = key.indexOf(CharPool.PERIOD); if (pos != -1) { String baseName = key.substring(0, pos); String innerName = key.substring(pos + 1); if (_innerParameters == null) { _innerParameters = new HashMap<>(); } List<NameValue<String, Object>> values = _innerParameters.get(baseName); if (values == null) { values = new ArrayList<>(); _innerParameters.put(baseName, values); } values.add(new NameValue<String, Object>(innerName, value)); return value; } return super.put(key, value); }
From source file:com.liferay.tool.datamanipulator.handler.BaseHandler.java
License:Open Source License
public String getDisplayFieldName(String postfix) { return _displayFieldPreString + StringPool.DASH + postfix; }
From source file:com.liferay.tool.datamanipulator.handler.content.JournalArticleHandler.java
License:Open Source License
@Override protected Map<String, Object> getAddEntrySpecifiedArgs(RequestContext requestContext) throws Exception { boolean autoArticleId = requestContext.getBoolean(getDisplayFieldName(AUTO_ARTICLE_ID)); String articleId;// w w w . j a va 2s.c o m if (autoArticleId) { articleId = StringPool.BLANK; } else { StringBuilder sb = new StringBuilder(); sb.append(requestContext.getString("entryName")); sb.append(requestContext.getString("entryCount")); sb.append("-ARTICLE-ID-"); sb.append(RandomUtil.nextString()); articleId = sb.toString().toUpperCase(); articleId = articleId.replace(StringPool.SPACE, StringPool.DASH); } long structureId = requestContext.getLong(getDisplayFieldName(STRUCTURE_LIST)); long templateId = 0; String structureKey = StringPool.BLANK; String templateKey = StringPool.BLANK; if (structureId != 0) { DDMStructure strucrute = DDMStructureLocalServiceUtil.getStructure(structureId); structureKey = strucrute.getStructureKey(); List<DDMTemplate> templates = DDMTemplateLocalServiceUtil.getTemplates(structureId); DDMTemplate template = templates.get(0); if (Validator.isNotNull(templates) && templates.size() > 0) { templateId = template.getTemplateId(); } if (templateId != 0) { try { templateKey = (String) BeanUtil.getProperty(template, "templateKey"); } catch (Exception e) { templateKey = String.valueOf(templateId); } } } //int index = RandomUtil.nextInt(JournalArticleConstants.TYPES.length); //String type = JournalArticleConstants.TYPES[index]; Map<String, Object> args = new HashMap<String, Object>(); args.put("articleId", articleId); args.put("articleURL", requestContext.getString("createURL")); args.put("autoArticleId", autoArticleId); args.put("classNameId", (long) 0); args.put("classPK", (long) 0); args.put("content", StringUtil.getLocalizedContent("")); args.put("layoutUuid", null); //args.put("neverExpire", RandomUtil.nextBoolean()); args.put("neverExpire", true); //args.put("neverReview", RandomUtil.nextBoolean()); args.put("neverReview", true); args.put("structureId", structureKey); args.put("structureKey", structureKey); args.put("ddmStructureKey", structureKey); args.put("templateId", structureKey); args.put("templateKey", templateKey); args.put("ddmTemplateKey", templateKey); //args.put("type", type); args.put("version", JournalArticleConstants.VERSION_DEFAULT); return args; }
From source file:com.liferay.tool.datamanipulator.handler.portal.UserHandler.java
License:Open Source License
@Override protected Map<String, Object> getAddEntrySpecifiedArgs(RequestContext requestContext) throws Exception { StringBuilder postSB = new StringBuilder(3); postSB.append(requestContext.getString("entryCount")); postSB.append(StringPool.DASH); postSB.append(requestContext.getRandomString()); String postString = postSB.toString(); String screenName = "test-" + postString; Map<String, Object> args = new HashMap<String, Object>(16); args.put("creatorUserId", requestContext.getUserId()); args.put("password1", "test"); args.put("password2", "test"); args.put("screenName", screenName); args.put("emailAddress", screenName + "@liferaz.com"); args.put("firstName", "Test" + postString); args.put("lastName", "Test" + postString); args.put("birthdayMonth", 10); args.put("birthdayDay", 16); args.put("birthdayYear", 1984); args.put("male", true); args.put("jobTitle", "QA Engineer"); args.put("groupIds", requestContext.getGroupIds()); args.put("organizationIds", requestContext.getOrganizationIds()); args.put("roleIds", requestContext.getRoleIds()); args.put("userGroupIds", requestContext.getUserGroupIds()); return args;// w ww . j av a2 s. c o m }
From source file:com.liferay.tool.datamanipulator.util.StringUtil.java
License:Open Source License
public static String normalizeFriendlyURL(String friendlyURL) { if (Validator.isNull(friendlyURL)) { return friendlyURL; }/*www . j av a 2 s.c o m*/ friendlyURL = friendlyURL.toLowerCase(); friendlyURL = Normalizer.normalize(friendlyURL, Normalizer.Form.NFD); friendlyURL = friendlyURL.replaceAll("[^\\p{ASCII}]", ""); friendlyURL = friendlyURL.replaceAll("[^a-z0-9./_-]", StringPool.DASH); friendlyURL = friendlyURL.replaceAll("(-)\\1+", StringPool.DASH); return friendlyURL; }