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:com.norconex.importer.handler.transformer.impl.ReplaceTransformer.java

@Override
protected void saveHandlerToXML(EnhancedXMLStreamWriter writer) throws XMLStreamException {
    writer.writeAttribute("caseSensitive", Boolean.toString(isCaseSensitive()));
    for (String from : replacements.keySet()) {
        String to = replacements.get(from);
        writer.writeStartElement("replace");
        writer.writeStartElement("fromValue");
        writer.writeCharacters(from);//from  ww w  .  jav  a 2s  .  c o  m
        writer.writeEndElement();
        writer.writeStartElement("toValue");
        writer.writeCharacters(to);
        writer.writeEndElement();
        writer.writeEndElement();
    }
}

From source file:org.yamj.core.configuration.ConfigService.java

public void setProperty(String key, boolean value) {
    setProperty(key, Boolean.toString(value));
}

From source file:com.bluexml.side.util.libs.eclipse.pages.PageControlsHelper.java

/**
 * this one display label before the checkbox
 * //from  w  w w  . j  a  v  a2  s .c o  m
 * @param composite
 * @param label
 * @param id
 * @param initialValue
 * @param values
 * @return
 */
public Button createBooleanFieldControl2(Composite composite, final String label, final String id,
        boolean initialValue, final Map<String, Object> values) {
    values.put(id, Boolean.toString(initialValue));

    Label artifactIdLabel = new Label(composite, SWT.NONE);
    artifactIdLabel.setText(label);

    GridData newLayoutData = StylingUtil.getNewLayoutData();
    newLayoutData.horizontalSpan = 3;

    final Button button = new Button(composite, SWT.CHECK);
    button.setSelection(initialValue);
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            values.put(id, Boolean.toString(button.getSelection()));
            page.checkPageComplite();
        }
    });
    button.setLayoutData(newLayoutData);
    return button;
}

From source file:com.adr.taskexecutor.ui.TaskExecutorRemote.java

