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.envision.envservice.rest.ClgApplicationResource.java

/**
 * ???//  www  . j  a  v  a2s .c  o  m
 * 
 * */
@GET
@Path("/queryAll")
@Produces(MediaType.APPLICATION_JSON)
public Response queryAll() throws Exception {
    HttpStatus status = HttpStatus.CREATED;
    String response = StringUtils.EMPTY;
    List<ClgApplication> list = clgApplicationService.queryClgApplication();
    response = JSONObject.toJSONString(list, JSONFilter.UNDERLINEFILTER);
    return Response.status(status.value()).entity(response).build();
}

From source file:com.ctc.storefront.web.wrappers.UrlEncodeHttpRequestWrapperTest.java

@Test
public void getServletPathTest() {
    mockAndTestServletPath(SLASH, StringUtils.EMPTY);
    mockAndTestServletPath(SLASH + TEST_PATTERN, StringUtils.EMPTY);
    mockAndTestServletPath(SLASH + TEST_PATTERN + SLASH, StringUtils.EMPTY);
    mockAndTestServletPath(TEST_SERVLET_PATH + SLASH + TEST_PATTERN + SLASH, TEST_SERVLET_PATH + SLASH);
    mockAndTestServletPath(TEST_SERVLET_PATH, TEST_SERVLET_PATH);
}

From source file:com.liferay.portlet.StrutsResourceBundle.java

@Override
protected Object handleGetObject(String key) {
    if (key == null) {
        throw new NullPointerException();
    }//from  w ww .java2  s.  c  o m
    if ((key.equals(JavaConstants.JAVAX_PORTLET_DESCRIPTION) || key.equals(JavaConstants.JAVAX_PORTLET_KEYWORDS)
            || key.equals(JavaConstants.JAVAX_PORTLET_LONG_TITLE)
            || key.equals(JavaConstants.JAVAX_PORTLET_SHORT_TITLE)
            || key.equals(JavaConstants.JAVAX_PORTLET_TITLE))) {

        key = key.concat(StringPool.PERIOD).concat(_portletName);
    }
    String value = StringUtils.EMPTY;
    try {
        value = ResourceBundleUtil.getString(_locale, key);
    } catch (Exception e) {
        _logger.error(e.getMessage());
    }
    if (StringUtils.isBlank(value))
        LanguageUtil.get(_locale, key);
    if ((value == null) && ResourceBundleThreadLocal.isReplace()) {
        value = ResourceBundleUtil.NULL_VALUE;
    }
    return value;
}

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

ManyFieldCriterion(RDBMSDataSource dataSource, Criteria typeSelectionCriteria, TableResolver resolver,
        FieldMetadata field, Object value, int position) {
    super(StringUtils.EMPTY, new Object[0], new Type[0]);
    this.dataSource = dataSource;
    this.typeCriteria = typeSelectionCriteria;
    this.resolver = resolver;
    this.field = field;
    this.value = value;
    this.position = position;
}

From source file:com.vmware.thinapp.common.workpool.dto.OsType.java

/**
 * Return the OsVariant string for all OsTypes.
 * Implementation for retrieving OsVariant is specific to each implementation.
 *
 * @return//from  ww w  . jav  a  2s. c  o m
 */
public String getOsVariantName() {
    return StringUtils.EMPTY;
}

From source file:com.amalto.core.server.routing.NoOpService.java

@Override
public Serializable fetchFromOutbound(String command, String parameters, String schedulePlanID)
        throws XtentisException {
    return StringUtils.EMPTY;
}

From source file:com.tera.gsaion.network.packethandler.server.W_NPC_INFO.java

