Example usage for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE

List of usage examples for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE.

Prototype

ToStringStyle SHORT_PREFIX_STYLE

To view the source code for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE.

Click Source Link

Document

The short prefix toString style.

Usage

From source file:jp.primecloud.auto.zabbix.ZabbixAccessor.java

public synchronized Object execute(String method, JSON params) {
    // auth??????
    if (!"user.login".equals(method) && StringUtils.isEmpty(auth)) {
        authenticate();// w w  w  .  j  a v  a  2 s  . com
    }

    Map<String, Object> request = new HashMap<String, Object>();
    request.put("jsonrpc", "2.0");
    request.put("method", method);
    request.put("params", params == null ? Collections.EMPTY_MAP : params);
    request.put("auth", auth == null ? "" : auth);
    request.put("id", ++id);

    String jsonRequest = JSONObject.fromObject(request).toString();
    if (log.isDebugEnabled()) {
        // ?
        String str = jsonRequest;
        if (str.contains("password")) {
            str = str.replaceAll("\"password\":\".*?\"", "\"password\":\"--------\"");
        }
        if (str.contains("passwd")) {
            str = str.replaceAll("\"passwd\":\".*?\"", "\"passwd\":\"--------\"");
        }

        log.debug(str);
    }

    String jsonResponse = post(jsonRequest);
    if (log.isDebugEnabled()) {
        log.debug(jsonResponse);
    }

    JSONObject response = JSONObject.fromObject(jsonResponse);

    if (response.containsKey("error")) {
        ResponseError error = (ResponseError) JSONObject.toBean(response.getJSONObject("error"),
                ResponseError.class);

        // ?????????????
        if ("Not authorized".equals(error.getData())) {
            auth = "";
            return execute(method, params);
        }

        // 
        AutoException exception = new AutoException("EZABBIX-000001", method);
        exception.addDetailInfo("params=" + params);
        exception.addDetailInfo(
                "error=" + ReflectionToStringBuilder.toString(error, ToStringStyle.SHORT_PREFIX_STYLE));
        throw exception;
    }

    return response.get("result");
}

From source file:io.horizondb.model.schema.DatabaseDefinition.java

/**
 * {@inheritDoc}/*from  ww  w .  j  av a  2s .c o  m*/
 */
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("name", this.name)
            .append("timestamp", this.timestamp).toString();
}

From source file:de.hybris.platform.b2bpunchoutaddon.controllers.pages.DefaultPunchOutController.java

private String printSessionInfo(final PunchOutSession punchoutSession) {

    return new ToStringBuilder(punchoutSession, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("operation", punchoutSession.getOperation())
            .append("browserFormPostUrl", punchoutSession.getBrowserFormPostUrl())
            .append("buyerCookie", punchoutSession.getBuyerCookie()).append("time", punchoutSession.getTime())
            .append("initiatedBy",
                    ToStringBuilder.reflectionToString(punchoutSession.getInitiatedBy(),
                            ToStringStyle.SHORT_PREFIX_STYLE))
            .append("targetedTo",
                    ToStringBuilder.reflectionToString(punchoutSession.getTargetedTo(),
                            ToStringStyle.SHORT_PREFIX_STYLE))
            .append("sentBy",
                    ToStringBuilder.reflectionToString(punchoutSession.getSentBy(),
                            ToStringStyle.SHORT_PREFIX_STYLE))
            .append("shippingAddress", ToStringBuilder.reflectionToString(punchoutSession.getShippingAddress(),
                    ToStringStyle.SHORT_PREFIX_STYLE))
            .toString();/*from   w  ww.j  a v  a2s  .  co  m*/
}

From source file:io.horizondb.model.core.predicates.FieldPredicate.java

/**
 * {@inheritDoc}//from  ww  w  .  jav  a  2  s  .  c  om
 */
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("fieldName", this.fieldName)
            .toString();
}

From source file:de.iteratec.iteraplan.model.Seal.java

@Override
public String toString() {
    ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
    builder.append("id", id);
    builder.append("date", date);
    builder.append("user", user);
    builder.append("isr", bb);
    builder.append("comment", comment);

    return builder.toString();
}

From source file:be.fedict.eid.idp.entity.AttributeProtocolUriEntity.java

@Override
public String toString() {

    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("pk", this.pk).toString();
}

From source file:de.is24.infrastructure.gridfs.http.jaxb.primary.XmlYumPackageFormat.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append(license).append(vendor)
            .append(group).append(buildHost).append(sourceRpm).append(requires).append(provides)
            .append(obsoletes).append(conflicts).toString();
}

From source file:de.iteratec.iteraplan.model.queries.SavedQuery.java

@Override
public String toString() {
    ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
    builder.append("id", getId());
    builder.append("name", getName());
    builder.append("bbt", getResultBbType());

    return builder.toString();
}

From source file:io.horizondb.model.protocol.InsertPayload.java

/**
 * {@inheritDoc}/*w w w .ja  v  a  2  s. co m*/
 */
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("database", this.database)
            .append("series", this.series).append("recordType", this.recordType).append("buffer", this.buffer)
            .toString();
}

From source file:com.opengamma.engine.view.calcnode.MutableExecutionLog.java

@Override
public String toString() {
    StringBuffer sb = new StringBuffer();
    ToStringStyle style = ToStringStyle.SHORT_PREFIX_STYLE;
    style.appendStart(sb, this);
    style.append(sb, "error", hasError(), null);
    style.append(sb, "warn", hasWarn(), null);
    style.append(sb, "info", hasInfo(), null);
    if (hasException()) {
        style.append(sb, "exception", getExceptionClass(), null);
    }/*from w  w w.j a  v  a  2  s .  c  om*/
    style.appendEnd(sb, this);
    return sb.toString();
}