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.addsimplicity.anicetus.hibernate.TelemetryInterceptor.java

/**
 * This method is called by Hibernate each time an entity is being inserted.
 *///from   w w w.  ja va 2 s.c om
@Override
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
    HibernateEntity he = new HibernateEntity(entity.getClass().getName(), id != null ? id.toString() : "NEW",
            HibernateOperation.Create);
    getTelemetry().addHibernateEntity(he);
    return false;
}

From source file:no.uka.findmyapp.android.rest.client.RestProcessor.java

private boolean isInstanceOfJavaNativeType(Serializable object) {
    Log.v(debug, "Type of " + object.toString());
    if (object instanceof String || object instanceof Integer) {
        return true;
    }/*  w ww .  j  a v a2  s  .  c o  m*/
    Log.v(debug, "isInstanceOfJavaNativeType: false");
    return false;
}

From source file:org.sakaiproject.component.osid.logging.WritableLog.java

public void appendLog(java.io.Serializable entryItem) throws org.osid.logging.LoggingException {

    try {/*from   w ww.j a  v a 2  s.com*/
        if ("trace".equalsIgnoreCase(logName)) {
            if (LOG.isTraceEnabled())
                LOG.trace(entryItem.toString());
        } else if ("debug".equalsIgnoreCase(logName)) {
            if (LOG.isDebugEnabled())
                LOG.debug(entryItem.toString());
        } else if ("info".equalsIgnoreCase(logName)) {
            LOG.info(entryItem.toString());
        } else if ("warn".equalsIgnoreCase(logName)) {
            LOG.warn(entryItem.toString());
        } else if ("error".equalsIgnoreCase(logName)) {
            LOG.error(entryItem.toString());
        } else if ("fatal".equalsIgnoreCase(logName)) {
            LOG.fatal(entryItem.toString());
        } else {
            LOG.info(entryItem.toString());
        }

    } catch (Throwable t) {
        // Ignore - not much to do...
        System.out.println("Sakai OSID Log:" + t.toString());
        System.out.println(this + "Entry=" + entryItem);
    }

}

From source file:net.chrisrichardson.foodToGo.acknowledgeOrderService.hibernate.HibernateOrderAttachmentManagerTests.java

public void testChanged() throws Exception {

    Order po = OrderMother.makeOrder();/* w  w w.  j a v a  2  s.co  m*/
    save(po.getRestaurant());
    save(po);
    final Serializable orderId = po.getId();

    Order detachedOrder = am.detach(po);

    doWithTransaction(new TxnCallback() {
        public void execute() throws Exception {
            Order po = (Order) load(Order.class, orderId.toString());
            po.noteSent("msgid", new Date());
            po.accept("x");
        }
    });

    try {
        Order attachedOrder = am.attach(detachedOrder);
        fail("Expected exception");
    } catch (OptimisticLockingFailureException e) {

    }
}

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

private boolean checkQuestionPermission(final String username, final Serializable targetId,
        final Object permission) {
    if (permission instanceof String && permission.equals("owner")) {
        final Question question = dao.getQuestion(targetId.toString());
        if (question != null) {
            final Session session = dao.getSessionFromId(question.getSessionId());
            if (session == null) {
                return false;
            }//from w  w w. j  av  a2s  .  co m
            return session.getCreator().equals(username);
        }
    }
    return false;
}

From source file:com.parallax.server.blocklyprop.security.BlocklyPropSessionDao.java

@Override
public Session readSession(Serializable sessionId) throws UnknownSessionException {
    //        System.out.println("Read session: " + sessionId);
    try {//from  w  w w.j  av  a  2s  .  c o  m
        SessionRecord sessionRecord = SessionServiceImpl.getSessionService().readSession(sessionId.toString());
        if (sessionRecord != null) {
            return convert(sessionRecord);
        }
        throw new UnknownSessionException();
    } catch (NullPointerException npe) {
        throw new UnknownSessionException();
    }
}

From source file:org.pentaho.reporting.platform.plugin.ExecuteReportContentHandler.java

/**
 * helper method to lookup the path and use this for the Object ID in the Audit instead of the fileID
 * @param fileId// w w  w  . j  a v a  2s. c  om
 * @return
 */
private String getObjectIdFromContent(final Serializable fileId) {
    String name;
    String objID = fileId.toString();
    Iterator it = (Iterator) contentGenerator.getPathParameters().getParameterNames();
    while (it.hasNext()) {
        name = (String) it.next();
        if (name.equals("path")) {
            objID = (String) contentGenerator.getPathParameters().getParameter(name);
            break;
        }
    }
    return objID;
}

From source file:com.epam.reportportal.auth.integration.github.GithubEndpoint.java

@RequestMapping(value = { "/sso/me/github/synchronize" }, method = RequestMethod.POST)
public OperationCompletionRS synchronize(OAuth2Authentication user) {
    Serializable upstreamToken = user.getOAuth2Request().getExtensions().get("upstream_token");
    BusinessRule.expect(upstreamToken, Objects::nonNull).verify(ErrorType.INCORRECT_AUTHENTICATION_TYPE,
            "Cannot synchronize GitHub User");
    this.replicator.synchronizeUser(upstreamToken.toString());
    return new OperationCompletionRS("User info successfully synchronized");
}

From source file:com.boundlessgeo.geoserver.bundle.BundleImporter.java

void updateConnectionParams(StoreInfo s) {
    // update workspace relative paths
    // update namespace uri
    LinkedHashMap<String, Serializable> map = new LinkedHashMap<>();
    for (Map.Entry<String, Serializable> e : s.getConnectionParameters().entrySet()) {
        Serializable value = e.getValue();
        if (value instanceof String && value.toString().contains("%WORKSPACE%")) {
            value = value.toString().replace("%WORKSPACE%", "workspaces/" + workspace.getName());
        }//from w  ww.  ja  v  a 2 s  .co  m
        if ("namespace".equalsIgnoreCase(e.getKey())) {
            value = namespace.getURI();
        }
        map.put(e.getKey(), value);
    }

    s.getConnectionParameters().clear();
    s.getConnectionParameters().putAll(map);
}

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

private boolean checkSessionPermission(final String username, final Serializable targetId,
        final Object permission) {
    if (permission instanceof String && (permission.equals("owner") || permission.equals("write"))) {
        return dao.getSessionFromKeyword(targetId.toString()).getCreator().equals(username);
    } else if (permission instanceof String && permission.equals("read")) {
        return dao.getSessionFromKeyword(targetId.toString()).isActive();
    }/* ww  w . j  a v a2  s.  co m*/
    return false;
}