Example usage for org.apache.commons.lang StringUtils EMPTY

List of usage examples for org.apache.commons.lang StringUtils EMPTY

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils EMPTY.

Prototype

String EMPTY

To view the source code for org.apache.commons.lang StringUtils EMPTY.

Click Source Link

Document

The empty String "".

Usage

From source file:com.mirth.connect.model.converters.DICOMSerializer.java

@Override
public String fromXML(String source) throws SerializerException {
    if (source == null || source.length() == 0) {
        return StringUtils.EMPTY;
    }//ww w  .ja  v a  2 s .  com

    try {
        // re-parse the xml to Mirth format
        Document document = documentSerializer.fromXML(source);
        Element element = document.getDocumentElement();
        Node node = element.getChildNodes().item(0);

        // change back to <attr> tag for all tags under <dicom> tag
        while (node != null) {
            renameTagToAttr(document, node);
            node = node.getNextSibling();
        }

        NodeList items = document.getElementsByTagName("item");

        // change back to <attr> tag for all tags under <item> tags
        if (items != null) {
            for (int i = 0; i < items.getLength(); i++) {
                Node itemNode = items.item(i);

                if (itemNode.getChildNodes() != null) {
                    NodeList itemNodes = itemNode.getChildNodes();

                    for (int j = 0; j < itemNodes.getLength(); j++) {
                        Node nodeItem = itemNodes.item(j);
                        renameTagToAttr(document, nodeItem);
                    }
                }
            }
        }

        // find the charset
        String charset = null;
        Element charsetElement = (Element) document.getElementsByTagName("tag00080005").item(0);

        if (charsetElement != null) {
            charset = charsetElement.getNodeValue();
        } else {
            charset = "utf-8";
        }

        // parse the Document into a DicomObject
        SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
        DicomObject dicomObject = new BasicDicomObject();
        ContentHandlerAdapter contentHandler = new ContentHandlerAdapter(dicomObject);
        byte[] documentBytes = documentSerializer.toXML(document).trim().getBytes(charset);
        parser.parse(new InputSource(new ByteArrayInputStream(documentBytes)), contentHandler);
        return new String(Base64.encodeBase64Chunked(DICOMUtil.dicomObjectToByteArray(dicomObject)));
    } catch (Exception e) {
        throw new SerializerException(e);
    }
}

From source file:fr.paris.lutece.portal.business.template.DatabaseTemplateDAO.java

/**
 * {@inheritDoc}/*from w  w  w  .  j  a v  a2 s  .  c  o m*/
 */
@Override
public String getTemplateFromKey(String strKey) {
    DAOUtil daoUtil = new DAOUtil(SQL_QUERY_SELECT_TEMPLATE_FROM_KEY);
    daoUtil.setString(1, strKey);

    String strTemplate = StringUtils.EMPTY;

    daoUtil.executeQuery();

    if (daoUtil.next()) {
        strTemplate = daoUtil.getString(1);
    }

    daoUtil.free();

    return strTemplate;
}

From source file:com.opengamma.web.position.WebPositionsResourceTest.java

@Test
public void testGetAllPositions() throws Exception {
    populatePositionMaster();//from  www .  java  2  s . c om
    MultivaluedMap<String, String> queryParameters = _uriInfo.getQueryParameters();
    queryParameters.putSingle("identifier", StringUtils.EMPTY);
    queryParameters.putSingle("minquantity", StringUtils.EMPTY);
    queryParameters.putSingle("maxquantity", StringUtils.EMPTY);
    queryParameters.put("tradeId", Collections.<String>emptyList());
    queryParameters.put("positionId", Collections.<String>emptyList());

    String allPositions = _webPositionsResource.getJSON(null, null, null, null, null, null,
            queryParameters.get("positionId"), queryParameters.get("tradeId"));
    assertNotNull(allPositions);
    assertJSONObjectEquals(loadJson("com/opengamma/web/position/allPositionsJson.txt"),
            new JSONObject(allPositions));
}

From source file:com.zb.app.web.controller.site.SiteController.java

/**
 * //from  www. j  a v a2  s .  co  m
 * 
 * @param chugangId
 * @return
 */
@RequestMapping(value = "/modifyChugang.htm", produces = "application/json")
@ResponseBody
public JsonResult modifyChugang(Long chugangId) {
    if (Argument.isNotPositive(chugangId)) {
        return JsonResultUtils.error("?!");
    }
    cookieManager.set(CookieKeyEnum.chugang_id, chugangId + StringUtils.EMPTY);
    return JsonResultUtils.success();
}

From source file:com.amalto.core.storage.hibernate.SystemScatteredMappingCreator.java

