id
stringlengths
7
14
text
stringlengths
1
106k
3250434_4
public <T> T getBean(Class<T> type) { Collection<T> result = getBeans(type); if (result.isEmpty()) { throw new IllegalStateException("Bean is not registered : " + type.getName()); } if (result.size() > 1) { throw new IllegalStateException("More than one bean found of type : " + type.getN...
3250434_5
public void register(Class<?> type) { beans.put(type, new Object[1]); }
3250434_6
public <T> T map(final Object srcObj, final Class<T> destClass) { return map(srcObj, destClass, null); }
3250434_7
static List<?> prepareDestinationList(Collection<?> srcCollectionValue, Object field) { if (field == null) { return new ArrayList<>(srcCollectionValue.size()); } else { if (CollectionUtils.isList(field.getClass())) { return (List<?>)field; } else if (CollectionUtils.isArray(f...
3250434_8
static List<?> prepareDestinationList(Collection<?> srcCollectionValue, Object field) { if (field == null) { return new ArrayList<>(srcCollectionValue.size()); } else { if (CollectionUtils.isList(field.getClass())) { return (List<?>)field; } else if (CollectionUtils.isArray(f...
3250434_9
static List<?> prepareDestinationList(Collection<?> srcCollectionValue, Object field) { if (field == null) { return new ArrayList<>(srcCollectionValue.size()); } else { if (CollectionUtils.isList(field.getClass())) { return (List<?>)field; } else if (CollectionUtils.isArray(f...
3256677_0
public void createJobConf(JobConf conf, String[] args) throws IOException { log.info("Loading paths..."); String line = null; List<Path> paths = new ArrayList<Path>(); BufferedReader br = new BufferedReader( new FileReader( args[ 0 ] ) ); while( ( line = br.readLine() ) != null ) { paths.add( new Path( line ) );...
3256677_1
public void setAllowMatchByFileExtension( boolean allowMatchByFileExtension) { this.allowMatchByFileExtension = allowMatchByFileExtension; }
3263787_0
public static double tryParse(String value, double defaultValue) { try { return Double.parseDouble(value); } catch (Exception e) { return defaultValue; } }
3263787_1
public static int tryParse(String value, int defaultValue) { try { return parseInt(value); } catch (NumberFormatException e) { return defaultValue; } }
3263787_2
public LocalDate startOfCurrentReportMonth(LocalDate date) { if (date.getDayOfMonth() >= REPORTING_MONTH_START_DAY) { return new LocalDate(date.getYear(), date.getMonthOfYear(), REPORTING_MONTH_START_DAY); } if (date.getMonthOfYear() == JANUARY) { return new LocalDate(previousYear(date), DEC...
3263787_3
public LocalDate startDateOfNextReportingMonth(LocalDate date) { if (date.getDayOfMonth() < REPORTING_MONTH_START_DAY) { return new LocalDate(date.getYear(), date.getMonthOfYear(), REPORTING_MONTH_START_DAY); } if (date.getMonthOfYear() == DECEMBER) { return new LocalDate(date.plusYears(1).g...
3263787_4
public LocalDate endDateOfReportingMonthGivenStartDate(LocalDate startDate) { return startDate.plusMonths(1).minusDays(1); }
3263787_5
public LocalDate endOfCurrentReportMonth(LocalDate date) { if (date.getDayOfMonth() > REPORTING_MONTH_END_DAY) { if (date.getMonthOfYear() == DECEMBER) { return new LocalDate(nextYear(date), JANUARY, REPORTING_MONTH_END_DAY); } else { return new LocalDate(date.getYear(), next...
3263787_6
public boolean isDateWithinCurrentReportMonth(LocalDate lastReportedDate) { return areDatesBelongToSameReportingMonth(lastReportedDate, DateUtil.today()); }
3263787_7
public boolean areDatesBelongToSameReportingMonth(LocalDate date, LocalDate anotherDate) { return !(date.isBefore(startOfCurrentReportMonth(anotherDate)) || date.isAfter(endOfCurrentReportMonth(anotherDate))); }
3263787_8
public ANMDetailsFetcher detailsFetcher(List<String> roles) { if(roles.contains(PHC_USER_ROLE)) { return phcUserDetailsFetcher; } return scUserDetailsFetcher; }
3263787_9
public ANMDetailsFetcher detailsFetcher(List<String> roles) { if(roles.contains(PHC_USER_ROLE)) { return phcUserDetailsFetcher; } return scUserDetailsFetcher; }
3273720_0
public void validateCloudifyUrls(final ValidationContext validationContext) throws CloudProvisioningException { final String baseCloudifyUrl = cloud.getProvider().getCloudifyUrl(); final SystemDefaultHttpClient client = new SystemDefaultHttpClient(); if (baseCloudifyUrl.endsWith(".tar.gz") || baseCloudifyUrl.ends...
3273720_1
public void validateCloudifyUrls(final ValidationContext validationContext) throws CloudProvisioningException { final String baseCloudifyUrl = cloud.getProvider().getCloudifyUrl(); final SystemDefaultHttpClient client = new SystemDefaultHttpClient(); if (baseCloudifyUrl.endsWith(".tar.gz") || baseCloudifyUrl.ends...
3273720_2
@Override public void setDSLEntity(Object dslEntity) { this.entity = (ServiceLifecycle) dslEntity; }
3273720_3
public GroovyFileCompilationResult validateFile(final File groovyFile) { try { this.groovyShell.parse(groovyFile); return GroovyFileCompilationResult.SUCCESS; } catch (final CompilationFailedException e) { return new GroovyFileCompilationResult(false, e.getMessage(), "Failed to parse groovy file " + groovyF...
3273720_4
public GroovyFileCompilationResult validateFile(final File groovyFile) { try { this.groovyShell.parse(groovyFile); return GroovyFileCompilationResult.SUCCESS; } catch (final CompilationFailedException e) { return new GroovyFileCompilationResult(false, e.getMessage(), "Failed to parse groovy file " + groovyF...
3273720_5
public GroovyFileCompilationResult validateFile(final File groovyFile) { try { this.groovyShell.parse(groovyFile); return GroovyFileCompilationResult.SUCCESS; } catch (final CompilationFailedException e) { return new GroovyFileCompilationResult(false, e.getMessage(), "Failed to parse groovy file " + groovyF...
3273720_6
public String resolveAPIVersion() { final String sysprop = System.getProperty(CloudifyConstants.SYSTEM_PROPERTY_CLI_REST_API_VERSION); if (sysprop != null) { return sysprop; } final String platformVersion = PlatformVersion.getVersion(); return platformVersion; }
3273720_7
public String resolveOldAPIVersion() { final String sysprop = System.getProperty(CloudifyConstants.SYSTEM_PROPERTY_CLI_OLD_REST_API_VERSION); if (sysprop != null) { return sysprop; } final String platformVersion = PlatformVersion.getVersionNumber(); return platformVersion; }
3273720_8
public String resolveAPIVersion() { final String sysprop = System.getProperty(CloudifyConstants.SYSTEM_PROPERTY_CLI_REST_API_VERSION); if (sysprop != null) { return sysprop; } final String platformVersion = PlatformVersion.getVersion(); return platformVersion; }
3273720_9
public String resolveOldAPIVersion() { final String sysprop = System.getProperty(CloudifyConstants.SYSTEM_PROPERTY_CLI_OLD_REST_API_VERSION); if (sysprop != null) { return sysprop; } final String platformVersion = PlatformVersion.getVersionNumber(); return platformVersion; }
327391_10
public String extract(int start, int end) { return origBuffer.extract(map(start), map(end)); }
327472_10
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_11
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_12
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("version")) { return true; } return false; }
327472_13
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("version")) { return true; } return false; }
327472_14
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("version")) { return true; } return false; }
327472_15
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("version")) { return true; } return false; }
327472_16
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("version")) { return true; } return false; }
327472_17
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("version")) { return true; } return false; }
327472_18
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("version")) { return true; } return false; }
327472_19
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_20
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_21
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("exit")) { return true; } return false; }
327472_22
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("exit")) { return true; } return false; }
327472_23
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("exit")) { return true; } return false; }
327472_24
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("exit")) { return true; } return false; }
327472_25
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("exit")) { return true; } return false; }
327472_26
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("exit")) { return true; } return false; }
327472_27
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("exit")) { return true; } return false; }
327472_28
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_29
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_30
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_31
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("help")) { return true; } return false; }
327472_32
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("help")) { return true; } return false; }
327472_33
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("help")) { return true; } return false; }
327472_34
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("help")) { return true; } return false; }
327472_35
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("help")) { return true; } return false; }
327472_36
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("help")) { return true; } return false; }
327472_37
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("help")) { return true; } return false; }
327472_38
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_39
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_40
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_41
public static List<Command> getRegisteredDynamicCommands() throws InstantiationException, IllegalAccessException, ClassNotFoundException { final List<Command> result = new LinkedList<Command>(); final ClassFinder finder = new ClassFinder(); finder.addClassPath(); final ClassFilter filter = new AndCl...
327472_42
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("show query")) { return true; } return false; }
327472_43
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("show query")) { return true; } return false; }
327472_44
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("show query")) { return true; } return false; }
327472_45
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("show query")) { return true; } return false; }
327472_46
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("show query")) { return true; } return false; }
327472_47
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("show query")) { return true; } return false; }
327472_48
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("show query")) { return true; } return false; }
327472_49
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_50
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_51
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("reset properties")) { return true; } return false; }
327472_52
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("reset properties")) { return true; } return false; }
327472_53
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("reset properties")) { return true; } return false; }
327472_54
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("reset properties")) { return true; } return false; }
327472_55
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("reset properties")) { return true; } return false; }
327472_56
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("reset properties")) { return true; } return false; }
327472_57
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("reset properties")) { return true; } return false; }
327472_58
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().equals("reset properties")) { return true; } return false; }
327472_59
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_60
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_61
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } ...
327472_62
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_63
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_64
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_65
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_66
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_67
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_68
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_69
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_70
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_71
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_72
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_73
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_74
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() != null && state.getActiveCommand() instanceof QueryCommand) { return true; } else if (validateStatement(state, "select") || validateStatement(sta...
327472_75
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } if (state.getInput...
327472_76
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } if (state.getInput...
327472_77
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } if (state.getInput...
327472_78
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } if (state.getInput...
327472_79
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } if (state.getInput...
327472_80
@Override public void execute(final ConsoleReader reader, final PrintWriter out, final ConsoleState state) { Assertions.checkNotNull("reader", reader); Assertions.checkNotNull("out", out); Assertions.checkNotNull("state", state); if (!accept(state)) { return; } if (state.getInput...