List of usage examples for java.lang Boolean Boolean
@Deprecated(since = "9") public Boolean(String s)
From source file:de.thorstenberger.examServer.service.impl.ConfigManagerImpl.java
private void save() { try {/*ww w . j a v a2 s .c o m*/ final Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true)); final BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(this.configFile)); marshaller.marshal(config, bos); bos.close(); } catch (final JAXBException e) { throw new RuntimeException(e); } catch (final IOException e1) { throw new RuntimeException(e1); } }
From source file:userinterface.graph.AxisSettings.java
public AxisSettings(String name, boolean isDomain, Graph graph) { this.name = name; this.isDomain = isDomain; this.graph = graph; this.chart = graph.getChart(); this.plot = chart.getXYPlot(); this.axis = (isDomain) ? this.plot.getDomainAxis() : this.plot.getRangeAxis(); this.valuesFormatter = NumberFormat.getInstance(Locale.UK); if (this.valuesFormatter instanceof DecimalFormat) ((DecimalFormat) this.valuesFormatter) .applyPattern("###,###,###,###,###,###,###,###.########################"); /* Initialise all the settings. */ heading = new SingleLineStringSetting("heading", name, "The heading for this axis", this, true); headingFont = new FontColorSetting("heading font", new FontColorPair(new Font("SansSerif", Font.PLAIN, 12), Color.black), "The font for this axis' heading.", this, true); numberFont = new FontColorSetting("numbering font", new FontColorPair(new Font("SansSerif", Font.PLAIN, 12), Color.black), "The font used to number the axis.", this, true); showGrid = new BooleanSetting("show gridlines", new Boolean(true), "Should the gridlines be visible", this, true);//from w w w . j a v a 2 s . c o m gridColour = new ColorSetting("gridline colour", new Color(204, 204, 204), "The colour of the gridlines", this, true); String[] logarithmicChoices = { "Normal", "Logarithmic" }; scaleType = new ChoiceSetting("scale type", logarithmicChoices, logarithmicChoices[0], "Should the scale be normal, or logarithmic", this, true); autoScale = new BooleanSetting("auto-scale", new Boolean(true), "When set to true, all minimum values, maximum values, grid intervals, maximum logarithmic powers and minimum logarithmic powers are automatically set and maintained when the data changes.", this, true); minValue = new DoubleSetting("minimum value", new Double(0.0), "The minimum value for the axis", this, true); maxValue = new DoubleSetting("maximum value", new Double(1.0), "The maximum value for the axis", this, true); gridInterval = new DoubleSetting("gridline interval", new Double(0.2), "The interval between gridlines", this, false, new RangeConstraint(0, Double.POSITIVE_INFINITY, false, true)); logBase = new DoubleSetting("log base", new Double(10), "The base for the logarithmic scale", this, false, new RangeConstraint("1,")); minimumPower = new DoubleSetting("minimum power", new Double("0.0"), "The minimum logarithmic power that should be displayed on the scale", this, true); maximumPower = new DoubleSetting("maximum power", new Double("1.0"), "The maximum logarithmic power that should be displayed on the scale", this, true); String[] logStyleChoices = { "Values", "Base and exponent" }; logStyle = new ChoiceSetting("logarithmic number style", logStyleChoices, logStyleChoices[1], "Should the style of the logarithmic scale show the actual values, or the base with the exponent.", this, false); /* Add constraints. */ minValue.addConstraint(new NumericConstraint() { public void checkValueDouble(double d) throws SettingException { if (activated && d >= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be < Maximum value"); } public void checkValueInteger(int i) throws SettingException { if (activated && i >= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be < Maximum value"); } public void checkValueLong(long i) throws SettingException { if (activated && i >= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be < Maximum value"); } }); maxValue.addConstraint(new NumericConstraint() { public void checkValueDouble(double d) throws SettingException { if (activated && d <= minValue.getDoubleValue()) throw new SettingException("Maximum value should be > Minimum value"); } public void checkValueInteger(int i) throws SettingException { if (activated && i <= minValue.getDoubleValue()) throw new SettingException("Maximum value should be > Minimum value"); } public void checkValueLong(long i) throws SettingException { if (activated && i <= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be > Maximum value"); } }); minimumPower.addConstraint(new NumericConstraint() { public void checkValueDouble(double d) throws SettingException { if (activated && d >= maximumPower.getDoubleValue()) throw new SettingException("Minimum power should be < Maximum power"); } public void checkValueInteger(int i) throws SettingException { if (activated && i >= maximumPower.getDoubleValue()) throw new SettingException("Minimum power should be < Maximum power"); } public void checkValueLong(long i) throws SettingException { if (activated && i >= maximumPower.getDoubleValue()) throw new SettingException("Minimum power should be < Maximum power"); } }); maximumPower.addConstraint(new NumericConstraint() { public void checkValueDouble(double d) throws SettingException { if (activated && d <= minimumPower.getDoubleValue()) throw new SettingException("Maximum power should be > Minimum power"); } public void checkValueInteger(int i) throws SettingException { if (activated && i <= minimumPower.getDoubleValue()) throw new SettingException("Maximum power should be > Minimum power"); } public void checkValueLong(long i) throws SettingException { if (activated && i <= minimumPower.getDoubleValue()) throw new SettingException("Maximum power should be > Minimum power"); } }); doEnables(); display = null; activated = true; updateAxis(); setChanged(); notifyObservers(); }
From source file:com.wills.clientproxy.HessianLBProxy.java
/** * Handles the object invocation./*from w ww . j ava2 s . co m*/ * * @param proxy * the proxy object to invoke * @param method * the method to call * @param args * the arguments to the proxy object */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String mangleName; HessianClusterNode hcn = _cm.getAvailableNodeByStraitegy(); if (hcn == null) { throw new Exception("no available server node found!"); } if (hcn == null || hcn.getNode() == null) { throw new Exception("no server available"); } threadLocal.set(new URL(hcn.getURL() + this._type.getSimpleName())); try { lock.readLock().lock(); mangleName = _mangleMap.get(method); } finally { lock.readLock().unlock(); } if (mangleName == null) { String methodName = method.getName(); Class<?>[] params = method.getParameterTypes(); // equals and hashCode are special cased if (methodName.equals("equals") && params.length == 1 && params[0].equals(Object.class)) { Object value = args[0]; if (value == null || !Proxy.isProxyClass(value.getClass())) return Boolean.FALSE; Object proxyHandler = Proxy.getInvocationHandler(value); if (!(proxyHandler instanceof HessianLBProxy)) return Boolean.FALSE; HessianLBProxy handler = (HessianLBProxy) proxyHandler; return new Boolean(false); } else if (methodName.equals("hashCode") && params.length == 0) return new Integer(_cm.hashCode()); else if (methodName.equals("getHessianType")) return proxy.getClass().getInterfaces()[0].getName(); else if (methodName.equals("getHessianURL")) return threadLocal.get().toString(); else if (methodName.equals("toString") && params.length == 0) return "HessianProxy[" + threadLocal.get() + "]"; if (!_factory.isOverloadEnabled()) mangleName = method.getName(); else mangleName = mangleName(method); try { lock.writeLock().lock(); _mangleMap.put(method, mangleName); } finally { lock.writeLock().unlock(); } } InputStream is = null; HessianConnection conn = null; try { if (log.isLoggable(Level.FINER)) log.finer("Hessian[" + threadLocal.get() + "] calling " + mangleName); conn = sendRequest(mangleName, args, threadLocal.get()); if (conn.getStatusCode() != 200) { throw new HessianProtocolException("http code is " + conn.getStatusCode()); } is = conn.getInputStream(); if (log.isLoggable(Level.FINEST)) { PrintWriter dbg = new PrintWriter(new LogWriter(log)); HessianDebugInputStream dIs = new HessianDebugInputStream(is, dbg); dIs.startTop2(); is = dIs; } AbstractHessianInput in; int code = is.read(); if (code == 'H') { int major = is.read(); int minor = is.read(); in = _factory.getHessian2Input(is); Object value = in.readReply(method.getReturnType()); return value; } else if (code == 'r') { int major = is.read(); int minor = is.read(); in = _factory.getHessianInput(is); in.startReplyBody(); Object value = in.readObject(method.getReturnType()); if (value instanceof InputStream) { value = new ResultInputStream(conn, is, in, (InputStream) value); is = null; conn = null; } else in.completeReply(); return value; } else throw new HessianProtocolException("'" + (char) code + "' is an unknown code"); } catch (HessianProtocolException e) { throw new HessianRuntimeException(e); } finally { try { if (is != null) is.close(); } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } try { if (conn != null) conn.destroy(); } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } } }
From source file:es.pode.gestorFlujo.presentacion.objetosPendientes.ObjetosPendientesControllerImpl.java
/** * @see es.pode.gestorFlujo.presentacion.objetosPendientes.ObjetosPendientesController#cargarODESPendientes(org.apache.struts.action.ActionMapping, * es.pode.gestorFlujo.presentacion.objetosPendientes.CargarODESPendientesForm, * javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) *//*from w ww .j a v a2s .c om*/ public final void cargarODESPendientes(ActionMapping mapping, es.pode.gestorFlujo.presentacion.objetosPendientes.CargarODESPendientesForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // if(logger.isDebugEnabled()) // logger.debug("Cargando objetos Pendientes"); // SrvPublicacionService publi = this.getSrvPublicacionService(); // try { // form.setListaODESAsArray(publi.obtenODEsPropuestos()); // } catch (Exception ex) { // logger.error("Imposible obtener los odes pendientes", ex); // throw new ValidatorException("{gestorFlujo.error.inesperado}"); // } // form.setIdUsuario(LdapUserDetailsUtils.getUsuario()); // // // Como estamos en administracin damos por sentado que esta autenticado // form.setTipoUsuario(tipo_usuario(LdapUserDetailsUtils.getRoles())); // // form.setEsDespublicado(new Boolean(false)); // logger.debug("cargarODESPendientes-El objeto es despublicado?"+form.getEsDespublicado().booleanValue()); // logger.info("Objetos Pendientes cargados correctamente"); if (logger.isDebugEnabled()) logger.debug("Cargando objetos Pendientes de Publicacion"); SrvPublicacionService publi = this.getSrvPublicacionService(); SrvAdminUsuariosService admin = this.getSrvAdminUsuariosService(); try { TransicionVO[] odes = null; String[] todosUsuariosGrupos = admin .obtenerListaUsuariosGrupoTrabajo(LdapUserDetailsUtils.getUsuario()); // // String[] todosUsuariosGrupos=new String[] {LdapUserDetailsUtils.getUsuario()}; if (todosUsuariosGrupos != null && todosUsuariosGrupos.length > 0) { logger.info("Obtenidos lista de usuarios de los grupos pertenecientes de usuario:[" + LdapUserDetailsUtils.getUsuario() + "Numero de usuarios:[" + todosUsuariosGrupos.length); odes = publi.obtenODEsPropuestosPorUsuarios(todosUsuariosGrupos); logger.info("Obtenidos odes de esos usuarios, numero de odes pendientes de publicacion [" + odes.length); } else { logger.info("Obtenidos lista de todos los ODES, pues el usuario:[" + LdapUserDetailsUtils.getUsuario() + " es parte de todos los grupos"); odes = publi.obtenODEsPropuestos(); logger.info("Obtenidos odes de todos los usuarios, numero de odes pendientes de publicacion[" + odes.length); } form.setListaODESAsArray(odes); } catch (Exception ex) { logger.error("Imposible obtener los odes pendientes de publicacion", ex); throw new ValidatorException("{gestorFlujo.error.inesperado}"); } form.setIdUsuario(LdapUserDetailsUtils.getUsuario()); // Como estamos en administracin damos por sentado que esta autenticado form.setTipoUsuario(tipo_usuario(LdapUserDetailsUtils.getRoles())); form.setEsDespublicado(new Boolean(false)); logger.debug("cargarODESPendientes-El objeto es despublicado?" + form.getEsDespublicado().booleanValue()); logger.info("Objetos Pendientes de Publicacion cargados correctamente"); }
From source file:eu.optimis.vmmanager.rest.client.VMManagerRESTClient.java
/** * Suggests a migration for a VM// w w w . j a va2s . c o m * @param vmId the vm to migrate * @return true if the migration has been performed. false if not */ public boolean migrateVM(String vmId) { boolean done = false; try { WebResource resource = client.resource(this.getAddress()).path("/compute/" + vmId + "/migrate"); done = new Boolean(resource.type(MediaType.TEXT_PLAIN).post(String.class, vmId)); } catch (URISyntaxException e) { throw new RuntimeException(e); } return done; }
From source file:com.aurel.track.fieldType.runtime.bl.AttributeValueBL.java
public static Object getSpecificAttribute(TAttributeValueBean tAttributeValueBean, int valueType) { switch (valueType) { case ValueType.BOOLEAN: String charValue = tAttributeValueBean.getCharacterValue(); Boolean booleanValue = new Boolean(false); if (charValue != null) { if (BooleanFields.TRUE_VALUE.equals(charValue.trim())) { booleanValue = new Boolean(true); }//from w ww . jav a 2 s. c om } return booleanValue; case ValueType.CUSTOMOPTION: return tAttributeValueBean.getCustomOptionID(); case ValueType.DATE: case ValueType.DATETIME: return tAttributeValueBean.getDateValue(); case ValueType.DOUBLE: return tAttributeValueBean.getDoubleValue(); case ValueType.INTEGER: case ValueType.EXTERNALID: return tAttributeValueBean.getIntegerValue(); case ValueType.LONGTEXT: return tAttributeValueBean.getLongTextValue(); case ValueType.SYSTEMOPTION: return tAttributeValueBean.getSystemOptionID(); case ValueType.TEXT: return tAttributeValueBean.getTextValue(); default: return null; } }
From source file:UndoableToggleApp4.java
public void storeState(Hashtable ht) { ht.put(tog, new Boolean(tog.isSelected())); ht.put(cb, new Boolean(cb.isSelected())); ht.put(radio, new Boolean(radio.isSelected())); }
From source file:net.sf.morph.transform.transformers.BaseTransformer.java
/** * {@inheritDoc}//from w ww .j a v a2 s . co m * @see net.sf.morph.transform.ExplicitTransformer#isTransformable(java.lang.Class, java.lang.Class) */ public final boolean isTransformable(Class destinationType, Class sourceType) throws TransformationException { initialize(); // Note: null source and destination classes are allowed! // first, try to pull the source and destination from the cache ObjectPair pair = null; if (isCachingIsTransformableCalls()) { pair = new ObjectPair(destinationType, sourceType); if (getTransformableCallCache().containsKey(pair)) { Boolean isTransformable = (Boolean) getTransformableCallCache().get(pair); return isTransformable.booleanValue(); } } try { boolean isTransformable = isTransformableImpl(destinationType, sourceType); if (isCachingIsTransformableCalls()) { getTransformableCallCache().put(pair, new Boolean(isTransformable)); } return isTransformable; } catch (TransformationException e) { throw e; } catch (StackOverflowError e) { throw new TransformationException( "Stack overflow detected. This usually occurs when a transformer implements " + ObjectUtils.getObjectDescription(ExplicitTransformer.class) + " but does not override the isTransformableImpl method", e); } catch (Exception e) { if (e instanceof RuntimeException && !isWrappingRuntimeExceptions()) { throw (RuntimeException) e; } throw new TransformationException( "Could not determine if " + sourceType + " is convertible to " + destinationType, e); } }
From source file:com.adito.networkplaces.wizards.forms.NetworkPlaceDetailsForm.java
public void apply(AbstractWizardSequence sequence) throws Exception { super.apply(sequence); sequence.putAttribute(ATTR_PROVIDER, provider); sequence.putAttribute(ATTR_HOST, getHost()); sequence.putAttribute(ATTR_PATH, getPath()); sequence.putAttribute(ATTR_PORT, Integer.valueOf(getPort())); sequence.putAttribute(ATTR_USERNAME, getUsername()); sequence.putAttribute(ATTR_PASSWORD, getPassword()); sequence.putAttribute(ATTR_SCHEME, getScheme()); sequence.putAttribute(ATTR_READ_ONLY, new Boolean(readOnly)); sequence.putAttribute(ATTR_SHOW_HIDDEN, new Boolean(showHidden)); sequence.putAttribute(ATTR_ALLOW_RECURSIVE, new Boolean(allowRecursive)); sequence.putAttribute(ATTR_NO_DELETE, new Boolean(noDelete)); }
From source file:com.runwaysdk.controller.ServletDispatcher.java
/** * Loads objects from the parameter mapping and executes the given action. If * a parsing failure occurs when the objects are loaded then the proper * failure action is invoked./* w w w.j a v a 2s.co m*/ * * @param req * HttpServletRequest * @param resp * HttpServletResponse * @param manager * RequestManager manages the status of the parse * @param actionName * The name of the action * @param controllerName * The name of the controller * @param baseClass * The controller base class * @param baseMethod * The controller base method * * @throws NoSuchMethodException * @throws InstantiationException * @throws IllegalAccessException * @throws InvocationTargetException * @throws InstantiationException * @throws InvocationTargetException * @throws IOException * @throws FileUploadException */ private void dispatch(HttpServletRequest req, HttpServletResponse resp, RequestManager manager, String actionName, String controllerName, Class<?> baseClass, Method baseMethod) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InstantiationException, InvocationTargetException, IOException { Class<?> controllerClass = LoaderDecorator.load(controllerName); Constructor<?> constructor = controllerClass.getConstructor(HttpServletRequest.class, HttpServletResponse.class, Boolean.class); Object controller = constructor.newInstance(req, resp, isAsynchronous); // Add an asynchronous flag to the request object req.setAttribute(IS_ASYNCHRONOUS, new Boolean(isAsynchronous)); // Get parameter information for the base method annotation ActionParameters annotation = baseMethod.getAnnotation(ActionParameters.class); // parameter map will be different depending on the call Map<String, Parameter> parameters = this.getParameters(req, annotation); Object[] objects = this.getObjects(req, manager, annotation, parameters); // Ensure an exception has not occured while converting the request // parameters to objects. If an exception did occur then invoke the failure // case if (manager.hasExceptions()) { try { dispatchFailure(actionName, baseClass, controllerClass, controller, objects); } catch (UndefinedControllerActionException e) { RuntimeException ex; if (manager.getProblems().size() > 0) { ex = new ProblemExceptionDTO("", manager.getProblems()); } else { List<AttributeNotificationDTO> attrNots = manager.getAttributeNotifications(); List<String> msgs = new ArrayList<String>(); for (int i = 0; i < attrNots.size(); ++i) { msgs.add(attrNots.get(i).getMessage()); } ex = new RuntimeException(StringUtils.join(msgs, ", ")); } ErrorUtility.prepareThrowable(ex, this.req, this.resp, this.isAsynchronous, true); } } else { // No problems when converting parameters to objects dispatchSuccess(actionName, baseMethod, controllerClass, controller, objects); } }