syncs your project with the array you send (terms that are not found in the JSON object will be deleted from
project and the new ones added).

@param projectId id of the project
@param terms list of terms
@return TermsDetails
332949
public TermsDetails syncTerms(String projectId, List<Term> terms){
        String jsonTerms = new Gson().toJson(terms);
        EditTermsResponse response = service.syncTerms(Action.SYNC_TERMS, apiKey, projectId, jsonTerms);
        ApiUtils.checkResponse(response.response);
        return response.details;
    }
192948
public Map<Integer, String> listProjects() throws MPXJException
   {
      try
      {
         Map<Integer, String> result = new HashMap<Integer, String>();

         List<Row> rows = getRows("select proj_id, proj_short_name from " + m_schema + "project where delete_date is null");
         for (Row row : rows)
         {
            Integer id = row.getInteger("proj_id");
            String name = row.getString("proj_short_name");
            result.put(id, name);
         }

         return result;
      }

      catch (SQLException ex)
      {
         throw new MPXJException(MPXJException.READ_ERROR, ex);
      }
   }
566589
@Override
	public boolean addAll(Collection<? extends BooleanTerm> terms) {
		boolean modified = false;
		// a null booleanTerms means that the expression is
		// already true, so no need to modify it
		if (terms == null) {
			modified = booleanTerms != null;
			booleanTerms = null;
		} else if (booleanTerms != null) {
			for (BooleanTerm term : terms) {
				modified |= add(term);
			}
		}
		return modified;
	}
1112874
public static String getProjectId(String sessionId, AzkabanProjectConfig azkabanProjectConfig)
      throws IOException {
    log.info("Getting project Id for project: " + azkabanProjectConfig.getAzkabanProjectName());
    String projectId = AzkabanAjaxAPIClient.getProjectId(sessionId, azkabanProjectConfig);
    log.info("Project id: " + projectId);

    return projectId;
  }
317280
protected Set<Scope> updateProjectInformation(Collector collector) {
        long projectDataStart = System.currentTimeMillis();
        //Add or update teams that we got from api
        Set<Scope> projects = jiraClient.getProjects();

        projects.forEach(jiraScope -> {
            LOGGER.info(String.format("Adding :%s-%s", jiraScope.getpId(), jiraScope.getName()));
            jiraScope.setCollectorId(collector.getId());
            Scope existing = projectRepository.findByCollectorIdAndPId(collector.getId(), jiraScope.getpId());
            if (existing == null) {
                projectRepository.save(jiraScope);
            } else {
                jiraScope.setId(existing.getId());
                projectRepository.save(jiraScope);
            }
        });
        log("Project Data Collected", projectDataStart, projects.size());

        // Delete the ones that are gone from JIRA
        List<Scope> existingProjects = projectRepository.findByCollectorId(collector.getId());
        Set<String> newProjectIds = projects.stream().map(Scope::getpId).collect(Collectors.toSet());
        Set<Scope> toDelete = existingProjects.stream().filter(e -> !newProjectIds.contains(e.getpId())).collect(Collectors.toSet());
        if (!CollectionUtils.isEmpty(toDelete)) {
            toDelete.forEach(td -> {
                LOGGER.info(String.format("Deleting :%s-%s", td.getpId(), td.getName()));
            });
            projectRepository.delete(toDelete);
            log( "Project Data Collected. Deleted ", projectDataStart, toDelete.size());
        }
        return projects;
    }
86006
def _sync_projects(self, projects_json):
        """""""
        for project_json in projects_json:
            project_id = project_json['id']
            self.projects[project_id] = Project(project_json, self)
554669
@RequestMapping(value = "project/{projectId}/builds/diff", method = RequestMethod.GET)
    public Resources<Action> buildDiffActions(@PathVariable ID projectId) {
        return Resources.of(
                extensionManager.getExtensions(BuildDiffExtension.class)
                        .stream()
                        .filter(extension -> extension.apply(structureService.getProject(projectId)))
                        .map(this::resolveExtensionAction)
                        .collect(Collectors.toList()),
                uri(on(getClass()).buildDiffActions(projectId))
        );
    }
813913
protected CmsFileTable getProjectFiles(CmsUUID projectId) {

        final CmsFileTable fileTable = new CmsFileTable(null);
        fileTable.applyWorkplaceAppSettings();
        fileTable.setContextProvider(new I_CmsContextProvider() {

            /**
             * @see org.opencms.ui.apps.I_CmsContextProvider#getDialogContext()
             */
            public I_CmsDialogContext getDialogContext() {

                CmsFileTableDialogContext context = new CmsFileTableDialogContext(
                    CmsProjectManagerConfiguration.APP_ID,
                    ContextType.fileTable,
                    fileTable,
                    fileTable.getSelectedResources());
                context.setEditableProperties(CmsFileExplorer.INLINE_EDIT_PROPERTIES);
                return context;
            }
        });
        CmsObject cms = A_CmsUI.getCmsObject();
        List<CmsResource> childResources;
        try {
            childResources = cms.readProjectView(projectId, CmsResource.STATE_KEEP);
            fileTable.fillTable(cms, childResources);
        } catch (CmsException e) {
            CmsErrorDialog.showErrorDialog(
                CmsVaadinUtils.getMessageText(Messages.ERR_PROJECTS_CAN_NOT_DISPLAY_FILES_0),
                e);
        }
        return fileTable;
    }
1223602
public boolean projectExists(String name) throws IllegalArgumentException {
        if (name == null || name.isEmpty()) {
            throw new IllegalArgumentException("Project name cannot be empty");
        }
        return listProjects().stream()
            .map(p -> p.getMetadata().getName())
            .anyMatch(Predicate.isEqual(name));
    }
