List of usage examples for java.lang Boolean toString
public static String toString(boolean b)
From source file:fr.paris.lutece.plugins.workflow.modules.rest.service.formatters.StateFormatterXml.java
/** * Format the state/*from www .jav a 2s .co m*/ * @param sbXml the XML * @param state the state */ private void formatState(StringBuffer sbXml, State state) { XmlUtil.beginElement(sbXml, WorkflowRestConstants.TAG_STATE); XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_ID_STATE, state.getId()); XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_NAME, state.getName()); XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_DESCRIPTION, state.getDescription()); XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_ID_WORKFLOW, state.getWorkflow().getId()); XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_IS_INITIAL_STATE, Boolean.toString(state.isInitialState())); XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_IS_REQUIRED_WORKGROUP_ASSIGNED, Boolean.toString(state.isRequiredWorkgroupAssigned())); XmlUtil.endElement(sbXml, WorkflowRestConstants.TAG_STATE); }
From source file:com.clustercontrol.plugin.factory.ModifyDbmsScheduler.java
private void setEntityInfo(DbmsSchedulerEntity entity, JobDetail jobDetail, Trigger trigger) throws InvalidClassException { entity.setMisfireInstr(trigger.getMisfireInstruction()); entity.setDurable(jobDetail.isDurable()); entity.setJobClassName(jobDetail.getJobDataMap().getString(ReflectionInvokerJob.KEY_CLASS_NAME)); entity.setJobMethodName(jobDetail.getJobDataMap().getString(ReflectionInvokerJob.KEY_METHOD_NAME)); if (trigger instanceof CronTrigger) { entity.setTriggerType(SchedulerPlugin.TriggerType.CRON.name()); entity.setCronExpression(((CronTrigger) trigger).getCronExpression()); } else if (trigger instanceof SimpleTrigger) { entity.setTriggerType(SchedulerPlugin.TriggerType.SIMPLE.name()); entity.setRepeatInterval(((SimpleTrigger) trigger).getPeriod()); }/*from ww w . j av a 2 s. com*/ entity.setTriggerState(TriggerState.VIRGIN.name()); entity.setStartTime(trigger.getStartTime()); entity.setEndTime(trigger.getEndTime()); entity.setNextFireTime(trigger.getNextFireTime()); entity.setPrevFireTime(trigger.getPreviousFireTime()); @SuppressWarnings("unchecked") Class<? extends Serializable>[] argsType = (Class<? extends Serializable>[]) jobDetail.getJobDataMap() .get(ReflectionInvokerJob.KEY_ARGS_TYPE); Object[] args = (Object[]) jobDetail.getJobDataMap().get(ReflectionInvokerJob.KEY_ARGS); entity.setJobArgNum(args.length); for (int i = 0; i < args.length; i++) { String arg = ""; if (m_log.isDebugEnabled()) m_log.debug("arg[" + i + "]:" + args[i]); if (argsType[i] == String.class) { arg = (String) args[i]; } else if (argsType[i] == Boolean.class) { arg = Boolean.toString((Boolean) args[i]); } else if (argsType[i] == Integer.class) { arg = Integer.toString((Integer) args[i]); } else if (argsType[i] == Long.class) { arg = Long.toString((Long) args[i]); } else if (argsType[i] == Short.class) { arg = Short.toString((Short) args[i]); } else if (argsType[i] == Float.class) { arg = Float.toString((Float) args[i]); } else if (argsType[i] == Double.class) { arg = Double.toString((Double) args[i]); } else { m_log.error("not support class"); throw new InvalidClassException(argsType[i].getName()); } String typeArg = argsType[i].getSimpleName() + ":" + arg; if (arg == null) { typeArg = "nullString"; } if (m_log.isDebugEnabled()) m_log.debug("typeArg[" + i + "]:" + typeArg); switch (i) { case 0: entity.setJobArg00(typeArg); break; case 1: entity.setJobArg01(typeArg); break; case 2: entity.setJobArg02(typeArg); break; case 3: entity.setJobArg03(typeArg); break; case 4: entity.setJobArg04(typeArg); break; case 5: entity.setJobArg05(typeArg); break; case 6: entity.setJobArg06(typeArg); break; case 7: entity.setJobArg07(typeArg); break; case 8: entity.setJobArg08(typeArg); break; case 9: entity.setJobArg09(typeArg); break; case 10: entity.setJobArg10(typeArg); break; case 11: entity.setJobArg11(typeArg); break; case 12: entity.setJobArg12(typeArg); break; case 13: entity.setJobArg13(typeArg); break; case 14: entity.setJobArg14(typeArg); break; default: m_log.error("arg count ng."); } } }
From source file:at.molindo.notify.channel.mail.DirectMailClient.java
protected Session createSmtpSession(String domain) throws MailException { try {//w ww . j a va2 s. co m final Properties props = new Properties(); props.setProperty("mail.smtp.host", DnsUtils.lookupMailHosts(domain)[0]); props.setProperty("mail.smtp.port", "25"); props.setProperty("mail.smtp.auth", "false"); props.setProperty("mail.smtp.starttls.enable", Boolean.toString(getStartTLSEnabled())); // set proxy if (Boolean.TRUE.equals(getProxySet())) { props.setProperty("proxySet", "true"); props.setProperty("socksProxyHost", getSocksProxyHost()); props.setProperty("socksProxyPort", getSocksProxyPort()); } if (getLocalHost() != null) { props.setProperty("mail.smtp.localhost", getLocalHost()); } if (getLocalAddress() != null) { props.setProperty("mail.smtp.localaddress", getLocalAddress()); } props.setProperty("mail.smtp.connectiontimeout", CONNECTION_TIMEOUT_MS); props.setProperty("mail.smtp.timeout", READ_TIMEOUT_MS); // props.put("mail.debug", "true"); return Session.getInstance(props); } catch (NamingException e) { throw new MailException("can't lookup mail host: " + domain, e, true); } }
From source file:org.openmrs.web.controller.visit.VisitListController.java
/** * It handles calls from DataTables.//w w w.ja va 2 s . co m * * @param patient * @param request * @return {@link DatatableResponse} */ @RequestMapping(VISITS_PATH) public @ResponseBody DatatableResponse getVisits(@ModelAttribute Patient patient, HttpServletRequest request) { DatatableRequest datatable = DatatableRequest.parseRequest(request); DatatableResponse response = new DatatableResponse(datatable); Integer totalVisitsCount = Context.getEncounterService().getEncountersByVisitsAndPatientCount(patient, false, null); response.setiTotalRecords(totalVisitsCount); Map<String, Object> model = new HashMap<String, Object>(); model.put("person", patient); PortletControllerUtil.addFormToEditAndViewUrlMaps(model); @SuppressWarnings("unchecked") Map<Form, String> formToViewUrlMap = (Map<Form, String>) model.get("formToViewUrlMap"); @SuppressWarnings("unchecked") Map<Form, String> formToEditUrlMap = (Map<Form, String>) model.get("formToEditUrlMap"); if (!StringUtils.isBlank(datatable.getsSearch())) { Integer filteredVisitsCount = Context.getEncounterService() .getEncountersByVisitsAndPatientCount(patient, false, datatable.getsSearch()); response.setiTotalDisplayRecords(filteredVisitsCount); } else { response.setiTotalDisplayRecords(totalVisitsCount); } List<Encounter> encounters = Context.getEncounterService().getEncountersByVisitsAndPatient(patient, false, datatable.getsSearch(), datatable.getiDisplayStart(), datatable.getiDisplayLength()); response.setsColumns("visitId", "visitActive", "visitType", "visitLocation", "visitFrom", "visitTo", "visitIndication", "firstInVisit", "lastInVisit", "encounterId", "encounterDate", "encounterType", "encounterProviders", "encounterLocation", "encounterEnterer", "formViewURL"); for (Encounter encounter : encounters) { Map<String, String> row = new HashMap<String, String>(); if (encounter.getVisit() != null) { Visit visit = encounter.getVisit(); row.put("visitId", visit.getId().toString()); row.put("visitActive", Boolean.toString(isActive(visit.getStartDatetime(), visit.getStopDatetime()))); row.put("visitType", visit.getVisitType().getName()); row.put("visitLocation", (visit.getLocation() != null) ? visit.getLocation().getName() : ""); row.put("visitFrom", Context.getDateFormat().format(visit.getStartDatetime())); if (visit.getStopDatetime() != null) { row.put("visitTo", Context.getDateFormat().format(visit.getStopDatetime())); } if (visit.getIndication() != null && visit.getIndication().getName() != null) { row.put("visitIndication", visit.getIndication().getName().getName()); } Object[] visitEncounters = visit.getEncounters().toArray(); if (visitEncounters.length > 0) { if (encounter.equals(visitEncounters[0])) { row.put("firstInVisit", Boolean.TRUE.toString()); } if (encounter.equals(visitEncounters[visitEncounters.length - 1])) { row.put("lastInVisit", Boolean.TRUE.toString()); } } else { row.put("firstInVisit", Boolean.TRUE.toString()); row.put("lastInVisit", Boolean.TRUE.toString()); } } if (encounter.getId() != null) { //If it is not mocked encounter row.put("encounterId", encounter.getId().toString()); row.put("encounterDate", Context.getDateFormat().format(encounter.getEncounterDatetime())); row.put("encounterType", encounter.getEncounterType().getName()); row.put("encounterProviders", getProviders(encounter)); row.put("encounterLocation", (encounter.getLocation() != null) ? encounter.getLocation().getName() : ""); row.put("encounterEnterer", (encounter.getCreator() != null) ? encounter.getCreator().getPersonName().getFullName() : ""); row.put("formViewURL", getViewFormURL(request, formToViewUrlMap, formToEditUrlMap, encounter)); } response.addRow(row); } return response; }
From source file:cl.mmoscoso.geocomm.sync.GeoCommCreateRouteAsyncTask.java
@Override protected Boolean doInBackground(Void... params) { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpParams httpParams = httpclient.getParams(); httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 10000); httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, 10000); HttpPost httppost = new HttpPost(this.hostname); try {/* w ww . ja va2s. c om*/ // Add your data Log.i(TAGNAME, "PUBLIC: " + this.is_public); Log.i(TAGNAME, "NAME: " + this.name); Log.i(TAGNAME, "DESC: " + this.desc); Log.i(TAGNAME, "OWNER: " + this.id_user); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1); nameValuePairs.add(new BasicNameValuePair("name", this.name)); nameValuePairs.add(new BasicNameValuePair("description", this.desc)); nameValuePairs.add(new BasicNameValuePair("id", Integer.toString(this.id_user))); nameValuePairs.add(new BasicNameValuePair("public", Boolean.toString(this.is_public))); //nameValuePairs.add(new BasicNameValuePair("id", "1")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); int responseCode = response.getStatusLine().getStatusCode(); Log.i(TAGNAME, "ERROR: " + responseCode); switch (responseCode) { default: Log.i(TAGNAME, "ERROR"); //Toast.makeText(this.context,R.string.error_not200code, Toast.LENGTH_SHORT).show(); break; case 200: HttpEntity entity = response.getEntity(); if (entity != null) { String responseBody = EntityUtils.toString(entity); Log.i(TAGNAME, responseBody); JSONObject jObj; try { Log.i(TAGNAME, "Status: " + this.is_public); jObj = new JSONObject(responseBody); this.status = jObj.getInt("status"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } break; } } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } return true; }
From source file:org.jnap.core.mvc.async.AsyncRequestInterceptor.java
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(servletContext);/*ww w. ja va2 s . c o m*/ final ServletContext sc = servletContext; final Map<String, String> params = new HashMap<String, String>(); params.put(ApplicationConfig.WEBSOCKET_SUPPORT, Boolean.toString(this.useWebSocket)); params.put(ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, Boolean.toString(this.useNative)); params.put(ApplicationConfig.PROPERTY_BLOCKING_COMETSUPPORT, Boolean.toString(this.useBlocking)); params.put(ApplicationConfig.PROPERTY_USE_STREAM, Boolean.toString(this.useStream)); // atmosphere = new AtmosphereServlet(true); atmosphere = new AtmosphereServlet(); atmosphere.addAtmosphereHandler("/*", this); atmosphere.init(new ServletConfig() { @Override public String getServletName() { return AsyncRequestInterceptor.class.getSimpleName(); } @Override public ServletContext getServletContext() { return sc; } @Override public Enumeration getInitParameterNames() { return new IteratorEnumeration(params.keySet().iterator()); } @Override public String getInitParameter(String name) { return params.get(name); } }); }
From source file:com.smartitengineering.util.opensearch.io.impl.dom.OpenSearchDescriptorWriter.java
protected Document buildDoc() { Element rootElement = getOpenSearchElement(ELEM_OPENSEARCHDESCRIPTION); addStringElement(rootElement, ELEM_SHORTNAME, descriptor.getShortName()); addStringElement(rootElement, ELEM_DESCRIPTION, descriptor.getDescription()); addCollectionOfStringAsSpaceDelimitedStringTextElement(descriptor.getTags(), ELEM_TAGS, rootElement); addStringElement(rootElement, ELEM_CONTACT, descriptor.getContact()); for (Url url : descriptor.getUrls()) { addUrlElement(url, rootElement); }//from www . j a v a 2s.c o m addStringElement(rootElement, ELEM_LONGNAME, descriptor.getLongName()); for (Image image : descriptor.getImages()) { addImageElement(image, rootElement); } for (Query query : descriptor.getQueries()) { addQueryElement(query, rootElement); } addStringElement(rootElement, ELEM_DEVELOPER, descriptor.getDeveloper()); addStringElement(rootElement, ELEM_ATTRIBUTION, descriptor.getAttribution()); addStringElement(rootElement, ELEM_SYNDICATIONRIGHT, descriptor.getSyndicationRight().getValue()); addStringElement(rootElement, ELEM_ADULTCONTENT, Boolean.toString(descriptor.containsAdultContent())); addStringElement(rootElement, ELEM_LANGUAGE, getLocaleString(descriptor.getLanguage())); addStringElement(rootElement, ELEM_OUTPUTENCODING, descriptor.getOutputEncoding()); addStringElement(rootElement, ELEM_INPUTENCODING, descriptor.getInputEncoding()); return new Document(rootElement); }
From source file:edu.internet2.middleware.changelogconsumer.googleapps.GoogleAppsFullSync.java
/** * Runs a fullSync./*from w ww.j a v a2 s .c o m*/ * @param dryRun indicates that this is dryRun */ public void process(boolean dryRun) { synchronized (fullSyncIsRunningLock) { fullSyncIsRunning.put(consumerName, Boolean.toString(true)); } connector = new GoogleGrouperConnector(); //Start with a clean cache GoogleCacheManager.googleGroups().clear(); GoogleCacheManager.googleGroups().clear(); properties = new GoogleAppsSyncProperties(consumerName); Pattern googleGroupFilter = Pattern.compile(properties.getGoogleGroupFilter()); try { connector.initialize(consumerName, properties); if (properties.getprefillGoogleCachesForFullSync()) { connector.populateGoogleCache(); } } catch (GeneralSecurityException e) { LOG.error("Google Apps Consume '{}' Full Sync - This consumer failed to initialize: {}", consumerName, e.getMessage()); } catch (IOException e) { LOG.error("Google Apps Consume '{}' Full Sync - This consumer failed to initialize: {}", consumerName, e.getMessage()); } GrouperSession grouperSession = null; try { grouperSession = GrouperSession.startRootSession(); connector.getGoogleSyncAttribute(); connector.cacheSyncedGroupsAndStems(true); // time context processing final StopWatch stopWatch = new StopWatch(); stopWatch.start(); //Populate a normalized list (google naming) of Grouper groups ArrayList<ComparableGroupItem> grouperGroups = new ArrayList<ComparableGroupItem>(); for (String groupKey : connector.getSyncedGroupsAndStems().keySet()) { if (connector.getSyncedGroupsAndStems().get(groupKey).equalsIgnoreCase("yes")) { edu.internet2.middleware.grouper.Group group = connector.fetchGrouperGroup(groupKey); if (group != null) { grouperGroups.add(new ComparableGroupItem( connector.getAddressFormatter().qualifyGroupAddress(group.getName()), group)); } } } //Populate a comparable list of Google groups ArrayList<ComparableGroupItem> googleGroups = new ArrayList<ComparableGroupItem>(); for (String groupName : GoogleCacheManager.googleGroups().getKeySet()) { if (googleGroupFilter.matcher(groupName.replace("@" + properties.getGoogleDomain(), "")).find()) { googleGroups.add(new ComparableGroupItem(groupName)); LOG.debug("Google Apps Consumer '{}' Full Sync - {} group matches group filter: included", consumerName, groupName); } else { LOG.debug("Google Apps Consumer '{}' Full Sync - {} group does not match group filter: ignored", consumerName, groupName); } } //Get our sets Collection<ComparableGroupItem> extraGroups = CollectionUtils.subtract(googleGroups, grouperGroups); processExtraGroups(dryRun, extraGroups); Collection<ComparableGroupItem> missingGroups = CollectionUtils.subtract(grouperGroups, googleGroups); processMissingGroups(dryRun, missingGroups); Collection<ComparableGroupItem> matchedGroups = CollectionUtils.intersection(grouperGroups, googleGroups); processMatchedGroups(dryRun, matchedGroups); // stop the timer and log stopWatch.stop(); LOG.debug("Google Apps Consumer '{}' Full Sync - Processed, Elapsed time {}", new Object[] { consumerName, stopWatch }); } finally { GrouperSession.stopQuietly(grouperSession); synchronized (fullSyncIsRunningLock) { fullSyncIsRunning.put(consumerName, Boolean.toString(true)); } } }
From source file:com.foundstone.certinstaller.CertInstallerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "FS Cert Installer starting..."); setContentView(R.layout.start);//from w ww . ja va 2 s. c om final SharedPreferences sharedPrefs = CertUtils.getSharedPreferences(this); Log.d(TAG, Boolean.toString(sharedPrefs.getBoolean(CertUtils.PREF_AUTO_LOAD, false))); if (sharedPrefs.getBoolean(CertUtils.PREF_AUTO_LOAD, false)) { ((EditText) findViewById(R.id.ip_input_text)) .setText(sharedPrefs.getString(CertUtils.PREF_PROXY_IP, "")); ((EditText) findViewById(R.id.port_input_text)) .setText(sharedPrefs.getString(CertUtils.PREF_PROXY_PORT, "")); } // Do this so anytime they change any setting we reset the certs ((EditText) findViewById(R.id.url_input_text)).addTextChangedListener(this); ((EditText) findViewById(R.id.ip_input_text)).addTextChangedListener(this); ((EditText) findViewById(R.id.port_input_text)).addTextChangedListener(this); mCaCertInstalledText = (TextView) findViewById(R.id.ca_error_text); mSiteCertInstalledText = (TextView) findViewById(R.id.site_error_text); mFullCertChainErrorText = (TextView) findViewById(R.id.full_error_text); findViewById(R.id.test_cert_chain_button).setOnClickListener(this); findViewById(R.id.install_ca_button).setOnClickListener(this); findViewById(R.id.install_site_cert_button).setOnClickListener(this); }
From source file:com.jaeksoft.searchlib.web.PushServlet.java
@Override protected void doRequest(ServletTransaction transaction) throws ServletException { try {/*from w w w . j av a 2 s . c om*/ User user = transaction.getLoggedUser(); if (user != null && !user.isAdmin()) throw new SearchLibException("Not permitted"); Client client = transaction.getClient(); String cmd = transaction.getParameterString("cmd"); if (CALL_XML_CMD_INIT.equals(cmd)) { transaction.addXmlResponse(CALL_XML_KEY_CMD, CALL_XML_CMD_INIT); ClientCatalog.receive_init(client); transaction.addXmlResponse(XML_CALL_KEY_STATUS, XML_CALL_KEY_STATUS_OK); return; } if (CALL_XML_CMD_SWITCH.equals(cmd)) { transaction.addXmlResponse(CALL_XML_KEY_CMD, CALL_XML_CMD_SWITCH); ClientCatalog.receive_switch(transaction.getWebApp(), client); transaction.addXmlResponse(XML_CALL_KEY_STATUS, XML_CALL_KEY_STATUS_OK); return; } if (CALL_XML_CMD_MERGE.equals(cmd)) { transaction.addXmlResponse(CALL_XML_KEY_CMD, CALL_XML_CMD_MERGE); ClientCatalog.receive_merge(transaction.getWebApp(), client); transaction.addXmlResponse(XML_CALL_KEY_STATUS, XML_CALL_KEY_STATUS_OK); return; } if (CALL_XML_CMD_ABORT.equals(cmd)) { transaction.addXmlResponse(CALL_XML_KEY_CMD, CALL_XML_CMD_ABORT); ClientCatalog.receive_abort(client); transaction.addXmlResponse(XML_CALL_KEY_STATUS, XML_CALL_KEY_STATUS_OK); return; } String filePath = transaction.getParameterString(CALL_XML_CMD_FILEPATH); Long lastModified = transaction.getParameterLong("lastModified", 0L); Long length = transaction.getParameterLong("length", 0L); if (CALL_XML_CMD_EXISTS.equals(cmd)) { transaction.addXmlResponse(CALL_XML_KEY_CMD, CALL_XML_CMD_EXISTS); boolean exist = ClientCatalog.receive_file_exists(client, filePath, lastModified, length); transaction.addXmlResponse(CALL_XML_KEY_EXISTS, Boolean.toString(exist)); transaction.addXmlResponse(XML_CALL_KEY_STATUS, XML_CALL_KEY_STATUS_OK); return; } transaction.addXmlResponse(CALL_XML_KEY_CMD, CALL_XML_CMD_FILEPATH); if (FilenameUtils.getName(filePath).startsWith(".")) { transaction.addXmlResponse(XML_CALL_KEY_STATUS, XML_CALL_KEY_STATUS_OK); return; } filePath = FileUtils.unixToSystemPath(filePath); if (transaction.getParameterBoolean("type", "dir", false)) ClientCatalog.receive_dir(client, filePath); else ClientCatalog.receive_file(client, filePath, lastModified, transaction.getInputStream()); transaction.addXmlResponse(XML_CALL_KEY_STATUS, XML_CALL_KEY_STATUS_OK); } catch (SearchLibException e) { throw new ServletException(e); } catch (NamingException e) { throw new ServletException(e); } catch (InterruptedException e) { throw new ServletException(e); } catch (IOException e) { throw new ServletException(e); } }