Class BuildMemory
java.lang.Object
com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.model.BuildMemory
Keeps track of what builds have been triggered and if all builds are done for specific events.
- Author:
- Robert Sandell <robert.sandell@sonyericsson.com>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA holder for all builds triggered by one event. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelled(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Sets the status if a project to completed when queue is cancelled.voidcompleted(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run build) Sets the memory that a build is completed for an event.voidforget(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Removes the memory for the event.getBuilds(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Returns all started builds in memory for the event.getBuildsStartedStats(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Gets the statistics of started builds for a specific memory imprint.getMemoryImprint(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Gets the memory of a specific event.getStatusReport(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Returns the status report for the given MemoryImprint.booleanisAllBuildsCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Tells if all triggered builds have started for a specific memory imprint.booleanisAllBuildsStarted(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Tells if all triggered builds have started for a specific memory imprint.booleanisBuilding(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Checks if the provided event exists in this memory.booleanisBuilding(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Checks in memory if the project is building the event.booleanisTriggered(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Checks in memory if the project has been triggered for the event.voidremoveProject(Job project) Removes project from all memory imprints.report()Creates a snapshot clone of the current coordination memory status.voidretriggered(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project, List<Run> otherBuilds) Adds a new memory about a build that has been retriggered.voidsetEntryCustomUrl(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run r, String customUrl) Records a custom URL for the given build.voidsetEntryFailureMessage(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run r, String failureMessage) Deprecated.voidsetEntryUnsuccessfulMessage(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run r, String unsuccessfulMessage) Records the unsuccessful message for the given build.voidSets the memory that a build has started for an event.voidtriggered(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Adds a new memory about a build that has been/will be triggered.voidupdateTriggerContext(GerritCause cause, Run r) Updates theTriggerContextfor the event.
-
Constructor Details
-
BuildMemory
public BuildMemory()
-
-
Method Details
-
getMemoryImprint
public BuildMemory.MemoryImprint getMemoryImprint(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Gets the memory of a specific event.- Parameters:
event- the event.- Returns:
- the memory.
-
isAllBuildsCompleted
public boolean isAllBuildsCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Tells if all triggered builds have started for a specific memory imprint.- Parameters:
event- the event.- Returns:
- true if it is so.
-
getBuildsStartedStats
public BuildsStartedStats getBuildsStartedStats(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Gets the statistics of started builds for a specific memory imprint.- Parameters:
event- the event.- Returns:
- the statistics.
-
getStatusReport
public String getStatusReport(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Returns the status report for the given MemoryImprint.- Parameters:
event- the event.- Returns:
- the status as it is now.
- See Also:
-
isAllBuildsStarted
public boolean isAllBuildsStarted(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Tells if all triggered builds have started for a specific memory imprint.- Parameters:
event- the event.- Returns:
- true if it is so.
-
completed
public void completed(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run build) Sets the memory that a build is completed for an event.- Parameters:
event- the eventbuild- the build.
-
started
public void started(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run build) Sets the memory that a build has started for an event.- Parameters:
event- the event.build- the build.
-
triggered
public void triggered(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Adds a new memory about a build that has been/will be triggered.- Parameters:
event- the event that triggered it.project- the project that was triggered.
-
retriggered
public void retriggered(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project, List<Run> otherBuilds) Adds a new memory about a build that has been retriggered. If there is an active memory about the provided event, then the project is reset with no build info. Otherwise the memory is recreated from the list of other builds and their result.- Parameters:
event- the event to be retriggered.project- the project that has been retriggered.otherBuilds- the list of other builds that was in the "old" memory.
-
cancelled
public void cancelled(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Job project) Sets the status if a project to completed when queue is cancelled.- Parameters:
event- the event to be retriggered.project- the project that has been retriggered.
-
forget
public void forget(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Removes the memory for the event.- Parameters:
event- the event.
-
updateTriggerContext
Updates theTriggerContextfor the event. The cause and build is the "focal point" for the update, but all memory entities will be updated, but only the current context will beTriggerContext.setThisBuild(hudson.model.Run)updated.- Parameters:
cause- the cause.r- the build the cause is in.
-
isTriggered
public boolean isTriggered(@NonNull com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, @NonNull Job project) Checks in memory if the project has been triggered for the event.- Parameters:
event- the event.project- the project.- Returns:
- true if so.
-
isBuilding
public boolean isBuilding(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, @NonNull Job project) Checks in memory if the project is building the event.- Parameters:
event- the event.project- the project.- Returns:
- true if so.
-
isBuilding
public boolean isBuilding(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Checks if the provided event exists in this memory.- Parameters:
event- the event to look for.- Returns:
- true if so.
-
getBuilds
public List<Run> getBuilds(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event) Returns all started builds in memory for the event.- Parameters:
event- the event.- Returns:
- the list of builds, or null if there is no memory.
-
setEntryCustomUrl
public void setEntryCustomUrl(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run r, String customUrl) Records a custom URL for the given build.- Parameters:
event- the event.r- the build that caused the failure.customUrl- the URL.
-
setEntryUnsuccessfulMessage
public void setEntryUnsuccessfulMessage(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run r, String unsuccessfulMessage) Records the unsuccessful message for the given build.- Parameters:
event- the event.r- the build that caused the failure.unsuccessfulMessage- the unsuccessful message
-
setEntryFailureMessage
@Deprecated public void setEntryFailureMessage(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event, Run r, String failureMessage) Deprecated.Records the failure message for the given build.- Parameters:
event- the event.r- the build that caused the failure.failureMessage- the failure message
-
removeProject
Removes project from all memory imprints.- Parameters:
project- to be removed.
-
report
Creates a snapshot clone of the current coordination memory status.- Returns:
- the report
-
setEntryUnsuccessfulMessage(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent, hudson.model.Run, java.lang.String)