Example usage for java.lang Boolean toString

List of usage examples for java.lang Boolean toString

Introduction

In this page you can find the example usage for java.lang Boolean toString.

Prototype

public static String toString(boolean b) 

Source Link

Document

Returns a String object representing the specified boolean.

Usage

From source file:de.codesourcery.jasm16.ide.WorkspaceConfig.java

public void projectClosed(IAssemblyProject project) {
    configProperties.put(createProjectStateKey(project), Boolean.toString(false));
}

From source file:fr.paris.lutece.plugins.workflow.modules.rest.service.formatters.StateFormatterJson.java

/**
 * {@inheritDoc }//from w  w  w  .j a  va  2s  .  co  m
 */
@Override
public String format(State state) {
    JSONObject jsonObject = new JSONObject();

    jsonObject.element(WorkflowRestConstants.TAG_ID_STATE, state.getId());
    jsonObject.element(WorkflowRestConstants.TAG_NAME, state.getName());
    jsonObject.element(WorkflowRestConstants.TAG_DESCRIPTION, state.getDescription());
    jsonObject.element(WorkflowRestConstants.TAG_ID_WORKFLOW, state.getWorkflow().getId());
    jsonObject.element(WorkflowRestConstants.TAG_IS_INITIAL_STATE, Boolean.toString(state.isInitialState()));
    jsonObject.element(WorkflowRestConstants.TAG_IS_REQUIRED_WORKGROUP_ASSIGNED,
            Boolean.toString(state.isRequiredWorkgroupAssigned()));

    return jsonObject.toString();
}

From source file:io.gravitee.repository.redis.ratelimit.RedisRateLimitRepository.java

@Override
public void save(RateLimit rateLimit) {
    redisTemplate.executePipelined((RedisConnection redisConnection) -> {
        ((StringRedisConnection) redisConnection).lTrim(REDIS_KEY_PREFIX + rateLimit.getKey(), 1, 0);
        ((StringRedisConnection) redisConnection).lPush(REDIS_KEY_PREFIX + rateLimit.getKey(),
                Long.toString(rateLimit.getLastRequest()), Long.toString(rateLimit.getResetTime()),
                Long.toString(rateLimit.getCounter()), Long.toString(rateLimit.getCreatedAt()),
                Long.toString(rateLimit.getUpdatedAt()), Boolean.toString(rateLimit.isAsync()));
        ((StringRedisConnection) redisConnection).pExpireAt(REDIS_KEY_PREFIX + rateLimit.getKey(),
                rateLimit.getResetTime());

        if (rateLimit.isAsync()) {
            ((StringRedisConnection) redisConnection)
                    .lTrim(REDIS_KEY_PREFIX + rateLimit.getKey() + REDIS_ASYNC_SUFFIX, 1, 0);
            ((StringRedisConnection) redisConnection).lPush(
                    REDIS_KEY_PREFIX + rateLimit.getKey() + REDIS_ASYNC_SUFFIX,
                    REDIS_KEY_PREFIX + rateLimit.getKey(), Long.toString(rateLimit.getUpdatedAt()));
            ((StringRedisConnection) redisConnection).pExpireAt(
                    REDIS_KEY_PREFIX + rateLimit.getKey() + REDIS_ASYNC_SUFFIX, rateLimit.getResetTime());
        }/*from ww  w.j  ava 2  s  .c  o  m*/
        return null;
    });
}

From source file:com.koda.integ.hbase.test.BlockCacheSimpleTest.java

@Override
protected void setUp() throws Exception {
    if (cache != null)
        return;//w  w w.  j a  va2 s .c o  m
    conf = HBaseConfiguration.create();

    // Cache configuration
    conf.set(OffHeapBlockCache.BLOCK_CACHE_MEMORY_SIZE, Long.toString(cacheSize));
    conf.set(OffHeapBlockCache.BLOCK_CACHE_IMPL, cacheImplClass);
    conf.set(OffHeapBlockCache.BLOCK_CACHE_YOUNG_GEN_FACTOR, Float.toString(youngGenFactor));
    conf.set(OffHeapBlockCache.BLOCK_CACHE_COMPRESSION, cacheCompression);
    conf.set(OffHeapBlockCache.BLOCK_CACHE_OVERFLOW_TO_EXT_STORAGE_ENABLED,
            Boolean.toString(cacheOverflowEnabled));
    conf.set(OffHeapBlockCache.BLOCK_CACHE_EVICTION, cacheEviction);
    conf.set(OffHeapBlockCache.HEAP_BLOCK_CACHE_MEMORY_RATIO, onHeapRatio);
}

