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:net.ymate.platform.persistence.mongodb.impl.MongoSession.java

public <T extends IEntity> T delete(Class<T> entity, Serializable id) throws Exception {
    Document _document = __doGetCollection(entity).findOneAndDelete(
            Query.create(IMongo.OPT.ID, ComparisonExp.eq(new ObjectId(id.toString()))).toBson());
    return ResultSetHelper.toEntity(entity, _document);
}

From source file:org.bremersee.pagebuilder.PageRequestBuilderImpl.java

protected int getPageSize(final Serializable pageSize) {
    int value = Integer.MAX_VALUE;
    if (pageSize != null) {
        if (pageSize instanceof Number) {
            value = ((Number) pageSize).intValue();
        } else {/* w  ww.j av a  2 s.co m*/
            try {
                value = Integer.valueOf(pageSize.toString());
            } catch (Throwable t) { // NOSONAR
                value = Integer.MAX_VALUE;
                log.warn("Getting page size from value [" + pageSize + "] failed. Returning " + value + ".");
            }
        }
    }
    return value > 0 ? value : Integer.MAX_VALUE;
}

From source file:com.reactivetechnologies.platform.datagrid.HazelcastKeyValueAdapterBean.java

@Override
public void deleteAllOf(Serializable keyspace) {
    if (!hz.isStarted())
        throw new IllegalStateException("Hazelcast service not started!");
    Assert.notNull(keyspace, "Cannot deleteAllOf for null collection.");
    hz.getMap(keyspace.toString()).clear();
}

From source file:com.reactivetechnologies.platform.datagrid.HazelcastKeyValueAdapterBean.java

@Override
public long count(Serializable keyspace) {
    if (!hz.isStarted())
        throw new IllegalStateException("Hazelcast service not started!");
    Assert.notNull(keyspace, "Cannot count for null collection.");
    return hz.getMap(keyspace.toString()).size();
}

From source file:com.optaros.alfresco.docasu.wcs.AbstractDocumentWebScript.java

private String getProperty(FileInfo info, QName property, String defaultValue) {
    if (info.getProperties().containsKey(property)) {
        Serializable serializable = info.getProperties().get(property);
        if (serializable != null) {
            return serializable.toString();
        } else {/*from  w w  w  .  j a va2  s.co  m*/
            return defaultValue;
        }
    } else {
        return defaultValue;
    }
}

From source file:org.pentaho.di.base.AbstractBaseCommandExecutor.java

/**
 * Decodes the provided base64String into the specified filePath. Parent directories must already exist.
 *
 * @param base64Zip BASE64 representation of a file
 * @param filePath String The path to which the base64String is to be decoded
 * @return File the newly created File//w  w w .  java  2s.  co  m
 */
public File decodeBase64ToZipFile(Serializable base64Zip, String filePath) throws IOException {

    if (base64Zip == null || Utils.isEmpty(base64Zip.toString())) {
        return null;
    }

    //Decode base64String to byte[]
    byte[] decodedBytes = Base64.getDecoder().decode(base64Zip.toString());
    File file = new File(filePath);

    //Try-with-resources, write to file, ensure fos is always closed
    try (FileOutputStream fos = new FileOutputStream(file)) {
        fos.write(decodedBytes);
    } catch (IOException e) {
        throw e;
    }

    return file;
}

From source file:com.reactivetechnologies.platform.datagrid.HazelcastKeyValueAdapterBean.java

/**
 * @deprecated Expensive statement.//w  w w . j  a v a2  s. co  m
 */
@Override
public Iterable<?> getAllOf(Serializable keyspace) {
    if (!hz.isStarted())
        throw new IllegalStateException("Hazelcast service not started!");
    Assert.notNull(keyspace, "Cannot getAllOf for null collection.");
    return hz.getMap(keyspace.toString()).values();
}

From source file:com.reactivetechnologies.platform.datagrid.core.HazelcastClusterServiceBean.java

/**
 * //from w w w.j a va 2s  .  c  o  m
 * @param keyspace
 * @param listener
 * @throws IllegalAccessException 
 */
public void addLocalEntryListener(Serializable keyspace, MapListener listener) {
    hzInstance.addLocalEntryListener(keyspace.toString(), listener);
}

From source file:nz.net.orcon.kanban.security.GravityPermissionEvaluator.java

@Override
public boolean hasPermission(Authentication authentication, Serializable targetId, String targetType,
        Object permission) {/*from   ww w .j av a2  s . c  om*/

    if (LOG.isDebugEnabled()) {
        LOG.debug("HASPERMISSION - targetId:" + targetId + " targetType:" + targetType + " permission:"
                + permission);
    }

    try {
        Map<String, String> roles = getRolesById(targetType, targetId.toString());
        if (roles == null) {
            return false;
        }

        List<String> permissions = new ArrayList<String>(Arrays.asList(permission.toString().split(",")));
        return isAuthorised(authentication, roles, permissions);
    } catch (Exception e) {
        return false;
    }
}

From source file:org.bremersee.pagebuilder.PageRequestBuilderImpl.java

protected ComparatorItem getComparatorItem(final Serializable comparatorItem) {
    ComparatorItem value = null;/*from   w  w w  .  j  a  v a  2s . com*/
    if (comparatorItem != null) {
        if (comparatorItem instanceof ComparatorItem) {
            value = (ComparatorItem) comparatorItem;
        } else {
            try {
                value = comparatorItemTransformer.fromString(comparatorItem.toString(), urlEncoded, charset);
            } catch (Throwable t) { // NOSONAR
                value = null;
                log.warn("Getting comparator item from value [" + comparatorItem + "] failed. Returning null.");
            }
        }
    }
    return value;
}