@Override
public void run(TaskExecutor.RunProcess ui) throws Exception {

    URL url;/*  ww w.  j  a v  a 2  s  . co m*/
    BufferedReader readerin = null;
    Writer writerout = null;
    try {
        // http://localhost:8084/taskexecutor/executetask?parameter=&loglevel=INFO&trace=false&stats=true&task=
        url = new URL(jURL.getText());

        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        connection.setRequestMethod("POST");
        connection.setAllowUserInteraction(false);

        connection.setUseCaches(false);
        connection.setDoInput(true);
        connection.setDoOutput(true);

        String query = "&parameter=" + URLEncoder.encode(parameter, "UTF-8");
        query += "&task=" + URLEncoder.encode(task, "UTF-8");
        query += "&language=" + URLEncoder.encode(language, "UTF-8");
        query += "&loglevel=" + URLEncoder.encode(jLoggingLevel.getSelectedItem().toString(), "UTF-8");
        query += "&trace=" + URLEncoder.encode(Boolean.toString(jTrace.isSelected()), "UTF-8");
        query += "&stats=" + URLEncoder.encode(Boolean.toString(jStats.isSelected()), "UTF-8");

        writerout = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
        writerout.write("Content-Type: application/x-www- form-urlencoded,encoding=UTF-8\n");
        writerout.write("Content-length: " + String.valueOf(query.length()) + "\n");
        writerout.write("\n");
        writerout.write(query);
        writerout.flush();

        writerout.close();
        writerout = null;

        int responsecode = connection.getResponseCode();
        if (responsecode == HttpURLConnection.HTTP_OK) {
            StringBuilder text = new StringBuilder();

            readerin = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
            String line = null;
            while ((line = readerin.readLine()) != null) {
                text.append(line);
                text.append(System.getProperty("line.separator"));
            }

            JSONParser jsonp = new JSONParser();
            JSONObject json = (JSONObject) jsonp.parse(text.toString());

            // Print lines
            JSONArray jsonlines = (JSONArray) json.get("lines");
            for (Object l : jsonlines) {
                JSONObject jsonline = (JSONObject) l;
                Object type = jsonline.get("type");
                if ("build".equals(type)) {
                    ui.buildMessage((String) jsonline.get("text"));
                } else if ("run".equals(type)) {
                    ui.runMessage((String) jsonline.get("text"));
                } else if ("out".equals(type)) {
                    ui.printOut((String) jsonline.get("text"));
                } else if ("log".equals(type)) {
                    ui.printLog((String) jsonline.get("text"));
                } else if ("success".equals(type)) {
                    ui.successMessage(((Number) jsonline.get("time")).longValue());
                } else if ("fail".equals(type)) {
                    ui.failMessage((String) jsonline.get("text"), ((Number) jsonline.get("time")).longValue());
                } else if ("exception".equals(type)) {
                    ui.exceptionMessage((String) jsonline.get("text"),
                            ((Number) jsonline.get("time")).longValue());
                }
            }

            // Print stats
            ui.getStatsModel().reset();
            JSONArray jsonstats = (JSONArray) json.get("stats");
            if (jsonstats != null) {
                for (Object l : jsonstats) {
                    JSONObject jsonstat = (JSONObject) l;
                    ui.getStatsModel().addRow((String) jsonstat.get("task"), (String) jsonstat.get("step"),
                            ((Number) jsonstat.get("executions")).intValue(),
                            ((Number) jsonstat.get("records")).intValue(),
                            ((Number) jsonstat.get("rejected")).intValue(),
                            ((Number) jsonstat.get("totaltime")).doubleValue(),
                            ((Number) jsonstat.get("avgtime")).doubleValue());
                }
            }

            // save preferences if execution went well
            Configuration.getInstance().setPreference("remote.serverurl", jURL.getText());
            Configuration.getInstance().setPreference("remote.logginglevel",
                    jLoggingLevel.getSelectedItem().toString());
            Configuration.getInstance().setPreference("remote.trace", Boolean.toString(jTrace.isSelected()));
            Configuration.getInstance().setPreference("remote.stats", Boolean.toString(jStats.isSelected()));
            Configuration.getInstance().flushPreferences();

            //                 } catch (NullPointerException ex) {
            //                 } catch (ClassCastException ex) {
            //                 } catch (ParseException ex) {
        } else {
            throw new IOException(MessageFormat.format(bundle.getString("message.httperror"),
                    Integer.toString(responsecode), connection.getResponseMessage()));
        }
        //        } catch (MalformedURLException ex) {
        //        } catch (IOException ex) {
    } finally {
        if (writerout != null) {
            try {
                writerout.close();
            } catch (IOException ex) {
            }
            writerout = null;
        }
        if (readerin != null) {
            try {
                readerin.close();
            } catch (IOException ex) {
            }
            readerin = null;
        }
    }
}

From source file:gobblin.runtime.embedded.EmbeddedGobblinDistcp.java

/**
 * Specifies that files in the target that don't exist in the source should be deleted. Equivalent to -delete
 * option in Hadoop distcp.//w w  w . j a v a2  s.c o m
 */
@EmbeddedGobblinCliOption(description = "Delete files in target that don't exist on source.")
public EmbeddedGobblinDistcp delete() {
    this.setConfiguration(RecursiveCopyableDataset.DELETE_KEY, Boolean.toString(true));
    return this;
}

From source file:net.sourceforge.fenixedu.dataTransferObject.inquiries.InquiryGroupQuestionBean.java

public String validate(Set<InquiryBlockDTO> inquiryBlocks) {
    if (isVisible()) {
        Set<InquiryQuestionDTO> questions = getInquiryQuestions();
        boolean isGroupFilledIn = false;
        for (InquiryQuestionDTO inquiryQuestionDTO : questions) {
            InquiryQuestion inquiryQuestion = inquiryQuestionDTO.getInquiryQuestion();
            if (StringUtils.isEmpty(inquiryQuestionDTO.getResponseValue())) {
                if (inquiryQuestion.getRequired()) {
                    return Boolean.toString(false);
                }/*from  w w w.jav a2s  . c o m*/
                String questionConditionsValidation = validateQuestionConditions(inquiryQuestion,
                        inquiryBlocks);
                if (questionConditionsValidation != null) {
                    return questionConditionsValidation;
                }
            } else {
                isGroupFilledIn = true;
            }
        }
        if (getInquiryGroupQuestion().getRequired() && !isGroupFilledIn) {
            return Boolean.toString(false);
        }
        String groupConditionsValidation = validateGroupConditions(inquiryBlocks, isGroupFilledIn);
        if (groupConditionsValidation != null) {
            return groupConditionsValidation;
        }
    }
    return Boolean.toString(true);
}