From source file:net.indialend.attendance.controller.APIController.java

@RequestMapping("/saveLeave")
@ResponseBody/*from  w  ww . ja  v a2  s. c o  m*/
public String saveLeave(Leaves leaves, long staffId) {

    leaves.setType(LeaveType.PLANNED);
    leaves.setStaff(staffService.getStaff(staffId));
    return Boolean.toString(attendenceService.saveLeave(leaves));
}

From source file:io.orchestrate.client.KvListResource.java

/**
 * Fetch a paginated, lexicographically ordered list of items contained in a
 * collection./*w ww  .  j a  v  a2 s  . c o m*/
 *
 * <p>Usage:</p>
 * <pre>
 * {@code
 * KvList<String> objects =
 *         client.listCollection("someCollection")
 *               .limit(10)
 *               .get(String.class)
 *               .get();
 * }
 * </pre>
 *
 * @param clazz Type information for marshalling objects at runtime.
 * @param <T> The type to deserialize the result of the request to.
 * @return The prepared get request.
 */
public <T> OrchestrateRequest<KvList<T>> get(final @NonNull Class<T> clazz) {
    checkArgument(!inclusive || startKey != null, "'inclusive' requires 'startKey' for request.");

    final String uri = client.uri(collection);
    String query = "limit=".concat(Integer.toString(limit));
    query = query.concat("&values=").concat(Boolean.toString(withValues));
    if (startKey != null) {
        final String keyName = (inclusive) ? "startKey" : "afterKey";
        query = query.concat('&' + keyName + '=').concat(client.encode(startKey));
    }

    final HttpContent packet = HttpRequestPacket.builder().method(Method.GET).uri(uri).query(query).build()
            .httpContentBuilder().build();

    return new OrchestrateRequest<KvList<T>>(client, packet, new ResponseConverter<KvList<T>>() {
        @Override
        public KvList<T> from(final HttpContent response) throws IOException {
            final int status = ((HttpResponsePacket) response.getHttpHeader()).getStatus();
            assert (status == 200);

            final JsonNode jsonNode = toJsonNode(response);

            final OrchestrateRequest<KvList<T>> next;
            if (jsonNode.has("next")) {
                final String page = jsonNode.get("next").asText();
                final URI url = URI.create(page);
                final HttpContent packet = HttpRequestPacket.builder().method(Method.GET).uri(uri)
                        .query(url.getQuery()).build().httpContentBuilder().build();
                next = new OrchestrateRequest<KvList<T>>(client, packet, this, false);
            } else {
                next = null;
            }
            final int count = jsonNode.get("count").asInt();
            final List<KvObject<T>> results = new ArrayList<KvObject<T>>(count);

            final Iterator<JsonNode> iter = jsonNode.get("results").elements();
            while (iter.hasNext()) {
                results.add(toKvObject(iter.next(), clazz));
            }

            return new KvList<T>(results, count, next);
        }
    });
}

From source file:de.unistuttgart.ipvs.pmp.infoapp.webservice.properties.CellularConnectionProperties.java

@Override
public void commit() throws InternalDatabaseException, InvalidParameterException, IOException {
    try {//w ww .ja  va  2s.  c  o  m
        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        params.add(new BasicNameValuePair("provider", this.provider));
        params.add(new BasicNameValuePair("roaming", Boolean.toString(this.roaming)));
        switch (this.network) {
        case CDMA:
            params.add(new BasicNameValuePair("network", "cd"));
            break;
        case EDGE:
            params.add(new BasicNameValuePair("network", "ed"));
            break;
        case EHRPD:
            params.add(new BasicNameValuePair("network", "eh"));
            break;
        case EVDO_0:
            params.add(new BasicNameValuePair("network", "e0"));
            break;
        case EVDO_A:
            params.add(new BasicNameValuePair("network", "ea"));
            break;
        case EVDO_B:
            params.add(new BasicNameValuePair("network", "eb"));
            break;
        case GPRS:
            params.add(new BasicNameValuePair("network", "gp"));
            break;
        case HSDPA:
            params.add(new BasicNameValuePair("network", "hd"));
            break;
        case HSPA:
            params.add(new BasicNameValuePair("network", "hs"));
            break;
        case HSPAP:
            params.add(new BasicNameValuePair("network", "hp"));
            break;
        case HSUPA:
            params.add(new BasicNameValuePair("network", "hu"));
            break;
        case IDEN:
            params.add(new BasicNameValuePair("network", "id"));
            break;
        case LTE:
            params.add(new BasicNameValuePair("network", "lt"));
            break;
        case RTT:
            params.add(new BasicNameValuePair("network", "1r"));
            break;
        case UMTS:
            params.add(new BasicNameValuePair("network", "um"));
            break;
        case UNKNOWN:
            params.add(new BasicNameValuePair("network", "un"));
            break;

        }
        super.service.requestPostService("update_connection_cellular.php", params);
    } catch (JSONException e) {
        throw new IOException("Server returned no valid JSON object: " + e);
    }
}

