List of usage examples for java.lang Boolean Boolean
@Deprecated(since = "9") public Boolean(String s)
From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.ShowDegreesAction.java
public ActionForward nonMaster(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors = new ActionErrors(); Boolean inEnglish = new Boolean(false); InfoExecutionPeriod infoExecutionPeriod = (InfoExecutionPeriod) request .getAttribute(PresentationConstants.EXECUTION_PERIOD); InfoExecutionYear infoExecutionYear = null; if (infoExecutionPeriod != null) { infoExecutionYear = infoExecutionPeriod.getInfoExecutionYear(); }/*ww w. java 2s . c om*/ List executionDegreesList = null; try { // ReadExecutionDegreesByExecutionYear executionDegreesList = ReadNonMasterExecutionDegreesByExecutionYear.run(infoExecutionYear); } catch (FenixServiceException e) { errors.add("impossibleDegreeList", new ActionError("error.impossibleDegreeList")); saveErrors(request, errors); } // buil a list of degrees by execution degrees list List degreesList = buildDegreesList(executionDegreesList); // put both list in request request.setAttribute("degreesList", degreesList); request.setAttribute("inEnglish", inEnglish); return mapping.findForward("showDegrees"); }
From source file:com.seer.datacruncher.profiler.spring.CompareTableController.java
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String action = CommonUtil.notNullValue(request.getParameter("action")); CompareTableBL ctbl = new CompareTableBL(); ctbl.setTable1(CommonUtil.notNullValue(request.getParameter("table1"))); ctbl.setTable2(CommonUtil.notNullValue(request.getParameter("table2"))); ctbl.setCol1(CommonUtil.notNullValue(request.getParameter("col1"))); ctbl.setCol2(CommonUtil.notNullValue(request.getParameter("col2"))); ctbl.setRb(CommonUtil.notNullValue(request.getParameter("relation"))); ctbl.setFt(CommonUtil.notNullValue(request.getParameter("ft"))); ctbl.setLink(CommonUtil.notNullValue(request.getParameter("link"))); boolean editable = new Boolean(CommonUtil.notNullValue(request.getParameter("editable"))); if (action.equals("link")) { TableGridDTO tgDTO = ctbl.linkClicked(); GridUtil gridUtil = new GridUtil(); gridUtil.generateGridData(tgDTO, editable, null); out.println("{\"success\": true, \"data\":" + gridUtil.getData() + ", \"columns\":" + gridUtil.getColumnNames() + ", \"fields\":" + gridUtil.getFieldNames() + "}"); } else {/* w w w . java 2s. c om*/ Map<String, List<String>> dataMap = ctbl.buttonClicked(); String data = ChartUtil.generateDataSetFromMap(dataMap); out.println("{\"success\": true, \"data\":" + data + "}"); } return null; }
From source file:com.mockey.ui.ConfigurationInfoAJAXServlet.java
/** * /*from w w w . j a v a 2s . c om*/ * * @param req * basic request * @param resp * basic resp * @throws ServletException * basic * @throws IOException * basic */ public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ProxyServerModel proxyInfo = store.getProxy(); String transientState = req.getParameter("transient_state"); try { if (transientState != null) { store.setReadOnlyMode(new Boolean(transientState)); } } catch (Exception e) { logger.error("Unable to set transient state with value: " + transientState, e); } resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); try { JSONObject responseObject = new JSONObject(); JSONObject messageObject = new JSONObject(); messageObject.put("proxy_enabled", Boolean.toString(proxyInfo.isProxyEnabled())); messageObject.put("transient_state", store.getReadOnlyMode()); Long twistInfoId = store.getUniversalTwistInfoId(); TwistInfo twistInfo = store.getTwistInfoById(twistInfoId); if (twistInfo != null) { messageObject.put("twist_enabled", true); messageObject.put("twist-id", twistInfo.getId()); messageObject.put("twist-name", twistInfo.getName()); } else { messageObject.put("twist_enabled", false); } resp.setContentType("application/json;"); responseObject.put("result", messageObject); out.println(responseObject.toString()); } catch (JSONException e) { throw new ServletException(e); } out.flush(); out.close(); return; }
From source file:org.hbird.business.commanding.CommandingChainTest.java
@Before public void initialize() throws Exception { // Prepare parameter buffer (parameterBuffer) parameterBuffer.storeParameter(/*from w ww.j a v a2 s .c om*/ new StateParameter("TestParameter1", "Description of test parameter 1", null, new Boolean(true))); parameterBuffer.storeParameter( new StateParameter("TestParameter2", "Description of test parameter 2", null, new Boolean(true))); parameterBuffer.storeParameter( new StateParameter("TestParameter3", "Description of test parameter 3", null, new Boolean(true))); // Add a route to access activemq:topic:ParametersWarning via a mock endpoint. commandingChainContext.addRoutes(new RouteBuilder() { public void configure() throws Exception { from("activemq:queue:ReleasedCommands").to("mock:ResultsCommands"); from("activemq:queue:ExecutedTasks").to("mock:ResultsExecutedTasks"); } }); // In case that there are still old parameters left in the parameters // topic, wait until all have been routed to the 'results' components, so that // they don't disturb the testing. int oldCount = -1; int newCount = 0; while (oldCount < newCount) { Thread.sleep(250); oldCount = newCount; newCount = resultsCommands.getReceivedCounter() + resultsExecutedTasks.getReceivedCounter(); } // Reset Mock endpoints so that they don't contain any messages. resultsCommands.reset(); resultsExecutedTasks.reset(); }
From source file:com.meikai.common.web.servlet.FCKeditorConnectorServlet.java
/** * Initialize the servlet.<br>// w w w .j av a 2 s . co m * Retrieve from the servlet configuration the "baseDir" which is the root * of the file repository:<br> * If not specified the value of "/UserFiles/" will be used. * */ public void init() throws ServletException { baseDir = getInitParameter("baseDir"); debug = (new Boolean(getInitParameter("debug"))).booleanValue(); if (baseDir == null) baseDir = "/UserFiles/"; String realBaseDir = getServletContext().getRealPath(baseDir); File baseFile = new File(realBaseDir); if (!baseFile.exists()) { baseFile.mkdir(); } allowedExtensions = new Hashtable(3); deniedExtensions = new Hashtable(3); allowedExtensions.put("File", FckeditorUtil.stringToArrayList(getInitParameter("AllowedExtensionsFile"))); deniedExtensions.put("File", FckeditorUtil.stringToArrayList(getInitParameter("DeniedExtensionsFile"))); allowedExtensions.put("Image", FckeditorUtil.stringToArrayList(getInitParameter("AllowedExtensionsImage"))); deniedExtensions.put("Image", FckeditorUtil.stringToArrayList(getInitParameter("DeniedExtensionsImage"))); allowedExtensions.put("Flash", FckeditorUtil.stringToArrayList(getInitParameter("AllowedExtensionsFlash"))); deniedExtensions.put("Flash", FckeditorUtil.stringToArrayList(getInitParameter("DeniedExtensionsFlash"))); try { SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd"); dateCreated = simpledateformat.format(new Date()); } catch (Exception ex) { logger.error("? : " + ex.getMessage()); } }
From source file:org.esupportail.sympa.portlet.web.controllers.HomeController.java
private List<SympaListCriterion> formToCriterion(HomeForm form) { if (form == null) return null; List<SympaListCriterion> crits = new ArrayList<SympaListCriterion>(); if (form.isEditor()) crits.add(new SympaListCriterion(SympaListFields.editor, new Boolean(form.isEditor()))); if (form.isOwner()) crits.add(new SympaListCriterion(SympaListFields.owner, new Boolean(form.isOwner()))); if (form.isSubscriber()) crits.add(new SympaListCriterion(SympaListFields.subscriber, new Boolean(form.isSubscriber()))); return crits; }
From source file:com.cloudera.recordbreaker.learnstructure.test.GenerateRandomData.java
Object generateData(Schema s) { Schema.Type stype = s.getType(); if (stype == Schema.Type.ARRAY) { Schema arrayS = s.getElementType(); int numElts = 1 + r.nextInt(100); GenericData.Array result = new GenericData.Array(numElts, arrayS); for (int i = 0; i < numElts; i++) { result.add(generateData(arrayS)); }//from w ww .j a v a 2s . c om return arrayS; } else if (stype == Schema.Type.BOOLEAN) { return r.nextInt(2) == 0 ? new Boolean(true) : new Boolean(false); } else if (stype == Schema.Type.BYTES) { return ByteBuffer.wrap(new byte[16]); } else if (stype == Schema.Type.DOUBLE) { return new Double(r.nextDouble()); } else if (stype == Schema.Type.ENUM) { List<String> symbols = s.getEnumSymbols(); return symbols.get(r.nextInt(symbols.size())); } else if (stype == Schema.Type.FIXED) { return new GenericData.Fixed(s, new byte[16]); } else if (stype == Schema.Type.FLOAT) { return new Float(r.nextFloat()); } else if (stype == Schema.Type.INT) { return new Integer(r.nextInt()); } else if (stype == Schema.Type.LONG) { return new Long(r.nextLong()); } else if (stype == Schema.Type.MAP) { HashMap<Utf8, Object> result = new HashMap<Utf8, Object>(); Schema valType = s.getValueType(); int maxElts = 1 + r.nextInt(100); for (int i = 0; i < maxElts; i++) { result.put(new Utf8("label-" + i), generateData(valType)); } return result; } else if (stype == Schema.Type.NULL) { return null; } else if (stype == Schema.Type.RECORD) { GenericData.Record result = new GenericData.Record(s); for (Schema.Field f : s.getFields()) { result.put(f.name(), generateData(f.schema())); } return result; } else if (stype == Schema.Type.STRING) { return new Utf8("Rand-" + r.nextInt()); } else if (stype == Schema.Type.UNION) { List<Schema> types = s.getTypes(); return generateData(types.get(r.nextInt(types.size()))); } return null; }
From source file:is.idega.idegaweb.egov.application.presentation.ApplicationBlock.java
protected boolean useAgeRestriction(IWContext iwc) { return new Boolean( iwc.getApplicationSettings().getProperty(ATTRIBUTE_USE_AGE_RESTRICTION, Boolean.TRUE.toString())) .booleanValue();/*from w ww .ja va 2 s. c o m*/ }
From source file:org.openmrs.module.sync.SyncDrugOrderTest.java
@Test @NotTransactional/*from w ww . j a v a 2 s . c o m*/ public void shouldCreateDrugOrder() throws Exception { if (TestUtil.isOpenmrsVersionAtLeast("1.10")) { log.warn("NOT RUNNING DRUG ORDER TESTS AGAINST 1.10. TODO."); return; } runSyncTest(new SyncTestHelper() { OrderService orderService = Context.getOrderService(); public void runOnChild() throws Exception { Patient patient = Context.getPatientService().getPatient(new Integer(2)); assertNotNull(patient); Drug drug = Context.getConceptService().getDrugByNameOrId("Advil"); assertNotNull(drug); Concept concept = drug.getConcept(); assertNotNull(concept); DrugOrder drugOrder = new DrugOrder(); drugOrder.setDrug(drug); drugOrder.setConcept(concept); drugOrder.setPatient(patient); drugOrder.setDose(1.0); drugOrder.setInstructions(""); drugOrder.setStartDate(new Date()); drugOrder.setDateCreated(new Date()); drugOrder.setVoided(new Boolean(false)); Object orderType = OrderService.class.getMethod("getOrderType", Integer.class).invoke(orderService, 1); DrugOrder.class.getMethod("setOrderType", OrderType.class).invoke(drugOrder, orderType); DrugOrder.class.getMethod("setUnits", String.class).invoke(drugOrder, "tabs"); DrugOrder.class.getMethod("setFrequency", String.class).invoke(drugOrder, "4 times per day"); OrderService.class.getMethod("saveOrder", Order.class).invoke(orderService, drugOrder); List orders = (List) OrderService.class.getMethod("getDrugOrdersByPatient", Patient.class) .invoke(orderService, patient); Assert.assertEquals(2, orders.size()); } public void runOnParent() throws Exception { Patient patient = Context.getPatientService().getPatient(new Integer(2)); List orders = (List) OrderService.class.getMethod("getDrugOrdersByPatient", Patient.class) .invoke(orderService, patient); Assert.assertEquals(2, orders.size()); } }); }
From source file:com.zjy.utils.propertyset.BaseCachingPropertySet.java
public void reload() { if (logger.isDebugEnabled()) { logger.debug("RuntimeCachingPropertySet.init......"); }/* www . j a v a 2s. c o m*/ PropertySetConfig psc = PropertySetConfig.getConfig(); Map<?, ?> cacheConfig = psc.getArgs("cached"); Map<String, Object> cacheArgs = new HashMap<String, Object>(); cacheArgs.put("PropertySet", bjps); cacheArgs.put("bulkload", new Boolean("true")); super.init(cacheConfig, cacheArgs); }