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 String toString() 

Source Link

Document

Returns a String object representing this Boolean's value.

Usage

From source file:com.all.dht.DhtManager.java

private void removeRemoteEntity(DHTValueEntity valueEntity, Boolean oversized) {
    AllMessage<String> deleteMessage = new AllMessage<String>(DELETE_DHT_VALUE_REQUEST_TYPE,
            valueEntity.getPrimaryKey().toHexString());
    deleteMessage.putProperty(IS_OVERSIZED_VALUE, oversized.toString());
    InetSocketAddress contactAddress = (InetSocketAddress) valueEntity.getCreator().getContactAddress();
    networkingService.send(dht.getLocalNodeID().toHexString(), deleteMessage,
            contactAddress.getAddress().getHostAddress(), contactAddress.getPort() + 1);
}

From source file:de.stklcode.jvault.connector.HTTPVaultConnector.java

@Override
public final SealResponse unseal(final String key, final Boolean reset) throws VaultConnectorException {
    Map<String, String> param = new HashMap<>();
    param.put("key", key);
    if (reset != null)
        param.put("reset", reset.toString());
    try {//from   ww w  .  j a  va 2s.c om
        String response = requestPut(PATH_UNSEAL, param);
        return jsonMapper.readValue(response, SealResponse.class);
    } catch (IOException e) {
        throw new InvalidResponseException(Error.PARSE_RESPONSE, e);
    }
}

From source file:lcmc.common.ui.EditableInfo.java

/** Adds parameters to the panel. */
private void addParams(final JPanel optionsPanel, final String prefix, final String[] params,
        final MyButton thisApplyButton, final int leftWidth, final int rightWidth,
        final Map<String, Widget> sameAsFields) {
    swingUtils.isSwingThread();/*from   w ww  . jav  a2s.c om*/
    if (params == null) {
        return;
    }
    final MultiKeyMap<String, JPanel> panelPartsMap = new MultiKeyMap<String, JPanel>();
    final Collection<PanelPart> panelPartsList = new ArrayList<PanelPart>();
    final MultiKeyMap<String, Integer> panelPartRowsMap = new MultiKeyMap<String, Integer>();

    for (final String param : params) {
        final Widget paramWi = createWidget(param, prefix, rightWidth);
        /* sub panel */
        final String section = getSection(param);
        final JPanel panel;
        final AccessMode.Type accessType = getAccessType(param);
        final String accessTypeString = accessType.toString();
        final Boolean advanced = isAdvanced(param);
        final String advancedString = advanced.toString();
        if (panelPartsMap.containsKey(section, accessTypeString, advancedString)) {
            panel = panelPartsMap.get(section, accessTypeString, advancedString);
            panelPartRowsMap.put(section, accessTypeString, advancedString,
                    panelPartRowsMap.get(section, accessTypeString, advancedString) + 1);
        } else {
            panel = new JPanel(new SpringLayout());

            panel.setBackground(getSectionColor(section));
            if (advanced) {
                advancedPanelList.add(panel);
                panel.setVisible(access.isAdvancedMode());
            }
            panelPartsMap.put(section, accessTypeString, advancedString, panel);
            panelPartsList.add(new PanelPart(section, accessType, advanced));
            panelPartRowsMap.put(section, accessTypeString, advancedString, 1);
        }

        /* label */
        final JLabel label = new JLabel(getParamShortDesc(param));
        final String longDesc = getParamLongDesc(param);
        paramWi.setLabel(label, longDesc);

        /* tool tip */
        paramWi.setToolTipText(getToolTipText(param, paramWi));
        label.setToolTipText(longDesc + additionalToolTip(param));
        int height = 0;
        if (paramWi instanceof Label) {
            height = application.getDefaultSize("Browser.LabelFieldHeight");
        }
        addField(panel, label, paramWi.getComponent(), leftWidth, rightWidth, height);
    }
    final boolean wizard = Widget.WIZARD_PREFIX.equals(prefix);
    for (final String param : params) {
        final Widget paramWi = getWidget(param, prefix);
        if (wizard) {
            final Widget rpwi = getWidget(param, null);
            if (rpwi == null) {
                LOG.error("addParams: unknown param: " + param);
                continue;
            }
            if (paramWi.getValue() == null || paramWi.getValue().isNothingSelected()) {
                rpwi.setValueAndWait(null);
            } else {
                final Value value = paramWi.getValue();
                rpwi.setValueAndWait(value);
            }
        }
    }
    for (final String param : params) {
        final Widget paramWi = getWidget(param, prefix);
        Widget rpwi = null;
        if (wizard) {
            rpwi = getWidget(param, null);
        }
        final Widget realParamWi = rpwi;
        paramWi.addListeners(new WidgetListener() {
            @Override
            public void check(final Value value) {
                checkParameterFields(paramWi, realParamWi, param, getParametersFromXML(), thisApplyButton);
            }
        });
    }

    /* add sub panels to the option panel */
    final Map<String, JPanel> sectionMap = new HashMap<String, JPanel>();
    final Collection<JPanel> notAdvancedSections = new HashSet<JPanel>();
    final Collection<JPanel> advancedSections = new HashSet<JPanel>();
    for (final PanelPart panelPart : panelPartsList) {
        final String section = panelPart.getSection();
        final AccessMode.Type accessType = panelPart.getType();
        final String accessTypeString = accessType.toString();
        final Boolean advanced = panelPart.isAdvanced();
        final String advancedString = advanced.toString();

        final JPanel panel = panelPartsMap.get(section, accessTypeString, advancedString);
        final int rows = panelPartRowsMap.get(section, accessTypeString, advancedString);
        final int columns = 2;
        SpringUtilities.makeCompactGrid(panel, rows, columns, 1, 1, // initX, initY
                1, 1); // xPad, yPad
        final JPanel sectionPanel;
        if (sectionMap.containsKey(section)) {
            sectionPanel = sectionMap.get(section);
        } else {
            sectionPanel = getParamPanel(getSectionDisplayName(section), getSectionColor(section));
            sectionMap.put(section, sectionPanel);
            addSectionPanel(section, wizard, sectionPanel);
            optionsPanel.add(sectionPanel);
            if (sameAsFields != null) {
                final Widget sameAsCombo = sameAsFields.get(section);
                if (sameAsCombo != null) {
                    final JPanel saPanel = new JPanel(new SpringLayout());
                    saPanel.setBackground(Browser.BUTTON_PANEL_BACKGROUND);
                    final JLabel label = new JLabel(Tools.getString("ClusterBrowser.SameAs"));
                    sameAsCombo.setLabel(label, "");
                    addField(saPanel, label, sameAsCombo.getComponent(), leftWidth, rightWidth, 0);
                    SpringUtilities.makeCompactGrid(saPanel, 1, 2, 1, 1, // initX, initY
                            1, 1); // xPad, yPad
                    sectionPanel.add(saPanel);
                }
            }
        }
        sectionPanel.setVisible(isSectionEnabled(section));
        sectionPanel.add(panel);
        if (advanced) {
            advancedSections.add(sectionPanel);
        } else {
            notAdvancedSections.add(sectionPanel);
        }
    }
    boolean advanced = false;
    for (final Map.Entry<String, JPanel> sectionEntry : sectionMap.entrySet()) {
        final JPanel sectionPanel = sectionEntry.getValue();
        if (advancedSections.contains(sectionPanel)) {
            advanced = true;
        }
        if (!notAdvancedSections.contains(sectionPanel)) {
            advancedOnlySectionList.add(sectionEntry.getKey());
            sectionPanel.setVisible(access.isAdvancedMode() && isSectionEnabled(sectionEntry.getKey()));
        }
    }
    moreOptionsPanel.setVisible(advanced && !access.isAdvancedMode());
}

From source file:com.cloud.hypervisor.xen.resource.Xenserver625StorageProcessor.java

@Override
protected String getVhdParent(Connection conn, String primaryStorageSRUuid, String snapshotUuid,
        Boolean isISCSI) {
    String parentUuid = hypervisorResource.callHostPlugin(conn, "cloud-plugin-storage", "getVhdParent",
            "primaryStorageSRUuid", primaryStorageSRUuid, "snapshotUuid", snapshotUuid, "isISCSI",
            isISCSI.toString());

    if (parentUuid == null || parentUuid.isEmpty() || parentUuid.equalsIgnoreCase("None")) {
        s_logger.debug("Unable to get parent of VHD " + snapshotUuid + " in SR " + primaryStorageSRUuid);
        // errString is already logged.
        return null;
    }/*from  ww w.  j a v  a  2s .  c om*/
    return parentUuid;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public boolean setForeignKeyNotSep(Boolean sep) {
    boolean somethingChanged = setAppInfo("X_ForeignKey_NotSep", sep == null ? null : sep.toString(), true);//$NON-NLS-1$
    hasChanged = hasChanged | somethingChanged;
    return somethingChanged;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

/****************************************************************************
 * FKIntegerity and FKIntegrity_Override
 ****************************************************************************/

public boolean setFKIntegrity(Boolean integrity) {
    boolean somethingChanged = setAppInfo("X_FKIntegrity", integrity == null ? null : integrity.toString(), //$NON-NLS-1$
            true);//from   w  w w .  j  a  v  a 2 s  .  c o  m
    hasChanged = hasChanged | somethingChanged;
    return somethingChanged;
}

From source file:org.nabucco.alfresco.enhScriptEnv.share.util.VersionInfoContributor.java

protected void retrieveReposioryVersionInfo() {
    try {//  ww w  . j  a  va2s. c  o m
        final Connector connector = this.connectorService.getConnector("alfresco");

        // workaround NPE-bugs in RequestCachingConnector when calling "call" outside of active request
        final boolean fakedRequestContext;
        RequestContext requestContext = ThreadLocalRequestContext.getRequestContext();
        if (requestContext == null) {
            fakedRequestContext = true;
            requestContext = new AbstractRequestContext(this.serviceRegistry, this.frameworkUtil) {

                private static final long serialVersionUID = 1L;

                @Override
                public LinkBuilder getLinkBuilder() {
                    return null;
                }

                // Only relevant in Alfresco 5 - thus no @Override
                public boolean isExtensibilitySuppressed() {
                    return false;
                }
            };
        } else {
            fakedRequestContext = false;
        }

        try {

            final Response response = connector.call("/api/server");
            if (response.getStatus().getCode() == Status.STATUS_OK) {
                try {
                    final JSONObject json = new JSONObject(new JSONTokener(response.getResponse()));

                    final JSONObject data = json.getJSONObject("data");
                    if (data != null) {
                        final String edition = data.getString("edition");
                        final String schema = data.getString("schema");
                        final String version = data.getString("version");

                        final String coreVersion;
                        final Matcher versionMatcher = Pattern.compile(CORE_VERSION_PATTERN).matcher(version);
                        if (versionMatcher.find()) {
                            coreVersion = versionMatcher.group(1);
                        } else {
                            coreVersion = null;
                        }

                        this.cachedInformation.put(KEY_EDITION, edition);
                        this.cachedInformation.put(KEY_FULL_VERSION, version);
                        this.cachedInformation.put(KEY_VERSION, coreVersion);
                        this.cachedInformation.put(KEY_SCHEMA, schema);

                        final Boolean isCommunity;
                        if (EDITION_ENTERPRISE.equalsIgnoreCase(edition)
                                || EDITION_TEAM.equalsIgnoreCase(edition)) {
                            isCommunity = Boolean.FALSE;
                        } else if (EDITION_UNKNOWN.equalsIgnoreCase(edition)
                                || EDITION_COMMUNITY.equalsIgnoreCase(edition) || edition == null
                                || edition.trim().length() == 0) {
                            isCommunity = Boolean.TRUE;
                        } else {
                            LOGGER.warn("Unknown / unexpected edition {} - assuming 'community mode'", edition);
                            isCommunity = Boolean.TRUE;
                        }
                        this.cachedInformation.put(KEY_IS_COMMUNITY, isCommunity.toString());

                        this.lastUpdateCheckTimestamp = System.currentTimeMillis();
                        this.nextUpdateInterval = DEFAULT_UPDATE_CHECK_INTERVAL;
                    } else {
                        this.lastUpdateCheckTimestamp = System.currentTimeMillis();
                        // check again in a minute
                        this.nextUpdateInterval = 1000 * 60;
                        LOGGER.warn("Unexpected response content from /api/server");
                    }
                } catch (final JSONException jsonEx) {
                    this.lastUpdateCheckTimestamp = System.currentTimeMillis();
                    // check again in a minute
                    this.nextUpdateInterval = 1000 * 60;
                    LOGGER.error("Error parsing version information from Repository", jsonEx);
                }
            } else {
                this.lastUpdateCheckTimestamp = System.currentTimeMillis();
                // check again in a minute
                this.nextUpdateInterval = 1000 * 60;
                LOGGER.warn("Failed to load version information from Repository: " + response.getStatus());
            }
        } finally {
            if (fakedRequestContext && requestContext != null) {
                requestContext.release();
            }
        }
    } catch (final ConnectorServiceException conEx) {
        this.lastUpdateCheckTimestamp = System.currentTimeMillis();
        // check again in a minute
        this.nextUpdateInterval = 1000 * 60;

        LOGGER.error("Error retrieving connector for version information query to Repository", conEx);
    }
}

From source file:edu.ucsd.crbs.cws.dao.rest.WorkspaceFileRestDAOImpl.java

@Override
public List<WorkspaceFile> getWorkspaceFiles(String owner, final String type, final Boolean isFailed,
        Boolean synced, final Boolean showDeleted) throws Exception {
    ClientConfig cc = new DefaultClientConfig();
    cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    Client client = Client.create(cc);//from   w w  w .  ja  v a  2 s. c  o  m
    client.addFilter(new HTTPBasicAuthFilter(_user.getLogin(), _user.getToken()));
    client.setFollowRedirects(true);
    WebResource resource = client.resource(_restURL).path(Constants.REST_PATH)
            .path(Constants.WORKSPACEFILES_PATH);

    MultivaluedMap queryParams = _multivaluedMapFactory.getMultivaluedMap(_user);

    if (owner != null) {
        queryParams.add(Constants.OWNER_QUERY_PARAM, owner);
    }
    if (type != null) {
        queryParams.add(Constants.TYPE_QUERY_PARAM, type);
    }
    if (isFailed != null) {
        queryParams.add(Constants.WS_FAILED_QUERY_PARAM, isFailed.toString());
    }

    if (synced != null) {
        queryParams.add(Constants.SYNCED_QUERY_PARAM, synced.toString());
    }
    if (showDeleted != null) {
        queryParams.add(Constants.SHOW_DELETED_QUERY_PARAM, showDeleted.toString());
    }

    String json = resource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(String.class);
    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new ObjectifyJacksonModule());
    return mapper.readValue(json, new TypeReference<List<WorkspaceFile>>() {
    });
}

From source file:com.appfirst.communication.AFClient.java

/**
 * Update the device information in the database for push notification on
 * Android platform.//  w  ww  .  j  a  va2  s .  co m
 * 
 * @param url
 *            the query url
 * @param brand
 *            brand of the device, it's always Android.
 * @param uid
 *            the unique device id provided by Google push notification
 *            platform, or C2DM.
 * @return a JSONOject represents the device.
 */
public JSONObject saveDeviceInfo(String url, String brand, String uid, Boolean subscribeAll) {
    JSONObject device = null;
    List<NameValuePair> postContent = new ArrayList<NameValuePair>(2);
    postContent.add(new BasicNameValuePair("brand", brand));
    postContent.add(new BasicNameValuePair("uid", uid));
    postContent.add(new BasicNameValuePair("subscribe_all", subscribeAll.toString()));
    HttpPost post = new HttpPost(url);
    device = makeHttpPostRequest(post, postContent);
    return device;
}

From source file:org.openstack.burrow.backend.http.BaseHttp.java

/**
 * Generates a List of Name/Value Pairs for a DeleteMessage to be carried out
 * //from   ww w .  j av a 2 s.  com
 * @param request A DeleteMessage object
 * @return A List of Name/Value Pairs
 */
private List<NameValuePair> getQueryParameters(DeleteMessage request) {
    Boolean matchHidden = request.getMatchHidden();
    if (matchHidden != null) {
        List<NameValuePair> params = new ArrayList<NameValuePair>(1);
        params.add(new BasicNameValuePair("match_hidden", matchHidden.toString()));
        return params;
    } else {
        return null;
    }
}