List of usage examples for java.lang Boolean Boolean
@Deprecated(since = "9") public Boolean(String s)
From source file:com.icesoft.faces.utils.UpdatableProperty.java
public Object[] saveState(UIComponent comp) { //System.out.println(getDesc(comp, "SAVE_STATE")); //System.out.println(" name: " + name); //System.out.println(" savedValue: " + savedValue); //System.out.println(" haveSavedValue: " + haveSavedValue); //System.out.println(" submittedValue: " + submittedValue); //System.out.println(" setSubmittedInLocalValue: " + setSubmittedInLocalValue); //System.out.println(" value: " + value); //System.out.println(" setLocalValueInValueBinding: " + setLocalValueInValueBinding); Object[] state = new Object[] { name, savedValue, new Boolean(haveSavedValue), submittedValue, new Boolean(setSubmittedInLocalValue), value, new Boolean(setLocalValueInValueBinding) }; return state; }
From source file:com.duroty.service.Mailet.java
/** * DOCUMENT ME!//w w w . j a v a 2 s .co m * * @throws Throwable DOCUMENT ME! * @throws OutOfMemoryError DOCUMENT ME! */ private void flush() throws Exception, Throwable, OutOfMemoryError { SessionFactory hfactory = null; Session hsession = null; try { hfactory = (SessionFactory) ctx.lookup(hibernateSessionFactory); hsession = hfactory.openSession(); Users user = getUser(hsession, repositoryName); this.saveInReplyTo(messageName, mime); Message message = new Message(); message.setMesBox(getBoxName(mime, user)); mime.removeHeader("X-DBox"); mime.saveChanges(); StringBuffer bodyBuffer = new StringBuffer(); Vector mailParts = new Vector(); //Apply label/filter analysis to mimemessage LuceneMessage luceneMessage = prepareLuceneMessage(messageName, mime, bodyBuffer, mailParts); LuceneFiltersAnalysis luceneFiltersAnalysis = new LuceneFiltersAnalysis(luceneMessage, message); luceneFiltersAnalysis.init(null); luceneFiltersAnalysis.service(repositoryName, messageName, mime); message.setMesReferences(getParentId(messageName, mime)); message.setUsers(user); message.setMesName(messageName); String from = "unknown from"; try { from = MessageUtilities.decodeAddresses(mime.getFrom()); } catch (Exception e) { } message.setMesFrom(from); String to = "unknown to"; try { to = MessageUtilities.decodeAddresses(mime, javax.mail.Message.RecipientType.TO); } catch (Exception e) { } message.setMesTo(to); String cc = "unknown cc"; try { cc = MessageUtilities.decodeAddresses(mime, javax.mail.Message.RecipientType.CC); } catch (Exception e) { } message.setMesCc(cc); String replyTo = "unknown replyTo"; try { replyTo = MessageUtilities.decodeAddresses(mime.getReplyTo()); } catch (Exception e) { replyTo = from; } message.setMesReplyTo(replyTo); try { message.setMesSubject(mime.getSubject()); } catch (Exception e2) { message.setMesSubject("unknown subject"); } message.setMesBody(bodyBuffer.toString()); if (mime.getSentDate() == null) { if (mime.getReceivedDate() == null) { message.setMesDate(new Date()); } else { message.setMesDate(mime.getReceivedDate()); } } else { message.setMesDate(mime.getSentDate()); } if ((message.getMesBox() != null) && message.getMesBox().equals("SENT")) { message.setMesRecent(new Boolean(false)); } else { if (isRecent(mime)) { message.setMesRecent(new Boolean(true)); } else { message.setMesRecent(new Boolean(false)); } } int size = mime.getSize(); Enumeration e = mime.getAllHeaders(); while (e.hasMoreElements()) { size += ((Header) e.nextElement()).toString().length(); } message.setMesSize(new Integer(size)); try { InternetHeaders xheaders = MessageUtilities.getHeadersWithFrom(mime); Enumeration xenum = xheaders.getAllHeaderLines(); StringBuffer buff = new StringBuffer(); while (xenum.hasMoreElements()) { buff.append(xenum.nextElement()); buff.append('\n'); } message.setMesHeaders(buff.toString()); } catch (Exception e2) { message.setMesHeaders(""); } if ((mailParts != null) && (mailParts.size() > 0)) { for (int j = 0; j < mailParts.size(); j++) { MailPart part = (MailPart) mailParts.get(j); Attachment attachment = new Attachment(); attachment.setAttContentType(part.getContentType()); attachment.setAttName(part.getName()); attachment.setAttPart(part.getId()); attachment.setAttSize(part.getSize()); attachment.setMessage(message); message.addAttachment(attachment); } } if (!message.getMesBox().equals("SPAM")) { parseContacts(hsession, user, mime, message.getMesBox()); } //Inserto el dmail message i els attachments corresponents hsession.save(message); hsession.flush(); indexerLucene(messageName, luceneMessage, mime); try { Iterator it = user.getMailPreferenceses().iterator(); MailPreferences mailPreferences = (MailPreferences) it.next(); if (mailPreferences.isMaprVacationActive()) { sendVacationMessage(repositoryName, from); } } catch (Exception ex) { } } finally { GeneralOperations.closeHibernateSession(hsession); } }
From source file:eu.hydrologis.jgrass.charting.impl.JGrassXYBarChart.java
/** * Actions called be registered Objects/*w w w .j a v a 2 s .c o m*/ * * @param e the action event. */ public void actionPerformed(ActionEvent e) { // if the hide Checkboxes are toggled if (e.getSource() instanceof JCheckBox) { int series = -1; for (int i = 0; i < chartSeries.length; i++) { if (e.getActionCommand().equals(chartSeries[i].getDescription())) { series = i; } } if (series >= 0) { boolean visible = this.renderer.getItemVisible(series, 0); this.renderer.setSeriesVisible(series, new Boolean(!visible)); } } }
From source file:org.openxdata.server.report.birt.ReportManager.java
/** * Runs a report and returns a stream having the report output. * * @param baseUrl the server base url./*w w w . ja v a2 s . co m*/ * @param reportDesignXml the report design file. * @param format the report output format. For now we only support html and pdf * @return the stream containing the report output. */ public ByteArrayOutputStream getReportStream(String baseUrl, InputStream reportDesignXml, String format) { try { baseUrl += "/"; IReportRunnable runner = reportEngine.openReportDesign(reportDesignXml); IRunAndRenderTask task = reportEngine.createRunAndRenderTask(runner); RenderOption renderContext = new RenderOption(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); //HttpServletResponse response; //options.setOutputStream(response); IRenderOption options = null; HashMap<String, Object> contextMap = new HashMap<String, Object>(); if ("pdf".equals(format)) { contextMap.put(EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT, renderContext); options = new PDFRenderOption(); options.setOutputStream(baos); options.setOption(IPDFRenderOption.FIT_TO_PAGE, new Boolean(true)); options.setOption(IPDFRenderOption.PAGEBREAK_PAGINATION_ONLY, new Boolean(true)); options.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF); } else if ("excel".equals(format)) { options = new EXCELRenderOption(); options.setOutputStream(baos); options.setOutputFormat("xls"); } else { HTMLRenderContext rdContext = new HTMLRenderContext(); rdContext.setBaseImageURL(baseUrl + "birtimages?imageName="); rdContext.setBaseURL(baseUrl); rdContext.setImageDirectory(settingService.getSetting("birtImageDir", OpenXDataUtil.getApplicationDataDirectory() + "BIRT" + File.separator + "images")); rdContext.setSupportedImageFormats("PNG;GIF;JPG;BMP;SVG"); contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, rdContext); options = new HTMLRenderOption(); options.setOutputStream(baos); options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML); ((HTMLRenderOption) options).setEmbeddable(false); ((HTMLRenderOption) options).setImageHandler(new HTMLServerImageHandler()); } task.setAppContext(contextMap); task.setRenderOption(options); task.run(); task.close(); return baos; } catch (Exception ex) { //ex.printStackTrace(); log.error(ex.getMessage(), ex); } return null; }
From source file:com.duroty.application.mail.manager.PreferencesManager.java
/** * DOCUMENT ME!//from ww w .j a va2 s. c o m * * @param hsession DOCUMENT ME! * @param username DOCUMENT ME! * * @return DOCUMENT ME! * * @throws MailException DOCUMENT ME! */ public Vector getIdentities(Session hsession, String username) throws MailException { Vector identities = new Vector(); try { Criteria crit = hsession.createCriteria(Identity.class); crit.add(Restrictions.eq("users", getUser(hsession, username))); crit.add(Restrictions.eq("ideActive", new Boolean(true))); crit.addOrder(Order.asc("ideEmail")); ScrollableResults scroll = crit.scroll(); while (scroll.next()) { Identity identity = (Identity) scroll.get(0); IdentityObj obj = new IdentityObj(); obj.setIdint(identity.getIdeIdint()); obj.setEmail(identity.getIdeEmail()); obj.setImportant(identity.isIdeDefault()); obj.setName(identity.getIdeName()); obj.setReplyTo(identity.getIdeReplyTo()); identities.addElement(obj); } return identities; } catch (Exception ex) { return null; } finally { GeneralOperations.closeHibernateSession(hsession); } }
From source file:es.pode.administracion.presentacion.noticias.crear.CrearControllerImpl.java
public void obtenerCategoria(ActionMapping mapping, ObtenerCategoriaForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try {// www . j a va 2 s .co m /** * ************************************************************************************************************************************** * ****************************************** SE OBTIENEN LOS IDIOMAS TRADUCIBLES ******************************************************* * ************************************************************************************************************************************** * */ if (logger.isDebugEnabled()) logger.debug("Obtenemos los idiomas traducibles"); String[] idiomasPlataforma = I18n.getInstance().obtenerIdiomasPlataforma(); if (logger.isDebugEnabled()) logger.debug("Hay [" + idiomasPlataforma.length + "] en la plataforma"); String idiomaLogado = LdapUserDetailsUtils.getIdioma(); String idiomaPrioritario = I18n.getInstance().obtenerIdiomaDefectoPlataforma(); String idiomaSecundario = I18n.getInstance().obtenerIdiomaSecundarioPlataforma(); if (logger.isDebugEnabled()) logger.debug( "El idioma del usuario es [" + idiomaLogado + "], idioma prioritario de la plataforma es [" + idiomaPrioritario + "] y el secundario es [" + idiomaSecundario + "]"); /** * ************************************************************************************************************************************** * ******************************************* SE RELLENA EL COMBO DE CATEGORIAS ******************************************************** * ************************************************************************************************************************************** * */ NoticiasControllerImpl noticiasController = new NoticiasControllerImpl(); Collection categorias = Arrays.asList(this.getSrvNoticiasService() .obtenerCategoriasTraducidas(noticiasController.devuelveIdiomasTraducibles(idiomasPlataforma, idiomaLogado, idiomaPrioritario, idiomaSecundario))); form.setCategoriaBackingList(categorias, "idCategoriaNoticia", "nombreCategoria"); if (estaLleno(form.getNombreImagen())) form.setActivarImagen(new Integer(1)); //Introducimos los valores por defecto si estos vienen vacios if (form.getEstado() == null)//por defecto la noticia esta activa form.setEstado(new Boolean(true)); if (form.getActivarImagen() == null) { //Por defecto se selecciona la opcion de aadir una imagen a la noticia form.setActivarImagen(new Integer(3)); //Por defecto se selecciona el alineamiento arriba-izquierda form.setAlineamiento(new Integer(0)); } } catch (Exception e) { logger.error("Error recuperando las categorias"); throw new ValidatorException("{errors.categorias.recuperar}"); } }
From source file:com.netspective.sparx.navigate.query.QueryResultsNavigatorPage.java
public void refreshResultSet(NavigationContext nc) { nc.getRequest().setAttribute(refreshResultSetParamName, new Boolean(true)); }
From source file:com.heliumv.api.machine.MachineApi.java
@GET @Path("/planningview") public PlanningView getPlanningView(@QueryParam(Param.USERID) String userId, @QueryParam("dateMs") Long dateMs, @QueryParam("days") Integer days, @QueryParam(Param.LIMIT) Integer limit, @QueryParam(Param.STARTINDEX) Integer startIndex, @QueryParam(Filter.HIDDEN) Boolean filterWithHidden, @QueryParam("filter_startdate") Boolean filterStartDate, @QueryParam(With.DESCRIPTION) Boolean withDescription) throws RemoteException, NamingException, EJBExceptionLP { PlanningView planningView = new PlanningView(); if (connectClient(userId) == null) return planningView; planningView.setMachineList(getMachinesImpl(limit, startIndex, filterWithHidden)); if (filterStartDate == null) { filterStartDate = new Boolean(false); }/*www . j a v a2 s. c om*/ if (dateMs == null) { dateMs = new Long(System.currentTimeMillis()); } if (days == null) { days = new Integer(1); } Calendar c = Calendar.getInstance(); c.setTimeInMillis(dateMs); c.add(Calendar.DAY_OF_YEAR, days); long endDateMs = c.getTimeInMillis(); planningView.setOpenWorkList(productionApi.getOpenWorkEntriesImpl(limit, startIndex, filterStartDate ? dateMs : null, endDateMs)); planningView.setMachineGroupList(getMachineGroupsImpl(limit, startIndex)); Map<Integer, MachineAvailabilityEntryList> mapAvailability = new HashMap<Integer, MachineAvailabilityEntryList>(); for (MachineEntry machine : planningView.getMachineList().getEntries()) { mapAvailability.put(machine.getId(), getAvailabilitiesImpl(machine.getId(), dateMs, days, withDescription)); } planningView.setMachineAvailabilityMap(mapAvailability); return planningView; }
From source file:com.softwareverde.util.Json.java
private static final <T> T _convert(Object obj, T type) { T value = null;/* w w w . j av a 2 s .c o m*/ if (type instanceof String) { if (obj instanceof String) { value = (T) obj; } else { value = (T) obj.toString(); } } else if (type instanceof Integer) { if (obj instanceof Integer) { value = (T) obj; } else if (obj.getClass() == int.class) { value = (T) obj; } else if (obj instanceof String) { try { value = (T) new Integer(Integer.parseInt((String) obj)); } catch (Exception e) { value = (T) new Integer(0); } } else { Json.debug("WARNING: Returning null for Json._convert. (Integer)"); } } else if (type instanceof Double) { if (obj instanceof Double) { value = (T) obj; } else if (obj.getClass() == double.class) { value = (T) obj; } else if (obj instanceof String) { try { value = (T) new Double(Double.parseDouble((String) obj)); } catch (Exception e) { value = (T) new Double(0); } } else { Json.debug("WARNING: Returning null for Json._convert. (Double)"); } } else if (type instanceof Boolean) { if (obj instanceof Boolean) { value = (T) obj; } else if (obj.getClass() == boolean.class) { value = (T) obj; } else if (obj instanceof String) { try { value = (T) new Boolean((Integer.parseInt((String) obj) > 0)); } catch (Exception e) { value = (T) new Boolean(false); } } else { Json.debug("WARNING: Returning null for Json._convert. (Boolean)"); } } else if (type instanceof Json) { if (obj instanceof Json) { value = (T) obj; } else if (obj instanceof JSONObject) { Json json = new Json(); json._jsonObject = (JSONObject) obj; json._isArray = false; value = (T) json; } else if (obj instanceof JSONArray) { Json json = new Json(); json._jsonArray = (JSONArray) obj; json._isArray = true; value = (T) json; } else if (obj instanceof String) { value = (T) Json.fromString((String) obj); } else { Json.debug("WARNING: Returning null for Json._convert. (Json)"); } } return value; }
From source file:edu.wustl.xipHost.hostControl.HostConfigurator.java
/** * (non-Javadoc)/*from w ww . ja v a 2s .c o m*/ * @see edu.wustl.xipHost.hostControl.HostManager#loadHostConfigParameters() */ public boolean loadHostConfigParameters(File hostConfigFile) { if (hostConfigFile == null) { return false; } else if (!hostConfigFile.exists()) { return false; } else { try { document = builder.build(hostConfigFile); root = document.getRootElement(); //path for the parent of TMP directory if (root.getChild("tmpDir") == null) { parentOfTmpDir = ""; } else if (root.getChild("tmpDir").getValue().trim().isEmpty() || new File(root.getChild("tmpDir").getValue()).exists() == false) { parentOfTmpDir = ""; } else { parentOfTmpDir = root.getChild("tmpDir").getValue(); } if (root.getChild("outputDir") == null) { parentOfOutDir = ""; } else if (root.getChild("outputDir").getValue().trim().isEmpty() || new File(root.getChild("outputDir").getValue()).exists() == false) { parentOfOutDir = ""; } else { //path for the parent of output directory. //parentOfOutDir used to store data produced by the xip application parentOfOutDir = root.getChild("outputDir").getValue(); } if (root.getChild("displayStartup") == null) { displayStartup = new Boolean(true); } else { if (root.getChild("displayStartup").getValue().equalsIgnoreCase("true") || root.getChild("displayStartup").getValue().trim().isEmpty() || parentOfTmpDir.isEmpty() || parentOfOutDir.isEmpty() || parentOfTmpDir.equalsIgnoreCase(parentOfOutDir)) { if (parentOfTmpDir.equalsIgnoreCase(parentOfOutDir)) { parentOfTmpDir = ""; parentOfOutDir = ""; } displayStartup = new Boolean(true); } else if (root.getChild("displayStartup").getValue().equalsIgnoreCase("false")) { displayStartup = new Boolean(false); } else { displayStartup = new Boolean(true); } } if (root.getChild("AETitle") == null) { aeTitle = ""; } else if (root.getChild("AETitle").getValue().trim().isEmpty()) { aeTitle = ""; } else { aeTitle = root.getChild("AETitle").getValue(); } if (root.getChild("AuditRepositoryURL") == null) { auditRepositoryURL = ""; } else if (root.getChild("AuditRepositoryURL").getValue().trim().isEmpty()) { auditRepositoryURL = ""; } else { auditRepositoryURL = root.getChild("AuditRepositoryURL").getValue(); } if (root.getChild("PdqSendFacilityOID") == null) { pdqSendFacilityOID = ""; } else if (root.getChild("PdqSendFacilityOID").getValue().trim().isEmpty()) { pdqSendFacilityOID = ""; } else { pdqSendFacilityOID = root.getChild("PdqSendFacilityOID").getValue(); } if (root.getChild("PdqSendApplicationOID") == null) { pdqSendApplicationOID = ""; } else if (root.getChild("PdqSendApplicationOID").getValue().trim().isEmpty()) { pdqSendApplicationOID = ""; } else { pdqSendApplicationOID = root.getChild("PdqSendApplicationOID").getValue(); } if (root.getChild("StsUrl") == null) { stsURL = ""; } else { stsURL = (root.getChild("StsUrl").getValue()); } if (root.getChild("HostTrustStoreFile") == null) { trustStoreLoc = ""; } else { trustStoreLoc = (root.getChild("HostTrustStoreFile").getValue()); } if (root.getChild("HostTrustStorePswd") == null) { trustStorePswd = ""; } else { trustStorePswd = (root.getChild("HostTrustStorePswd").getValue()); } if (root.getChild("useXUA") == null) { useXUA = false; } else { useXUA = Boolean.valueOf(root.getChild("useXUA").getValue()); } if (root.getChild("useNBIASecur") == null) { useNBIASecur = false; } else { useNBIASecur = Boolean.valueOf(root.getChild("useNBIASecur").getValue()); } if (root.getChild("useSTS") == null) { useSTS = false; } else { useSTS = Boolean.valueOf(root.getChild("useSTS").getValue()); } } catch (JDOMException e) { return false; } catch (IOException e) { return false; } } return true; }