public boolean containsIndex(String indexName) { return getIndexesResponse.getIndexNameList().contains(indexName); }
public boolean containsField(String fieldName) { return getFieldNamesResponse.getFieldNameList().contains(fieldName); }
/** * Returns the dependencies. */ public ImmutableList<ProtoFile> getDependencies() { ImmutableList.Builder<ProtoFile> builder = ImmutableList.builder(); for (ProtoFile file : model.getFiles()) { if (proto.getDependencyList().contains(file.getSimpleName())) { builder.add(file); } } return builder.build(); }
/** * Returns the dependencies. */ public ImmutableList<ProtoFile> getDependencies() { ImmutableList.Builder<ProtoFile> builder = ImmutableList.builder(); for (ProtoFile file : model.getFiles()) { if (proto.getDependencyList().contains(file.getSimpleName())) { builder.add(file); } } return builder.build(); }
@Override public Stream<PluginProtos.CodeGeneratorResponse.File> generate(PluginProtos.CodeGeneratorRequest request) throws GeneratorException { final ProtoTypeMap typeMap = ProtoTypeMap.of(request.getProtoFileList()); List<FileDescriptorProto> protosToGenerate = request.getProtoFileList().stream() .filter(protoFile -> request.getFileToGenerateList().contains(protoFile.getName())) .collect(Collectors.toList()); List<ServiceContext> services = findServices(protosToGenerate, typeMap); List<PluginProtos.CodeGeneratorResponse.File> files = generateFiles(services); return files.stream(); }
@Override public List<UnitConfig> getUnitGroupConfigsByUnitConfig(final UnitConfig unitConfig) throws CouldNotPerformException { validateData(); List<UnitConfig> unitConfigList = new ArrayList<>(); for (UnitConfig unitGroupUnitConfig : unitGroupUnitConfigRemoteRegistry.getMessages()) { if (unitGroupUnitConfig.getUnitGroupConfig().getMemberIdList().contains(unitConfig.getId())) { unitConfigList.add(unitGroupUnitConfig); } } return unitConfigList; }
/** * {@inheritDoc} * * @param unitConfig * @return * @throws CouldNotPerformException */ @Override public List<UnitConfig> getUnitGroupConfigsByUnitConfig(final UnitConfig unitConfig) throws CouldNotPerformException { List<UnitConfig> unitConfigList = new ArrayList<>(); for (UnitConfig unitGroupUnitConfig : unitGroupUnitConfigRegistry.getMessages()) { if (unitGroupUnitConfig.getUnitGroupConfig().getMemberIdList().contains(unitConfig.getId())) { unitConfigList.add(unitGroupUnitConfig); } } return unitConfigList; }
@Override public List<PluginProtos.CodeGeneratorResponse.File> generateFiles(PluginProtos.CodeGeneratorRequest request) throws GeneratorException { final ProtoTypeMap protoTypeMap = ProtoTypeMap.of(request.getProtoFileList()); List<PluginProtos.CodeGeneratorResponse.File> files = new ArrayList<>(); for (DescriptorProtos.FileDescriptorProto protoFile : request.getProtoFileList()) { if (request.getFileToGenerateList().contains(protoFile.getName())) { for (ServiceContext ctx : extractContext(protoTypeMap, protoFile)) { files.add(buildFile(ctx)); } } } return files; }
@Override public List<PluginProtos.CodeGeneratorResponse.File> generateFiles(PluginProtos.CodeGeneratorRequest request) throws GeneratorException { final ProtoTypeMap protoTypeMap = ProtoTypeMap.of(request.getProtoFileList()); List<PluginProtos.CodeGeneratorResponse.File> files = new ArrayList<>(); for (DescriptorProtos.FileDescriptorProto protoFile : request.getProtoFileList()) { if (request.getFileToGenerateList().contains(protoFile.getName())) { for (ServiceContext ctx : extractContext(protoTypeMap, protoFile)) { files.add(buildFile(ctx)); } } } return files; }
@Override public List<UnitConfig> getNeighborLocations(String locationId) throws CouldNotPerformException { UnitConfig locationUnitConfig = getLocationConfigById(locationId); if (locationUnitConfig.getLocationConfig().getType() != LocationConfig.LocationType.TILE) { throw new CouldNotPerformException("Id[" + locationId + "] does not belong to a tile and therefore its neighbors aren't defined!"); } Map<String, UnitConfig> neighborMap = new HashMap<>(); for (UnitConfig connectionConfig : getConnectionConfigs()) { if (connectionConfig.getConnectionConfig().getTileIdList().contains(locationId)) { for (String id : connectionConfig.getConnectionConfig().getTileIdList()) { if (id.equals(locationId)) { continue; } neighborMap.put(id, getLocationConfigById(id)); } } } return new ArrayList<>(neighborMap.values()); }
private static UCFG deserializeUcfg(FileInputStream fis) throws IOException { String methodId = ""; try { Ucfg.UCFG ucfg = Ucfg.UCFG.parseFrom(fis); methodId = ucfg.getMethodId(); UCFGBuilder builder = UCFGBuilder.createUCFGForMethod(methodId).at(fromProtobuf(ucfg.getLocation())); ucfg.getParametersList().forEach(pId -> builder.addMethodParam(UCFGBuilder.variableWithId(pId))); Map<String, UCFGBuilder.BlockBuilder> blockById = ucfg.getBasicBlocksList().stream().collect(Collectors.toMap(Ucfg.BasicBlock::getId, UCFGtoProtobuf::fromProtobuf)); for (Map.Entry<String, UCFGBuilder.BlockBuilder> entry : blockById.entrySet()) { if (ucfg.getEntriesList().contains(entry.getKey())) { builder.addStartingBlock(entry.getValue()); } else { builder.addBasicBlock(entry.getValue()); } } return builder.build(); } catch (Exception e) { throw new IllegalStateException("An error occured while deserializing UCFG for method "+methodId, e); } }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} */ @Override public List<UnitConfig> getNeighborLocations(String locationId) throws CouldNotPerformException { UnitConfig locationConfig = getLocationConfigById(locationId); if (locationConfig.getLocationConfig().getType() != LocationConfig.LocationType.TILE) { throw new CouldNotPerformException("Id[" + locationId + "] does not belong to a tile and therefore its neighbors aren't defined!"); } Map<String, UnitConfig> neighborMap = new HashMap<>(); for (UnitConfig connectionConfig : getConnectionConfigs()) { if (connectionConfig.getConnectionConfig().getTileIdList().contains(locationId)) { for (String id : connectionConfig.getConnectionConfig().getTileIdList()) { if (id.equals(locationId)) { continue; } neighborMap.put(id, getLocationConfigById(id)); } } } return new ArrayList<>(neighborMap.values()); }
/** * Method collects all connections between this and the given location and returns those instances. * * @param locationID the location id of the location to check. * @param waitForData flag defines if the method should block until all needed instances are available. * @return a collection of unit connection remotes. * @throws CouldNotPerformException is thrown if the check could not be performed e.g. if some data is not available yet. */ public List<ConnectionRemote> getDirectConnectionList(final String locationID, final boolean waitForData) throws CouldNotPerformException { if (!getConfig().getLocationConfig().getType().equals(LocationType.TILE)) { throw new CouldNotPerformException("Location is not a Tile!"); } List<ConnectionRemote> connectionList = new ArrayList<>(); try { for (UnitConfig connectionUnitConfig : Registries.getLocationRegistry().getConnectionConfigs()) { ConnectionRemote connection = Units.getUnit(connectionUnitConfig, waitForData, CONNECTION); if (connectionUnitConfig.getConnectionConfig().getTileIdList().contains(getId()) && connectionUnitConfig.getConnectionConfig().getTileIdList().contains(locationID)) { connectionList.add(connection); } } } catch (InterruptedException ex) { throw new CouldNotPerformException("Could not get all connections!", ex); } return connectionList; }
public List<ConnectionRemote> getConnectionList(final boolean waitForData) throws CouldNotPerformException { if (!getConfig().getLocationConfig().getType().equals(LocationType.TILE)) { throw new CouldNotPerformException("Location is not a Tile!"); } List<ConnectionRemote> connectionList = new ArrayList<>(); try { for (UnitConfig connectionUnitConfig : CachedLocationRegistryRemote.getRegistry().getConnectionConfigs()) { ConnectionRemote connection = Units.getUnit(connectionUnitConfig, waitForData, CONNECTION); if (connection.getConfig().getConnectionConfig().getTileIdList().contains(getId())) { connectionList.add(connection); } } } catch (InterruptedException ex) { throw new CouldNotPerformException("Could not get all connections!", ex); } return connectionList; }
if (groupMembers.contains(userId) && permitted(entry.getPermission(), type)) { return true;
if (!tileConfig.getConnectionIdList().contains(connectionId)) { modification = true; break;
boolean replicaAdded = false; for (String missingReplica : missingReplicas) { if (existingUrLedgerFormat.getReplicaList().contains(missingReplica)) { continue; } else {
if (!authorizationGroup.getMemberIdList().contains(adminConfig.getId())) { authorizationGroup.addMemberId(adminConfig.getId()); authorizationGroupConfigRegistry.update(adminGroupConfig.build());
static void mergeVariants(Builder destVariant, Variant srcVariant) { // Merge alternates preserving the order of pre-existing alts in the destination. for (String srcAlt : srcVariant.getAlternateBasesList()) { if (!destVariant.getAlternateBasesList().contains(srcAlt)) { destVariant.addAlternateBases(srcAlt); } } // Re-number genotypes and merge calls. for (VariantCall call : srcVariant.getCallsList()) { VariantCall.Builder updatedCall = VariantCall.newBuilder(call); for (int i = 0; i < call.getGenotypeCount(); i++) { if (0 < call.getGenotype(i)) { int updatedGenotype = destVariant.getAlternateBasesList().indexOf( srcVariant.getAlternateBasesList().get(call.getGenotype(i) - 1)) + 1; updatedCall.setGenotype(i, updatedGenotype); } } destVariant.addCalls(updatedCall); } } }
if (!authorizationGroup.getMemberIdList().contains(userId)) { authorizationGroup.addMemberId(userId); authorizationGroupConfigRegistry.update(bcoGroupConfig.build());