List of usage examples for java.lang Boolean parseBoolean
public static boolean parseBoolean(String s)
From source file:com.haulmont.cuba.gui.xml.layout.loaders.AbstractFieldLoader.java
protected void loadRequired(Field component, Element element) { String required = element.attributeValue("required"); if (StringUtils.isNotEmpty(required)) { component.setRequired(Boolean.parseBoolean(required)); }/* www . j a v a2 s .c om*/ String requiredMessage = element.attributeValue("requiredMessage"); if (requiredMessage != null) { component.setRequiredMessage(loadResourceString(requiredMessage)); } else if (component.isRequired() && component.getDatasource() != null) { MetaPropertyPath propertyPath = component.getMetaPropertyPath(); component.setRequiredMessage( messageTools.getDefaultRequiredMessage(propertyPath.getMetaClass(), propertyPath.toString())); } }
From source file:com.soulgalore.crawler.run.AbstractCrawl.java
/** * Create a crawl object, will fetch the args that is needed. * //from w w w .j av a 2s.c om * @param args containing needed args * @throws ParseException if the input parameter couldn't be parsed */ public AbstractCrawl(String[] args) throws ParseException { super(args); configuration = CrawlerConfiguration.builder() .setMaxLevels(Integer.parseInt(getLine().getOptionValue(LEVEL, Integer.toString(CrawlerConfiguration.DEFAULT_CRAWL_LEVEL)))) .setVerifyUrls(Boolean.parseBoolean(getLine().getOptionValue(VERIFY, Boolean.toString(CrawlerConfiguration.DEFAULT_SHOULD_VERIFY_URLS)))) .setOnlyOnPath(getLine().getOptionValue(FOLLOW_PATH, "")) .setNotOnPath(getLine().getOptionValue(NO_FOLLOW_PATH, "")) .setRequestHeaders(getLine().getOptionValue(REQUEST_HEADERS, "")) .setStartUrl(getLine().getOptionValue(URL)).build(); }
From source file:com.clican.pluto.dataprocess.spring.parser.AbstractProcessorParser.java
@SuppressWarnings({ "unchecked", "rawtypes" }) public BeanDefinition parse(Element element, ParserContext parserContext) { BeanDefinitionRegistry bdr = parserContext.getRegistry(); RootBeanDefinition beanDef = new RootBeanDefinition(); beanDef.setDestroyMethodName("destroy"); beanDef.setAbstract(false);/*w ww . ja v a2 s .co m*/ beanDef.setBeanClass(getDataProcessorClass()); beanDef.setLazyInit(false); beanDef.setAutowireMode(Autowire.BY_NAME.value()); String id = element.getAttribute("id"); if (bdr.containsBeanDefinition(id)) { throw new RuntimeException("id[" + id + "]??"); } bdr.registerBeanDefinition(id, beanDef); beanDef.getPropertyValues().addPropertyValue("id", id); String startProcessor = element.getAttribute("startProcessor"); boolean sp = false; if (StringUtils.isNotEmpty(startProcessor)) { sp = Boolean.parseBoolean(startProcessor); } beanDef.getPropertyValues().addPropertyValue("startProcessor", sp); String transaction = element.getAttribute("transaction"); if (StringUtils.isNotEmpty(transaction)) { beanDef.getPropertyValues().addPropertyValue("transaction", transaction); } else if (sp) { beanDef.getPropertyValues().addPropertyValue("transaction", TransactionMode.BEGIN.getMode()); } String cloneContext = element.getAttribute("cloneContext"); if (StringUtils.isNotEmpty(cloneContext)) { beanDef.getPropertyValues().addPropertyValue("cloneContext", Boolean.parseBoolean(cloneContext)); } String propagations = element.getAttribute("propagations"); if (StringUtils.isNotEmpty(propagations)) { List<String> propataionList = new ArrayList<String>(); for (String propagation : propagations.split(",")) { propataionList.add(propagation); } beanDef.getPropertyValues().addPropertyValue("propagations", propataionList); } String nextDataProcessors = element.getAttribute("nextDataProcessors"); if (StringUtils.isNotEmpty(nextDataProcessors)) { List nextDataProcessList = new ManagedList(); for (String nextDataProcess : nextDataProcessors.split(",")) { nextDataProcess = nextDataProcess.trim(); nextDataProcessList.add(new RuntimeBeanReference(nextDataProcess)); } beanDef.getPropertyValues().addPropertyValue("nextDataProcessors", nextDataProcessList); } customiseBeanDefinition(beanDef, element, parserContext); return beanDef; }
From source file:eu.scape_project.planning.xml.plan.TriggerFactory.java
@Override public Trigger createObject(Attributes arg0) throws Exception { Trigger trigger = new Trigger(); // legacy import for old trigger definition pre plato-2.0: String id = arg0.getValue("id"); String value = arg0.getValue("value"); if (id != null) { // this means we have an old xml trigger.setActive(true);/*from w ww . java 2 s . co m*/ if ("1".equals(id)) { trigger.setType(TriggerType.NEW_COLLECTION); } else if ("2".equals(id)) { trigger.setType(TriggerType.PERIODIC_REVIEW); } else if ("3".equals(id)) { trigger.setType(TriggerType.CHANGED_ENVIRONMENT); } else if ("4".equals(id)) { trigger.setType(TriggerType.CHANGED_OBJECTIVE); } else if ("5".equals(id)) { trigger.setType(TriggerType.CHANGED_COLLECTION_PROFILE); } trigger.setDescription(value); } else { // new xml >= plato 2.0 trigger.setActive(Boolean.parseBoolean(arg0.getValue("active"))); trigger.setDescription(arg0.getValue("description")); trigger.setType(TriggerType.valueOf(arg0.getValue("type"))); } return trigger; }
From source file:io.gravitee.repository.redis.ratelimit.RedisRateLimitRepository.java
@Override public RateLimit get(String rateLimitKey) { RateLimit rateLimit = new RateLimit(rateLimitKey); List<String> members = redisTemplate.opsForList().range(REDIS_KEY_PREFIX + rateLimit.getKey(), 0, 5); if (!members.isEmpty()) { Iterator<String> ite = members.iterator(); rateLimit.setAsync(Boolean.parseBoolean(ite.next())); rateLimit.setUpdatedAt(Long.parseLong(ite.next())); rateLimit.setCreatedAt(Long.parseLong(ite.next())); rateLimit.setCounter(Long.parseLong(ite.next())); rateLimit.setResetTime(Long.parseLong(ite.next())); rateLimit.setLastRequest(Long.parseLong(ite.next())); }/*w ww . ja v a 2 s .c o m*/ return rateLimit; }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.SearchFieldLoader.java
@Override public void loadComponent() { super.loadComponent(); SearchField searchField = (SearchField) resultComponent; String minSearchStringLength = element.attributeValue("minSearchStringLength"); if (StringUtils.isNotEmpty(minSearchStringLength)) { searchField.setMinSearchStringLength(Integer.parseInt(minSearchStringLength)); }//from ww w .ja v a 2 s .c o m String modeString = element.attributeValue("mode"); if (StringUtils.isNotEmpty(modeString)) { SearchField.Mode mode; try { mode = SearchField.Mode.valueOf(StringUtils.upperCase(modeString)); } catch (IllegalArgumentException e) { throw new GuiDevelopmentException("Unable to parse mode for search", context.getFullFrameId(), "mode", modeString); } searchField.setMode(mode); } String escapeValueForLike = element.attributeValue("escapeValueForLike"); if (StringUtils.isNotEmpty(escapeValueForLike)) { searchField.setEscapeValueForLike(Boolean.parseBoolean(escapeValueForLike)); } }
From source file:org.zanata.sync.jobs.system.ResourceProducer.java
private static boolean isGitExecutableOnPath() { String tryNativeGit = System.getenv(TRY_NATIVE_GIT); if (Boolean.parseBoolean(tryNativeGit)) { Pattern pattern = Pattern.compile(Pattern.quote(File.pathSeparator)); return pattern.splitAsStream(System.getenv("PATH")).map(Paths::get) .anyMatch(path -> Files.exists(path.resolve("git"))); }/* w w w . j ava2 s . c om*/ return false; }
From source file:com.esri.geoportal.harvester.folder.FolderBrokerDefinitionAdaptor.java
/** * Creates instance of the adaptor.//w ww .jav a 2 s.com * @param entityDefinition broker definition * @throws InvalidDefinitionException if invalid definition */ public FolderBrokerDefinitionAdaptor(EntityDefinition entityDefinition) throws InvalidDefinitionException { super(entityDefinition); if (StringUtils.trimToEmpty(entityDefinition.getType()).isEmpty()) { entityDefinition.setType(FolderConnector.TYPE); } else if (!FolderConnector.TYPE.equals(entityDefinition.getType())) { throw new InvalidDefinitionException("Broker definition doesn't match"); } else { try { this.rootFolder = new File(get(P_ROOT_FOLDER)); } catch (NullPointerException ex) { throw new InvalidDefinitionException( String.format("Invalid %s: %s", P_ROOT_FOLDER, get(P_ROOT_FOLDER)), ex); } cleanup = Boolean.parseBoolean(get(P_FOLDER_CLEANUP)); } }
From source file:com.cubeia.backoffice.users.migration.MySQLMigrationAdapter.java
private boolean checkActive() { return Boolean.parseBoolean(configuration.getProperty("user.service.migration.mysql.active")); }
From source file:Item.SaveItem.java
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, FileNotFoundException { System.err.println("fet 3al post"); Item item = new Item(); item.setName(request.getParameter("name")); item.setDescription(request.getParameter("description")); item.setSaleRentPrice(Double.parseDouble(request.getParameter("saleRentPrice"))); item.setMinLimit(Integer.parseInt(request.getParameter("minLimit"))); item.setMaxLimit(Integer.parseInt(request.getParameter("maxLimit"))); item.setIsAvailable(Boolean.parseBoolean(request.getParameter("available"))); item.setIsActive(Boolean.parseBoolean(request.getParameter("active"))); item.setItemCategory_id(Long.parseLong(request.getParameter("category"))); String barcode = request.getParameter("barcode"); System.out.println("barcodeeee: " + request.getParameter("barcode")); String barcodeImgPath = "C:/Users/Douha/Documents/NetBeansProjects/LibraryLatest/web/public/barcode/" + barcode + ".png"; BarcodeManager.generateCode128(barcode, barcodeImgPath); item.setImgBracodePath("./public/barcode/" + barcode + ".png"); item.setBarcode(request.getParameter("barcode")); ItemBean itemBean = new ItemBean(); /* if(ServletFileUpload.isMultipartContent(request)){ //from w w w . ja va 2 s.c om try { List<FileItem> multiparts = new ServletFileUpload( new DiskFileItemFactory()).parseRequest(request); for(FileItem file : multiparts){ if(!file.isFormField()){ String name = new File(file.getName()).getName(); file.write( new File(UPLOAD_DIRECTORY + "/"+ name)); } } //File uploaded successfully System.err.print("File Uploaded Successfully"); } catch (Exception ex) { System.err.print("File Upload Failed due to " + ex); } }else{ System.err.print("Sorry this Servlet only handles file upload request"); } */ if (!request.getParameter("id").equals("")) { System.err.println("fet 3al ifff"); item.setId(Long.parseLong(request.getParameter("id"))); itemBean.modifyItem(item); if (request.getParameter("book") != null && request.getParameter("book").equals("true")) { BookBean bookBean = new BookBean(); Book book = bookBean.getBookFormItem(item.getId()); System.err.println("item iddd:" + item.getId()); response.sendRedirect("GetBook?item_id=" + item.getId() + "&id=" + book.getId()); } else response.sendRedirect("GetItems"); } else { System.err.println("fet 3al elseee"); long item_id = itemBean.addItem(item); System.err.println("item id:" + item_id); if (request.getParameter("book") != null && request.getParameter("book").equals("true")) response.sendRedirect("GetBook?item_id=" + item_id + "&id="); else response.sendRedirect("GetItems"); } }