From source file:com.foglyn.core.FogBugzClientFactory.java

public synchronized FogBugzClient getFogbugzClient(TaskRepository repository, IProgressMonitor monitor)
        throws CoreException {
    Pair<String, AuthenticationCredentials> key = repositoryKey(repository);

    FogBugzClient client = clients.get(key);
    if (client != null) {
        return client;
    }/*w  w  w.j  a  v  a2 s.  co  m*/

    AbstractWebLocation loc = repositoryLocationFactory.get().createWebLocation(repository);

    try {
        client = createFogBugzClient(monitor, loc, true, true);
    } catch (FogBugzException e) {
        StatusHandler.log(Utils.toStatus(e));

        throw new FoglynCoreException(e);
    }

    repository.setProperty(FoglynConstants.REPOSITORY_IS_FOGBUGZ7_REPOSITORY,
            Boolean.toString(client.isFogBugz7Repository()));
    repository.setProperty(IRepositoryConstants.PROPERTY_CATEGORY, IRepositoryConstants.CATEGORY_TASKS);

    // get current credentials, it might have changed
    key = repositoryKey(repository);
    clients.put(key, client);

    return client;
}

From source file:io.wcm.sling.commons.request.RequestParamTest.java

@SuppressWarnings("unused")
protected Map<String, Object> getParamMap() throws UnsupportedEncodingException {
    return ImmutableMap.<String, Object>builder().put(STRING_PARAM, new String[] { STRING_VALUE })
            .put(MULTI_STRING_PARAM, MULTI_STRING_VALUE)
            .put(INTEGER_PARAM, new String[] { Integer.toString(INTEGER_VALUE) })
            .put(LONG_PARAM, new String[] { Long.toString(LONG_VALUE) })
            .put(FLOAT_PARAM, new String[] { Float.toString(FLOAT_VALUE) })
            .put(DOUBLE_PARAM, new String[] { Double.toString(DOUBLE_VALUE) })
            .put(BOOLEAN_PARAM, new String[] { Boolean.toString(BOOLEAN_VALUE) })
            .put(ENUM_PARAM, new String[] { ENUM_VALUE.name() })
            .put(RequestParam.PARAMETER_FORMENCODING, new String[] { CharEncoding.UTF_8 }).build();
}

From source file:com.zaizi.alfresco.crowd.webscript.CrowdValidationTokenWebScript.java

/**
 * <p>Perform the crowd token validation</p>
 * /*w w w  .  j  a v  a2 s . co m*/
 * @param req the {@code WebScriptRequest} request
 * @param status the {@code Status}
 * @param Cache the {@code Cache}
 * 
 * @return a map containing the properties to be passed to the model
 */
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {

    Map<String, Object> model = new HashMap<String, Object>();
    String token = req.getParameter(TOKEN_PARAMETER);
    logger.debug("Validating crowd token");
    try {
        /* Validate the token */
        User crowdUser = crowdClient.findUserFromSSOToken(token);
        String userName = crowdUser.getName();
        logger.debug("Token valid. User is " + userName);

        /* Set current username and then obtain the current ticket for this user */
        this.authenticationComponent.setCurrentUser(userName);
        String alfToken = this.authenticationService.getCurrentTicket();

        /* Model properties to be passed to the webscript template */
        model.put(MODEL_VALID_KEY, Boolean.toString(true));
        model.put(MODEL_ALF_TOKEN_KEY, alfToken);
        model.put(MODEL_USER_KEY, crowdUser.getName());
    } catch (Exception exception) {
        /* Token not valid */
        logger.debug("Error validating token: " + exception.getMessage());
        model.put(MODEL_VALID_KEY, Boolean.toString(false));
    }

    return model;
}