@Override
protected void writeImpl(S_NPC_INFO cp, Object buf) {
    final Npc npc = cp.getNpc();
    final WorldPosition position = npc.getPosition();
    final ANpcTemplate template = (ANpcTemplate) npc.getTemplate();
    writeF(buf, position.getX());/*  w  w  w. ja va 2s  . c  om*/
    writeF(buf, position.getY());
    writeF(buf, position.getZ());
    writeD(buf, npc.getObjectId());
    writeD(buf, template.getTemplateId());
    writeD(buf, template.getTemplateId());

    writeC(buf, 38);// TODO npc type id
    writeH(buf, 65);// TODO npc state
    writeC(buf, position.getHeading());
    writeD(buf, template.getNameId());
    writeD(buf, 0);// TODO title id

    writeH(buf, 0x00);// unk
    writeC(buf, 0x00);// unk
    writeD(buf, 0x00);// unk

    writeD(buf, 0);// TODO masterObjectId
    writeS(buf, StringUtils.EMPTY);// TODO masterName

    writeC(buf, 100);// TODO %hp
    writeD(buf, 100);// TODO maxhp
    writeC(buf, template.getLevel());

    writeH(buf, 0x00); // TODO gear

    writeF(buf, 1.5f);// unk
    writeF(buf, template.getHeight());
    writeF(buf, template.getWalkSpeed());// TODO current speed

    writeH(buf, 2000);// 0x834 (depends on speed ? )
    writeH(buf, 2000);// 0x834

    writeC(buf, 0x00);// unk

    // TODO movement same as for player
    writeF(buf, position.getX());// x
    writeF(buf, position.getY());// y
    writeF(buf, position.getZ());// z
    writeC(buf, 0x00); // move type
    writeH(buf, 0);// TODO static id from spawn
    writeC(buf, 0);
    writeC(buf, 0);
    writeC(buf, 0);
    writeC(buf, 0);
    writeC(buf, 0);
    writeC(buf, 0);
    writeC(buf, 0);
    writeC(buf, 0);
    writeC(buf, 0); // TODO visualState

    writeH(buf, 1);// TODO npc object type id
    writeC(buf, 0x00);// unk
    writeD(buf, 0);// TODO npc target obj id
}

From source file:com.ms.commons.utilities.StaticContentDeploy.java

private static String getPropertyFromFile(File propertyFile, String property) {
    FileInputStream inputStream = null;
    InputStreamReader reader = null;
    try {/*  w ww.ja v a2 s  .c  om*/
        inputStream = new FileInputStream(propertyFile);
        reader = new InputStreamReader(inputStream, "utf-8");
        Properties properties = new Properties();
        properties.load(reader);
        return properties.getProperty(property, StringUtils.EMPTY);
    } catch (Exception e) {
        logger.error("StaticContentDeploy init failed", e);
    } finally {
        closeQuietly(inputStream, reader);
    }
    return StringUtils.EMPTY;
}

From source file:com.sugaronrest.restapicalls.methodcalls.GetPagedEntryList.java

/**
 * Gets paged entries [SugarCRM REST method - get_entry_list].
 *
 * @param url REST API Url./*from   w w  w  . j  a  v  a2 s.  c  o  m*/
 * @param sessionId Session identifier.
 * @param moduleName SugarCRM module name.
 * @param selectFields Selected field list.
 * @param queryString Formatted query string.
 * @param currentPage The current page number.
 * @param numberPerPage The number of pages per page.
 * @return ReadEntryListResponse object.
 * @throws Exception
 */
