List of usage examples for org.apache.commons.lang StringUtils EMPTY
String EMPTY
To view the source code for org.apache.commons.lang StringUtils EMPTY.
Click Source Link
""
. From source file:fr.paris.lutece.plugins.workflow.modules.ticketing.service.task.TaskAssignTicketToMe.java
@Override public String processTicketingTask(int nIdResourceHistory, HttpServletRequest request, Locale locale) { String strTaskInformation = StringUtils.EMPTY; // We get the ticket to modify Ticket ticket = getTicket(nIdResourceHistory); if (ticket != null) { AssigneeUser assigneeUser = ticket.getAssigneeUser(); String strCurrentUser = null; if (assigneeUser == null) { assigneeUser = new AssigneeUser(); strCurrentUser = I18nService.getLocalizedString(MESSAGE_ASSIGN_TICKET_TO_ME_NO_CURRENT_USER, Locale.FRENCH); } else {/*from ww w. j a v a 2s . c o m*/ strCurrentUser = assigneeUser.getFirstname() + " " + assigneeUser.getLastname(); } AdminUser user = AdminUserService.getAdminUser(request); if ((user != null) && (user.getUserId() != assigneeUser.getAdminUserId())) { assigneeUser.setAdminUserId(user.getUserId()); assigneeUser.setEmail(user.getEmail()); assigneeUser.setFirstname(user.getFirstName()); assigneeUser.setLastname(user.getLastName()); ticket.setAssigneeUser(assigneeUser); List<Unit> unitsList = UnitHome.findByIdUser(user.getUserId()); if ((unitsList != null) && (unitsList.size() > 0)) { AssigneeUnit assigneeUnit = new AssigneeUnit(unitsList.get(0)); ticket.setAssigneeUnit(assigneeUnit); } TicketHome.update(ticket); strTaskInformation = MessageFormat.format( I18nService.getLocalizedString(MESSAGE_ASSIGN_TICKET_TO_ME_INFORMATION, Locale.FRENCH), strCurrentUser, assigneeUser.getFirstname() + " " + assigneeUser.getLastname()); } } return strTaskInformation; }
From source file:jenkins.plugins.coverity.CoverityTool.CovCaptureCommandTest.java
@Test public void customTestCommandTest_WithParseException() throws IOException, InterruptedException { TaOptionBlock taOptionBlock = new TaOptionBlockBuilder().withCustomTestCommand("\'").build(); CoverityPublisher publisher = new CoverityPublisherBuilder().withTaOptionBlock(taOptionBlock).build(); Command covCaptureCommand = new CovCaptureCommand(build, launcher, listener, publisher, StringUtils.EMPTY, envVars);/* w ww .j a va 2 s . com*/ try { covCaptureCommand.runCommand(); fail("RuntimeException should have been thrown"); } catch (RuntimeException e) { assertEquals("ParseException occurred during tokenizing the cov capture custom test command.", e.getMessage()); } }
From source file:com.alibaba.otter.manager.biz.monitor.impl.ProcessTimeoutRuleMonitor.java
private String checkTimeout(AlarmRule rule, Map<Long, Long> processTime) { if (!inPeriod(rule)) { return StringUtils.EMPTY; }//from w ww.ja v a 2s .c om String matchValue = rule.getMatchValue(); matchValue = StringUtils.substringBeforeLast(matchValue, "@"); Long maxSpentTime = Long.parseLong(StringUtils.trim(matchValue)); List<Long> timeoutProcessIds = new LinkedList<Long>(); Collections.sort(timeoutProcessIds); long maxSpent = 0; for (Entry<Long, Long> entry : processTime.entrySet()) { // maxSpentTime processTimevalue if (entry.getValue() >= (maxSpentTime * 1000)) { timeoutProcessIds.add(entry.getKey()); maxSpent = maxSpent > entry.getValue() ? maxSpent : entry.getValue(); } } if (CollectionUtils.isEmpty(timeoutProcessIds)) { return StringUtils.EMPTY; } String processIds = StringUtils.join(timeoutProcessIds, ","); String message = String.format(TIME_OUT_MESSAGE, rule.getPipelineId(), processIds, (maxSpent / 1000)); sendAlarm(rule, message); return message; }
From source file:com.chadekin.jadys.syntax.JadysSqlQueryBuilderTest.java
@Test public void shouldbBuildEmptyStatement() { // Act/* w w w . ja v a2 s.c o m*/ String sql = ((JadysSqlQueryBuilder) builder).build(); // Assert assertThat(sql, is(StringUtils.EMPTY)); }
From source file:com.tesora.dve.mysqlapi.repl.messages.MyUserVarLogEvent.java
String processVariableValue(ByteBuf cb) throws PEException { String value = StringUtils.EMPTY; valueType = MyItemResultCode.fromByte(cb.readByte()); valueCharSet = cb.readInt();/*ww w .j a v a 2 s. co m*/ valueLen = cb.readInt(); valueBytes = Unpooled.buffer(cb.readableBytes()).order(ByteOrder.LITTLE_ENDIAN); valueBytes.writeBytes(cb); switch (valueType) { case DECIMAL_RESULT: value = processDecimalValue(valueBytes, valueLen); break; case INT_RESULT: value = processIntValue(valueBytes, valueLen); break; case REAL_RESULT: value = Double.toString(valueBytes.readDouble()); break; case STRING_RESULT: value = "'" + StringUtils.replace( MysqlAPIUtils.readBytesAsString(valueBytes, valueLen, CharsetUtil.UTF_8), "'", "''") + "'"; break; case ROW_RESULT: default: throw new PEException( "Unsupported variable type '" + valueType + "' for variable '" + variableName + "'"); } return value; }
From source file:com.microsoft.alm.plugin.external.commands.InfoCommand.java
/** * Example of output// w w w. j a va 2s . c o m * Local information: * Local path: D:\tmp\TFVC_1\build.xml * Server path: $/TFVC_1/build.xml * Changeset: 18 * Change: none * Type: file * Server information: * Server path: $/TFVC_1/build.xml * Changeset: 18 * Deletion ID: 0 * Lock: none * Lock owner: * Last modified: Nov 18, 2016 11:10:20 AM * Type: file * File type: windows-1252 * Size: 1385 */ @Override public List<ItemInfo> parseOutput(final String stdout, final String stderr) { super.throwIfError(stderr); final List<ItemInfo> itemInfos = new ArrayList<ItemInfo>(itemPaths.size()); final Map<String, String> propertyMap = new HashMap<String, String>(15); final String[] output = getLines(stdout); String prefix = ""; for (final String line : output) { if (StringUtils.startsWithIgnoreCase(line, "local information:")) { // switch to local mode prefix = ""; if (!propertyMap.isEmpty()) { itemInfos.add(getItemInfo(propertyMap)); } propertyMap.clear(); } else if (StringUtils.startsWithIgnoreCase(line, "server information:")) { // switch to server mode prefix = "server "; } else if (StringUtils.isNotBlank(line)) { // add property final int colonPos = line.indexOf(":"); if (colonPos > 0) { final String key = prefix + line.substring(0, colonPos).trim().toLowerCase(); final String value = colonPos + 1 < line.length() ? line.substring(colonPos + 1).trim() : StringUtils.EMPTY; propertyMap.put(key, value); } } } if (!propertyMap.isEmpty()) { itemInfos.add(getItemInfo(propertyMap)); } return itemInfos; }
From source file:fr.paris.lutece.plugins.workflow.modules.ticketing.service.task.TaskQualifyTicket.java
@Override public String processTicketingTask(int nIdResourceHistory, HttpServletRequest request, Locale locale) { String strTaskInformation = StringUtils.EMPTY; StringBuilder sb = new StringBuilder(); // We get the ticket to modify Ticket ticket = getTicket(nIdResourceHistory); if (ticket != null) { boolean bPriorityChanged = false; String strPriority = request.getParameter(PARAMETER_TICKET_PRIORITY); int nPriority = Integer.parseInt(strPriority); TicketPriority priorityBefore = TicketPriority.valueOf(ticket.getPriority()); TicketPriority priorityAfter = TicketPriority.valueOf(nPriority); ticket.setPriority(nPriority);//from w w w .j a v a 2 s . co m String strCriticality = request.getParameter(PARAMETER_TICKET_CRITICALITY); int nCriticality = Integer.parseInt(strCriticality); TicketCriticality criticalityBefore = TicketCriticality.valueOf(ticket.getCriticality()); TicketCriticality criticalityAfter = TicketCriticality.valueOf(nCriticality); ticket.setCriticality(nCriticality); TicketHome.update(ticket); if (priorityBefore != priorityAfter) { sb.append( MessageFormat.format( I18nService.getLocalizedString(MESSAGE_QUALIFY_TICKET_INFORMATION_PRIORITY, Locale.FRENCH), priorityBefore.getLocalizedMessage(Locale.FRENCH), priorityAfter.getLocalizedMessage(Locale.FRENCH))); bPriorityChanged = true; } if (criticalityBefore != criticalityAfter) { if (bPriorityChanged) { sb.append(NEW_LINE); } sb.append(MessageFormat.format( I18nService.getLocalizedString(MESSAGE_QUALIFY_TICKET_INFORMATION_CRITICALITY, Locale.FRENCH), criticalityBefore.getLocalizedMessage(Locale.FRENCH), criticalityAfter.getLocalizedMessage(Locale.FRENCH))); } strTaskInformation = sb.toString(); } return strTaskInformation; }
From source file:com.chadekin.jadys.syntax.orderby.impl.OrderByClauseBuilderImpl.java
private Consumer<String> expressionConsumer() { return value -> { extractAlias(value).stream().forEach(this::withAlias); String tempValue = null;/*w w w . jav a 2 s . c om*/ if (SORTING_ORDER.contains(value) && !columnsToOrder.isEmpty()) { tempValue = columnsToOrder.stream() .map(item -> new StringBuilder(item).append(JadysKeys.SPACE).append(value).toString()) .reduce((a, b) -> new StringBuilder(a).append(JadysKeys.COMMA).append(JadysKeys.SPACE) .append(b).toString()) .orElse(StringUtils.EMPTY); columnsToOrder.clear(); } else if (!SORTING_ORDER.contains(value)) { columnsToOrder.add(value); } if (StringUtils.isNotBlank(tempValue)) { if (getResultSql().length() > 0) { getResultSql().append(JadysKeys.COMMA); } getResultSql().append(JadysKeys.SPACE).append(tempValue); } }; }
From source file:com.nridge.connector.common.con_com.transform.TContentClean.java
private String cleanControl(String aValue) { String cleanValue;//from w w w . jav a 2 s . c o m if (StringUtils.isNotEmpty(aValue)) { String[] nlReplace = new String[] { " ", " ", " " }; String[] nlPattern = new String[] { "\r", "\n", "\t" }; String replaceValue = StringUtils.replaceEach(aValue, nlPattern, nlReplace); replaceValue = StringUtils.trim(replaceValue); cleanValue = replaceValue.replaceAll("\\p{Cntrl}", ""); StringBuilder asciiValue = new StringBuilder(cleanValue.length()); int strLength = cleanValue.length(); for (int i = 0; i < strLength; i++) { if (isASCII(cleanValue.charAt(i))) asciiValue.append(cleanValue.charAt(i)); } cleanValue = asciiValue.toString(); } else cleanValue = StringUtils.EMPTY; return cleanValue; }