Example usage for java.io Serializable toString

List of usage examples for java.io Serializable toString

Introduction

In this page you can find the example usage for java.io Serializable toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.sipfoundry.sipxconfig.search.DefaultBeanAdaptor.java

private String getKeyword(Object bean, Serializable id) {
    StringBuffer buffer = new StringBuffer();
    buffer.append(bean.getClass().getName());
    buffer.append(':');
    buffer.append(id.toString());
    return buffer.toString();
}

From source file:de.thm.arsnova.security.ApplicationPermissionEvaluator.java

private boolean checkInterposedQuestionPermission(final String username, final Serializable targetId,
        final Object permission) {
    if (permission instanceof String && permission.equals("owner")) {
        final InterposedQuestion question = dao.getInterposedQuestion(targetId.toString());
        if (question != null) {
            // Does the creator want to delete his own question?
            if (question.getCreator() != null && question.getCreator().equals(username)) {
                return true;
            }//from   w w  w . j  a  v  a  2  s  .  c  om
            // Allow deletion if requested by session owner
            final Session session = dao.getSessionFromKeyword(question.getSessionId());
            if (session == null) {
                return false;
            }
            return session.getCreator().equals(username);
        }
    }
    return false;
}

From source file:io.cloudslang.lang.systemtests.EventDataTest.java

private void validateSensitiveDataNotReveiledInContext(List<ScoreEvent> events) {
    for (ScoreEvent scoreEvent : events) {
        LanguageEventData eventDataAsMap = getData(scoreEvent);
        Map<String, Serializable> context = eventDataAsMap.getContext();
        if (MapUtils.isNotEmpty(context)) {
            for (Serializable value : context.values()) {
                if (value.toString().contains(SENSITIVE_VALUE_STRING)) {
                    fail(SENSITIVE_VALUE_STRING + " string should not be in event data");
                }//  w  w  w  .j ava 2s  .co m
            }
        }
    }
}

From source file:org.addsimplicity.anicetus.hibernate.TelemetryInterceptor.java

/**
 * This method is called by Hibernate prior to an entity being updated.
 *///from   w ww  .  j a  v a  2 s  . c om
@Override
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState,
        String[] propertyNames, Type[] types) {
    HibernateEntity he = new HibernateEntity(entity.getClass().getName(), id.toString(),
            HibernateOperation.Update);
    getTelemetry().addHibernateEntity(he);
    return false;
}

From source file:business.security.CustomPermissionEvaluator.java

@Override
public boolean hasPermission(Authentication authentication, Serializable targetId, String targetType,
        Object permission) {//from   w  w w. j  a  v a  2  s.  c  om
    log.trace("hasPermission[2]: user = " + authentication.getName() + ", targetId = " + targetId.toString()
            + ", targetType = " + targetType + ", permission = " + permission.toString());
    return false;
}

From source file:ro.nextreports.server.web.common.jgrowl.JGrowlAjaxBehavior.java

private String renderFeedback() {
    //   this.getComponent().getFeedbackMessage();
    FeedbackMessages fm = Session.get().getFeedbackMessages();

    Iterator<FeedbackMessage> iter = fm.iterator();
    StringBuilder sb = new StringBuilder();
    while (iter.hasNext()) {
        FeedbackMessage message = iter.next();
        if ((message.getReporter() != null) || message.isRendered()) {
            // if a component-level message, don't show it
            continue;
        }// w  w  w.jav a  2  s .  c o  m

        // if we are info stick set to info else set to message level
        String cssClassSuffix = "";
        switch (message.getLevel()) {
        case INFO_STICKY:
        case INFO_FADE:
            cssClassSuffix = "INFO";
            break;
        case ERROR_STICKY:
            cssClassSuffix = "ERROR";
            break;
        default:
            cssClassSuffix = message.getLevelAsString();
            break;
        }
        Serializable serializable = message.getMessage();

        // grab the message, if it's null use an empty string
        String msg = (serializable == null) ? StringUtils.EMPTY : serializable.toString();

        sb.append("$.jGrowl(\"").append(escape(msg)).append('\"');
        sb.append(", {");
        // set the css style, i.e. the theme
        sb.append("theme: \'jgrowl-").append(cssClassSuffix).append("\'");
        // set afterOpen
        String afterOpen = getAfterOpenJavaScript();
        if (StringUtils.isNotEmpty(afterOpen)) {
            sb.append(", afterOpen: " + getAfterOpenJavaScript());
        }
        // set sticky
        if (message.getLevel() > FeedbackMessage.INFO) {
            sb.append(", sticky: true");
        } else {
            // default is 3000 (3sec)
            sb.append(", life: 5000");
        }

        sb.append("});");

        message.markRendered();
    }

    return sb.toString();
}

From source file:org.nuxeo.elasticsearch.audit.pageprovider.ESAuditPageProvider.java

protected void preprocessCommentsIfNeeded(List<LogEntry> entries) {
    Serializable preprocess = getProperties().get(UICOMMENTS_PROPERTY);

    if (preprocess != null && "true".equalsIgnoreCase(preprocess.toString())) {
        CoreSession session = getCoreSession();
        if (session != null) {
            CommentProcessorHelper cph = new CommentProcessorHelper(session);
            cph.processComments(entries);
        }/*from  ww  w.j ava 2 s. co  m*/
    }
}

From source file:net.ymate.platform.persistence.mongodb.impl.MongoSession.java

public <T extends IEntity> T find(Class<T> entity, Serializable id) throws Exception {
    return findFirst(entity, Query.create(IMongo.OPT.ID, ComparisonExp.eq(new ObjectId(id.toString()))));
}

From source file:org.springframework.security.acls.jdbc.AclClassIdUtils.java

/**
 * Converts to a {@link Long}, attempting to use the {@link ConversionService} if available.
 * @param identifier    The identifier// ww  w .  j  a v  a2s. c o  m
 * @return Long version of the identifier
 * @throws NumberFormatException if the string cannot be parsed to a long.
 * @throws org.springframework.core.convert.ConversionException if a conversion exception occurred
 * @throws IllegalArgumentException if targetType is null
 */
private Long convertToLong(Serializable identifier) {
    Long idAsLong;
    if (canConvertFromStringTo(Long.class)) {
        idAsLong = conversionService.convert(identifier, Long.class);
    } else {
        idAsLong = Long.valueOf(identifier.toString());
    }
    return idAsLong;
}