From source file:co.kuali.coeus.reporting.web.struts.action.ReportForwardAction.java

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    String currentUserName = getGlobalVariableService().getUserSession().getPrincipalName();
    String currentUserId = getGlobalVariableService().getUserSession().getPrincipalId();
    String clientId = getClientId(request);
    String reportId = request.getParameter("reportId");

    if (!getUnitAuthorizationService().hasPermission(currentUserId,
            getUnitService().getTopUnit().getUnitNumber(), RoleConstants.DEPARTMENT_ROLE_TYPE,
            PermissionConstants.RUN_GLOBAL_REPORTS)) {
        throw new AuthorizationException(currentUserName, "Run", "Reports");
    }/*from w w  w.j a v  a2s.  co  m*/

    boolean isPI = isPrincipalInvestigator(currentUserName);

    String urlBase = getKualiConfigurationService().getPropertyValueAsString(URL_BASE);
    String queryBase = getKualiConfigurationService().getPropertyValueAsString(QUERY_BASE);
    String adHocView = getKualiConfigurationService().getPropertyValueAsString(ADHOC_LIST_QUERY);
    String credentials[] = new String[] { currentUserName, Boolean.toString(isPI), clientId };
    final String url;

    final String query;
    if (StringUtils.isNotBlank(reportId)) {
        query = queryBase + reportId;
    } else {
        query = adHocView;
    }
    LOG.debug("generating absolute URL");
    final Method generateAbsoluteURL = getTokenURLGenerator().getClass().getMethod("generateAbsoluteURL",
            String.class, String.class, String[].class);
    url = (String) generateAbsoluteURL.invoke(getTokenURLGenerator(), urlBase, query, credentials);

    LOG.debug("redirecting to url \"" + url + "\"");
    response.sendRedirect(url);
    return null;
}

From source file:com.architexa.diagrams.jdt.builder.ReloASTExtractor.java

protected void initResource(Resource res, IProject proj) {
    rdfModel.addTypeStatement(res, RJCore.projectType);
    rdfModel.addNameStatement(res, RSECore.name, proj.getName());
    rdfModel.addStatement(res, RSECore.initialized, Boolean.toString(true));
}

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

/**
 * Format the state/*  w  w w  .j  a va 2  s .  com*/
 * @param sbXml the XML
 * @param resource the state
 */
private void formatResourceWorkflow(StringBuffer sbXml, ResourceWorkflow resource) {
    XmlUtil.beginElement(sbXml, WorkflowRestConstants.TAG_RESOURCE_WORKFLOW);

    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_ID_RESOURCE, resource.getIdResource());
    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_RESOURCE_TYPE, resource.getResourceType());
    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_ID_WORKFLOW, resource.getWorkflow().getId());
    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_ID_STATE, resource.getState().getId());

    if (resource.getExternalParentId() != null) {
        XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_ID_EXTERNAL_PARENT, resource.getExternalParentId());
    }

    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_IS_ASSOCIATED_WITH_WORKGROUP,
            Boolean.toString(resource.isAssociatedWithWorkgroup()));
    XmlUtil.beginElement(sbXml, WorkflowRestConstants.TAG_WORKGROUPS);

    for (String strWorkgroupKey : resource.getWorkgroups()) {
        XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_WORKGROUP_KEY, strWorkgroupKey);
    }

    XmlUtil.endElement(sbXml, WorkflowRestConstants.TAG_WORKGROUPS);

    XmlUtil.endElement(sbXml, WorkflowRestConstants.TAG_RESOURCE_WORKFLOW);
}

From source file:com.norconex.importer.handler.filter.impl.RegexMetadataFilter.java

@Override
protected void saveFilterToXML(EnhancedXMLStreamWriter writer) throws XMLStreamException {
    writer.writeAttribute("field", field);
    writer.writeAttribute("caseSensitive", Boolean.toString(caseSensitive));
    writer.writeCharacters(regex == null ? "" : regex);
}