@Override public void meet(IsNumeric node) throws RuntimeException { ValueExpr arg = node.getArg(); // operator must be a variable or a constant if (arg instanceof ValueConstant) { try { Double.parseDouble(((ValueConstant) arg).getValue().stringValue()); builder.append(Boolean.toString(true)); } catch (NumberFormatException ex) { builder.append(Boolean.toString(false)); } } else if (arg instanceof Var) { String var = getVariableAlias((Var) arg); Preconditions.checkState(var != null, "no alias available for variable"); builder .append("(") .append(var) .append(".ntype = 'int' OR ") .append(var) .append(".ntype = 'double')"); } }
/** @throws Exception */ public void testGetAttributeStringString() throws Exception { assertEquals( this.id, Long.toString(1), this.testData.getAttribute("A", "default")); // $NON-NLS-1$ //$NON-NLS-2$ assertEquals( this.id, Double.toString(2.), this.testData.getAttribute("B", "default")); // $NON-NLS-1$ //$NON-NLS-2$ assertEquals( this.id, Boolean.toString(true), this.testData.getAttribute("C", "default")); // $NON-NLS-1$ //$NON-NLS-2$ assertEquals( this.id, "Hello", this.testData.getAttribute("D", "default")); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ assertEquals( this.id, 1. + ";" + 2., this.testData.getAttribute("E", "default")); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ assertEquals( this.id, Boolean.toString(false), this.testData.getAttribute("F", "default")); // $NON-NLS-1$ //$NON-NLS-2$ }
/** Called when this widget is getting loaded */ protected void onLoad() { if (DOM.getElementById("overlay") != null || DOM.getElementById("lightbox") != null) { clear(); } if (image != null) { DOM.appendChild(getElement(), createAnchor(image, "lightbox")); } else if (images != null) { childrens = new Element[images.length]; for (int i = 0; i < images.length; i++) { childrens[i] = createAnchor(images[i], "lightbox[" + imagesets + "]"); setAttribute(childrens[i], "startslideshow", Boolean.toString(slideshow)); setAttribute(childrens[i], "slideDuration", String.valueOf(slideshowDelayInSeconds)); if (backgroundMusicURL != null) { setAttribute(childrens[i], "music", backgroundMusicURL); } if (slideshow) { setAttribute(childrens[i], "forever", Boolean.toString(slideshowForever)); } DOM.appendChild(getElement(), childrens[i]); } imagesets++; if (slideshow && images.length > 0) { toggleImage(currentIdx); } } init(); }
public void writeToLog(String preamble) throws IOException { String dirText = " (top down):"; if (mSearchMethod == JOAConstants.SEARCH_BOTTOM_UP) dirText = " (bottom up):"; try { JOAConstants.LogFileStream.writeBytes(preamble); JOAConstants.LogFileStream.writeBytes( "\t" + "Interpolation " + dirText + " " + mIntVar + " WRT " + mWRTVar + " Int. at Value = " + JOAFormulas.formatDouble(mIntAtValue, 3, false) + " Use deepest = " + Boolean.toString(mUseDeepest) + " At Surface = " + Boolean.toString(mAtSurface) + " Surface Depth Limit = " + JOAFormulas.formatDouble(mSurfaceDepthLimit, 3, false) + " At Bottom = " + Boolean.toString(mAtBottom) + " Interpolate Missing = " + Boolean.toString(mInterpolateMissing) + "\n"); JOAConstants.LogFileStream.flush(); } catch (IOException ex) { throw ex; } }
protected void saveConfigToLocal() { final Preferences uniqueMachinePreferencesNode = topLevelMachinesPreferenceNode.node(Long.toString(robotUID)); uniqueMachinePreferencesNode.put("limit_top", Double.toString(limitTop)); uniqueMachinePreferencesNode.put("limit_bottom", Double.toString(limitBottom)); uniqueMachinePreferencesNode.put("limit_right", Double.toString(limitRight)); uniqueMachinePreferencesNode.put("limit_left", Double.toString(limitLeft)); uniqueMachinePreferencesNode.put("m1invert", Boolean.toString(isLeftMotorInverted)); uniqueMachinePreferencesNode.put("m2invert", Boolean.toString(isRightMotorInverted)); uniqueMachinePreferencesNode.put("bobbin_left_diameter", Double.toString(pulleyDiameter)); uniqueMachinePreferencesNode.put("acceleration", Double.toString(maxAcceleration)); uniqueMachinePreferencesNode.put("startingPosIndex", Integer.toString(startingPositionIndex)); uniqueMachinePreferencesNode.putDouble("paper_left", paperLeft); uniqueMachinePreferencesNode.putDouble("paper_right", paperRight); uniqueMachinePreferencesNode.putDouble("paper_top", paperTop); uniqueMachinePreferencesNode.putDouble("paper_bottom", paperBottom); uniqueMachinePreferencesNode.putInt("paperColorR", paperColor.getRed()); uniqueMachinePreferencesNode.putInt("paperColorG", paperColor.getGreen()); uniqueMachinePreferencesNode.putInt("paperColorB", paperColor.getBlue()); uniqueMachinePreferencesNode.put("paper_margin", Double.toString(paperMargin)); uniqueMachinePreferencesNode.put("reverseForGlass", Boolean.toString(reverseForGlass)); // uniqueMachinePreferencesNode.put("current_tool", Integer.toString(getCurrentToolNumber())); uniqueMachinePreferencesNode.put("isRegistered", Boolean.toString(isRegistered())); uniqueMachinePreferencesNode.put("hardwareVersion", Integer.toString(hardwareVersion)); savePenConfig(uniqueMachinePreferencesNode); }
protected Document generateAntTask() { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document doc = factory.newDocumentBuilder().newDocument(); Element root = doc.createElement("project"); // $NON-NLS-1$ root.setAttribute("name", "build"); // $NON-NLS-1$ //$NON-NLS-2$ root.setAttribute("default", "feature_export"); // $NON-NLS-1$ //$NON-NLS-2$ doc.appendChild(root); Element target = doc.createElement("target"); // $NON-NLS-1$ target.setAttribute("name", "feature_export"); // $NON-NLS-1$ //$NON-NLS-2$ root.appendChild(target); Element export = doc.createElement("pde.exportFeatures"); // $NON-NLS-1$ export.setAttribute("features", getFeatureIDs()); // $NON-NLS-1$ export.setAttribute("destination", fPage.getDestination()); // $NON-NLS-1$ String filename = fPage.getFileName(); if (filename != null) export.setAttribute("filename", filename); // $NON-NLS-1$ export.setAttribute("exportType", getExportOperation()); // $NON-NLS-1$ export.setAttribute("useJARFormat", Boolean.toString(fPage.useJARFormat())); // $NON-NLS-1$ export.setAttribute("exportSource", Boolean.toString(fPage.doExportSource())); // $NON-NLS-1$ if (fPage.doExportSource()) { export.setAttribute( "exportSourceBundle", Boolean.toString(fPage.doExportSourceBundles())); // $NON-NLS-1$ } String qualifier = fPage.getQualifier(); if (qualifier != null) export.setAttribute("qualifier", qualifier); // $NON-NLS-1$ target.appendChild(export); return doc; } catch (DOMException e) { } catch (FactoryConfigurationError e) { } catch (ParserConfigurationException e) { } return null; }
/** * Method to save the send settings. * * @param request The current request. * @param notificationSettings The settings to save. * @param result The result to bind errors and so on to. * @return The ModelAndView to use. */ @RequestMapping(method = RequestMethod.POST) public ModelAndView saveSettings( HttpServletRequest request, @ModelAttribute("command") ClientProfileNotificationsForm notificationSettings, BindingResult result) { Map<ClientConfigurationPropertyConstant, String> settings = new HashMap<ClientConfigurationPropertyConstant, String>(); settings.put( ClientProperty.NOTIFICATION_RENDER_ATTACHMENTLINKS, Boolean.toString(notificationSettings.isRenderAttachmentLinks())); settings.put( ClientProperty.NOTIFICATION_RENDER_PERMALINKS, Boolean.toString(notificationSettings.isRenderPermalinks())); settings.put( ClientProperty.INVITATION_RENDER_BLOG_PERMALINK, Boolean.toString(notificationSettings.isRenderBlogPermalinkInInvitation())); settings.put( ClientProperty.MAX_NUMBER_OF_MENTIONED_USERS, Integer.toString(notificationSettings.getMaxUsersToMention())); CommunoteRuntime.getInstance() .getConfigurationManager() .updateClientConfigurationProperties(settings); MessageHelper.saveMessageFromKey(request, "client.profile.notifications.success"); return get(); }
private static void writeHashDbsToDisk(Document doc, Element rootEl, List<HashDb> hashDbs) { for (HashDb db : hashDbs) { // Get the path for the hash database before writing anything, in // case an exception is thrown. String path; try { if (db.hasIndexOnly()) { path = db.getIndexPath(); } else { path = db.getDatabasePath(); } } catch (TskCoreException ex) { Logger.getLogger(HashDbManager.class.getName()) .log( Level.SEVERE, "Error getting path of hash database " + db.getHashSetName() + ", discarding from hash database configuration", ex); // NON-NLS continue; } Element setElement = doc.createElement(SET_ELEMENT); setElement.setAttribute(SET_NAME_ATTRIBUTE, db.getHashSetName()); setElement.setAttribute(SET_TYPE_ATTRIBUTE, db.getKnownFilesType().toString()); setElement.setAttribute( SEARCH_DURING_INGEST_ATTRIBUTE, Boolean.toString(db.getSearchDuringIngest())); setElement.setAttribute( SEND_INGEST_MESSAGES_ATTRIBUTE, Boolean.toString(db.getSendIngestMessages())); Element pathElement = doc.createElement(PATH_ELEMENT); pathElement.setTextContent(path); setElement.appendChild(pathElement); rootEl.appendChild(setElement); } }
protected Map<String, Object> getParamsAsMap() { Map<String, Object> params = new HashMap<String, Object>(); if (isNoop()) { params.put("noop", Boolean.toString(true)); } if (isDelete()) { params.put("delete", Boolean.toString(true)); } if (move != null) { params.put("move", move); } if (moveFailed != null) { params.put("moveFailed", moveFailed); } if (preMove != null) { params.put("preMove", preMove); } if (exclusiveReadLockStrategy != null) { params.put("exclusiveReadLockStrategy", exclusiveReadLockStrategy); } if (readLock != null) { params.put("readLock", readLock); } if (readLockCheckInterval > 0) { params.put("readLockCheckInterval", readLockCheckInterval); } if (readLockTimeout > 0) { params.put("readLockTimeout", readLockTimeout); } return params; }
/** Print the status booleans for analysis operations */ void printBooleanStatus() { // Print the boolean statuses upon handling activity requests Log.i("Has select positives?:", Boolean.toString(hasChosenPositives)); Log.i("Has select negatives?:", Boolean.toString(isHasChosenNegatives)); Log.i("Has select neutrals?:", Boolean.toString(isHasChosenNeutrals)); Log.i("Has select target?:", Boolean.toString(hasChosenTarget)); }
public Property get(String category, String key, boolean defaultValue) { Property prop = get(category, key, Boolean.toString(defaultValue), BOOLEAN); if (!prop.isBooleanValue()) { prop.value = Boolean.toString(defaultValue); } return prop; }
@Override protected Map<String, String> getSystemPropertyDefaults() { // FIXME: some threads must be kept alive that prevent JVM // from shutting down FrameworkImpl.killAfterShutdown = true; Map<String, String> defaults = super.getSystemPropertyDefaults(); String true_ = Boolean.toString(true); String false_ = Boolean.toString(false); // Audio system should not be disabled defaults.put(MediaServiceImpl.DISABLE_AUDIO_SUPPORT_PNAME, false_); defaults.put(DeviceConfiguration.PROP_AUDIO_SYSTEM, AudioSystem.LOCATOR_PROTOCOL_AUDIOSILENCE); defaults.put("org.jitsi.impl.neomedia.device.PortAudioSystem.disabled", true_); defaults.put("org.jitsi.impl.neomedia.device.PulseAudioSystem.disabled", true_); // Disables COIN notifications defaults.put(OperationSetTelephonyConferencingJabberImpl.DISABLE_COIN_PROP_NAME, true_); // FIXME not sure about this one // It makes no sense for Jitsi Videobridge to pace its RTP output. defaults.put( DeviceConfiguration.PROP_VIDEO_RTP_PACING_THRESHOLD, Integer.toString(Integer.MAX_VALUE)); // FIXME not sure about this one /* * XXX Explicitly support JitMeet by default because is is the primary * use case of Jitsi Videobridge right now. */ defaults.put(SsrcTransformEngine.DROP_MUTED_AUDIO_SOURCE_IN_REVERSE_TRANSFORM, true_); defaults.put(SRTPCryptoContext.CHECK_REPLAY_PNAME, false_); return defaults; }
/* (non-Javadoc) * @see com.aptana.ide.core.io.ConnectionPoint#saveState(com.aptana.ide.core.io.epl.IMemento) */ @Override protected void saveState(IMemento memento) { super.saveState(memento); memento.createChild(ELEMENT_HOST).putTextData(host); if (IFTPSConstants.FTP_PORT_DEFAULT != port) { memento.createChild(ELEMENT_PORT).putTextData(Integer.toString(port)); } if (!Path.ROOT.equals(path)) { memento.createChild(ELEMENT_PATH).putTextData(path.toPortableString()); } if (login.length() != 0) { memento.createChild(ELEMENT_LOGIN).putTextData(login); } memento.createChild(ELEMENT_EXPLICIT).putTextData(Boolean.toString(explicit)); memento .createChild(ELEMENT_VALIDATE_CERTIFICATE) .putTextData(Boolean.toString(validateCertificate)); if (noSSLSessionResumption) { memento .createChild(ELEMENT_NO_SSL_SESSION_RESUMPTION) .putTextData(Boolean.toString(noSSLSessionResumption)); } memento.createChild(ELEMENT_PASSIVE).putTextData(Boolean.toString(passiveMode)); if (!IFTPSConstants.TRANSFER_TYPE_AUTO.equals(transferType)) { memento.createChild(ELEMENT_TRANSFER_TYPE).putTextData(transferType); } if (!IFTPSConstants.ENCODING_DEFAULT.equals(encoding)) { memento.createChild(ELEMENT_ENCODING).putTextData(encoding); } if (timezone != null && timezone.length() != 0) { memento.createChild(ELEMENT_TIMEZONE).putTextData(timezone); } }
/** * Adds extra parameters to a Solr query for better term searches, including custom options. More * specifically, adds parameters for requesting the score to be included in the results, for * requesting a spellcheck result, and sets the {@code start} and {@code rows} parameters when * missing. * * @param originalParams the original Solr parameters to enhance * @param queryOptions extra options to include in the query; these override the default values, * but don't override values already set in the query * @return the enhanced parameters */ public static SolrParams enhanceParams( SolrParams originalParams, Map<String, String> queryOptions) { if (originalParams == null) { return null; } ModifiableSolrParams newParams = new ModifiableSolrParams(); newParams.set(CommonParams.START, "0"); newParams.set(CommonParams.ROWS, "1000"); newParams.set(CommonParams.FL, "* score"); if (queryOptions != null) { for (Map.Entry<String, String> item : queryOptions.entrySet()) { newParams.set(item.getKey(), item.getValue()); } } for (Map.Entry<String, Object> item : originalParams.toNamedList()) { if (item.getValue() != null && item.getValue() instanceof String[]) { newParams.set(item.getKey(), (String[]) item.getValue()); } else { newParams.set(item.getKey(), String.valueOf(item.getValue())); } } if (newParams.get(SPELLCHECK) == null) { newParams.set(SPELLCHECK, Boolean.toString(true)); newParams.set(SpellingParams.SPELLCHECK_COLLATE, Boolean.toString(true)); } return newParams; }
@Override public void gamepadButtonEvent(FtcGamepad gamepad, final int btnMask, final boolean pressed) { if (gamepad == driverGamepad) { dashboard.displayPrintf(5, "Driver[%d] = %s", btnMask, Boolean.toString(pressed)); switch (btnMask) { case FtcGamepad.GAMEPAD_A: break; case FtcGamepad.GAMEPAD_B: break; case FtcGamepad.GAMEPAD_X: break; case FtcGamepad.GAMEPAD_Y: break; } } else if (gamepad == operatorGamepad) { dashboard.displayPrintf(6, "Operator[%d] = %s", btnMask, Boolean.toString(pressed)); switch (btnMask) { case FtcGamepad.GAMEPAD_A: break; case FtcGamepad.GAMEPAD_B: break; case FtcGamepad.GAMEPAD_X: break; case FtcGamepad.GAMEPAD_Y: break; } } } // gamepadButtonEvent
@Test public void testExecute() throws Exception { HashMap<UserOptions, String> configMap = new HashMap<UserOptions, String>(); configMap.put(UserOptions.DisplayButtons, Boolean.toString(true)); configMap.put(UserOptions.EditorPageSize, Integer.toString(25)); configMap.put(UserOptions.EnterSavesApproved, Boolean.toString(true)); SaveOptionsAction action = new SaveOptionsAction(configMap); SaveOptionsResult result = handler.execute(action, null); assertThat(result.isSuccess(), Matchers.equalTo(true)); List<HAccountOption> accountOptions = getEm().createQuery("from HAccountOption").getResultList(); assertThat(accountOptions, Matchers.hasSize(configMap.size())); Map<String, HAccountOption> editorOptions = authenticatedAccount.getEditorOptions(); assertThat(editorOptions.values(), Matchers.containsInAnyOrder(accountOptions.toArray())); handler.execute(action, null); // save again should override previous // value accountOptions = getEm().createQuery("from HAccountOption").getResultList(); assertThat(accountOptions, Matchers.hasSize(configMap.size())); assertThat(editorOptions.values(), Matchers.containsInAnyOrder(accountOptions.toArray())); }
private void saveChanges() { saveString(Reseeder.PROP_PROXY_PORT, "port"); saveString(Reseeder.PROP_PROXY_HOST, "host"); saveString(Reseeder.PROP_PROXY_USERNAME, "username"); saveString(Reseeder.PROP_PROXY_PASSWORD, "password"); saveBoolean(Reseeder.PROP_PROXY_AUTH_ENABLE, "auth"); saveString(Reseeder.PROP_SPROXY_PORT, "sport"); saveString(Reseeder.PROP_SPROXY_HOST, "shost"); saveString(Reseeder.PROP_SPROXY_USERNAME, "susername"); saveString(Reseeder.PROP_SPROXY_PASSWORD, "spassword"); saveBoolean(Reseeder.PROP_SPROXY_AUTH_ENABLE, "sauth"); String url = getJettyString("reseedURL"); if (url != null) { url = url.trim().replace("\r\n", ",").replace("\n", ","); if (url.length() <= 0) { addFormNotice("Restoring default URLs"); removes.add(Reseeder.PROP_RESEED_URL); } else { changes.put(Reseeder.PROP_RESEED_URL, url); } } String mode = getJettyString("mode"); boolean req = "1".equals(mode); boolean disabled = "2".equals(mode); changes.put(Reseeder.PROP_SSL_REQUIRED, Boolean.toString(req)); changes.put(Reseeder.PROP_SSL_DISABLE, Boolean.toString(disabled)); saveBoolean(Reseeder.PROP_PROXY_ENABLE, "enable"); saveBoolean(Reseeder.PROP_SPROXY_ENABLE, "senable"); if (_context.router().saveConfig(changes, removes)) addFormNotice(_("Configuration saved successfully.")); else addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs")); }
/** Exposes the name/value as an environment variable. */ @Override public void buildEnvVars(AbstractBuild<?, ?> build, EnvVars env) { env.put(name, Boolean.toString(value)); env.put( name.toUpperCase(Locale.ENGLISH), Boolean.toString(value)); // backward compatibility pre 1.345 }
// Used in the table label provider public String getViewerColumnValue(int index) { switch (index) { case 0: // transition name return transitionName; case 1: // qualified name return sourceFeature.getName() + "." + transitionData.stateMachineName + "." + transitionData.regionName; case 2: // requires safe composition return Boolean.toString(needsSAT); case 3: // has error return Boolean.toString(hasError); case 4: // logical proposition if (!needsSAT || hasError) { // if does not need SAT or is an error return empty return ""; } return SCUtils.translatesRequiringImpl(sourceFeature, requiringFeatures); case 5: // is consistent (if satisfiable means is inconsistent, that is why it is negated) if (!needsSAT || hasError) { // if does not need SAT or is an error return empty return ""; } return Boolean.toString(!evaluationValues.get(0)); // case 6: // eval time if (!needsSAT || hasError) { // if does not need SAT or is an error return empty return ""; } return Long.toString(evaluationTime); case 7: // remarks return errorMessage; default: return "unkown " + index; } } // getViewrColumnValue
private void handleBranchingInstruction( ProblemsHolder holder, StandardInstructionVisitor visitor, Set<Instruction> trueSet, Set<Instruction> falseSet, HashSet<PsiElement> reportedAnchors, BranchingInstruction instruction, final boolean onTheFly) { PsiElement psiAnchor = instruction.getPsiAnchor(); boolean underBinary = isAtRHSOfBooleanAnd(psiAnchor); if (instruction instanceof InstanceofInstruction && visitor.isInstanceofRedundant((InstanceofInstruction) instruction)) { if (visitor.canBeNull((BinopInstruction) instruction)) { holder.registerProblem( psiAnchor, InspectionsBundle.message("dataflow.message.redundant.instanceof"), new RedundantInstanceofFix()); } else { final LocalQuickFix localQuickFix = createSimplifyBooleanExpressionFix(psiAnchor, true); holder.registerProblem( psiAnchor, InspectionsBundle.message( underBinary ? "dataflow.message.constant.condition.when.reached" : "dataflow.message.constant.condition", Boolean.toString(true)), localQuickFix == null ? null : new LocalQuickFix[] {localQuickFix}); } } else if (psiAnchor instanceof PsiSwitchLabelStatement) { if (falseSet.contains(instruction)) { holder.registerProblem( psiAnchor, InspectionsBundle.message("dataflow.message.unreachable.switch.label")); } } else if (psiAnchor != null && !reportedAnchors.contains(psiAnchor) && !isFlagCheck(psiAnchor)) { boolean evaluatesToTrue = trueSet.contains(instruction); final PsiElement parent = psiAnchor.getParent(); if (parent instanceof PsiAssignmentExpression && ((PsiAssignmentExpression) parent).getLExpression() == psiAnchor) { holder.registerProblem( psiAnchor, InspectionsBundle.message( "dataflow.message.pointless.assignment.expression", Boolean.toString(evaluatesToTrue)), createConditionalAssignmentFixes( evaluatesToTrue, (PsiAssignmentExpression) parent, onTheFly)); } else if (!skipReportingConstantCondition(visitor, psiAnchor, evaluatesToTrue)) { final LocalQuickFix fix = createSimplifyBooleanExpressionFix(psiAnchor, evaluatesToTrue); String message = InspectionsBundle.message( underBinary ? "dataflow.message.constant.condition.when.reached" : "dataflow.message.constant.condition", Boolean.toString(evaluatesToTrue)); holder.registerProblem(psiAnchor, message, fix == null ? null : new LocalQuickFix[] {fix}); } reportedAnchors.add(psiAnchor); } }
/** * String form. Generated from: * org.dmd.dms.meta.MetaComplexTypeFormatter.dumpComplexType(MetaComplexTypeFormatter.java:257) */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append(type.toString()); sb.append(' '); sb.append(name.toString()); sb.append(' '); sb.append("\"" + description.toString() + "\""); if (quoted != null) { sb.append(' '); sb.append("quoted=" + quoted.toString()); } if (multivalued != null) { sb.append(' '); sb.append("multivalued=" + multivalued.toString()); } if (weakref != null) { sb.append(' '); sb.append("weakref=" + weakref.toString()); } if (greedy != null) { sb.append(' '); sb.append("greedy=" + greedy.toString()); } return (sb.toString()); }
@Bean public JavaMailSenderImpl javaMailSender(JHipsterProperties jHipsterProperties) { log.debug("Configuring mail server"); String host = jHipsterProperties.getMail().getHost(); int port = jHipsterProperties.getMail().getPort(); String user = jHipsterProperties.getMail().getUsername(); String password = jHipsterProperties.getMail().getPassword(); String protocol = jHipsterProperties.getMail().getProtocol(); Boolean tls = jHipsterProperties.getMail().isTls(); Boolean auth = jHipsterProperties.getMail().isAuth(); JavaMailSenderImpl sender = new JavaMailSenderImpl(); if (host != null && !host.isEmpty()) { sender.setHost(host); } else { log.warn("Warning! Your SMTP server is not configured. We will try to use one on localhost."); log.debug("Did you configure your SMTP settings in your application.yml?"); sender.setHost(DEFAULT_HOST); } sender.setPort(port); sender.setUsername(user); sender.setPassword(password); Properties sendProperties = new Properties(); sendProperties.setProperty(PROP_SMTP_AUTH, auth.toString()); sendProperties.setProperty(PROP_STARTTLS, tls.toString()); sendProperties.setProperty(PROP_TRANSPORT_PROTO, protocol); sender.setJavaMailProperties(sendProperties); return sender; }
@Override public ContentValues getValues() { ContentValues values = new ContentValues(); values.put(HostDatabase.FIELD_HOST_NICKNAME, nickname); values.put(HostDatabase.FIELD_HOST_PROTOCOL, protocol); values.put(HostDatabase.FIELD_HOST_USERNAME, username); values.put(HostDatabase.FIELD_HOST_HOSTNAME, hostname); values.put(HostDatabase.FIELD_HOST_PORT, port); values.put(HostDatabase.FIELD_HOST_HOSTKEYALGO, hostKeyAlgo); values.put(HostDatabase.FIELD_HOST_HOSTKEY, hostKey); values.put(HostDatabase.FIELD_HOST_LASTCONNECT, lastConnect); values.put(HostDatabase.FIELD_HOST_COLOR, color); values.put(HostDatabase.FIELD_HOST_USEKEYS, Boolean.toString(useKeys)); values.put(HostDatabase.FIELD_HOST_USEAUTHAGENT, useAuthAgent); values.put(HostDatabase.FIELD_HOST_POSTLOGIN, postLogin); values.put(HostDatabase.FIELD_HOST_PUBKEYID, pubkeyId); values.put(HostDatabase.FIELD_HOST_WANTSESSION, Boolean.toString(wantSession)); values.put(HostDatabase.FIELD_HOST_DELKEY, delKey); values.put(HostDatabase.FIELD_HOST_FONTSIZE, fontSize); values.put(HostDatabase.FIELD_HOST_COMPRESSION, Boolean.toString(compression)); values.put(HostDatabase.FIELD_HOST_ENCODING, encoding); values.put(HostDatabase.FIELD_HOST_STAYCONNECTED, stayConnected); values.put(HostDatabase.FIELD_HOST_QUICKDISCONNECT, quickDisconnect); values.put(HostDatabase.FIELD_HOST_MOSHPORT, moshPort); values.put(HostDatabase.FIELD_HOST_MOSH_SERVER, moshServer); values.put(HostDatabase.FIELD_HOST_LOCALE, locale); return values; }
@Bean public JavaMailSenderImpl javaMailSender() { log.debug("Configuring mail server"); String host = propertyResolver.getProperty(PROP_HOST, DEFAULT_PROP_HOST); int port = propertyResolver.getProperty(PROP_PORT, Integer.class, 0); String user = propertyResolver.getProperty(PROP_USER); String password = propertyResolver.getProperty(PROP_PASSWORD); String protocol = propertyResolver.getProperty(PROP_PROTO); Boolean tls = propertyResolver.getProperty(PROP_TLS, Boolean.class, false); Boolean auth = propertyResolver.getProperty(PROP_AUTH, Boolean.class, false); JavaMailSenderImpl sender = new JavaMailSenderImpl(); if (host != null && !host.isEmpty()) { sender.setHost(host); } else { log.warn("Warning! Your SMTP server is not configured. We will try to use one on localhost."); log.debug("Did you configure your SMTP settings in your application.yml?"); sender.setHost(DEFAULT_HOST); } sender.setPort(port); sender.setUsername(user); sender.setPassword(password); Properties sendProperties = new Properties(); sendProperties.setProperty(PROP_SMTP_AUTH, auth.toString()); sendProperties.setProperty(PROP_STARTTLS, tls.toString()); sendProperties.setProperty(PROP_TRANSPORT_PROTO, protocol); sender.setJavaMailProperties(sendProperties); return sender; }
@Test public void defaultConfigNoEsFile() { // check that all ES settings will be taken from the default values in Configuration.java if // nothing is specified. Map<String, String> minimalSettings = Maps.newHashMap(); ElasticsearchConfiguration defaultConfig = setupConfig(minimalSettings); Map<String, String> settings = Maps.newHashMap(); ElasticsearchConfiguration config = setupConfig(settings); Map<String, String> nodeSettings = EsNodeProvider.readNodeSettings(config); assertEquals(defaultConfig.getClusterName(), nodeSettings.get("cluster.name")); assertEquals(defaultConfig.getNodeName(), nodeSettings.get("node.name")); assertEquals(Boolean.toString(defaultConfig.isMasterNode()), nodeSettings.get("node.master")); assertEquals(Boolean.toString(defaultConfig.isDataNode()), nodeSettings.get("node.data")); assertEquals(Boolean.toString(defaultConfig.isHttpEnabled()), nodeSettings.get("http.enabled")); assertEquals( String.valueOf(defaultConfig.getTransportTcpPort()), nodeSettings.get("transport.tcp.port")); assertEquals( defaultConfig.getInitialStateTimeout(), nodeSettings.get("discovery.initial_state_timeout")); assertEquals( Boolean.toString(defaultConfig.isMulticastDiscovery()), nodeSettings.get("discovery.zen.ping.multicast.enabled")); assertEquals(Boolean.toString(false), nodeSettings.get("action.auto_create_index")); }
public boolean visit(LambdaFunctionDeclaration s) throws Exception { Map<String, String> parameters = createInitialParameters(s); parameters.put("isReference", Boolean.toString(s.isReference())); if (s.isStatic()) { parameters.put("isStatic", Boolean.toString(s.isStatic())); } xmlWriter.startTag("LambdaFunctionDeclaration", parameters); xmlWriter.startTag("Arguments", new HashMap<String, String>()); for (FormalParameter p : s.getArguments()) { p.traverse(this); } xmlWriter.endTag("Arguments"); Collection<? extends Expression> lexicalVars = s.getLexicalVars(); if (lexicalVars != null) { xmlWriter.startTag("LexicalVars", new HashMap<String, String>()); for (Expression var : lexicalVars) { var.traverse(this); } xmlWriter.endTag("LexicalVars"); } s.getBody().traverse(this); return false; }
void _serializeBool(String key, boolean value) { NodeList elements = booleanElements.getElementsByTagName(ENTRY_FLAG); final int size = elements.getLength(); for (int i = 0; i < size; ++i) { Element e = (Element) elements.item(i); Attr nameAttr = e.getAttributeNode(KEY_FLAG); if (nameAttr == null) { throw newMalformedKeyAttrException(Repository.BOOLEAN); } if (key.equals(nameAttr.getValue())) { Attr valueAttr = e.getAttributeNode(VALUE_FLAG); if (valueAttr == null) { throw newMalformedValueAttrException(key, Repository.BOOLEAN); } valueAttr.setValue(Boolean.toString(value)); return; } } // no existing element found Element element = xmlDoc.createElement(ENTRY_FLAG); element.setAttribute(KEY_FLAG, key); element.setAttribute(VALUE_FLAG, Boolean.toString(value)); booleanElements.appendChild(element); }
public EarningReceiptVO( String hallid, String ReceiptID, String NumberOfCourier, String NameOfCourier, String Date, int Count, double Price, double TotalPrice, double Weight, double Volume, boolean Situation, boolean isHandled) { this.add(NumberOfCourier); this.add(NameOfCourier); this.add(Date); this.add("" + Count); this.add("" + Price); this.add("" + TotalPrice); this.add("" + Weight); this.add("" + Volume); this.add(Boolean.toString(Situation)); this.add(ReceiptID); this.add(hallid); this.add(Boolean.toString(isHandled)); }
/** * Retrieve boolean property value and if the value is not specified return the default value. * * @param prpSettings - properties to retrieve the setting from * @param strProperty - name of the property to retrieve * @param bDefaultValue - default value to use if a valid value is not specified. If null is * specified as a default value and no value is found then no config message will be printed * into log * @param strDisplayName - user friendly name of the property * @return boolean - value of the property or default value if the value is not specified */ public static Boolean getBooleanProperty( Properties prpSettings, String strProperty, Boolean bDefaultValue, String strDisplayName) { String strParam; Boolean bValue; strParam = prpSettings.getProperty(strProperty, strProperty); if ((strParam.equals(strProperty)) || (strParam.length() == 0)) { if (bDefaultValue != null) { printConfigMessage( strProperty, bDefaultValue.toString(), strDisplayName + " is not set in property " + strProperty + ", using default value " + bDefaultValue); } bValue = bDefaultValue; } else { bValue = GlobalConstants.isTrue(strParam) ? Boolean.TRUE : Boolean.FALSE; } if (bValue != null) { printConfigMessage(strProperty, bValue.toString(), null); } return bValue; }
public void write(SPSSODescriptorType spSSODescriptor) throws ProcessingException { StaxUtil.writeStartElement( writer, METADATA_PREFIX, JBossSAMLConstants.SP_SSO_DESCRIPTOR.get(), METADATA_NSURI.get()); StaxUtil.writeAttribute( writer, new QName(JBossSAMLConstants.PROTOCOL_SUPPORT_ENUMERATION.get()), spSSODescriptor.getProtocolSupportEnumeration().get(0)); // Write the attributes Boolean authnSigned = spSSODescriptor.isAuthnRequestsSigned(); if (authnSigned != null) { StaxUtil.writeAttribute( writer, new QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()), authnSigned.toString()); } Boolean wantAssertionsSigned = spSSODescriptor.isWantAssertionsSigned(); if (wantAssertionsSigned != null) { StaxUtil.writeAttribute( writer, new QName(JBossSAMLConstants.WANT_ASSERTIONS_SIGNED.get()), wantAssertionsSigned.toString()); } // Get the key descriptors List<KeyDescriptorType> keyDescriptors = spSSODescriptor.getKeyDescriptor(); for (KeyDescriptorType keyDescriptor : keyDescriptors) { writeKeyDescriptor(keyDescriptor); } List<EndpointType> sloServices = spSSODescriptor.getSingleLogoutService(); for (EndpointType endpoint : sloServices) { writeSingleLogoutService(endpoint); } List<IndexedEndpointType> artifactResolutions = spSSODescriptor.getArtifactResolutionService(); for (IndexedEndpointType artifactResolution : artifactResolutions) { writeArtifactResolutionService(artifactResolution); } List<String> nameIDFormats = spSSODescriptor.getNameIDFormat(); for (String nameIDFormat : nameIDFormats) { writeNameIDFormat(nameIDFormat); } List<IndexedEndpointType> assertionConsumers = spSSODescriptor.getAssertionConsumerService(); for (IndexedEndpointType assertionConsumer : assertionConsumers) { writeAssertionConsumerService(assertionConsumer); } List<AttributeConsumingServiceType> attributeConsumers = spSSODescriptor.getAttributeConsumingService(); for (AttributeConsumingServiceType attributeConsumer : attributeConsumers) { writeAttributeConsumingService(attributeConsumer); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }