List of usage examples for java.lang Boolean FALSE
Boolean FALSE
To view the source code for java.lang Boolean FALSE.
Click Source Link
From source file:net.bican.wordpress.Main.java
/** * @param args execute with "-?" for an explanation of args * @throws ParseException When the command line options cannot be parsed *//* w w w . j a v a2s . co m*/ public static void main(String[] args) throws ParseException { try { Options options = new Options(); options.addOption("?", "help", false, "Print usage information"); options.addOption("h", "url", true, "Specify the url to xmlrpc.php"); options.addOption("u", "user", true, "User name"); options.addOption("p", "pass", true, "Password"); options.addOption("a", "authors", false, "Get author list"); options.addOption("s", "slug", true, "Slug for categories"); options.addOption("pi", "parentid", true, "Parent id for categories"); options.addOption("oi", "postid", true, "Post id for pages and posts"); options.addOption("c", "categories", false, "Get category list"); options.addOption("cn", "newcategory", true, "New category (uses --slug and --parentid)"); options.addOption("pg", "pages", false, "Get page list (full)"); options.addOption("pl", "pagelist", false, "Get page list"); options.addOption("ps", "page", true, "Get page"); options.addOption("pn", "newpage", true, "New page from file <arg> (needs --publish)"); options.addOption("pe", "editpage", true, "Edit page (needs --postid and --publish"); options.addOption("pd", "deletepage", true, "Delete page (needs --publish)"); options.addOption("l", "publish", true, "Publish status for \"new\" options"); options.addOption("us", "userinfo", false, "Get user information"); options.addOption("or", "recentposts", true, "Get recent posts"); options.addOption("os", "getpost", true, "Get post"); options.addOption("on", "newpost", true, "New post from file <arg> (needs --publish)"); options.addOption("oe", "editpost", true, "Edit post (needs --postid and --publish"); options.addOption("od", "deletepost", true, "Delete post (needs --publish)"); options.addOption("sm", "supportedmethods", false, "List supported methods"); options.addOption("st", "supportedfilters", false, "List supported text filters"); options.addOption("mn", "newmedia", true, "New media file (uses --overwrite)"); options.addOption("ov", "overwrite", false, "Allow overwrite in uploading new media"); options.addOption("so", "supportedstatus", false, "Print supported page and post status values"); options.addOption("cs", "commentstatus", false, "Print comment status names for the blog"); options.addOption("cc", "commentcount", true, "Get comment count for a post (-1 for all posts)"); options.addOption("ca", "newcomment", true, "New comment from file"); options.addOption("cd", "deletecomment", true, "Delete comment"); options.addOption("ce", "editcomment", true, "Edit comment from file"); options.addOption("cg", "getcomment", true, "Get comment"); options.addOption("ct", "getcomments", true, "Get comments for the post"); options.addOption("cs", "commentstatus", true, "Comment status (for --getcomments)"); options.addOption("co", "commentoffset", true, "Comment offset # (for --getcomments)"); options.addOption("cm", "commentnumber", true, "Comment # (for --getcomments)"); try { WpCliConfiguration config = new WpCliConfiguration(args, options, Main.class); if (config.hasOption("help")) { showHelp(options); } else if ((!config.hasOption("url")) || (!config.hasOption("user")) || (!config.hasOption("pass"))) { System.err.println("Specify --user, --pass and --url"); } else { try { Wordpress wp = new Wordpress(config.getOptionValue("user"), config.getOptionValue("pass"), config.getOptionValue("url")); if (config.hasOption("authors")) { printList(wp.getAuthors(), Author.class, true); } else if (config.hasOption("categories")) { printList(wp.getCategories(), Category.class, true); } else if (config.hasOption("newcategory")) { String slug = config.getOptionValue("slug"); Integer parentId = getInteger("parentid", config); if (slug == null) slug = ""; if (parentId == null) parentId = 0; System.out .println(wp.newCategory(config.getOptionValue("newcategory"), slug, parentId)); } else if (config.hasOption("pages")) { printList(wp.getPages(), Page.class, false); } else if (config.hasOption("pagelist")) { printList(wp.getPageList(), PageDefinition.class, false); } else if (config.hasOption("page")) { printItem(wp.getPage(getInteger("page", config)), Page.class); } else if (config.hasOption("userinfo")) { printItem(wp.getUserInfo(), User.class); } else if (config.hasOption("recentposts")) { printList(wp.getRecentPosts(getInteger("recentposts", config)), Page.class, false); } else if (config.hasOption("getpost")) { printItem(wp.getPost(getInteger("getpost", config)), Page.class); } else if (config.hasOption("supportedmethods")) { printList(wp.supportedMethods(), String.class, false); } else if (config.hasOption("supportedfilters")) { printList(wp.supportedTextFilters(), String.class, false); } else if (config.hasOption("newpage")) { if (!config.hasOption("publish")) { showHelp(options); } else { System.out.println( wp.newPage(Page.fromFile(new File(config.getOptionValue("newpage"))), config.getOptionValue("publish"))); } } else if (config.hasOption("editpage")) { edit(options, config, wp, "editpage", true); } else if (config.hasOption("editpost")) { edit(options, config, wp, "editpost", false); } else if (config.hasOption("deletepage")) { delete(options, config, wp, "deletepage", true); } else if (config.hasOption("deletepost")) { delete(options, config, wp, "deletepost", false); } else if (config.hasOption("newpost")) { if (!config.hasOption("publish")) { showHelp(options); } else { System.out.println( wp.newPost(Page.fromFile(new File(config.getOptionValue("newpost"))), Boolean.valueOf(config.getOptionValue("publish")))); } } else if (config.hasOption("newmedia")) { String fileName = config.getOptionValue("newmedia"); File file = new File(fileName); String mimeType = new MimetypesFileTypeMap().getContentType(file); Boolean overwrite = Boolean.FALSE; if (config.hasOption("overwrite")) overwrite = Boolean.TRUE; MediaObject result = wp.newMediaObject(mimeType, file, overwrite); if (result != null) { System.out.println(result); } } else if (config.hasOption("supportedstatus")) { System.out.println("Recognized status values for posts:"); printList(wp.getPostStatusList(), PostAndPageStatus.class, true); System.out.println("\nRecognized status values for pages:"); printList(wp.getPageStatusList(), PostAndPageStatus.class, true); } else if (config.hasOption("commentstatus")) { showCommentStatus(wp); } else if (config.hasOption("commentcount")) { showCommentCount(config, wp); } else if (config.hasOption("newcomment")) { editComment(wp, config.getOptionValue("newcomment"), "newcomment"); } else if (config.hasOption("editcomment")) { editComment(wp, config.getOptionValue("editcomment"), "editcomment"); } else if (config.hasOption("deletecomment")) { System.err.println(Integer.valueOf(config.getOptionValue("deletecomment"))); deleteComment(wp, Integer.valueOf(config.getOptionValue("deletecomment"))); } else if (config.hasOption("getcomment")) { printComment(wp, Integer.valueOf(config.getOptionValue("getcomment"))); } else if (config.hasOption("getcomments")) { Integer postID = Integer.valueOf(config.getOptionValue("getcomments")); String commentStatus = config.getOptionValue("commentstatus"); Integer commentOffset; try { commentOffset = Integer.valueOf(config.getOptionValue("commentoffset")); } catch (NumberFormatException e) { commentOffset = null; } Integer commentNumber; try { commentNumber = Integer.valueOf(config.getOptionValue("commentnumber")); } catch (Exception e) { commentNumber = null; } printComments(wp, postID, commentStatus, commentOffset, commentNumber); } else { showHelp(options); } } catch (MalformedURLException e) { System.err.println("URL \"" + config.getOptionValue("url") + "\" is invalid, reason is: " + e.getLocalizedMessage()); } catch (IOException e) { System.err.println("Can't read from file, reason is: " + e.getLocalizedMessage()); } catch (InvalidPostFormatException e) { System.err.println("Input format is invalid."); } } } catch (ParseException e) { System.err.println("Can't process command line arguments, reason is: " + e.getLocalizedMessage()); } } catch (XmlRpcFault e) { String reason = e.getLocalizedMessage(); System.err.println("Operation failed, reason is: " + reason); } }
From source file:MonitorSaurausRex.MainMenu.java
/** * @param args the command line arguments *//* www . j a v a 2 s . co m*/ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainMenu().setVisible(true); } }); /* Use an appropriate Look and Feel */ try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException | ClassNotFoundException ex) { } /* Turn off metal's use of bold fonts */ UIManager.put("swing.boldMetal", Boolean.FALSE); //Schedule a job for the event-dispatching thread: //adding TrayIcon. SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); }
From source file:Main.java
public static boolean isNvl(Object obj) { if (null == obj || obj.equals("")) { return Boolean.TRUE; }/*ww w .ja v a 2 s. c o m*/ return Boolean.FALSE; }
From source file:Main.java
public static Boolean readBoolean(ByteArrayInputStream bais) { int b = bais.read(); if (b == 0) { return Boolean.FALSE; } else {//from ww w. j a va2 s. c o m return Boolean.TRUE; } }
From source file:com.mongodb.hadoop.examples.wordcount.split.WordCountSplitTest.java
public static void main(String[] args) throws Exception { boolean useQuery = false; boolean testSlaveOk = false; for (int i = 0; i < args.length; i++) { final String argi = args[i]; if (argi.equals("--use-query")) useQuery = true;/*from www .j av a2s .c o m*/ else if (argi.equals("--test-slave-ok")) testSlaveOk = true; else { System.err.println("Unknown argument: " + argi); System.exit(1); } } boolean[] tf = { false, true }; Boolean[] ntf = { null }; if (testSlaveOk) ntf = new Boolean[] { null, Boolean.TRUE, Boolean.FALSE }; for (boolean use_shards : tf) for (boolean use_chunks : tf) for (Boolean slaveok : ntf) test(use_shards, use_chunks, slaveok, useQuery); }
From source file:modnlp.capte.AlignmentInterfaceWS.java
public static void main(String args[]) { try {//from ww w . j ava 2 s. co m //set splitting action equal to true //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); doSplit = true; //default AlreadyRun to false AlreadyRun = false; //lineConvert = true; lineConvert = true; // Read config file boolean isMac = false; boolean isWin = false; boolean isUnix = false; String tmp = ""; String winsep = "\\"; String unixsep = "/"; String ostype = System.getProperty("os.name").toLowerCase(); System.out.println("Operating system type =>" + ostype); if (ostype.indexOf("win") >= 0) { isWin = true; isUnix = false; isMac = false; } else if ((ostype.indexOf("nix") >= 0) || (ostype.indexOf("nux") >= 0)) { isUnix = true; isWin = false; isMac = false; } else if (ostype.indexOf("mac") >= 0) { isWin = false; isUnix = false; isMac = true; } else { throw new UnsupportedOperationException("your OS is not supported!"); } //creating and showing this application's GUI. SwingUtilities.invokeLater(new Runnable() { public void run() { //Turn off metal's use of bold fonts UIManager.put("swing.boldMetal", Boolean.FALSE); createAndShowGUI(); } }); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static String[] intersect(String[] arr1, String[] arr2) { Map<String, Boolean> map = new HashMap<String, Boolean>(); LinkedList<String> list = new LinkedList<String>(); for (String str : arr1) { if (!map.containsKey(str)) { map.put(str, Boolean.FALSE); }// ww w . j ava 2 s . c o m } for (String str : arr2) { if (map.containsKey(str)) { map.put(str, Boolean.TRUE); } } for (Map.Entry<String, Boolean> e : map.entrySet()) { if (e.getValue().equals(Boolean.TRUE)) { list.add(e.getKey()); } } String[] result = {}; return list.toArray(result); }
From source file:Main.java
public static int countFalse(String propertyName, Collection<?> collection) { int count = 0; for (Object o : collection) { BeanWrapper bw = new BeanWrapperImpl(o); Boolean propertyValue = (Boolean) bw.getPropertyValue(propertyName); if (Boolean.FALSE.equals(propertyValue)) { count++;//from ww w. j av a2 s . c om } } return count; }
From source file:Main.java
public static <T> Boolean isEmpty(T[] arr) { if (arr == null || arr.length < 1) { return Boolean.TRUE; }//from ww w .j a va 2 s .c om return Boolean.FALSE; }
From source file:Main.java
public static String[] intersect(String[] arr1, String[] arr2) { Map<String, Boolean> map = new HashMap<>(); LinkedList<String> list = new LinkedList<>(); for (String str : arr1) { if (!map.containsKey(str)) { map.put(str, Boolean.FALSE); }/*from w ww.j av a2 s .c o m*/ } for (String str : arr2) { if (map.containsKey(str)) { map.put(str, Boolean.TRUE); } } for (Map.Entry<String, Boolean> e : map.entrySet()) { if (e.getValue().equals(Boolean.TRUE)) { list.add(e.getKey()); } } String[] result = {}; return list.toArray(result); }