120913
@Override
  public List<Integer> getRunningFlows(final int projectId, final String flowId) {
    final List<Integer> executionIds = new ArrayList<>();
    try {
      executionIds.addAll(getRunningFlowsHelper(projectId, flowId,
          this.executorLoader.fetchUnfinishedFlows().values()));
    } catch (final ExecutorManagerException e) {
      logger.error("Failed to get running flows for project " + projectId + ", flow "
          + flowId, e);
    }
    return executionIds;
  }
1006069
public CollectionRequest<Section> findByProject(String project) {
    
        String path = String.format("/projects/%s/sections", project);
        return new CollectionRequest<Section>(this, Section.class, path, "GET");
    }
802215
@Override
  protected TermsByQueryResponse newResponse(TermsByQueryRequest request, AtomicReferenceArray shardsResponses, ClusterState clusterState) {
    int successfulShards = 0;
    int failedShards = 0;
    int numTerms = 0;
    TermsSet[] termsSets = new TermsSet[shardsResponses.length()];
    List<ShardOperationFailedException> shardFailures = null;

    // we check each shard response
    for (int i = 0; i < shardsResponses.length(); i++) {
      Object shardResponse = shardsResponses.get(i);
      if (shardResponse == null) {
        // simply ignore non active shards
      } else if (shardResponse instanceof BroadcastShardOperationFailedException) {
        failedShards++;
        if (shardFailures == null) {
          shardFailures = new ArrayList<>();
        }
        logger.error("Shard operation failed", (BroadcastShardOperationFailedException) shardResponse);
        shardFailures.add(new DefaultShardOperationFailedException((BroadcastShardOperationFailedException) shardResponse));
      } else {
        // on successful shard response, just add to the array or responses so we can process them below
        // we calculate the total number of terms gathered across each shard so we can use it during
        // initialization of the final TermsResponse below (to avoid rehashing during merging)
        TermsByQueryShardResponse shardResp = ((TermsByQueryShardResponse) shardResponse);
        TermsSet terms = shardResp.getTerms();
        termsSets[i] = terms;
        numTerms += terms.size();
        successfulShards++;
      }
    }

    // Merge the responses

    try {
      // NumericTermsSet is responsible for the merge, set size to avoid rehashing on certain implementations.
      long expectedElements = request.expectedTerms() != null ? request.expectedTerms() : numTerms;
      TermsSet termsSet = TermsSet.newTermsSet(expectedElements, request.termsEncoding(), breakerService.getBreaker(CircuitBreaker.REQUEST));

      TermsByQueryResponse rsp;
      try {
        for (int i = 0; i < termsSets.length; i++) {
          TermsSet terms = termsSets[i];
          if (terms != null) {
            termsSet.merge(terms);
            terms.release(); // release the shard terms set and adjust the circuit breaker
            termsSets[i] = null;
          }
        }

        long tookInMillis = System.currentTimeMillis() - request.nowInMillis();

        rsp = new TermsByQueryResponse(termsSet, tookInMillis, shardsResponses.length(), successfulShards, failedShards, shardFailures);
      }
      finally {
        // we can now release the terms set and adjust the circuit breaker, since the TermsByQueryResponse holds an
        // encoded version of the terms set
        termsSet.release();
      }

      return rsp;
    }
    finally { // If something happens, release the terms sets and adjust the circuit breaker
      for (int i = 0; i < termsSets.length; i++) {
        TermsSet terms = termsSets[i];
        if (terms != null) {
          terms.release();
        }
      }
    }
  }
112844
static DeleteGlossaryResponse deleteGlossary(String projectId, String location, String name) {
    try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {

      GlossaryName glossaryName =
          GlossaryName.newBuilder()
              .setProject(projectId)
              .setLocation(location)
              .setGlossary(name)
              .build();

      // Call the API
      DeleteGlossaryResponse response =
          translationServiceClient
              .deleteGlossaryAsync(glossaryName.toString())
              .get(300, TimeUnit.SECONDS);

      System.out.format("Deleted: %s\n", response.getName());
      return response;
    } catch (Exception e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
889428
public Observable<ServiceResponse<List<Iteration>>> getIterationsWithServiceResponseAsync(UUID projectId) {
        if (projectId == null) {
            throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
        }
        if (this.client.apiKey() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
        }
        return service.getIterations(projectId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<Iteration>>>>() {
                @Override
                public Observable<ServiceResponse<List<Iteration>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<List<Iteration>> clientResponse = getIterationsDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
844868
public List<GitlabBadge> getProjectBadges(Serializable projectId) throws IOException {
        String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBadge.URL;
        return Arrays.asList(retrieve().to(tailUrl, GitlabBadge[].class));
    }
1255293
public static String getProjectId(String sessionId, AzkabanProjectConfig azkabanProjectConfig) throws IOException {
    // Note: Every get call to Azkaban provides a projectId in response, so we have are using fetchProjectFlows call
    // .. because it does not need any additional params other than project name
    Map<String, String> params = Maps.newHashMap();
    params.put("ajax", "fetchprojectflows");
    params.put("project", azkabanProjectConfig.getAzkabanProjectName());

    return executeGetRequest(prepareGetRequest(azkabanProjectConfig.getAzkabanServerUrl() + "/manager",
        sessionId, params)).get("projectId");
  }
921710
public ProjectSubscriptionName deleteSubscription(String subscriptionId) throws Exception {
    // [START pubsub_delete_subscription]
    try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
      ProjectSubscriptionName subscriptionName =
          ProjectSubscriptionName.of(projectId, subscriptionId);
      subscriptionAdminClient.deleteSubscription(subscriptionName);
      return subscriptionName;
    }
    // [END pubsub_delete_subscription]
  }