code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
public Agent fetchAgentFromDBByUUIDIncludingDeleted(final String uuid) { List<String> uuids = List.of(uuid); AgentMutex mutex = agentMutexes.acquire(uuids); synchronized (mutex) { Agent agent = (Agent) transactionTemplate.execute(transactionStatus -> { Query query = s...
Understands persisting and retrieving agent uuid-cookie mapping
fetchAgentFromDBByUUIDIncludingDeleted
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
public void saveOrUpdate(Agent agent) { final String key = agentCacheKey(agent.getUuid()); updateAgentIdFromDBIfAgentDoesNotHaveAnIdAndAgentExistInDB(agent); List<String> uuids = List.of(agent.getUuid()); AgentMutex mutex = agentMutexes.acquire(uuids); synchronized (mutex) { ...
Understands persisting and retrieving agent uuid-cookie mapping
saveOrUpdate
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { registerAfterCommitCallback(() -> clearCacheAndNotifyAgentEntityChangeListeners(key, agent)); sessionFactory.getCurrentSession().saveOrUpdate(agent); }
Understands persisting and retrieving agent uuid-cookie mapping
doInTransactionWithoutResult
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private void clearCacheAndNotifyAgentEntityChangeListeners(String cachKey, Agent agent) { cache.remove(cachKey); notifyAgentEntityChangeListeners(agent); }
Understands persisting and retrieving agent uuid-cookie mapping
clearCacheAndNotifyAgentEntityChangeListeners
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private void notifyAgentEntityChangeListeners(Agent agent) { agentEntityChangeListenerSet.forEach(listener -> listener.entityChanged(agent)); }
Understands persisting and retrieving agent uuid-cookie mapping
notifyAgentEntityChangeListeners
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private void notifyBulkAgentEntityChangeListeners(List<String> uuids) { agentEntityChangeListenerSet.forEach(listener -> { List<Agent> changedAgents = getAgentsByUUIDs(uuids); listener.bulkEntitiesChanged(changedAgents); }); }
Understands persisting and retrieving agent uuid-cookie mapping
notifyBulkAgentEntityChangeListeners
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
public void updateAgentIdFromDBIfAgentDoesNotHaveAnIdAndAgentExistInDB(Agent agent) { Long idFromDB = (Long) getHibernateTemplate().execute(session -> { Query query = session.createQuery("select id from Agent where uuid = :uuid"); query.setString("uuid", agent.getUuid()); ret...
Understands persisting and retrieving agent uuid-cookie mapping
updateAgentIdFromDBIfAgentDoesNotHaveAnIdAndAgentExistInDB
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
public void disableAgents(final List<String> uuids) { AgentMutex mutex = agentMutexes.acquire(uuids); synchronized (mutex) { transactionTemplate.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionS...
Understands persisting and retrieving agent uuid-cookie mapping
disableAgents
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { String queryString = format("update Agent set disabled = :disabled where uuid in (:uuids)"); Query query = sessionFactory.getCurrentSession().createQuery(queryString); ...
Understands persisting and retrieving agent uuid-cookie mapping
doInTransactionWithoutResult
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
public void bulkUpdateAgents(List<Agent> agents) { List<String> uuids = agents.stream().map(agent -> agent.getUuid()).collect(toList()); AgentMutex mutex = agentMutexes.acquire(uuids); synchronized (mutex) { transactionTemplate.execute(new TransactionCallbackWithoutResult() { ...
Understands persisting and retrieving agent uuid-cookie mapping
bulkUpdateAgents
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { agents.forEach(agent -> sessionFactory.getCurrentSession().saveOrUpdate(Agent.class.getName(), agent)); List<String> uuids = agents.stream().map(Agent::getUuid).collect(toList()); ...
Understands persisting and retrieving agent uuid-cookie mapping
doInTransactionWithoutResult
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
public void bulkSoftDelete(List<String> uuids) { AgentMutex mutex = agentMutexes.acquire(uuids); synchronized (mutex) { transactionTemplate.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus...
Understands persisting and retrieving agent uuid-cookie mapping
bulkSoftDelete
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { String queryString = format("update Agent set deleted = true where uuid in (:uuids)"); Query query = sessionFactory.getCurrentSession().createQuery(queryString); ...
Understands persisting and retrieving agent uuid-cookie mapping
doInTransactionWithoutResult
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private synchronized void clearCacheAndNotifyBulkAgentEntityChangeListeners(List<String> uuids) { uuids.stream().map(this::agentCacheKey).forEach(cache::remove); notifyBulkAgentEntityChangeListeners(uuids); }
Understands persisting and retrieving agent uuid-cookie mapping
clearCacheAndNotifyBulkAgentEntityChangeListeners
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private synchronized void clearCacheAndNotifyBulkAgentEntityDeleteListeners(List<String> uuids) { uuids.stream().map(this::agentCacheKey).forEach(cache::remove); notifyBulkAgentEntityDeleteListeners(uuids); }
Understands persisting and retrieving agent uuid-cookie mapping
clearCacheAndNotifyBulkAgentEntityDeleteListeners
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private void notifyBulkAgentEntityDeleteListeners(List<String> uuids) { agentEntityChangeListenerSet.forEach(listener -> listener.bulkEntitiesDeleted(uuids)); }
Understands persisting and retrieving agent uuid-cookie mapping
notifyBulkAgentEntityDeleteListeners
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private void registerAfterCommitCallback(Runnable runnable) { synchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { runnable.run(); } }); }
Understands persisting and retrieving agent uuid-cookie mapping
registerAfterCommitCallback
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
@Override public void afterCommit() { runnable.run(); }
Understands persisting and retrieving agent uuid-cookie mapping
afterCommit
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
@TestOnly public void clearListeners() { this.agentEntityChangeListenerSet.clear(); }
Understands persisting and retrieving agent uuid-cookie mapping
clearListeners
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
@Override public String toString() { return "AgentMutexes ( uuidToMutexMap=" + uuidToMutexMap + " )"; }
Understands persisting and retrieving agent uuid-cookie mapping
toString
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
public synchronized void release(List<String> uuids, AgentMutex mutex) { mutex.setUsedByCount(mutex.getUsedByCount() - 1); if (mutex.getUsedByCount() <= 0) { uuids.forEach(uuidToMutexMap::remove); uuidToMutexMap.entrySet().removeIf(entry -> entry.getValue().equals(mutex)); ...
Understands persisting and retrieving agent uuid-cookie mapping
release
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
public synchronized AgentMutex acquire(List<String> uuids) { return uuids.stream() .filter(uuidToMutexMap::containsKey) .map(this::getExistingMutexWithIncrementedUsedByCount) .findAny() .orElseGet(() -> createNewMutex(uuids)); }
Understands persisting and retrieving agent uuid-cookie mapping
acquire
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private AgentMutex createNewMutex(List<String> uuids) { String mutexId = "Mutex-" + new UuidGenerator().randomUuid(); AgentMutex mutex = new AgentMutex(mutexId, 1); uuids.forEach(uuid -> uuidToMutexMap.putIfAbsent(uuid, mutex)); return mutex; }
Understands persisting and retrieving agent uuid-cookie mapping
createNewMutex
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
private AgentMutex getExistingMutexWithIncrementedUsedByCount(String uuid) { AgentMutex mutex = uuidToMutexMap.get(uuid); mutex.setUsedByCount(mutex.getUsedByCount() + 1); return mutex; }
Understands persisting and retrieving agent uuid-cookie mapping
getExistingMutexWithIncrementedUsedByCount
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
@Override public synchronized String toString() { return "Agent Mutex { id=[" + id + "]" + ", usedByCount=[" + usedByCount + "] }"; }
Understands persisting and retrieving agent uuid-cookie mapping
toString
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/AgentDao.java
Apache-2.0
public void save(ArtifactPlan artifactPlan) { if (artifactPlan != null) { getHibernateTemplate().save(artifactPlan); } }
Understands persisting and retrieving artifact plan
save
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/ArtifactPlanRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/ArtifactPlanRepository.java
Apache-2.0
@SuppressWarnings("unchecked") public List<ArtifactPlan> findByBuildId(long buildId) { return (List<ArtifactPlan>) getHibernateTemplate().find(GET_ARTIFACT_PLANS_BY_BUILD_ID, buildId); }
Understands persisting and retrieving artifact plan
findByBuildId
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/ArtifactPlanRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/ArtifactPlanRepository.java
Apache-2.0
public ArtifactPlan saveCopyOf(long jobId, ArtifactPlan artifactPlan) { ArtifactPlan copyOfArtifactPlan = new ArtifactPlan(artifactPlan); copyOfArtifactPlan.setBuildId(jobId); save(copyOfArtifactPlan); return copyOfArtifactPlan; }
Understands persisting and retrieving artifact plan
saveCopyOf
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/ArtifactPlanRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/ArtifactPlanRepository.java
Apache-2.0
@SuppressWarnings("unchecked") public List<Modification> getModificationsForPipelineRange(final String pipelineName, final Integer fromCounter, final Integer toCounter) { return (Lis...
Understands how to store and retrieve Materials from the database
getModificationsForPipelineRange
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private List<Long> fromInclusiveModificationsForPipelineRange(Session session, String pipelineName, Integer fromCounter, I...
Understands how to store and retrieve Materials from the database
fromInclusiveModificationsForPipelineRange
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public Map<Long, List<ModificationForPipeline>> findModificationsForPipelineIds(final List<Long> pipelineIds) { final int MODIFICATION = 0; final int RELEVANT_PIPELINE_ID = 1; final int RELEVANT_PIPELINE_NAME = 2; final int MATERIAL_TYPE = 3; final int MATERIAL_FINGERPRINT = 4; ...
Understands how to store and retrieve Materials from the database
findModificationsForPipelineIds
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private Map<PipelineId, Set<Long>> relevantToLookedUpDependencyMap(Session session, List<Long> pipelineIds) { final int LOOKED_UP_PIPELINE_ID = 2; final int RELEVANT_PIPELINE_ID = 0; final int RELEVANT_PIPELINE_NAME = 1; String pipelineIdsSql = queryExtensions.queryRelevantToLookedUpDep...
Understands how to store and retrieve Materials from the database
relevantToLookedUpDependencyMap
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public MaterialRevisions findMaterialRevisionsForPipeline(long pipelineId) { List<PipelineMaterialRevision> revisions = findPipelineMaterialRevisions(pipelineId); MaterialRevisions materialRevisions = new MaterialRevisions(); for (PipelineMaterialRevision revision : revisions) { List...
Understands how to store and retrieve Materials from the database
findMaterialRevisionsForPipeline
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public void cacheMaterialRevisionsForPipelines(Set<Long> pipelineIds) { List<Long> ids = new ArrayList<>(pipelineIds); final int batchSize = 500; loadPMRsIntoCache(ids, batchSize); }
Understands how to store and retrieve Materials from the database
cacheMaterialRevisionsForPipelines
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void loadPMRsIntoCache(List<Long> ids, int batchSize) { int total = ids.size(), remaining = total; while (!ids.isEmpty()) { LOGGER.info("Loading PMRs,Remaining {} Pipelines (Total: {})...", remaining, total); final List<Long> idsBatch = batchIds(ids, batchSize); ...
Understands how to store and retrieve Materials from the database
loadPMRsIntoCache
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private <T> List<T> batchIds(List<T> items, int batchSize) { List<T> ids = new ArrayList<>(); for (int i = 0; i < batchSize; ++i) { if (items.isEmpty()) { break; } ids.add(items.remove(0)); } return ids; }
Understands how to store and retrieve Materials from the database
batchIds
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public List<PipelineMaterialRevision> findPipelineMaterialRevisions(long pipelineId) { String cacheKey = pipelinePmrsKey(pipelineId); synchronized (cacheKey) { List<PipelineMaterialRevision> results = goCache.get(cacheKey); if (results != null) { return results; ...
Understands how to store and retrieve Materials from the database
findPipelineMaterialRevisions
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@SuppressWarnings("unchecked") private List<PipelineMaterialRevision> findPMRByPipelineId(long pipelineId) { return (List<PipelineMaterialRevision>) getHibernateTemplate().find("FROM PipelineMaterialRevision WHERE pipelineId = ? ORDER BY id", pipelineId); }
Understands how to store and retrieve Materials from the database
findPMRByPipelineId
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void loadPMRByPipelineIds(List<Long> pipelineIds) { @SuppressWarnings("unchecked") List<PipelineMaterialRevision> pmrs = (List<PipelineMaterialRevision>) getHibernateTemplate().findByCriteria(buildPMRDetachedQuery(pipelineIds)); sortPersistentObjectsById(pmrs, true); final Set<PipelineMa...
Understands how to store and retrieve Materials from the database
loadPMRByPipelineIds
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void sortPersistentObjectsById(List<? extends PersistentObject> persistentObjects, boolean asc) { Comparator<PersistentObject> ascendingSort = (po1, po2) -> (int) (po1.getId() - po2.getId()); Comparator<PersistentObject> descendingSort = (po1, po2) -> (int) (po2.getId() - po1.getId()); p...
Understands how to store and retrieve Materials from the database
sortPersistentObjectsById
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public void putMaterialInstanceIntoCache(MaterialInstance materialInstance) { String cacheKey = materialKey(materialInstance.getFingerprint()); goCache.put(cacheKey, materialInstance); }
Understands how to store and retrieve Materials from the database
putMaterialInstanceIntoCache
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private DetachedCriteria buildPMRDetachedQuery(List<Long> pipelineIds) { DetachedCriteria criteria = DetachedCriteria.forClass(PipelineMaterialRevision.class); criteria.add(Restrictions.in("pipelineId", pipelineIds)); criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); ...
Understands how to store and retrieve Materials from the database
buildPMRDetachedQuery
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void loadModificationsIntoCache(Set<PipelineMaterialRevision> pmrs) { List<PipelineMaterialRevision> pmrList = new ArrayList<>(pmrs); int batchSize = 100, total = pmrList.size(), remaining = total; while (!pmrList.isEmpty()) { LOGGER.info("Loading modifications, Remaining {} ...
Understands how to store and retrieve Materials from the database
loadModificationsIntoCache
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void loadModificationsForPMR(List<PipelineMaterialRevision> pmrs) { List<Criterion> criterions = new ArrayList<>(); for (PipelineMaterialRevision pmr : pmrs) { if (goCache.get(pmrModificationsKey(pmr)) != null) { continue; } final Criterion mod...
Understands how to store and retrieve Materials from the database
loadModificationsForPMR
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private DetachedCriteria buildModificationDetachedQuery(List<Criterion> criteria) { DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Modification.class); Disjunction disjunction = Restrictions.disjunction(); detachedCriteria.add(disjunction); for (Criterion criterion : crite...
Understands how to store and retrieve Materials from the database
buildModificationDetachedQuery
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private String pipelinePmrsKey(long pipelineId) { return (MaterialRepository.class.getName() + "_pipelinePMRs_" + pipelineId).intern(); }
Understands how to store and retrieve Materials from the database
pipelinePmrsKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@SuppressWarnings("unchecked") List<Modification> findMaterialRevisionsForMaterial(long id) { return (List<Modification>) getHibernateTemplate().find("FROM Modification WHERE materialId = ?", new Object[]{id}); }
Understands how to store and retrieve Materials from the database
findMaterialRevisionsForMaterial
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@SuppressWarnings("unchecked") List<Modification> findModificationsFor(PipelineMaterialRevision pmr) { String cacheKey = pmrModificationsKey(pmr); List<Modification> modifications = goCache.get(cacheKey); if (modifications == null) { synchronized (cacheKey) { modi...
Understands how to store and retrieve Materials from the database
findModificationsFor
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private String pmrModificationsKey(PipelineMaterialRevision pmr) { // we intern() it because we might synchronize on the returned String return (MaterialRepository.class.getName() + "_pmrModifications_" + pmr.getId()).intern(); }
Understands how to store and retrieve Materials from the database
pmrModificationsKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private List<String> pmrModificationsKey(Modification modification, List<PipelineMaterialRevision> pmrs) { final long id = modification.getId(); final MaterialInstance materialInstance = modification.getMaterialInstance(); Collection<PipelineMaterialRevision> matchedPmrs = CollectionUtils.select...
Understands how to store and retrieve Materials from the database
pmrModificationsKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
String latestMaterialModificationsKey(MaterialInstance materialInstance) { // we intern() it because we might synchronize on the returned String return (MaterialRepository.class.getName() + "_latestMaterialModifications_" + materialInstance.getId()).intern(); }
Understands how to store and retrieve Materials from the database
latestMaterialModificationsKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
String materialModificationCountKey(MaterialInstance materialInstance) { // we intern() it because we might synchronize on the returned String return (MaterialRepository.class.getName() + "_materialModificationCount_" + materialInstance.getId()).intern(); }
Understands how to store and retrieve Materials from the database
materialModificationCountKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
String materialModificationsWithPaginationKey(MaterialInstance materialInstance) { // we intern() it because we might synchronize on the returned String return (MaterialRepository.class.getName() + "_materialModificationsWithPagination_" + materialInstance.getId()).intern(); }
Understands how to store and retrieve Materials from the database
materialModificationsWithPaginationKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
String materialModificationsWithPaginationSubKey(Pagination pagination) { return String.format("%s-%s", pagination.getOffset(), pagination.getPageSize()); }
Understands how to store and retrieve Materials from the database
materialModificationsWithPaginationSubKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public void saveOrUpdate(MaterialInstance materialInstance) { String cacheKey = materialKey(materialInstance.getFingerprint()); synchronized (cacheKey) { getHibernateTemplate().saveOrUpdate(materialInstance); goCache.remove(cacheKey); goCache.put(cacheKey, materialIns...
Understands how to store and retrieve Materials from the database
saveOrUpdate
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public MaterialInstance find(long id) { return getHibernateTemplate().load(MaterialInstance.class, id); }
Understands how to store and retrieve Materials from the database
find
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public MaterialInstance saveMaterialRevision(MaterialRevision materialRevision) { LOGGER.info("Saving revision {}", materialRevision); MaterialInstance materialInstance = findOrCreateFrom(materialRevision.getMaterial()); saveModifications(materialInstance, materialRevision.getModifications()); ...
Understands how to store and retrieve Materials from the database
saveMaterialRevision
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@TestOnly public void saveModification(MaterialInstance materialInstance, Modification modification) { modification.setMaterialInstance(materialInstance); try { getHibernateTemplate().saveOrUpdate(modification); removeLatestCachedModification(materialInstance); re...
Understands how to store and retrieve Materials from the database
saveModification
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public MaterialInstance findOrCreateFrom(Material material) { String cacheKey = materialKey(material); synchronized (cacheKey) { MaterialInstance materialInstance = findMaterialInstance(material); if (materialInstance == null) { LOGGER.debug("Material instance for...
Understands how to store and retrieve Materials from the database
findOrCreateFrom
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
final String materialKey(Material material) { return materialKey(material.getFingerprint()); }
Understands how to store and retrieve Materials from the database
materialKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private String materialKey(String fingerprint) { // we intern() it because we synchronize on the returned String return (MaterialRepository.class.getName() + "_materialInstance_" + fingerprint).intern(); }
Understands how to store and retrieve Materials from the database
materialKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public MaterialInstance findMaterialInstance(Material material) { String cacheKey = materialKey(material); MaterialInstance materialInstance = goCache.get(cacheKey); if (materialInstance == null) { synchronized (cacheKey) { materialInstance = goCache.get(cacheKey); ...
Understands how to store and retrieve Materials from the database
findMaterialInstance
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public MaterialInstance findMaterialInstance(MaterialConfig materialConfig) { String cacheKey = materialKey(materialConfig.getFingerprint()); MaterialInstance materialInstance = goCache.get(cacheKey); if (materialInstance == null) { synchronized (cacheKey) { materialI...
Understands how to store and retrieve Materials from the database
findMaterialInstance
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@Nullable private MaterialInstance findMaterialInstanceWithHibernate(String cacheKey, DetachedCriteria hibernateCriteria, Map<String, Object> sqlCriteria) { MaterialInstance materialInstance; for (Map.Entry<String, Object> property : sqlCriteria.entrySet()) { if (!property.getKey().equal...
Understands how to store and retrieve Materials from the database
findMaterialInstanceWithHibernate
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@SuppressWarnings("unchecked") private <T> T firstResult(DetachedCriteria criteria) { List<T> results = (List<T>) getHibernateTemplate().findByCriteria(criteria); if (results.isEmpty()) { return null; } return results.get(0); }
Understands how to store and retrieve Materials from the database
firstResult
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public void savePipelineMaterialRevision(Pipeline pipeline, long pipelineId, MaterialRevision materialRevision) { Modification from = materialRevision.getOldestModification(); Modification to = materialRevision.getLatestModification(); Long actualFromModificationId = getLastBuiltModificationId(p...
Understands how to store and retrieve Materials from the database
savePipelineMaterialRevision
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private Long getLastBuiltModificationId(final Pipeline pipeline, final MaterialInstance materialInstance, Modification from) { if (materialInstance instanceof DependencyMaterialInstance) { Long id = findLastBuilt...
Understands how to store and retrieve Materials from the database
getLastBuiltModificationId
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private long modificationAfter(final long id, final MaterialInstance materialInstance) { BigInteger result = (BigInteger) getHibernateTemplate().execute(session -> { String sql = "SELECT id " + " FROM modifications " + " WHERE materialId = ? " + " ...
Understands how to store and retrieve Materials from the database
modificationAfter
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private Long findLastBuiltModificationId(final Pipeline pipeline, final MaterialInstance materialInstance) { BigInteger result = (BigInteger) getHibernateTemplate().execute(session -> { String sql = "SELECT fromRevisionId " + " FROM pipelineMaterialRevisions pmr " + "...
Understands how to store and retrieve Materials from the database
findLastBuiltModificationId
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void save(final PipelineMaterialRevision pipelineMaterialRevision, final String pipelineName) { getHibernateTemplate().save(pipelineMaterialRevision); transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void...
Understands how to store and retrieve Materials from the database
save
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@Override public void afterCommit() { String key = cacheKeyForLatestPmrForPipelineKey(pipelineMaterialRevision.getMaterialId(), pipelineName.toLowerCase()); synchronized (key) { goCache.remove(key); } }
Understands how to store and retrieve Materials from the database
afterCommit
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public void createPipelineMaterialRevisions(Pipeline pipeline, Long pipelineId, MaterialRevisions materialRevisions) { for (MaterialRevision materialRevision : materialRevisions) { savePipelineMaterialRev...
Understands how to store and retrieve Materials from the database
createPipelineMaterialRevisions
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@TestOnly public void save(MaterialRevisions materialRevisions) { for (MaterialRevision materialRevision : materialRevisions) { saveMaterialRevision(materialRevision); } }
Understands how to store and retrieve Materials from the database
save
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public List<Modification> findModificationsSinceAndUptil(Material material, MaterialRevision materialRevision, PipelineTimelineEntry.Revision scmRevision) { List<Modification> modificationsS...
Understands how to store and retrieve Materials from the database
findModificationsSinceAndUptil
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public List<Modification> findModificationsSince(Material material, MaterialRevision revision) { MaterialInstance materialInstance = findOrCreateFrom(material); String cacheKey = latestMaterialModificationsKey(materialInstance); synchronized (cacheKey) { long sinceModificationId = re...
Understands how to store and retrieve Materials from the database
findModificationsSince
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private boolean modificationExists(long sinceModificationId, Modifications modifications) { return modifications != null && modifications.hasModification(sinceModificationId); }
Understands how to store and retrieve Materials from the database
modificationExists
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private boolean shouldCache(Modifications modifications) { return modifications.size() <= latestModificationsCacheLimit; }
Understands how to store and retrieve Materials from the database
shouldCache
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@SuppressWarnings("unchecked") private Modifications _findModificationsSince(MaterialInstance materialInstance, long sinceModificationId) { return new Modifications((List<Modification>) getHibernateTemplate().find("FROM Modification WHERE materialId = ? AND id >= ? ORDER BY id DESC", new Object[]{materialIn...
Understands how to store and retrieve Materials from the database
_findModificationsSince
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void removeLatestCachedModification(final MaterialInstance materialInstance) { transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { String cacheKey = latestMaterialModificationsKe...
Understands how to store and retrieve Materials from the database
removeLatestCachedModification
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@Override public void afterCommit() { String cacheKey = latestMaterialModificationsKey(materialInstance); synchronized (cacheKey) { goCache.remove(cacheKey); } }
Understands how to store and retrieve Materials from the database
afterCommit
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void removeCachedModificationCountFor(final MaterialInstance materialInstance) { transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { String key = materialModificationCountKey(mat...
Understands how to store and retrieve Materials from the database
removeCachedModificationCountFor
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@Override public void afterCommit() { String key = materialModificationCountKey(materialInstance); synchronized (key) { goCache.remove(key); } }
Understands how to store and retrieve Materials from the database
afterCommit
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void removeCachedModificationsFor(final MaterialInstance materialInstance) { transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { String key = materialModificationsWithPaginationK...
Understands how to store and retrieve Materials from the database
removeCachedModificationsFor
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@Override public void afterCommit() { String key = materialModificationsWithPaginationKey(materialInstance); synchronized (key) { goCache.remove(key); } }
Understands how to store and retrieve Materials from the database
afterCommit
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
Modifications cachedModifications(MaterialInstance materialInstance) { return goCache.get(latestMaterialModificationsKey(materialInstance)); }
Understands how to store and retrieve Materials from the database
cachedModifications
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public MaterialRevisions findLatestModification(Material material) { MaterialInstance materialInstance = findMaterialInstance(material); if (materialInstance == null) { return new MaterialRevisions(); } Materials materials = new Materials(); materialExpansionService.e...
Understands how to store and retrieve Materials from the database
findLatestModification
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
Modification findLatestModification(final MaterialInstance expandedInstance) { Modifications modifications = cachedModifications(expandedInstance); if (modifications != null && !modifications.isEmpty()) { return modifications.get(0); } String cacheKey = latestMaterialModifica...
Understands how to store and retrieve Materials from the database
findLatestModification
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public void saveModifications(MaterialInstance materialInstance, List<Modification> newChanges) { if (newChanges.isEmpty()) { return; } List<Modification> list = new ArrayList<>(newChanges); Collections.reverse(list); for (Modification modification : list) { ...
Understands how to store and retrieve Materials from the database
saveModifications
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private void checkAndRemoveDuplicates(MaterialInstance materialInstance, List<Modification> newChanges, List<Modification> list) { if (!new SystemEnvironment().get(SystemEnvironment.CHECK_AND_REMOVE_DUPLICATE_MODIFICATIONS)) { ...
Understands how to store and retrieve Materials from the database
checkAndRemoveDuplicates
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public Modification findModificationWithRevision(final Material material, final String revision) { return getHibernateTemplate().execute(session -> { try { final long materialId = findOrCreateFrom(material).getId(); return MaterialRepository.this.findModificationWithR...
Understands how to store and retrieve Materials from the database
findModificationWithRevision
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
Modification findModificationWithRevision(Session session, long materialId, String revision) { Modification modification; String key = cacheKeyForModificationWithRevision(materialId, revision); modification = goCache.get(key); if (modification == null) { synchronized (key) { ...
Understands how to store and retrieve Materials from the database
findModificationWithRevision
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public MaterialRevisions findLatestRevisions(MaterialConfigs materialConfigs) { MaterialRevisions materialRevisions = new MaterialRevisions(); for (MaterialConfig materialConfig : materialConfigs) { MaterialInstance materialInstance = findMaterialInstance(materialConfig); if (mat...
Understands how to store and retrieve Materials from the database
findLatestRevisions
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public boolean hasPipelineEverRunWith(final String pipelineName, final MaterialRevisions revisions) { return getHibernateTemplate().execute(session -> { int numberOfMaterials = revisions.getRevisions().size(); int match = 0; for (MaterialRevision revision : revisions) { ...
Understands how to store and retrieve Materials from the database
hasPipelineEverRunWith
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private String cacheKeyForHasPipelineEverRunWithModification(Object pipelineName, long materialId, long modificationId) { return cacheKeyGenerator.generate("hasPipelineEverRunWithMod...
Understands how to store and retrieve Materials from the database
cacheKeyForHasPipelineEverRunWithModification
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@SuppressWarnings("unchecked") public List<MatchedRevision> findRevisionsMatching(final MaterialConfig materialConfig, final String searchString) { return getHibernateTemplate().execute(session -> { String sql = "SELECT m.*" + " FROM modifications AS m" + " INNER ...
Understands how to store and retrieve Materials from the database
findRevisionsMatching
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
@SuppressWarnings("unchecked") public List<Modification> modificationFor(final StageIdentifier stageIdentifier) { if (stageIdentifier == null) { return null; } String key = cacheKeyForModificationsForStageLocator(stageIdentifier); List<Modification> modifications = goCach...
Understands how to store and retrieve Materials from the database
modificationFor
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public Long getTotalModificationsFor(final MaterialInstance materialInstance) { String key = materialModificationCountKey(materialInstance); Long totalCount = goCache.get(key); if (totalCount == null || totalCount == 0) { synchronized (key) { totalCount = goCache.get(...
Understands how to store and retrieve Materials from the database
getTotalModificationsFor
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public Modifications getModificationsFor(final MaterialInstance materialInstance, final Pagination pagination) { String key = materialModificationsWithPaginationKey(materialInstance); String subKey = materialModificationsWithPaginationSubKey(pagination); Modifications modifications = (Modificati...
Understands how to store and retrieve Materials from the database
getModificationsFor
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
public Long latestModificationRunByPipeline(final CaseInsensitiveString pipelineName, final Material material) { final long materialId = findMaterialInstance(material).getId(); String key = cacheKeyForLatestPmrForPipelineKey(materialId, pipelineName.toLower()); Long modificationId = goCache.get(...
Understands how to store and retrieve Materials from the database
latestModificationRunByPipeline
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0
private String cacheKeyForLatestPmrForPipelineKey(long materialId, final String lowerCasePipelineName) { return cacheKeyGenerator.generate("latestPmrForPipeline", lowerCasePipelineName, "andMaterial", materialId); }
Understands how to store and retrieve Materials from the database
cacheKeyForLatestPmrForPipelineKey
java
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/persistence/MaterialRepository.java
Apache-2.0