List of usage examples for java.lang Boolean toString
public String toString()
From source file:com.gitblit.tests.HtpasswdAuthenticationTest.java
private MemorySettings getSettings(String userfile, String groupfile, Boolean overrideLA) { MS.put("realm.userService", RESOURCE_DIR + "users.conf"); MS.put("realm.htpasswd.userfile", (userfile == null) ? (RESOURCE_DIR + "htpasswd") : userfile); MS.put("realm.htpasswd.groupfile", (groupfile == null) ? (RESOURCE_DIR + "htgroup") : groupfile); MS.put("realm.htpasswd.overrideLocalAuthentication", (overrideLA == null) ? "false" : overrideLA.toString()); // Default to keep test the same on all platforms. MS.put(KEY_SUPPORT_PLAINTEXT_PWD, "false"); return MS;/*from w ww. j a va 2 s .co m*/ }
From source file:fr.mailjet.rest.impl.ListsRESTServiceImpl.java
@Override public String addManyContacts(EnumReturnType parType, Integer parListId, List<String> parContacts, Boolean parForce) throws UniformInterfaceException, IllegalArgumentException { if (parListId == null || parContacts == null || parContacts.isEmpty()) throw new IllegalArgumentException(); MultivaluedMap<String, String> locParameters = this.createHTTPProperties(parType); locParameters.putSingle(_ListId, parListId.toString()); locParameters.putSingle(_contacts, this.toString(parContacts)); if (parForce != null) { locParameters.putSingle(_force, parForce.toString()); }/*from w ww. jav a 2 s . c o m*/ return this.createPOSTRequest("listsAddmanycontacts", locParameters); }
From source file:edu.ku.brc.specify.plugins.ipadexporter.IPadCloudJSONImpl.java
@Override public boolean addNewDataSet(final String dsName, final String dirName, final String guid, final String div, final String disp, final String coll, final Boolean isGlobal, final String iconName, final String curator, final String collGuid) { HashMap<String, String> map = createHashMap(kUserName, userName, kCollection, coll, kDiscipline, disp, kDivision, div, kGUID, guid, kDirName, dirName, kIsGlobal, isGlobal != null ? isGlobal.toString() : "false", kIcon, iconName, kCurator, curator, kCollGUID, collGuid, kAction, "adddataset"); JSONObject data = sendPost(map);//from w w w.j a v a 2 s . co m return data != null && isStatusOK(data); }
From source file:edu.ku.brc.af.prefs.AppPreferences.java
/** * Sets a Boolean value into a pref.//from ww w . j ava 2 s. c o m * @param name the name * @param value the new value */ public void putBoolean(final String name, final Boolean value) { put(name, value.toString()); }
From source file:com.redhat.rhn.manager.satellite.ConfigureSatelliteCommand.java
/** * Update a configuration value for this satellite. This tracks * the values that are actually changed. * @param configKey key to the Config value you want to set * @param newValue you want to set//from w ww. ja v a2s . c om */ public void updateBoolean(String configKey, Boolean newValue) { if (logger.isDebugEnabled()) { logger.debug( "updateBoolean(String configKey=" + configKey + ", Boolean newValue=" + newValue + ") - start"); } if (newValue == null) { // If its true we are changing the value if (Config.get().getBoolean(configKey)) { Config.get().setBoolean(configKey, Boolean.FALSE.toString()); keysToBeUpdated.add(configKey); } } else { if (Config.get().getBoolean(configKey) != newValue.booleanValue()) { Config.get().setBoolean(configKey, newValue.toString()); keysToBeUpdated.add(configKey); } } if (logger.isDebugEnabled()) { logger.debug("updateBoolean(String, Boolean) - end"); } }
From source file:edu.ucsd.crbs.cws.dao.rest.WorkflowRestDAOImpl.java
@Override public List<Workflow> getAllWorkflows(boolean omitWorkflowParams, final Boolean showDeleted) throws Exception { ClientConfig cc = new DefaultClientConfig(); cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); Client client = Client.create(cc);/*from www . j av a 2s . 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.WORKFLOWS_PATH); MultivaluedMap queryParams = _multivaluedMapFactory.getMultivaluedMap(_user); if (omitWorkflowParams == true) { queryParams.add(Constants.NOWORKFLOWPARAMS_QUERY_PARAM, Boolean.TRUE.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<Workflow>>() { }); }
From source file:com.sikulix.core.SX.java
public static boolean isOption(String pName, Boolean bDefault) { if (sxOptions == null) { return bDefault; }/* w ww .j av a2 s . c om*/ String pVal = sxOptions.getString(pName, bDefault.toString()).toLowerCase(); if (pVal.contains("yes") || pVal.contains("true") || pVal.contains("on")) { return true; } return false; }
From source file:com.lrazvan.server.connection.ApplicationServer.java
/** * This method handles any messages received from the client. * * @param msg The message received from the client. * @param client The connection from which the message originated. *//* w ww . ja v a 2 s . com*/ public void handleMessageFromClient(Object msg, ConnectionToClient client) { JSONObject jsonObject = new JSONObject((String) msg); String subject = jsonObject.getString("Subject"); System.out.println("Message received: " + subject + " from " + client); JSONObject response; switch (subject) { case "GetAllPatients": List<PatientDTO> patientDTOList = api.findAllPatients(); response = new JSONObject(); response.put("Subject", "PatientList"); response.put("Body", patientDTOList); try { client.sendToClient(response.toString()); } catch (IOException e) { e.printStackTrace(); } break; case "GetPatientConsultations": PatientDTO patientDTO = Commons.jsonObjectToPatientDTO(jsonObject.getJSONObject("patientDTO")); List<ConsultationDTO> consultationDTOList = api.getPatientConsultations(patientDTO); response = new JSONObject(); response.put("Subject", "PatientConsultationList"); response.put("ConsultationList", consultationDTOList); try { client.sendToClient(response.toString()); } catch (IOException e) { e.printStackTrace(); } break; case "GetScheduledConsultations": String doctorUsername = jsonObject.getString("doctorUsername"); consultationDTOList = api.getScheduledConsultations(doctorUsername); response = new JSONObject(); response.put("Subject", "PatientConsultationList"); response.put("ConsultationList", consultationDTOList); try { client.sendToClient(response.toString()); } catch (IOException e) { e.printStackTrace(); } break; case "GetDoctorPatients": doctorUsername = jsonObject.getString("doctorUsername"); patientDTOList = api.getDoctorPatients(doctorUsername); response = new JSONObject(); response.put("Subject", "DoctorPatientList"); response.put("patientList", patientDTOList); try { client.sendToClient(response.toString()); } catch (IOException e) { e.printStackTrace(); } break; case "GetAllSecretaries": List<SecretaryDTO> secretaryDTOList = api.getAllSecretaries(); response = new JSONObject(); response.put("Subject", "SecretaryList"); response.put("SecretaryList", secretaryDTOList); try { client.sendToClient(response.toString()); } catch (IOException e) { e.printStackTrace(); } break; case "GetAllDoctors": List<DoctorDTO> doctorDTOList = api.getAllDoctors(); response = new JSONObject(); response.put("Subject", "DoctorList"); response.put("DoctorList", doctorDTOList); try { client.sendToClient(response.toString()); } catch (IOException e) { e.printStackTrace(); } break; case "GetAvailableDoctors": Timestamp date = Timestamp.valueOf(jsonObject.getString("date")); doctorDTOList = api.getAvailableDoctors(date); response = new JSONObject(); response.put("Subject", "AvailableDoctors"); response.put("DoctorList", doctorDTOList); try { client.sendToClient(response.toString()); } catch (IOException e) { e.printStackTrace(); } break; case "SaveConsultation": ConsultationDTO consultationDTO = Commons .jsonObjectToConsultationDTO(jsonObject.getJSONObject("consultationDTO")); api.saveConsultation(consultationDTO); break; case "SavePatient": patientDTO = Commons.jsonObjectToPatientDTO(jsonObject.getJSONObject("patientDTO")); api.savePatientDTO(patientDTO); break; case "SaveSecretary": SecretaryDTO secretaryDTO = Commons.jsonObjectToSecretaryDTO(jsonObject.getJSONObject("secretaryDTO")); api.saveSecretaryDTO(secretaryDTO); break; case "DeleteSecretary": secretaryDTO = Commons.jsonObjectToSecretaryDTO(jsonObject.getJSONObject("secretaryDTO")); api.deleteSecretaryDTO(secretaryDTO); break; case "DeleteConsultation": consultationDTO = Commons.jsonObjectToConsultationDTO(jsonObject.getJSONObject("consultationDTO")); api.deleteConsultation(consultationDTO); break; case "SaveDoctor": DoctorDTO doctorDTO = Commons.jsonObjectToDoctorDTO(jsonObject.getJSONObject("doctorDTO")); api.saveDoctorDTO(doctorDTO); break; case "DeleteDoctor": doctorDTO = Commons.jsonObjectToDoctorDTO(jsonObject.getJSONObject("doctorDTO")); api.deleteDoctorDTO(doctorDTO); break; case "Authenticate": String role = jsonObject.getString("role"); String username = jsonObject.getString("username"); String password = jsonObject.getString("password"); Boolean authenticated = false; switch (role) { case Commons.SECRETARY_ROLE: authenticated = api.authenticateSecretary(username, password); break; case Commons.DOCTOR_ROLE: authenticated = api.authenticateDoctor(username, password); break; case Commons.ADMIN_ROLE: authenticated = api.authenticateAdmin(username, password); break; } response = new JSONObject(); response.put("Subject", "Authenticate Result"); response.put("result", authenticated.toString()); response.put("username", username); response.put("role", role); try { client.sendToClient(response.toString()); } catch (IOException e) { e.printStackTrace(); } break; default: System.out.println("Unknown command: " + subject); } //this.sendToAllClients(msg); }