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:com.cognifide.cq.cache.model.DefinitionPathTranslator.java
private String findPagePath() { Page page = resource.getResourceResolver().adaptTo(PageManager.class).getContainingPage(resource); return null != page ? page.getPath() : StringUtils.EMPTY; }
From source file:com.wpl.db.query.jpa.Where.java
public String toQuery() { return mAnd.count() == 0 ? StringUtils.EMPTY : String.format(" WHERE %s", mAnd.toQuery()); }
From source file:fr.paris.lutece.plugins.librarynotifygru.services.HttpAccessTransport.java
/** * {@inheritDoc}/*w w w .ja v a 2 s .c o m*/ */ @Override public String doPost(String strUrl, Map<String, String> mapParams, Map<String, String> mapHeadersRequest) { HttpAccess clientHttp = new HttpAccess(); Map<String, String> mapHeadersResponse = new HashMap<String, String>(); String strOutput = StringUtils.EMPTY; try { strOutput = clientHttp.doPost(strUrl, mapParams, null, null, mapHeadersRequest, mapHeadersResponse); } catch (HttpAccessException e) { String strError = "LibraryNotifyGru - Error HttpAccessTransport.doPost on URL [" + strUrl + "] : "; _logger.error(strError + e.getMessage(), e); throw new NotifyGruException(strError, e); } return strOutput; }
From source file:com.microsoft.alm.plugin.external.commands.UndoCommand.java
/** * Returns the files that were undone//from w w w . j av a2 s. c o m * <p/> * Output example: * /path/path: * Undoing edit: file1.java * No pending changes were found for /path/path/file2.java. * <p/> */ @Override public List<String> parseOutput(final String stdout, final String stderr) { final String[] output = getLines(stdout); // check for failure if (StringUtils.isNotEmpty(stderr)) { logger.error("Undo failed with the following stderr: " + stderr); for (int i = 0; i < output.length; i++) { // finding error message by eliminating all other known output lines since we can't parse for the error line itself (it's unknown to us) // TODO: figure out a better way to get the error message instead of parsing if (isOutputLineExpected(output[i], new String[] { UNDO_LINE_PREFIX }, true)) { throw new RuntimeException(output[i]); } } // couldn't figure out error message parsing so returning generic error logger.error("Parsing of the stdout failed to get the error message"); throw new TeamServicesException(TeamServicesException.KEY_ERROR_UNKNOWN); } final List<String> filesUndone = new ArrayList<String>(); // parse output for directory paths and file names to combine String path = StringUtils.EMPTY; for (int i = 0; i < output.length; i++) { if (isFilePath(output[i])) { path = output[i]; } else if (StringUtils.isNotEmpty(output[i])) { filesUndone.add(getFilePath(path, output[i], "")); //TODO: Need to pass in the path root } } return filesUndone; }
From source file:com.microsoft.alm.plugin.external.commands.CreateWorkspaceCommand.java
/** * There is no useful output from this command unless there is an error. This method parses the error and throws if * one exists./* w w w .j a v a2s . c o m*/ */ @Override public String parseOutput(final String stdout, final String stderr) { throwIfError(stderr); // There is no useful output on success return StringUtils.EMPTY; }
From source file:de.hybris.platform.importcockpit.services.impex.generator.operations.impl.DefaultDataGeneratorOperationTest.java
@Test public void generateDataLineForProductAttribEntrySourceLineValueReturned() { when(attributeLine.getValue()).thenReturn(StringUtils.EMPTY); final SourceColumnModel sourceColumnModel = Mockito.mock(SourceColumnModel.class); when(sourceColumnModel.getId()).thenReturn("42"); when(attributeLine.getSource()).thenReturn(sourceColumnModel); when(inputDataLine.get(Integer.valueOf(42))).thenReturn(null); operation.generateDataLineForProductAttribEntry(inputDataLine, attributeLine); verify(sourceColumnModel, Mockito.times(2)).getId(); verify(inputDataLine).get(Integer.valueOf(42)); }
From source file:com.chadekin.jadys.commons.expression.SqlExpressionBuilderFactoryTest.java
@Test public void shouldNotBuildExpressionClauseWhenValueIsEmpty() { // Arrange// w w w . j a v a 2 s .c o m SqlExpressionFactory localBuilder = SqlExpressionFactory.newExpression("name", JadysSqlOperation.NOT_EQUAL, StringUtils.EMPTY); // Act String sql = localBuilder.build(); // Assert assertThat(sql, is(StringUtils.EMPTY)); }
From source file:com.sugaronrest.SugarRestRequest.java
/** * Initializes a new instance of the SugarRestRequest class. * * @param requestType The request type. */// www . j a v a 2 s . c o m public SugarRestRequest(RequestType requestType) { this.setRequestType(requestType); this.setOptions(new Options()); this.validationMessage = StringUtils.EMPTY; }
From source file:com.hybris.backoffice.cockpitng.dataaccess.facades.DefaultPlatformObjectFacadeStrategyTest.java
@Test public void testDeleteSuccess() throws ObjectNotFoundException { final ModelService modelService = Mockito.mock(ModelService.class); final LabelService labelService = Mockito.mock(LabelService.class); final UserModel user = new UserModel(); user.setName("Test User"); Mockito.doNothing().when(modelService).remove(user); Mockito.when(labelService.getObjectLabel(Mockito.any())).thenReturn(StringUtils.EMPTY); final DefaultPlatformObjectFacadeStrategy strategy = new DefaultPlatformObjectFacadeStrategy(); strategy.setModelService(modelService); strategy.setLabelService(labelService); try {/* www . j ava 2 s. c o m*/ strategy.delete(user, null); } catch (final ObjectDeletionException ex) { Assert.fail(); } Mockito.verify(modelService).remove(user); // Assert.assertEquals(user, strategy.delete(user, null)); }
From source file:fr.paris.lutece.plugins.calendar.web.HtmlUtils.java
/** * Fill a template with events info/*from w w w . j a v a 2s . c o m*/ * @param model The model used to fill events * @param event The event * @param strDate The current date */ public static void fillEventTemplate(Map<String, Object> model, MultiAgendaEvent event, String strDate) { CalendarService calendarService = SpringContextService.getBean(Constants.BEAN_CALENDAR_CALENDARSERVICE); int nShortTitleLength = AppPropertiesService.getPropertyInt(Constants.PROPERTY_EVENT_SHORT_TITLE_LENGTH, 18); StringBuilder sbTitle = new StringBuilder(); String strImage = StringUtils.EMPTY; AgendaResource agenda = calendarService.getAgendaResource(event.getAgenda()); if (agenda != null) { sbTitle.append(agenda.getEventPrefix()); sbTitle.append(Constants.SPACE); strImage = agenda.getEventImage(); } if (StringUtils.isNotBlank(event.getDateTimeStart())) { sbTitle.append(event.getDateTimeStart()); } sbTitle.append(Constants.INDENT); if (StringUtils.isNotBlank(event.getDateTimeEnd())) { sbTitle.append(event.getDateTimeEnd()); } sbTitle.append(Constants.SPACE); sbTitle.append(removeHtml(event.getTitle())); String strShortTitle = sbTitle.toString(); if (strShortTitle.length() > nShortTitleLength) { StringBuilder sbShortTitle = new StringBuilder(); sbShortTitle.append(strShortTitle.substring(0, nShortTitleLength)); sbShortTitle.append(AppPropertiesService.getProperty(Constants.PROPERTY_EVENT_SHORT_TITLE_END)); strShortTitle = sbShortTitle.toString(); } String strDescription = (event.getDescription() != null) ? event.getDescription() : StringUtils.EMPTY; String strLocation = (event.getLocation() != null) ? event.getLocation() : StringUtils.EMPTY; String strUrl = (event.getUrl() != null) ? event.getUrl() : StringUtils.EMPTY; model.put(Constants.MARK_AGENDA, event.getAgenda()); model.put(Constants.MARK_EVENT_TITLE, sbTitle.toString()); model.put(Constants.MARK_EVENT_SHORT_TITLE, strShortTitle); model.put(Constants.MARK_EVENT_DESCRIPTION, strDescription); model.put(Constants.MARK_EVENT_LOCATION, strLocation); model.put(Constants.MARK_EVENT_URL, strUrl); model.put(Constants.MARK_EVENT_IMAGE, strImage); model.put(Constants.MARK_DATE, strDate); }