public static ReadEntryListResponse run(String url, String sessionId, String moduleName,
        List<String> selectFields, String queryString, int currentPage, int numberPerPage) throws Exception {

    ReadEntryListResponse readEntryListResponse = null;
    ErrorResponse errorResponse = null;

    String jsonRequest = new String();
    String jsonResponse = new String();

    ObjectMapper mapper = JsonObjectMapper.getMapper();

    try {
        Map<String, Object> requestData = new LinkedHashMap<String, Object>();
        requestData.put("session", sessionId);
        requestData.put("module_name", moduleName);
        requestData.put("query", queryString);
        requestData.put("order_by", StringUtils.EMPTY);
        int offset = (currentPage - 1) * numberPerPage;
        requestData.put("offset", offset);
        requestData.put("select_fields", selectFields);
        requestData.put("link_name_to_fields_array", StringUtils.EMPTY);
        requestData.put("max_results", numberPerPage);
        requestData.put("deleted", 0);
        requestData.put("favorites", false);

        String jsonRequestData = mapper.writeValueAsString(requestData);

        Map<String, Object> request = new LinkedHashMap<String, Object>();
        request.put("method", "get_entry_list");
        request.put("input_type", "json");
        request.put("response_type", "json");
        request.put("rest_data", requestData);

        jsonRequest = mapper.writeValueAsString(request);

        request.put("rest_data", jsonRequestData);

        HttpResponse response = Unirest.post(url).fields(request).asJson();

        if (response == null) {
            readEntryListResponse = new ReadEntryListResponse();
            errorResponse = ErrorResponse.format("An error has occurred!", "No data returned.");
            readEntryListResponse.setStatusCode(HttpStatus.SC_BAD_REQUEST);
            readEntryListResponse.setError(errorResponse);
        } else {

            jsonResponse = response.getBody().toString();

            if (StringUtils.isNotBlank(jsonResponse)) {
                // First check if we have an error
                errorResponse = ErrorResponse.fromJson(jsonResponse);
                if (errorResponse == null) {
                    readEntryListResponse = mapper.readValue(jsonResponse, ReadEntryListResponse.class);
                }
            }

            if (readEntryListResponse == null) {
                readEntryListResponse = new ReadEntryListResponse();
                readEntryListResponse.setError(errorResponse);

                readEntryListResponse.setStatusCode(HttpStatus.SC_OK);
                if (errorResponse != null) {
                    readEntryListResponse.setStatusCode(errorResponse.getStatusCode());
                }
            } else {
                readEntryListResponse.setStatusCode(HttpStatus.SC_OK);
            }
        }
    } catch (Exception exception) {
        readEntryListResponse = new ReadEntryListResponse();
        errorResponse = ErrorResponse.format(exception, exception.getMessage());
        readEntryListResponse.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
        errorResponse.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
        readEntryListResponse.setError(errorResponse);
    }

    readEntryListResponse.setJsonRawRequest(jsonRequest);
    readEntryListResponse.setJsonRawResponse(jsonResponse);

    return readEntryListResponse;
}

From source file:jp.co.opentone.bsol.linkbinder.util.elasticsearch.CorresponDocumentConverter.java

/**
 * ??./*  w  w  w  . java 2  s.c o  m*/
 * @param correspon 
 * @param attachments 
 * @return ??
 */
public static List<ElasticsearchDocument> convert(Correspon correspon, List<Attachment> attachments) {
    List<ElasticsearchDocument> result = Lists.newArrayList();
    CorresponElasticsearchDocument doc = new CorresponElasticsearchDocument();
    doc.id = String.valueOf(correspon.getId());
    doc.type = SystemConfig.getValue(Constants.KEY_ELASTICSEARCH_TYPE_NAME);
    doc.title = correspon.getSubject();
    doc.body = Jsoup.parse(correspon.getBody()).text();
    doc.lastModified = DateUtil.convertDateToString(correspon.getUpdatedAt());
    doc.workflowStatus = String.valueOf(correspon.getWorkflowStatus().getValue());
    doc.forLearning = String.valueOf(correspon.getForLearning().getValue());

    result.add(doc);

    attachments.forEach(a -> {
        CorresponElasticsearchDocument attachmentDoc = new CorresponElasticsearchDocument();
        attachmentDoc.id = ObjectUtils.toString(a.getId()) + "@" + correspon.getId();
        attachmentDoc.type = doc.type;
        attachmentDoc.title = StringUtils.EMPTY;
        attachmentDoc.body = StringUtils.EMPTY;
        attachmentDoc.lastModified = doc.lastModified;
        attachmentDoc.workflowStatus = doc.workflowStatus;
        attachmentDoc.workflowStatus = doc.forLearning;

        attachmentDoc.attachments = Lists
                .newArrayList(new CorresponElasticsearchDocument.Attachment(ObjectUtils.toString(a.getId()),
                        a.getFileName(), ConvertUtil.toBase64String(a.getContent()), a.getExtractedText()));

        result.add(attachmentDoc);
    });

    return result;
}