public String serialize(CaptureSearchResult result) { String r = result.getRobotFlags(); return r == null ? DEFAULT_VALUE : r; } }
public String serialize(CaptureSearchResult result) { String r = result.getRobotFlags(); return r == null ? DEFAULT_VALUE : r; } }
/** * test if {@code robotflags} field has flag {@code flag} set. * @param flag one flag to test * @return {@code true} if {@code flag} is set. */ public boolean isRobotFlagSet(char flag) { String flags = getRobotFlags(); return flags != null && flags.indexOf(flag) >= 0; }
/** * test if {@code robotflags} field has flag {@code flag} set. * @param flag one flag to test * @return {@code true} if {@code flag} is set. */ public boolean isRobotFlagSet(char flag) { String flags = getRobotFlags(); return flags != null && flags.indexOf(flag) >= 0; }
/** * test if {@code robotflags} field has flag {@code flag} set. * <p> * Caveat: if {@code flag} has more than once character, * {@code robotflags} must have {@code flag} as its substring * for this method to return {@code true} (not really useful). * </p> * @param flag flag to test * @return {@code true} if {@code flag} is set. */ public boolean isRobotFlagSet(String flag) { String flags = getRobotFlags(); if (flags == null) { return false; } return flags.contains(flag); }
/** * test if {@code robotflags} field has flag {@code flag} set. * <p> * Caveat: if {@code flag} has more than once character, * {@code robotflags} must have {@code flag} as its substring * for this method to return {@code true} (not really useful). * </p> * @param flag flag to test * @return {@code true} if {@code flag} is set. */ public boolean isRobotFlagSet(String flag) { String flags = getRobotFlags(); if (flags == null) { return false; } return flags.contains(flag); }
protected static boolean hasAnyRobotFlags(CaptureSearchResult capture, String flags) { // most capture have no robot flag - do a shortcut. if (capture.getRobotFlags() != null) { for (int i = 0; i < flags.length(); i++) { if (capture.isRobotFlagSet(flags.charAt(i))) return true; } } return false; }
protected static boolean hasAnyRobotFlags(CaptureSearchResult capture, String flags) { // most capture have no robot flag - do a shortcut. if (capture.getRobotFlags() != null) { for (int i = 0; i < flags.length(); i++) { if (capture.isRobotFlagSet(flags.charAt(i))) return true; } } return false; }
/** * Add a flag to {@code robotflags} field. * If {@code flag} is already set, this is a no-op. * @param flag a flag to add (don't put multiple flags). */ public void setRobotFlag(String flag) { String flags = getRobotFlags(); if (flags == null) { flags = ""; } if (!flags.contains(flag)) { flags = flags + flag; } setRobotFlags(flags); }
/** * Add a flag to {@code robotflags} field. * If {@code flag} is already set, this is a no-op. * @param flag a flag to add (don't put multiple flags). */ public void setRobotFlag(String flag) { String flags = getRobotFlags(); if (flags == null) { flags = ""; } if (!flags.contains(flag)) { flags = flags + flag; } setRobotFlags(flags); }
/** * Add a flag to {@code robotflags} field. * If {@code flag} is already set, this is a no-op. * @param flag a flag to add */ public void setRobotFlag(char flag) { String flags = getRobotFlags(); if (flags == null) { setRobotFlags(Character.toString(flag)); } else { if (flags.indexOf(flag) < 0) { setRobotFlags(flags + flag); } } }
/** * Add a flag to {@code robotflags} field. * If {@code flag} is already set, this is a no-op. * @param flag a flag to add */ public void setRobotFlag(char flag) { String flags = getRobotFlags(); if (flags == null) { setRobotFlags(Character.toString(flag)); } else { if (flags.indexOf(flag) < 0) { setRobotFlags(flags + flag); } } }
sb.append(DELIMITER); if(outputRobot) { String robotFlags = result.getRobotFlags(); if(robotFlags == null || robotFlags.equals("")) { robotFlags = "-";
sb.append(DELIMITER); if(outputRobot) { String robotFlags = result.getRobotFlags(); if(robotFlags == null || robotFlags.equals("")) { robotFlags = "-";
public void testBlock() { acClient.policyToReturn = "block"; // object properties are not really used except for originalUrl. CaptureSearchResult capture = new FastCaptureSearchResult(); capture.setOriginalUrl("http://www.example.com/"); int rv = cut.filterObject(capture); // Now "block" returns FILTER_INCLUDE, "X" flag in robotflags. assertEquals(CustomPolicyOracleFilter.FILTER_INCLUDE, rv); assertEquals( Character.toString(CaptureSearchResult.CAPTURE_ROBOT_BLOCKED), capture.getRobotFlags()); }
assertEquals("X", captureX.getRobotFlags());