Java Code Examples for com.google.common.collect.ImmutableMultimap#containsKey()
The following examples show how to use
com.google.common.collect.ImmutableMultimap#containsKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Actions.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
public String blame(XmlDocument xmlDocument) throws IOException, SAXException, ParserConfigurationException { ImmutableMultimap<Integer, Record> resultingSourceMapping = getResultingSourceMapping(xmlDocument); LineReader lineReader = new LineReader( new StringReader(xmlDocument.prettyPrint())); StringBuilder actualMappings = new StringBuilder(); String line; int count = 1; while ((line = lineReader.readLine()) != null) { actualMappings.append(count).append(line).append("\n"); if (resultingSourceMapping.containsKey(count)) { for (Record record : resultingSourceMapping.get(count)) { actualMappings.append(count).append("-->") .append(record.getActionLocation().toString()) .append("\n"); } } count++; } return actualMappings.toString(); }
Example 2
Source File: Actions.java From javaide with GNU General Public License v3.0 | 6 votes |
public String blame(XmlDocument xmlDocument) throws IOException, SAXException, ParserConfigurationException { ImmutableMultimap<Integer, Record> resultingSourceMapping = getResultingSourceMapping(xmlDocument); LineReader lineReader = new LineReader( new StringReader(xmlDocument.prettyPrint())); StringBuilder actualMappings = new StringBuilder(); String line; int count = 0; while ((line = lineReader.readLine()) != null) { actualMappings.append(count + 1).append(line).append("\n"); if (resultingSourceMapping.containsKey(count)) { for (Record record : resultingSourceMapping.get(count)) { actualMappings.append(count + 1).append("-->") .append(record.getActionLocation().toString()) .append("\n"); } } count++; } return actualMappings.toString(); }
Example 3
Source File: Actions.java From buck with Apache License 2.0 | 6 votes |
@NonNull public String blame(@NonNull XmlDocument xmlDocument) throws IOException, SAXException, ParserConfigurationException { ImmutableMultimap<Integer, Record> resultingSourceMapping = getResultingSourceMapping(xmlDocument); LineReader lineReader = new LineReader( new StringReader(xmlDocument.prettyPrint())); StringBuilder actualMappings = new StringBuilder(); String line; int count = 0; while ((line = lineReader.readLine()) != null) { actualMappings.append(count + 1).append(line).append("\n"); if (resultingSourceMapping.containsKey(count)) { for (Record record : resultingSourceMapping.get(count)) { actualMappings.append(count + 1).append("-->") .append(record.getActionLocation().toString()) .append("\n"); } } count++; } return actualMappings.toString(); }
Example 4
Source File: BackupTask.java From timbuctoo with GNU General Public License v3.0 | 6 votes |
@Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception { if (!parameters.containsKey(BACKUP_PATH)) { output.println("Please provide a \"" + BACKUP_PATH + "\""); output.flush(); return; } for (DataSet dataSet : dataSetRepository.getDataSets()) { try { dataSet.backupDatabases(parameters.get(BACKUP_PATH).iterator().next()); LOG.info("backup dataset: {}", dataSet.getMetadata().getCombinedId()); output.println("backup dataset: " + dataSet.getMetadata().getCombinedId()); output.flush(); } catch (Throwable t) { LOG.error("sync of {} failed", dataSet.getMetadata().getCombinedId()); output.println("sync of '" + dataSet.getMetadata().getCombinedId() + "' failed"); output.flush(); LOG.error("Exception thrown", t); } } LOG.info("backup complete"); output.println("backup complete"); output.flush(); }
Example 5
Source File: BdbDumpTask.java From timbuctoo with GNU General Public License v3.0 | 6 votes |
@Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception { if (!parameters.keySet().containsAll(REQUIRED_PARAMS)) { output.write("Make sure you provide the following parameters: " + REQUIRED_PARAMS); return; } BdbWrapper<String, String> database = environmentCreator.getDatabase( getParam(parameters, OWNER), getParam(parameters, DATA_SET), getParam(parameters, DATABASE), true, STRING_BINDER, STRING_BINDER, new StringStringIsCleanHandler() ); String prefix = parameters.containsKey("prefix") ? getParam(parameters, "prefix") : ""; int start = parameters.containsKey("start") ? Integer.parseInt(getParam(parameters, "start")) : 0; int count = parameters.containsKey("count") ? Integer.parseInt(getParam(parameters, "count")) : 10; output.write("uncommitted data: " + database.dump(prefix, start, count, LockMode.READ_UNCOMMITTED)); output.write("committed data: " + database.dump(prefix, start, count, LockMode.READ_COMMITTED)); }
Example 6
Source File: HUsToPickViewBasedProcess.java From metasfresh-webui-api-legacy with GNU General Public License v3.0 | 5 votes |
private boolean huRowReservationMatchesPackageableRow(@NonNull final HUEditorRow huRow) { final Optional<OrderLineId> orderLineId = Optional .ofNullable(getSingleSelectedPackageableRowOrNull()) .flatMap(PackageableRow::getSalesOrderLineId); final ImmutableMultimap<OrderLineId, HUEditorRow> // includedOrderLineReservations = huRow.getIncludedOrderLineReservations(); if (orderLineId.isPresent()) { final int numberOfOrderLineIds = includedOrderLineReservations.keySet().size(); final boolean reservedForMoreThanOneOrderLine = numberOfOrderLineIds > 1; if (reservedForMoreThanOneOrderLine) { return false; } else if (numberOfOrderLineIds == 1) { final boolean reservedForDifferentOrderLine = !includedOrderLineReservations.containsKey(orderLineId.get()); if (reservedForDifferentOrderLine) { return false; } } } else { final boolean rowHasHuWithReservation = !includedOrderLineReservations.isEmpty(); if (rowHasHuWithReservation) { return false; } } return true; }
Example 7
Source File: ReloadDataSet.java From timbuctoo with GNU General Public License v3.0 | 5 votes |
@Override public void execute(ImmutableMultimap<String, String> immutableMultimap, PrintWriter printWriter) throws Exception { if (immutableMultimap.containsKey(DATA_SET_ID_PARAM)) { final String dataSetId = immutableMultimap.get(DATA_SET_ID_PARAM).iterator().next(); dataSetRepository.reloadDataSet(dataSetId); } else { printWriter.println( String.format("Make sure your request contains the param '%s'", DATA_SET_ID_PARAM) ); } }
Example 8
Source File: StopBdbDataStore.java From timbuctoo with GNU General Public License v3.0 | 5 votes |
@Override public void execute(ImmutableMultimap<String, String> immutableMultimap, PrintWriter printWriter) throws Exception { if (immutableMultimap.containsKey(DATA_SET_ID_PARAM) && immutableMultimap.containsKey(DATA_STORE_PARAM)) { final String dataSetId = immutableMultimap.get(DATA_SET_ID_PARAM).iterator().next(); final String dataStore = immutableMultimap.get(DATA_STORE_PARAM).iterator().next(); final Tuple<String, String> ownerDataSet = DataSetMetaData.splitCombinedId(dataSetId); environmentCreator.closeDatabase(ownerDataSet.getLeft(), ownerDataSet.getRight(), dataStore); } else { printWriter.println( String.format("Make sure your request contains the params '%s' and '%s'", DATA_SET_ID_PARAM, DATA_STORE_PARAM) ); } }
Example 9
Source File: DatabaseValidationTask.java From timbuctoo with GNU General Public License v3.0 | 5 votes |
@Override public synchronized void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception { long curTime = clock.millis(); timeOut = 5000; if (parameters.containsKey("force") || curTime - lastExecutionTime > timeOut) { writeResult(databaseValidator.check(), output); lastExecutionTime = clock.millis(); } else { output.write("Still in cooling off period. Use force to override"); } }