Example usage for org.springframework.util ObjectUtils getDisplayString

List of usage examples for org.springframework.util ObjectUtils getDisplayString

Introduction

In this page you can find the example usage for org.springframework.util ObjectUtils getDisplayString.

Prototype

public static String getDisplayString(@Nullable Object obj) 

Source Link

Document

Return a content-based String representation if obj is not null ; otherwise returns an empty String.

Usage

From source file:org.rill.bpm.api.finder.support.RoleTagRelationManFinderInterceptorAdapter.java

public Object invoke(MethodInvocation arg0) throws Throwable {

    boolean firstMatch = false;
    try {//w ww.jav  a2  s. c om

        // Check the return value is empty or not
        String[] foundMans = null;
        for (RoleTagRelationalManFinder f : this.finder) {

            // Set finder component
            boolean internalFirstMatch = setMatchFinderComponent(f);
            if (!firstMatch && internalFirstMatch) {
                firstMatch = true;
            }

            String[] fm = f.findTaskExemans((String) arg0.getArguments()[0], (String) arg0.getArguments()[1],
                    (String) arg0.getArguments()[2], (Long) arg0.getArguments()[3]);

            if (!ObjectUtils.isEmpty(fm)) {
                for (String s : fm) {
                    foundMans = (String[]) ObjectUtils.addObjectToArray(foundMans, s);
                }
            }
        }

        if (!ObjectUtils.isEmpty(foundMans)) {
            if (log.isDebugEnabled())
                log.debug("Found result " + ObjectUtils.getDisplayString(foundMans) + " by "
                        + this.finder.getClass().getName());

            List<String> list = Arrays.asList(foundMans);
            Set<String> afterFilter = new LinkedHashSet<String>(list);
            return afterFilter.toArray(new String[afterFilter.size()]);
        }

        // Let next intercepter do it.
        return arg0.proceed();
    } finally {
        if (firstMatch) {
            clearFirstMatchFinderComponent();
        }
    }
}

From source file:org.rill.bpm.api.finder.support.StaticTaskManFinderImpl.java

public String[] findTaskExemans(String roleTag, String gwfpProcessId, String gwfpTaskId,
        Long processInstanceId) {

    if (log.isDebugEnabled())
        log.debug("This is out-of-box class, return rejected exeMans" + ObjectUtils.getDisplayString(exeMans));

    return this.exeMans;
}

From source file:org.rill.bpm.api.support.XpathVarConvertTaskLifecycleInterceptor.java

@Override
protected void doPreComplete(TaskExecutionContext taskExecutionContext) {

    // First get all process instance related variables
    Set<String> engineRelateDatanames = null;
    engineRelateDatanames = getWorkflowAccessor()
            .getProcessInstanceVariableNames(taskExecutionContext.getProcessInstanceId());

    Map<String, Object> convertAndFilter = convertAndFilter(engineRelateDatanames,
            taskExecutionContext.getWorkflowParams());

    log.info("Change workflow parameter map to :" + ObjectUtils.getDisplayString(convertAndFilter));
    taskExecutionContext.getWorkflowParams().putAll(convertAndFilter);
}

From source file:org.rill.bpm.api.support.XpathVarConvertTaskLifecycleInterceptor.java

/**
 * @param engineRelateDatanames//from w  w  w  .j av a  2s  . c om
 * @param workflowParams
 * @return after convert and filter. NOT NULL
 */
public static Map<String, Object> convertAndFilter(Set<String> engineRelateDatanames,
        Map<String, Object> workflowParams) {

    log.info("Before Xpath variable convertion:" + ObjectUtils.getDisplayString(workflowParams));

    Map<String, Object> convertAndFilter = new HashMap<String, Object>();
    try {
        // Second use Xpath expression
        if (!CollectionUtils.isEmpty(engineRelateDatanames)) {
            for (String engineRelateDataname : engineRelateDatanames) {
                if (!workflowParams.containsKey(engineRelateDataname)) {
                    // FIXME: Do not set unrelated variables to 0
                    //                        logger.log(Level.FINE, "Put 0 for variable name:{0} into workflowParams", engineRelateDataname);
                    //                        workflowParams.put(engineRelateDataname, "0");
                    if (!engineRelateDataname.startsWith(ENGINE_VARIABLE_DEFINITION_PREFIX)) {
                        log.debug("Ignore unrelated variables" + engineRelateDataname
                                + " and do not change it's value");
                    } else {
                        // Generate by Xpath
                        generateByXpath(workflowParams, engineRelateDataname, convertAndFilter);
                    }
                } else {
                    convertAndFilter.put(engineRelateDataname, workflowParams.get(engineRelateDataname));
                }
            }
        }
    } catch (Exception e) {
        log.error("Exception occurred when parse expression using XPath.", e);
        throw new ProcessException("Exception occurred when parse expression using XPath.", e);
    }

    log.info("After Xpath variable convertion: " + ObjectUtils.getDisplayString(workflowParams));
    return convertAndFilter;
}

From source file:org.rill.bpm.api.ThreadLocalResourceHolder.java

public static String printAll() {

    return ObjectUtils.getDisplayString(getThreadMap());
}

From source file:org.springframework.web.context.ContextLoader.java

protected void configureAndRefreshWebApplicationContext(ConfigurableWebApplicationContext wac,
        ServletContext sc) {//  w  w  w.  j  a va 2 s.  c om
    if (ObjectUtils.identityToString(wac).equals(wac.getId())) {
        // The application context id is still set to its original default value
        // -> assign a more useful id based on available information
        String idParam = sc.getInitParameter(CONTEXT_ID_PARAM);
        if (idParam != null) {
            wac.setId(idParam);
        } else {
            // Generate default id...
            wac.setId(ConfigurableWebApplicationContext.APPLICATION_CONTEXT_ID_PREFIX
                    + ObjectUtils.getDisplayString(sc.getContextPath()));
        }
    }

    wac.setServletContext(sc);
    String configLocationParam = sc.getInitParameter(CONFIG_LOCATION_PARAM);
    if (configLocationParam != null) {
        wac.setConfigLocation(configLocationParam);
    }

    // The wac environment's #initPropertySources will be called in any case when the context
    // is refreshed; do it eagerly here to ensure servlet property sources are in place for
    // use in any post-processing or initialization that occurs below prior to #refresh
    ConfigurableEnvironment env = wac.getEnvironment();
    if (env instanceof ConfigurableWebEnvironment) {
        ((ConfigurableWebEnvironment) env).initPropertySources(sc, null);
    }

    customizeContext(sc, wac);
    wac.refresh();
}