List of usage examples for java.lang Boolean Boolean
@Deprecated(since = "9") public Boolean(String s)
From source file:GenerateWorkItems.java
private static void initTorque() { try {/* w w w .ja va 2 s .c o m*/ PropertiesConfiguration tcfg = new PropertiesConfiguration(); URL torqueURL = GenerateWorkItems.class.getResource("/Torque.properties"); InputStream in = torqueURL.openStream(); tcfg.load(in); /*tcfg.setProperty("torque.dsfactory.track.connection.user", "sysdba"); tcfg.setProperty("torque.dsfactory.track.connection.password", "masterkey"); tcfg.setProperty("torque.database.track.adapter", "firebird"); tcfg.setProperty("torque.dsfactory.track.connection.driver", "org.firebirdsql.jdbc.FBDriver"); tcfg.setProperty("torque.dsfactory.track.connection.url", "jdbc:firebirdsql://localhost/C:/Firebird_1_5/databases/TEST34.GDB"); tcfg.setProperty("torque.dsfactory.track.factory", "org.apache.torque.dsfactory.SharedPoolDataSourceFactory"); tcfg.setProperty("torque.dsfactory.track.pool.maxActive", "30"); tcfg.setProperty("torque.dsfactory.track.pool.testOnBorrow","true"); tcfg.setProperty("torque.dsfactory.track.pool.validationQuery","SELECT PKEY FROM TSTATE"); */ tcfg.setProperty("torque.applicationRoot", "."); tcfg.setProperty("torque.database.default", "track"); tcfg.setProperty("torque.idbroker.clever.quantity", new Boolean(false)); tcfg.setProperty("torque.idbroker.prefetch", new Boolean(false)); tcfg.setProperty("torque.manager.useCache", new Boolean(true)); in.close(); Torque.init(tcfg); } catch (Exception e) { e.printStackTrace(); } }
From source file:roommateapp.info.net.FileDownloader.java
/** * Parallel execution/*from w w w . j a va 2 s .c o m*/ */ @SuppressLint("UseValueOf") @Override protected Object doInBackground(Object... params) { if (!this.isHolidayFile) { /* Progressbar einblenden */ this.ac.runOnUiThread(new Runnable() { public void run() { toggleProgressbar(); } }); } boolean success = true; String eingabe = (String) params[0]; if (eingabe != null) { try { URL url = new URL(eingabe); // Get filename String fileName = eingabe; StringTokenizer tokenizer = new StringTokenizer(fileName, "/", false); int tokens = tokenizer.countTokens(); for (int i = 0; i < tokens; i++) { fileName = tokenizer.nextToken(); } // Create file this.downloadedFile = new File(this.roommateDirectory, fileName); // Download and write file try { // Password and username if it's HTACCESS String authData = new String(Base64.encode((username + ":" + pw).getBytes(), Base64.NO_WRAP)); URLConnection urlcon = url.openConnection(); // Authorisation if it's a userfile if (eingabe.startsWith(RoommateConfig.URL)) { urlcon.setRequestProperty("Authorization", "Basic " + authData); urlcon.setDoInput(true); } InputStream inputstream = urlcon.getInputStream(); ByteArrayBuffer baf = new ByteArrayBuffer(50); int current = 0; while ((current = inputstream.read()) != -1) { baf.append((byte) current); } FileOutputStream fos = new FileOutputStream(this.downloadedFile); fos.write(baf.toByteArray()); fos.close(); } catch (IOException e) { success = false; e.printStackTrace(); } } catch (MalformedURLException e) { success = false; e.printStackTrace(); } } else { success = false; } return new Boolean(success); }
From source file:userinterface.graph.SeriesSettings.java
public SeriesSettings(Graph graph, Graph.SeriesKey key) { this.graph = graph; this.key = key; this.chart = graph.getChart(); this.plot = chart.getXYPlot(); /* This should really be checked first. */ this.renderer = (XYLineAndShapeRenderer) plot.getRenderer(); seriesHeading = new SingleLineStringSetting("heading", "heading", "The heading for this series, as displayed in the legend.", this, true); seriesColour = new ColorSetting("colour", Color.black, "The colour for all lines and points in this series.", this, true); showPoints = new BooleanSetting("show points", new Boolean(true), "Should points be displayed for this series?", this, true); String[] choices = { "Circle", "Square", "Triangle", "Horizontal Rectangle", "Vertical Rectangle", "None" }; seriesShape = new ChoiceSetting("point shape", choices, choices[0], "The shape of points for this series.", this, true); showLines = new BooleanSetting("show lines", new Boolean(true), "Should lines be displayed for this series?", this, true); lineWidth = new DoubleSetting("line width", new Double(1.0), "The line width for this series.", this, true, new RangeConstraint("0.0,")); String[] styles = { "---------", "- - - - -", "- -- - --" }; lineStyle = new ChoiceSetting("line style", styles, styles[0], "The line style for this series.", this, true);// w ww.j a va2 s . c o m /** JFreeChart is smart enough to choose sensible values for colours, shapes etc. Lets try to use these if we can. */ synchronized (graph.getSeriesLock()) { int seriesIndex = graph.getJFreeChartIndex(key); if (seriesIndex >= 0) { /* Set series colour. */ if (renderer.lookupSeriesPaint(seriesIndex) instanceof Color) { try { seriesColour.setValue((Color) renderer.getSeriesPaint(seriesIndex)); } catch (SettingException e) { } } /* Set series heading. */ try { seriesHeading.setValue(graph.getXYSeries(key).getKey()); } catch (SettingException e) { } /* Set showPoints. */ try { // just do it. Boolean pointsVisibleFlag = true; showPoints.setValue(new Boolean(pointsVisibleFlag == null || pointsVisibleFlag.booleanValue())); } catch (SettingException e) { } /* Set seriesShape. */ Shape shape = renderer.lookupSeriesShape(seriesIndex); try { boolean foundShape = false; for (int i = CIRCLE; i < NONE; i++) { if (ShapeUtilities.equal(shape, SHAPES[i])) { seriesShape.setSelectedIndex(i); foundShape = true; break; } } if (!foundShape) seriesShape.setSelectedIndex(NONE); } catch (SettingException e) { e.printStackTrace(); } /* Set showLines. */ try { Boolean linesVisibleFlag = true; showLines.setValue(new Boolean(linesVisibleFlag == null || linesVisibleFlag.booleanValue())); } catch (SettingException e) { } } } updateSeries(); }
From source file:ispyb.common.util.Constants.java
public static final boolean isAuthorisationActive() { String active = getProperty(AUTHORISATION_ACTIVE, "false"); if (active != null) return new Boolean(active).booleanValue(); return false; }
From source file:net.sf.ginp.config.Configuration.java
/** * Validate a user.//from ww w . j a v a2s .co m * @param userName username * @param userPass password * @return if the user is valid or not */ public static Boolean accessCheck(final String userName, final String userPass) { //Find user collections that have zero users or the given user String xpath = "/ginp/user[@username='" + StringTool.XMLEscape(userName) + "' and @userpass='" + StringTool.XMLEscape(userPass) + "']"; List elem = document.selectNodes(xpath); return new Boolean(elem.size() > 0); }
From source file:com.heliumv.api.machine.MachineApi.java
private MachineAvailabilityEntryList getAvailabilitiesImpl(Integer machineId, Long dateMs, Integer days, Boolean withDescription) throws NamingException, RemoteException { MachineAvailabilityEntryList entries = new MachineAvailabilityEntryList(); Date d = null;/*from ww w . j av a2s . c o m*/ if (dateMs == null) { d = new Date(System.currentTimeMillis()); } else { d = new Date(dateMs); } if (days == null) { days = new Integer(1); } else { if (days < 0) { respondBadRequest("days", "value = '" + days + "' is not >= 0."); return entries; } } if (withDescription == null) { withDescription = new Boolean(false); } List<MaschinenVerfuegbarkeitsStundenDto> dtos = maschineCall.getVerfuegbarkeitStunden(machineId, d, days); Map<Integer, DayTypeEntry> mapTypes = null; if (withDescription) { List<DayTypeEntry> dayTypes = zeiterfassungCall.getAllSprTagesarten(); mapTypes = new HashMap<Integer, DayTypeEntry>(); for (DayTypeEntry dayTypeEntry : dayTypes) { mapTypes.put(dayTypeEntry.getId(), dayTypeEntry); } } List<MachineAvailabilityEntry> apiDtos = new ArrayList<MachineAvailabilityEntry>(); for (MaschinenVerfuegbarkeitsStundenDto dto : dtos) { MachineAvailabilityEntry entry = new MachineAvailabilityEntry(); entry.setMachineId(dto.getMaschineId()); entry.setDayTypeId(dto.getTagesartId()); entry.setAvailabilityHours(dto.getVerfuegbarkeitH()); entry.setDateMs(dto.getDate().getTime()); if (mapTypes != null) { if (mapTypes.get(dto.getTagesartId()) == null) { entry.setDayTypeDescription("Unbekannt (" + dto.getTagesartId() + ")."); } else { entry.setDayTypeDescription(mapTypes.get(dto.getTagesartId()).getDescription()); } } apiDtos.add(entry); } entries.setEntries(apiDtos); return entries; }
From source file:de.ingrid.usermanagement.jetspeed.SecurityAccessImpl.java
/** * <p>//www . j a v a 2 s . com * Returns the {@link InternalUserPrincipal} from the user name. * </p> * * @param username * The user name. * @param isMappingOnly * Whether a principal's purpose is for security mappping only. * @return The {@link InternalUserPrincipal}. */ public InternalUserPrincipal getInternalUserPrincipal(String username, boolean isMappingOnly) { UserPrincipal userPrincipal = new UserPrincipalImpl(username); String fullPath = userPrincipal.getFullPath(); // Get user. Criteria filter = new Criteria(); filter.addEqualTo("fullPath", fullPath); filter.addEqualTo("isMappingOnly", new Boolean(isMappingOnly)); Query query = QueryFactory.newQuery(InternalUserPrincipalImpl.class, filter); InternalUserPrincipal internalUser = null; internalUser = (InternalUserPrincipal) broker.getObjectByQuery(query); return internalUser; }
From source file:com.flagleader.builder.BuilderConfig.java
public void save() { Properties localProperties = null; try {//from w ww. j a v a 2s. c o m localProperties = new Properties(); if (this.c == null) this.c = new File(SystemUtils.USER_HOME + File.separator + ".visualrules", "builder.conf"); if (!this.c.exists()) this.c.createNewFile(); localProperties.setProperty("autosave", new Boolean(this.h).toString()); localProperties.setProperty("userName", this.k); localProperties.setProperty("licenseKey", this.l); localProperties.setProperty("demoKey", this.j); localProperties.setProperty("autosaveTime", new Long(this.i).toString()); localProperties.setProperty("tomcatLogFile", this.n); localProperties.setProperty("projPath", this.q); localProperties.setProperty("updateUrl", this.r); localProperties.setProperty("emailServer", this.w); localProperties.setProperty("emailUser", this.x); localProperties.setProperty("emailPasswd", ConnectionFactory.encrypt(this.y)); localProperties.setProperty("emailAuthor", this.z); localProperties.setProperty("emailAuthorName", this.A); localProperties.setProperty("emailTo", this.B); localProperties.setProperty("emailToName", this.C); localProperties.setProperty("firstLogin", new Boolean(this.s).toString()); localProperties.setProperty("loadDefault", new Boolean(this.t).toString()); localProperties.setProperty("autoCheckVersion", new Boolean(this.u).toString()); localProperties.setProperty("autoCheckVersionTime", new Long(this.v).toString()); localProperties.setProperty("compositeBuffer", this.m); localProperties.setProperty("fontname", this.g.getFontData()[0].getName()); localProperties.setProperty("fontheight", String.valueOf(this.g.getFontData()[0].getHeight())); localProperties.setProperty("fontstyle", String.valueOf(this.g.getFontData()[0].getStyle())); localProperties.store(new FileOutputStream(this.c), "Business Rule Builder Config File"); } catch (Exception localException) { localException.printStackTrace(); } }
From source file:org.redbus.arrivaltime.ArrivalTimeHelper.java
private static void getBusTimesResponse(BusDataRequest request) { if (request.content == null) { try {// www. ja v a 2s.c o m request.callback.onAsyncGetBusTimesError(request.requestId, BUSSTATUS_HTTPERROR, "A network error occurred"); } catch (Throwable t) { } return; } if (request.content.toLowerCase().contains("doesn't exist")) { try { request.callback.onAsyncGetBusTimesError(request.requestId, BUSSTATUS_BADSTOPCODE, "The BusStop code was invalid"); } catch (Throwable t) { } return; } HashMap<String, ArrivalTime> wasDiverted = new HashMap<String, ArrivalTime>(); HashMap<String, ArrivalTime> hasTime = new HashMap<String, ArrivalTime>(); HashMap<String, Boolean> validServices = new HashMap<String, Boolean>(); ArrayList<ArrivalTime> allBusTimes = new ArrayList<ArrivalTime>(); ArrayList<ArrivalTime> validBusTimes = new ArrayList<ArrivalTime>(); try { XmlPullParser parser = Xml.newPullParser(); parser.setInput(new StringReader(request.content)); boolean inBusStopServiceSelector = false; boolean grabValidService = false; while (parser.next() != XmlPullParser.END_DOCUMENT) { String tagName = parser.getName(); switch (parser.getEventType()) { case XmlPullParser.START_TAG: if (tagName.equals("tr")) { String classAttr = ""; String styleAttr = parser.getAttributeValue(null, "style"); if (styleAttr != null) { if (styleAttr.contains("display") && styleAttr.contains("none")) classAttr = "BADTIME"; } else { classAttr = parser.getAttributeValue(null, "class"); if (classAttr == null) continue; if ((!classAttr.contains("tblanc")) && (!classAttr.contains("tgris"))) continue; classAttr = classAttr.replace("tblanc", ""); classAttr = classAttr.replace("tgris", ""); classAttr = classAttr.trim().toLowerCase(); } ArrivalTime bt = parseStopTime(parser, request.stopCode); bt.cssClass = classAttr; if (bt.isDiverted) { if (wasDiverted.containsKey(bt.service)) continue; wasDiverted.put(bt.service.toLowerCase(), bt); } else { hasTime.put(bt.service.toLowerCase(), bt); allBusTimes.add(bt); } } else if (tagName.equals("select")) { String idAttr = parser.getAttributeValue(null, "id"); if (idAttr == null) continue; if (!idAttr.contains("busStopService")) continue; inBusStopServiceSelector = true; } else if (tagName.equals("option")) { if (!inBusStopServiceSelector) break; grabValidService = true; } break; case XmlPullParser.TEXT: if (grabValidService) { String serviceName = parser.getText().toLowerCase(); validServices.put(serviceName.substring(0, serviceName.indexOf(' ')), new Boolean(true)); } grabValidService = false; break; case XmlPullParser.END_TAG: if (tagName.equals("select")) inBusStopServiceSelector = false; break; } } // find the "bad" css class String badCssClass = "BADTIME"; for (ArrivalTime at : allBusTimes) { if (!validServices.containsKey(at.service.toLowerCase())) { badCssClass = at.cssClass; break; } } // filter out bad times for (ArrivalTime at : allBusTimes) { if ((!validServices.containsKey(at.service.toLowerCase())) || at.cssClass.equals(badCssClass)) continue; validBusTimes.add(at); } // and add in any diverted services for (ArrivalTime at : wasDiverted.values()) { if (!validServices.containsKey(at.service.toLowerCase())) continue; if (hasTime.containsKey(at.service.toLowerCase())) continue; allBusTimes.add(at); } } catch (Throwable t) { Log.e("BusDataHelper.GetBusTimesResponse", request.content, t); try { request.callback.onAsyncGetBusTimesError(request.requestId, BUSSTATUS_BADDATA, "Invalid data was received from the bus website"); } catch (Throwable t2) { } return; } try { request.callback.onAsyncGetBusTimesSuccess(request.requestId, validBusTimes); } catch (Throwable t) { } }
From source file:org.squale.squaleweb.applicationlayer.action.results.application.ApplicationResultsAction.java
/** * Synthse d'une application Si l'application comporte un seul projet, la synthse du projet est alors affiche. * Dans le cas contraire, trois onglets sont prsents : un qui donne la rpartition, l'autre donnant les facteurs * par projet et le dernier donnant le kiviat. * //from w w w. j a v a2s .co m * @param pMapping le mapping. * @param pForm le formulaire lire. * @param pRequest la requte HTTP. * @param pResponse la rponse de la servlet. * @return l'action raliser. */ public ActionForward summary(ActionMapping pMapping, ActionForm pForm, HttpServletRequest pRequest, HttpServletResponse pResponse) { // Cette action est appele dans plusieurs contextes possibles // Depuis une action struts avec l'id de l'application ou depuis // une page de l'application sans id de l'application (on a alors affaire l'application courante) ActionForward forward; try { // Add an user access for this application addUserAccess(pRequest, ActionUtils.getCurrentApplication(pRequest).getId()); forward = checkApplication(pMapping, pRequest); // Si forward est renseign, l'application contient un seul projet // On redirige donc vers le projet adquat if (null == forward) { // Rcupration des informations concernant les facteurs // Rcupration du paramtre : tous les facteurs ou seuls les facteurs ayant une note ? ResultListForm resultListForm = (ResultListForm) pForm; boolean pAllFactors = resultListForm.isAllFactors(); // On met cette valeur en session pRequest.getSession().setAttribute(ALL_FACTORS, new Boolean(pAllFactors)); ApplicationForm application = ActionUtils.getCurrentApplication(pRequest); // On remet jour les form en session permettant d'accder aux diffrents types d'audits SplitAuditsListForm auditsForm = (SplitAuditsListForm) pRequest.getSession() .getAttribute("splitAuditsListForm"); if (auditsForm != null) { auditsForm.copyValues(application); auditsForm.resetAudits(ActionUtils.getCurrentAuditsAsDTO(pRequest)); pRequest.getSession().setAttribute("splitAuditsListForm", auditsForm); } List auditsDTO = ActionUtils.getCurrentAuditsAsDTO(pRequest); if (auditsDTO != null) { ((ResultListForm) pForm).resetAudits(auditsDTO); } // On efface ce form contenant les erreurs de l'application, car si on passe par ici // Ce form ne peut que contenir les informations pour une autre application pRequest.getSession().removeAttribute("applicationErrorForm"); // Prparation de l'appel la couche mtier IApplicationComponent ac = AccessDelegateHelper.getInstance("Results"); List applications = Arrays .asList(WTransformerFactory.formToObj(ApplicationTransformer.class, application)); Object[] paramIn = { applications, auditsDTO }; // Les rsultats sont retourns dans l'ordre impos par la grille // on maintient cet ordre pour l'affichage List results = (List) ac.execute("getApplicationResults", paramIn); pRequest.getSession().removeAttribute(SqualeWebConstants.RESULTS_KEY); if (null != results && results.size() > 0) { // Transformation des rsultats avant leur affichage par la couche // welcom WTransformerFactory.objToForm(FactorsResultListTransformer.class, (ResultListForm) pForm, new Object[] { applications, results }); } else { // si aucun resultat => liste vide WTransformerFactory.objToForm(FactorsResultListTransformer.class, (ResultListForm) pForm, new Object[] { applications, new ArrayList() }); } // Rcupration des donnes permettant la gnration du Kiviat et du PieChart de l'application if (null != auditsDTO && null != auditsDTO.get(0)) { // Prparation de l'appel la couche mtier ac = AccessDelegateHelper.getInstance("Graph"); Long pCurrentAuditId = new Long(((AuditDTO) auditsDTO.get(0)).getID()); Object[] paramAuditIdKiviat = { pCurrentAuditId, String.valueOf(pAllFactors) }; // Recherche des donnes Kiviat KiviatMaker maker = new KiviatMaker(); Map projectsValues = (Map) ac.execute("getApplicationKiviatGraph", paramAuditIdKiviat); Set keysSet = projectsValues.keySet(); Iterator it = keysSet.iterator(); while (it.hasNext()) { String key = (String) it.next(); maker.addValues(key, (SortedMap) projectsValues.get(key), pRequest); } JFreeChart chartKiviat = maker.getChart(); ChartRenderingInfo infoKiviat = new ChartRenderingInfo(new StandardEntityCollection()); // Initialisation du kiviat String fileNameKiviat = ServletUtilities.saveChartAsPNG(chartKiviat, KiviatMaker.DEFAULT_WIDTH, KiviatMaker.DEFAULT_HEIGHT, infoKiviat, pRequest.getSession()); GraphMaker applicationKiviatChart = new GraphMaker(pRequest, fileNameKiviat, infoKiviat); // Pour l'export en PDF pRequest.getSession().removeAttribute("kiviatChart"); pRequest.getSession().setAttribute("kiviatChart", chartKiviat.createBufferedImage(KiviatMaker.DEFAULT_WIDTH, KiviatMaker.DEFAULT_HEIGHT)); // Recherche des donnes PieChart Object[] paramAuditIdPieChart = { pCurrentAuditId }; JFreeChart pieChart; Object[] maps = (Object[]) ac.execute("getApplicationPieChartGraph", paramAuditIdPieChart); String pPreviousAuditId = null; // on peut ne pas avoir d'audit prcdent if (auditsDTO.size() > 1) { pPreviousAuditId = "" + ((AuditDTO) auditsDTO.get(1)).getID(); } PieChartMaker pieMaker = new PieChartMaker(null, pCurrentAuditId.toString(), pPreviousAuditId); pieMaker.setValues((Map) maps[0]); pieChart = pieMaker.getChart((Map) maps[1], pRequest); ChartRenderingInfo infoPieChart = new ChartRenderingInfo(new StandardEntityCollection()); // Initialisation du pieChart String fileName = ServletUtilities.saveChartAsPNG(pieChart, PieChartMaker.DEFAULT_WIDTH, PieChartMaker.DEFAULT_HEIGHT, infoPieChart, pRequest.getSession()); GraphMaker applicationPieChart = new GraphMaker(pRequest, fileName, infoPieChart); // Met jour les 2 champs du form avec les 2 graphs calculs ((ResultListForm) pForm).setKiviat(applicationKiviatChart); ((ResultListForm) pForm).setPieChart(applicationPieChart); // Met jour le form en session pRequest.getSession().setAttribute("resultListForm", pForm); // Pour l'export en PDF pRequest.getSession().removeAttribute("pieChart"); pRequest.getSession().setAttribute("pieChart", pieChart .createBufferedImage(PieChartMaker.DEFAULT_WIDTH, PieChartMaker.DEFAULT_HEIGHT)); } // Affichage des informations sur la page jsp forward = pMapping.findForward("summary"); } } catch (Exception e) { ActionErrors errors = new ActionErrors(); // Traitement factoris des erreurs handleException(e, errors, pRequest); // Sauvegarde des erreurs saveMessages(pRequest, errors); // Routage vers la page d'erreur forward = pMapping.findForward("total_failure"); } // On est pass par un menu donc on rinitialise le traceur resetTracker(pRequest); // Indique que l'on vient d'une vue synthse et pas d'une vue composant changeWay(pRequest, "false"); return forward; }