private TypeMapping handleField(FieldMetadata field) {
    SimpleTypeFieldMetadata newFlattenField;
    newFlattenField = new SimpleTypeFieldMetadata(currentType.peek(), field.isKey(), field.isMany(),
            field.isMandatory(), context.getFieldColumn(field), field.getType(), field.getWriteUsers(),
            field.getHideUsers(), field.getWorkflowAccessRights(), StringUtils.EMPTY);
    TypeMetadata declaringType = field.getDeclaringType();
    if (declaringType != field.getContainingType() && declaringType.isInstantiable()) {
        SoftTypeRef type = new SoftTypeRef(internalRepository, declaringType.getNamespace(),
                declaringType.getName(), true);
        newFlattenField.setDeclaringType(type);
    }/*from  www  .j  a  v a2 s.c  om*/
    String data = field.getType().<String>getData(MetadataRepository.DATA_MAX_LENGTH);
    Boolean preferLongVarchar = field.getType().getData(LongString.PREFER_LONGVARCHAR);
    if (data != null && preferClobUse && preferLongVarchar == null) {
        newFlattenField.getType().setData(TypeMapping.SQL_TYPE, TypeMapping.SQL_TYPE_CLOB);
        newFlattenField.setData(MetadataRepository.DATA_ZIPPED, Boolean.FALSE);
    }
    currentType.peek().addField(newFlattenField);
    entityMapping.map(field, newFlattenField);
    currentMapping.peek().map(field, newFlattenField);
    return null;
}

From source file:br.com.nordestefomento.jrimum.domkee.financeiro.banco.febraban.TipoDeMoeda.java

public String write() {

    String s = StringUtils.EMPTY;

    switch (this) {

    case REAL://from   w  w  w .j  a  v a 2  s .  c  o m
        s = "R$";
        break;

    default:
        s += this.getCodigo();
    }

    return s;
}

From source file:jenkins.plugins.coverity.CoverityTool.CovEmitJavaCommandTest.java

@Test
public void doesNotExecute_WithoutInvocationAssistance() throws IOException, InterruptedException {
    CoverityPublisher publisher = new CoverityPublisherBuilder().build();

    Command covEmitJavaCommand = new CovEmitJavaCommand(build, launcher, listener, publisher, StringUtils.EMPTY,
            envVars, false);/*from  ww  w .  j  ava  2  s.com*/
    covEmitJavaCommand.runCommand();
    verifyNumberOfExecutedCommands(0);
}

From source file:fr.paris.lutece.portal.business.portlet.PortletImpl.java

/**
 * Must be overloaded to return the complete Xml document (with heading)
 *
 * @param request The HTTP servlet request
 * @return none//  w  ww  . ja  v  a 2  s.c  o  m
 */
@Override
public String getXmlDocument(HttpServletRequest request) {
    return StringUtils.EMPTY;
}

From source file:jenkins.plugins.coverity.CoverityTool.CovCaptureCommandTest.java

@Test
public void customTestCommandTest() throws IOException, InterruptedException {
    TaOptionBlock taOptionBlock = new TaOptionBlockBuilder().withCustomTestCommand("CustomTestCommand").build();
    CoverityPublisher publisher = new CoverityPublisherBuilder().withTaOptionBlock(taOptionBlock).build();

    Command covCaptureCommand = new CovCaptureCommand(build, launcher, listener, publisher, StringUtils.EMPTY,
            envVars);//from  w w  w.j  av  a 2 s  . c  om
    setExpectedArguments(new String[] { "cov-capture", "--dir", "TestDir", "CustomTestCommand" });
    covCaptureCommand.runCommand();
    consoleLogger
            .verifyLastMessage("[Coverity] cov-capture command line arguments: " + actualArguments.toString());
}

From source file:br.com.nordestefomento.jrimum.utilix.TestField.java

@Before
public void setUp() {

    campoString = new Field<String>(StringUtils.EMPTY, 8);
    campoString.setFiller(Filler.WHITE_SPACE_RIGHT);

    campoDate = new Field<Date>(new GregorianCalendar(2007, Calendar.JULY, 22).getTime(), 6,
            DateUtil.FORMAT_DDMMYY);// w  w w .  j a v a  2  s.com

    campoInteger = new Field<Integer>(0, 6);
    campoInteger.setFiller(Filler.ZERO_LEFT);

    campoLong = new Field<Long>(0L, 6);
    campoLong.setFiller(Filler.ZERO_LEFT);

    campoDecimal = new Field<BigDecimal>(new BigDecimal("875.98"), 11, MonetaryUtil.FORMAT_REAL);
    campoDecimal.setFiller(Filler.ZERO_LEFT);

    campoDecimal_v9 = new Field<BigDecimal>(new BigDecimal("875.9"), 11,
            MonetaryUtil.FORMAT_REAL_UMA_CASA_DECIMAL);
    campoDecimal_v9.setFiller(Filler.ZERO_LEFT);
}