com.capitalone.dashboard:core

Rat (Release Audit Tool) results

The following document contains the results of Rat (Release Audit Tool).

*****************************************************
Summary
-------
Generated at: 2019-04-12T14:17:33-04:00

Notes: 2
Binaries: 2
Archives: 0
Standards: 642

Apache Licensed: 12
Generated Documents: 0

JavaDocs are generated, thus a license header is optional.
Generated files do not require license headers.

630 Unknown Licenses

*****************************************************

Files with unapproved licenses:

  MAINTAINERS
  README.md
  site-content/pom.xml
  site-content/pmd.xml
  site-content/MAINTAINERS
  site-content/README.md
  site-content/travis-utilities/release.sh
  site-content/travis-utilities/deploy-snapshot.sh
  site-content/travis-utilities/.travis.settings.xml
  site-content/checkstyle.xml
  site-content/create_collector.md
  site-content/.travis.yml
  site-content/src/test/resources/artifacts/artifacts.json
  site-content/src/test/resources/collectors/coll.json
  site-content/src/test/resources/component/component.json
  site-content/src/test/resources/builds/builds.json
  site-content/src/test/resources/librarypolicy/librarypolicy.json
  site-content/src/test/resources/dashboard/dashboard.json
  site-content/src/test/resources/codequality/codequality.json
  site-content/src/test/resources/test_results/test_results.json
  site-content/src/test/resources/collector_items/items.json
  site-content/src/test/resources/securityscan/securityscan.json
  site-content/src/test/java/com/capitalone/dashboard/repository/FongoBaseRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/repository/CollectorTaskTests.java
  site-content/src/test/java/com/capitalone/dashboard/repository/CollectorItemRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/repository/FongoConfig.java
  site-content/src/test/java/com/capitalone/dashboard/repository/TemplateRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/repository/AuthenticationRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/repository/FeatureRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/repository/ScopeOwnerRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/repository/DashboardCreateTests.java
  site-content/src/test/java/com/capitalone/dashboard/repository/TeamRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/repository/ScopeRepositoryTest.java
  site-content/src/test/java/com/capitalone/dashboard/util/HygieiaUtilsTest.java
  site-content/src/test/java/com/capitalone/dashboard/util/TestUtils.java
  site-content/src/test/java/com/capitalone/dashboard/util/EncryptionTests.java
  site-content/src/test/java/com/capitalone/dashboard/util/PipelineUtilsTest.java
  site-content/src/test/java/com/capitalone/dashboard/util/DashboardUtilsTest.java
  site-content/src/test/java/com/capitalone/dashboard/util/LoadTestData.java
  site-content/src/test/java/com/capitalone/dashboard/util/GitBranchSpecTest.java
  site-content/src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskTwoWithGenericItem.java
  site-content/src/test/java/com/capitalone/dashboard/collector/CollectorTaskTest.java
  site-content/src/test/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItemTest.java
  site-content/src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskWithGenericItem.java
  site-content/src/test/java/com/capitalone/dashboard/model/DashboardTest.java
  site-content/src/test/java/com/capitalone/dashboard/model/LibraryPolicyResultTest.java
  site-content/src/test/java/com/capitalone/dashboard/model/StandardWidgetTest.java
  site-content/src/test/java/com/capitalone/dashboard/model/ComponentTest.java
  site-content/src/test/java/com/capitalone/dashboard/event/EnvironmentComponentEventListenerTest.java
  site-content/src/test/java/com/capitalone/dashboard/event/TestResultEventListenerTest.java
  site-content/src/test/java/com/capitalone/dashboard/event/CommitEventListenerTest.java
  site-content/src/test/java/com/capitalone/dashboard/event/BuildEventListenerTest.java
  site-content/src/test/java/com/capitalone/dashboard/event/sync/SyncDashboardTest.java
  site-content/src/test/java/com/capitalone/dashboard/MarkdownTest.java
  site-content/src/main/resources/logback.xml
  site-content/src/main/java/com/capitalone/dashboard/misc/HygieiaException.java
  site-content/src/main/java/com/capitalone/dashboard/repository/AuditResultRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CollectorItemRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ChangeOrderRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/RequestLogRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryCustom.java
  site-content/src/main/java/com/capitalone/dashboard/repository/EnvironmentComponentRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/GitHubRepoRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/AuthenticationRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/GenericCollectorItemRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/RallyBurnDownRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CloudVolumeRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/BuildRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ApiTokenRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQuery.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CloudInstanceHistoryRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/FortifyScanRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/IncidentRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/JobRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/LibraryPolicyResultsRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryImpl.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ServiceAccountRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ScopeRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ScoreCriteriaSettingsRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CloudSubNetworkRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CollItemConfigHistoryRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/BaseCollectorItemRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/TeamRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CodeQualityRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryImpl.java
  site-content/src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryCustom.java
  site-content/src/main/java/com/capitalone/dashboard/repository/DashboardRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/TemplateRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ScoreRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CloudInstanceRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CmdbRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CloudVirtualNetworkRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ScoreCollectorItemRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/UserInfoRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ScopeOwnerRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/Monitor2Repository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/PipelineRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ConfigurationRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/RallyFeatureRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CommitRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CodeReposBuildsRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/MaturityModelRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/RepositoryPackage.java
  site-content/src/main/java/com/capitalone/dashboard/repository/EnvironmentStatusRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/TeamInventoryRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/PerformanceRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CollectorRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/ServiceRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/GitRequestRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/BaseCollectorRepository.java
  site-content/src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQueryImpl.java
  site-content/src/main/java/com/capitalone/dashboard/repository/TestResultRepository.java
  site-content/src/main/java/com/capitalone/dashboard/response/BuildDataCreateResponse.java
  site-content/src/main/java/com/capitalone/dashboard/response/CloudVolumeAggregatedResponse.java
  site-content/src/main/java/com/capitalone/dashboard/response/CloudVirtualNetworkAggregatedResponse.java
  site-content/src/main/java/com/capitalone/dashboard/response/RallyBurnDownResponse.java
  site-content/src/main/java/com/capitalone/dashboard/response/CloudSubNetworkAggregatedResponse.java
  site-content/src/main/java/com/capitalone/dashboard/util/PipelineUtils.java
  site-content/src/main/java/com/capitalone/dashboard/util/EncryptionException.java
  site-content/src/main/java/com/capitalone/dashboard/util/FeatureCollectorConstants.java
  site-content/src/main/java/com/capitalone/dashboard/util/CoreFeatureSettings.java
  site-content/src/main/java/com/capitalone/dashboard/util/Supplier.java
  site-content/src/main/java/com/capitalone/dashboard/util/HygieiaUtils.java
  site-content/src/main/java/com/capitalone/dashboard/util/SuperFeatureComparator.java
  site-content/src/main/java/com/capitalone/dashboard/util/Encryption.java
  site-content/src/main/java/com/capitalone/dashboard/util/DashboardUtils.java
  site-content/src/main/java/com/capitalone/dashboard/util/GitHubParsedUrl.java
  site-content/src/main/java/com/capitalone/dashboard/util/GitBranchSpec.java
  site-content/src/main/java/com/capitalone/dashboard/util/UnsafeDeleteException.java
  site-content/src/main/java/com/capitalone/dashboard/config/CollectorConfig.java
  site-content/src/main/java/com/capitalone/dashboard/config/collector/CloudConfig.java
  site-content/src/main/java/com/capitalone/dashboard/config/MongoConfig.java
  site-content/src/main/java/com/capitalone/dashboard/collector/CollectorTask.java
  site-content/src/main/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItem.java
  site-content/src/main/java/com/capitalone/dashboard/collector/RestOperationsSupplier.java
  site-content/src/main/java/com/capitalone/dashboard/status/LibraryPolicyAuditStatus.java
  site-content/src/main/java/com/capitalone/dashboard/status/CodeReviewAuditStatus.java
  site-content/src/main/java/com/capitalone/dashboard/status/CodeQualityAuditStatus.java
  site-content/src/main/java/com/capitalone/dashboard/status/ArtifactAuditStatus.java
  site-content/src/main/java/com/capitalone/dashboard/status/TestResultAuditStatus.java
  site-content/src/main/java/com/capitalone/dashboard/status/PerformanceTestAuditStatus.java
  site-content/src/main/java/com/capitalone/dashboard/status/BuildAuditStatus.java
  site-content/src/main/java/com/capitalone/dashboard/status/DashboardAuditStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/JobCollectorItem.java
  site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubRepo.java
  site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubParsed.java
  site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/MergeEvent.java
  site-content/src/main/java/com/capitalone/dashboard/model/RallyFeatureType.java
  site-content/src/main/java/com/capitalone/dashboard/model/BaseModel.java
  site-content/src/main/java/com/capitalone/dashboard/model/Build.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestCaseStep.java
  site-content/src/main/java/com/capitalone/dashboard/model/GitRequest.java
  site-content/src/main/java/com/capitalone/dashboard/model/DashboardType.java
  site-content/src/main/java/com/capitalone/dashboard/model/Pipeline.java
  site-content/src/main/java/com/capitalone/dashboard/model/GenericCollectorItem.java
  site-content/src/main/java/com/capitalone/dashboard/model/UserRole.java
  site-content/src/main/java/com/capitalone/dashboard/model/Stage.java
  site-content/src/main/java/com/capitalone/dashboard/model/Team.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestCaseStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/relation/RelatedCollectorItem.java
  site-content/src/main/java/com/capitalone/dashboard/model/ChangeOrder.java
  site-content/src/main/java/com/capitalone/dashboard/model/FeatureIssueLink.java
  site-content/src/main/java/com/capitalone/dashboard/model/PipelineStageType.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestCaseConditionResult.java
  site-content/src/main/java/com/capitalone/dashboard/model/Review.java
  site-content/src/main/java/com/capitalone/dashboard/model/Application.java
  site-content/src/main/java/com/capitalone/dashboard/model/ScopeOwner.java
  site-content/src/main/java/com/capitalone/dashboard/model/PerformanceMetric.java
  site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatLevel.java
  site-content/src/main/java/com/capitalone/dashboard/model/CodeReposBuilds.java
  site-content/src/main/java/com/capitalone/dashboard/model/RepoBranch.java
  site-content/src/main/java/com/capitalone/dashboard/model/quality/FindBugsXmlReport.java
  site-content/src/main/java/com/capitalone/dashboard/model/quality/PmdReport.java
  site-content/src/main/java/com/capitalone/dashboard/model/quality/JacocoXmlReport.java
  site-content/src/main/java/com/capitalone/dashboard/model/quality/ArtifactType.java
  site-content/src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitor.java
  site-content/src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitee.java
  site-content/src/main/java/com/capitalone/dashboard/model/quality/JunitXmlReport.java
  site-content/src/main/java/com/capitalone/dashboard/model/quality/CheckstyleReport.java
  site-content/src/main/java/com/capitalone/dashboard/model/UserStory.java
  site-content/src/main/java/com/capitalone/dashboard/model/StandardWidget.java
  site-content/src/main/java/com/capitalone/dashboard/model/BuildStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/CloudVirtualNetwork.java
  site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentStage.java
  site-content/src/main/java/com/capitalone/dashboard/model/RallyBurnDownData.java
  site-content/src/main/java/com/capitalone/dashboard/model/PerformanceMetricStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyType.java
  site-content/src/main/java/com/capitalone/dashboard/model/ScoreDisplayType.java
  site-content/src/main/java/com/capitalone/dashboard/model/RequestLog.java
  site-content/src/main/java/com/capitalone/dashboard/model/Configuration.java
  site-content/src/main/java/com/capitalone/dashboard/model/Collector.java
  site-content/src/main/java/com/capitalone/dashboard/model/NameValue.java
  site-content/src/main/java/com/capitalone/dashboard/model/CodeQuality.java
  site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityMetricStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/RallyStoryStages.java
  site-content/src/main/java/com/capitalone/dashboard/model/TeamMember.java
  site-content/src/main/java/com/capitalone/dashboard/model/CollectorItem.java
  site-content/src/main/java/com/capitalone/dashboard/model/TeamLevelDetails.java
  site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyResult.java
  site-content/src/main/java/com/capitalone/dashboard/model/Performance.java
  site-content/src/main/java/com/capitalone/dashboard/model/Component.java
  site-content/src/main/java/com/capitalone/dashboard/model/StoryIndicator.java
  site-content/src/main/java/com/capitalone/dashboard/model/PipelineStage.java
  site-content/src/main/java/com/capitalone/dashboard/model/Dashboard.java
  site-content/src/main/java/com/capitalone/dashboard/model/ServiceAccount.java
  site-content/src/main/java/com/capitalone/dashboard/model/Commit.java
  site-content/src/main/java/com/capitalone/dashboard/model/PipelineCommit.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestSuiteType.java
  site-content/src/main/java/com/capitalone/dashboard/model/AuditResult.java
  site-content/src/main/java/com/capitalone/dashboard/model/CollectorItemConfigHistory.java
  site-content/src/main/java/com/capitalone/dashboard/model/PerformanceType.java
  site-content/src/main/java/com/capitalone/dashboard/model/Authentication.java
  site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityType.java
  site-content/src/main/java/com/capitalone/dashboard/model/CloudInstance.java
  site-content/src/main/java/com/capitalone/dashboard/model/MaturityModel.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreTypeValue.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreComponentSettings.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreType.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreThresholdSettings.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteriaSettings.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScmScoreSettings.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/QualityScoreSettings.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/BuildScoreSettings.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/PropagateType.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/DeployScoreSettings.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ComponentAlert.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteria.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreCollectorItem.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreValueType.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetric.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetricBase.java
  site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreMetric.java
  site-content/src/main/java/com/capitalone/dashboard/model/UserInfo.java
  site-content/src/main/java/com/capitalone/dashboard/model/PolicyScanMetric.java
  site-content/src/main/java/com/capitalone/dashboard/model/Cmdb.java
  site-content/src/main/java/com/capitalone/dashboard/model/Comment.java
  site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentComponent.java
  site-content/src/main/java/com/capitalone/dashboard/model/Service.java
  site-content/src/main/java/com/capitalone/dashboard/model/CloudInstanceHistory.java
  site-content/src/main/java/com/capitalone/dashboard/model/Monitor2.java
  site-content/src/main/java/com/capitalone/dashboard/model/ConfigHistOperationType.java
  site-content/src/main/java/com/capitalone/dashboard/model/SprintEstimate.java
  site-content/src/main/java/com/capitalone/dashboard/model/CommitStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/ServiceStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/CloudSubNetwork.java
  site-content/src/main/java/com/capitalone/dashboard/model/CloudVolumeStorage.java
  site-content/src/main/java/com/capitalone/dashboard/model/Owner.java
  site-content/src/main/java/com/capitalone/dashboard/model/AuditType.java
  site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestCaseCondition.java
  site-content/src/main/java/com/capitalone/dashboard/model/CollectorType.java
  site-content/src/main/java/com/capitalone/dashboard/model/ApiToken.java
  site-content/src/main/java/com/capitalone/dashboard/model/AuthType.java
  site-content/src/main/java/com/capitalone/dashboard/model/Template.java
  site-content/src/main/java/com/capitalone/dashboard/model/CommitType.java
  site-content/src/main/java/com/capitalone/dashboard/model/Incident.java
  site-content/src/main/java/com/capitalone/dashboard/model/BinaryArtifact.java
  site-content/src/main/java/com/capitalone/dashboard/model/SCM.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestCapability.java
  site-content/src/main/java/com/capitalone/dashboard/model/KeyValueLog.java
  site-content/src/main/java/com/capitalone/dashboard/model/CollectionError.java
  site-content/src/main/java/com/capitalone/dashboard/model/RallyFeature.java
  site-content/src/main/java/com/capitalone/dashboard/model/Widget.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestResult.java
  site-content/src/main/java/com/capitalone/dashboard/model/TeamInventory.java
  site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityMetric.java
  site-content/src/main/java/com/capitalone/dashboard/model/ScopeOwnerCollectorItem.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestCase.java
  site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatDisposition.java
  site-content/src/main/java/com/capitalone/dashboard/model/ArtifactIdentifier.java
  site-content/src/main/java/com/capitalone/dashboard/model/FeatureStatus.java
  site-content/src/main/java/com/capitalone/dashboard/model/package-info.java
  site-content/src/main/java/com/capitalone/dashboard/model/NameValueCount.java
  site-content/src/main/java/com/capitalone/dashboard/model/FeatureHistory.java
  site-content/src/main/java/com/capitalone/dashboard/model/TestSuite.java
  site-content/src/main/java/com/capitalone/dashboard/model/FortifyScanReport.java
  site-content/src/main/java/com/capitalone/dashboard/request/CloudVirtualNetworkListRefreshRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/CodeQualityCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/GitRequestCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/DeployDataCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/TestDataCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/PerformanceCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/CloudInstanceCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/CloudSubnetListRefreshRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/CloudVolumeCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/GenericCollectorItemCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/CloudSubnetCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/PerfTestDataCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/BinaryArtifactCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/ConfigurationCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/Monitor2DataCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/CommitCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/CloudInstanceListRefreshRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/CloudVolumeListRefreshRequest.java
  site-content/src/main/java/com/capitalone/dashboard/request/BuildDataCreateRequest.java
  site-content/src/main/java/com/capitalone/dashboard/event/DashboardEventListener.java
  site-content/src/main/java/com/capitalone/dashboard/event/HygieiaMongoEventListener.java
  site-content/src/main/java/com/capitalone/dashboard/event/CodeQualityEventListener.java
  site-content/src/main/java/com/capitalone/dashboard/event/BuildEventListener.java
  site-content/src/main/java/com/capitalone/dashboard/event/RelatedCollectorItemEventListener.java
  site-content/src/main/java/com/capitalone/dashboard/event/EnvironmentComponentEventListener.java
  site-content/src/main/java/com/capitalone/dashboard/event/sync/SyncException.java
  site-content/src/main/java/com/capitalone/dashboard/event/sync/SyncDashboard.java
  site-content/src/main/java/com/capitalone/dashboard/event/TestResultEventListener.java
  site-content/src/main/java/com/capitalone/dashboard/event/CommitEventListener.java
  site-content/src/main/java/com/capitalone/dashboard/testutil/FongoConfig.java
  site-content/src/main/java/com/capitalone/dashboard/testutil/TestRestOperations.java
  site-content/src/main/java/com/capitalone/dashboard/testutil/TestRestTemplate.java
  site-content/src/main/java/com/capitalone/dashboard/testutil/GsonUtil.java
  site-content/src/main/java/com/capitalone/dashboard/testutil/BaseCollectorTestConfig.java
  site-content/src/main/java/com/capitalone/dashboard/testutil/TestResponse.java
  site-content/src/main/java/com/capitalone/dashboard/client/RestAuthType.java
  site-content/src/main/java/com/capitalone/dashboard/client/RestUserInfo.java
  site-content/src/main/java/com/capitalone/dashboard/client/RestClient.java
  create_collector.md
  .travis.yml
  src/devops/pmd.xml
  src/devops/release.sh
  src/devops/deploy-snapshot.sh
  src/devops/.travis.settings.xml
  src/test/resources/artifacts/artifacts.json
  src/test/resources/collectors/coll.json
  src/test/resources/component/component.json
  src/test/resources/builds/builds.json
  src/test/resources/librarypolicy/librarypolicy.json
  src/test/resources/dashboard/dashboard.json
  src/test/resources/codequality/codequality.json
  src/test/resources/test_results/test_results.json
  src/test/resources/collector_items/items.json
  src/test/resources/securityscan/securityscan.json
  src/test/java/com/capitalone/dashboard/repository/FongoBaseRepositoryTest.java
  src/test/java/com/capitalone/dashboard/repository/CollectorTaskTests.java
  src/test/java/com/capitalone/dashboard/repository/CollectorItemRepositoryTest.java
  src/test/java/com/capitalone/dashboard/repository/FongoConfig.java
  src/test/java/com/capitalone/dashboard/repository/TemplateRepositoryTest.java
  src/test/java/com/capitalone/dashboard/repository/AuthenticationRepositoryTest.java
  src/test/java/com/capitalone/dashboard/repository/FeatureRepositoryTest.java
  src/test/java/com/capitalone/dashboard/repository/ScopeOwnerRepositoryTest.java
  src/test/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepositoryTest.java
  src/test/java/com/capitalone/dashboard/repository/DashboardCreateTests.java
  src/test/java/com/capitalone/dashboard/repository/TeamRepositoryTest.java
  src/test/java/com/capitalone/dashboard/repository/ScopeRepositoryTest.java
  src/test/java/com/capitalone/dashboard/util/HygieiaUtilsTest.java
  src/test/java/com/capitalone/dashboard/util/TestUtils.java
  src/test/java/com/capitalone/dashboard/util/EncryptionTests.java
  src/test/java/com/capitalone/dashboard/util/PipelineUtilsTest.java
  src/test/java/com/capitalone/dashboard/util/DashboardUtilsTest.java
  src/test/java/com/capitalone/dashboard/util/LoadTestData.java
  src/test/java/com/capitalone/dashboard/util/GitBranchSpecTest.java
  src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskTwoWithGenericItem.java
  src/test/java/com/capitalone/dashboard/collector/CollectorTaskTest.java
  src/test/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItemTest.java
  src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskWithGenericItem.java
  src/test/java/com/capitalone/dashboard/model/DashboardTest.java
  src/test/java/com/capitalone/dashboard/model/LibraryPolicyResultTest.java
  src/test/java/com/capitalone/dashboard/model/StandardWidgetTest.java
  src/test/java/com/capitalone/dashboard/model/ComponentTest.java
  src/test/java/com/capitalone/dashboard/event/EnvironmentComponentEventListenerTest.java
  src/test/java/com/capitalone/dashboard/event/TestResultEventListenerTest.java
  src/test/java/com/capitalone/dashboard/event/CommitEventListenerTest.java
  src/test/java/com/capitalone/dashboard/event/BuildEventListenerTest.java
  src/test/java/com/capitalone/dashboard/event/sync/SyncDashboardTest.java
  src/test/java/com/capitalone/dashboard/MarkdownTest.java
  src/main/resources/logback.xml
  src/main/java/com/capitalone/dashboard/misc/HygieiaException.java
  src/main/java/com/capitalone/dashboard/repository/AuditResultRepository.java
  src/main/java/com/capitalone/dashboard/repository/CollectorItemRepository.java
  src/main/java/com/capitalone/dashboard/repository/ChangeOrderRepository.java
  src/main/java/com/capitalone/dashboard/repository/RequestLogRepository.java
  src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryCustom.java
  src/main/java/com/capitalone/dashboard/repository/EnvironmentComponentRepository.java
  src/main/java/com/capitalone/dashboard/repository/GitHubRepoRepository.java
  src/main/java/com/capitalone/dashboard/repository/AuthenticationRepository.java
  src/main/java/com/capitalone/dashboard/repository/GenericCollectorItemRepository.java
  src/main/java/com/capitalone/dashboard/repository/RallyBurnDownRepository.java
  src/main/java/com/capitalone/dashboard/repository/CloudVolumeRepository.java
  src/main/java/com/capitalone/dashboard/repository/BuildRepository.java
  src/main/java/com/capitalone/dashboard/repository/ApiTokenRepository.java
  src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQuery.java
  src/main/java/com/capitalone/dashboard/repository/CloudInstanceHistoryRepository.java
  src/main/java/com/capitalone/dashboard/repository/FortifyScanRepository.java
  src/main/java/com/capitalone/dashboard/repository/IncidentRepository.java
  src/main/java/com/capitalone/dashboard/repository/JobRepository.java
  src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepository.java
  src/main/java/com/capitalone/dashboard/repository/LibraryPolicyResultsRepository.java
  src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryImpl.java
  src/main/java/com/capitalone/dashboard/repository/ServiceAccountRepository.java
  src/main/java/com/capitalone/dashboard/repository/ScopeRepository.java
  src/main/java/com/capitalone/dashboard/repository/ScoreCriteriaSettingsRepository.java
  src/main/java/com/capitalone/dashboard/repository/CloudSubNetworkRepository.java
  src/main/java/com/capitalone/dashboard/repository/CollItemConfigHistoryRepository.java
  src/main/java/com/capitalone/dashboard/repository/BaseCollectorItemRepository.java
  src/main/java/com/capitalone/dashboard/repository/TeamRepository.java
  src/main/java/com/capitalone/dashboard/repository/CodeQualityRepository.java
  src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryImpl.java
  src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryCustom.java
  src/main/java/com/capitalone/dashboard/repository/DashboardRepository.java
  src/main/java/com/capitalone/dashboard/repository/TemplateRepository.java
  src/main/java/com/capitalone/dashboard/repository/ScoreRepository.java
  src/main/java/com/capitalone/dashboard/repository/CloudInstanceRepository.java
  src/main/java/com/capitalone/dashboard/repository/CmdbRepository.java
  src/main/java/com/capitalone/dashboard/repository/CloudVirtualNetworkRepository.java
  src/main/java/com/capitalone/dashboard/repository/ScoreCollectorItemRepository.java
  src/main/java/com/capitalone/dashboard/repository/UserInfoRepository.java
  src/main/java/com/capitalone/dashboard/repository/ScopeOwnerRepository.java
  src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java
  src/main/java/com/capitalone/dashboard/repository/Monitor2Repository.java
  src/main/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepository.java
  src/main/java/com/capitalone/dashboard/repository/PipelineRepository.java
  src/main/java/com/capitalone/dashboard/repository/ConfigurationRepository.java
  src/main/java/com/capitalone/dashboard/repository/RallyFeatureRepository.java
  src/main/java/com/capitalone/dashboard/repository/CommitRepository.java
  src/main/java/com/capitalone/dashboard/repository/CodeReposBuildsRepository.java
  src/main/java/com/capitalone/dashboard/repository/MaturityModelRepository.java
  src/main/java/com/capitalone/dashboard/repository/RepositoryPackage.java
  src/main/java/com/capitalone/dashboard/repository/EnvironmentStatusRepository.java
  src/main/java/com/capitalone/dashboard/repository/TeamInventoryRepository.java
  src/main/java/com/capitalone/dashboard/repository/PerformanceRepository.java
  src/main/java/com/capitalone/dashboard/repository/CollectorRepository.java
  src/main/java/com/capitalone/dashboard/repository/ServiceRepository.java
  src/main/java/com/capitalone/dashboard/repository/GitRequestRepository.java
  src/main/java/com/capitalone/dashboard/repository/BaseCollectorRepository.java
  src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQueryImpl.java
  src/main/java/com/capitalone/dashboard/repository/TestResultRepository.java
  src/main/java/com/capitalone/dashboard/response/BuildDataCreateResponse.java
  src/main/java/com/capitalone/dashboard/response/CloudVolumeAggregatedResponse.java
  src/main/java/com/capitalone/dashboard/response/CloudVirtualNetworkAggregatedResponse.java
  src/main/java/com/capitalone/dashboard/response/RallyBurnDownResponse.java
  src/main/java/com/capitalone/dashboard/response/CloudSubNetworkAggregatedResponse.java
  src/main/java/com/capitalone/dashboard/util/PipelineUtils.java
  src/main/java/com/capitalone/dashboard/util/EncryptionException.java
  src/main/java/com/capitalone/dashboard/util/FeatureCollectorConstants.java
  src/main/java/com/capitalone/dashboard/util/CoreFeatureSettings.java
  src/main/java/com/capitalone/dashboard/util/Supplier.java
  src/main/java/com/capitalone/dashboard/util/HygieiaUtils.java
  src/main/java/com/capitalone/dashboard/util/SuperFeatureComparator.java
  src/main/java/com/capitalone/dashboard/util/Encryption.java
  src/main/java/com/capitalone/dashboard/util/DashboardUtils.java
  src/main/java/com/capitalone/dashboard/util/GitHubParsedUrl.java
  src/main/java/com/capitalone/dashboard/util/GitBranchSpec.java
  src/main/java/com/capitalone/dashboard/util/UnsafeDeleteException.java
  src/main/java/com/capitalone/dashboard/config/CollectorConfig.java
  src/main/java/com/capitalone/dashboard/config/collector/CloudConfig.java
  src/main/java/com/capitalone/dashboard/config/MongoConfig.java
  src/main/java/com/capitalone/dashboard/collector/CollectorTask.java
  src/main/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItem.java
  src/main/java/com/capitalone/dashboard/collector/RestOperationsSupplier.java
  src/main/java/com/capitalone/dashboard/status/LibraryPolicyAuditStatus.java
  src/main/java/com/capitalone/dashboard/status/CodeReviewAuditStatus.java
  src/main/java/com/capitalone/dashboard/status/CodeQualityAuditStatus.java
  src/main/java/com/capitalone/dashboard/status/ArtifactAuditStatus.java
  src/main/java/com/capitalone/dashboard/status/TestResultAuditStatus.java
  src/main/java/com/capitalone/dashboard/status/PerformanceTestAuditStatus.java
  src/main/java/com/capitalone/dashboard/status/BuildAuditStatus.java
  src/main/java/com/capitalone/dashboard/status/DashboardAuditStatus.java
  src/main/java/com/capitalone/dashboard/model/JobCollectorItem.java
  src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubRepo.java
  src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubParsed.java
  src/main/java/com/capitalone/dashboard/model/webhook/github/MergeEvent.java
  src/main/java/com/capitalone/dashboard/model/RallyFeatureType.java
  src/main/java/com/capitalone/dashboard/model/BaseModel.java
  src/main/java/com/capitalone/dashboard/model/Build.java
  src/main/java/com/capitalone/dashboard/model/TestCaseStep.java
  src/main/java/com/capitalone/dashboard/model/GitRequest.java
  src/main/java/com/capitalone/dashboard/model/DashboardType.java
  src/main/java/com/capitalone/dashboard/model/Pipeline.java
  src/main/java/com/capitalone/dashboard/model/GenericCollectorItem.java
  src/main/java/com/capitalone/dashboard/model/UserRole.java
  src/main/java/com/capitalone/dashboard/model/Stage.java
  src/main/java/com/capitalone/dashboard/model/Team.java
  src/main/java/com/capitalone/dashboard/model/TestCaseStatus.java
  src/main/java/com/capitalone/dashboard/model/relation/RelatedCollectorItem.java
  src/main/java/com/capitalone/dashboard/model/ChangeOrder.java
  src/main/java/com/capitalone/dashboard/model/FeatureIssueLink.java
  src/main/java/com/capitalone/dashboard/model/PipelineStageType.java
  src/main/java/com/capitalone/dashboard/model/TestCaseConditionResult.java
  src/main/java/com/capitalone/dashboard/model/Review.java
  src/main/java/com/capitalone/dashboard/model/Application.java
  src/main/java/com/capitalone/dashboard/model/ScopeOwner.java
  src/main/java/com/capitalone/dashboard/model/PerformanceMetric.java
  src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatLevel.java
  src/main/java/com/capitalone/dashboard/model/CodeReposBuilds.java
  src/main/java/com/capitalone/dashboard/model/RepoBranch.java
  src/main/java/com/capitalone/dashboard/model/quality/FindBugsXmlReport.java
  src/main/java/com/capitalone/dashboard/model/quality/PmdReport.java
  src/main/java/com/capitalone/dashboard/model/quality/JacocoXmlReport.java
  src/main/java/com/capitalone/dashboard/model/quality/ArtifactType.java
  src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitor.java
  src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitee.java
  src/main/java/com/capitalone/dashboard/model/quality/JunitXmlReport.java
  src/main/java/com/capitalone/dashboard/model/quality/CheckstyleReport.java
  src/main/java/com/capitalone/dashboard/model/UserStory.java
  src/main/java/com/capitalone/dashboard/model/StandardWidget.java
  src/main/java/com/capitalone/dashboard/model/BuildStatus.java
  src/main/java/com/capitalone/dashboard/model/CloudVirtualNetwork.java
  src/main/java/com/capitalone/dashboard/model/EnvironmentStage.java
  src/main/java/com/capitalone/dashboard/model/RallyBurnDownData.java
  src/main/java/com/capitalone/dashboard/model/PerformanceMetricStatus.java
  src/main/java/com/capitalone/dashboard/model/LibraryPolicyType.java
  src/main/java/com/capitalone/dashboard/model/ScoreDisplayType.java
  src/main/java/com/capitalone/dashboard/model/RequestLog.java
  src/main/java/com/capitalone/dashboard/model/Configuration.java
  src/main/java/com/capitalone/dashboard/model/Collector.java
  src/main/java/com/capitalone/dashboard/model/NameValue.java
  src/main/java/com/capitalone/dashboard/model/CodeQuality.java
  src/main/java/com/capitalone/dashboard/model/CodeQualityMetricStatus.java
  src/main/java/com/capitalone/dashboard/model/RallyStoryStages.java
  src/main/java/com/capitalone/dashboard/model/TeamMember.java
  src/main/java/com/capitalone/dashboard/model/CollectorItem.java
  src/main/java/com/capitalone/dashboard/model/TeamLevelDetails.java
  src/main/java/com/capitalone/dashboard/model/LibraryPolicyResult.java
  src/main/java/com/capitalone/dashboard/model/Performance.java
  src/main/java/com/capitalone/dashboard/model/Component.java
  src/main/java/com/capitalone/dashboard/model/StoryIndicator.java
  src/main/java/com/capitalone/dashboard/model/PipelineStage.java
  src/main/java/com/capitalone/dashboard/model/Dashboard.java
  src/main/java/com/capitalone/dashboard/model/ServiceAccount.java
  src/main/java/com/capitalone/dashboard/model/Commit.java
  src/main/java/com/capitalone/dashboard/model/PipelineCommit.java
  src/main/java/com/capitalone/dashboard/model/TestSuiteType.java
  src/main/java/com/capitalone/dashboard/model/AuditResult.java
  src/main/java/com/capitalone/dashboard/model/CollectorItemConfigHistory.java
  src/main/java/com/capitalone/dashboard/model/PerformanceType.java
  src/main/java/com/capitalone/dashboard/model/Authentication.java
  src/main/java/com/capitalone/dashboard/model/CodeQualityType.java
  src/main/java/com/capitalone/dashboard/model/CloudInstance.java
  src/main/java/com/capitalone/dashboard/model/MaturityModel.java
  src/main/java/com/capitalone/dashboard/model/score/settings/ScoreTypeValue.java
  src/main/java/com/capitalone/dashboard/model/score/settings/ScoreComponentSettings.java
  src/main/java/com/capitalone/dashboard/model/score/settings/ScoreType.java
  src/main/java/com/capitalone/dashboard/model/score/settings/ScoreThresholdSettings.java
  src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteriaSettings.java
  src/main/java/com/capitalone/dashboard/model/score/settings/ScmScoreSettings.java
  src/main/java/com/capitalone/dashboard/model/score/settings/QualityScoreSettings.java
  src/main/java/com/capitalone/dashboard/model/score/settings/BuildScoreSettings.java
  src/main/java/com/capitalone/dashboard/model/score/settings/PropagateType.java
  src/main/java/com/capitalone/dashboard/model/score/settings/DeployScoreSettings.java
  src/main/java/com/capitalone/dashboard/model/score/settings/ComponentAlert.java
  src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteria.java
  src/main/java/com/capitalone/dashboard/model/score/ScoreCollectorItem.java
  src/main/java/com/capitalone/dashboard/model/score/ScoreValueType.java
  src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetric.java
  src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetricBase.java
  src/main/java/com/capitalone/dashboard/model/score/ScoreMetric.java
  src/main/java/com/capitalone/dashboard/model/UserInfo.java
  src/main/java/com/capitalone/dashboard/model/PolicyScanMetric.java
  src/main/java/com/capitalone/dashboard/model/Cmdb.java
  src/main/java/com/capitalone/dashboard/model/Comment.java
  src/main/java/com/capitalone/dashboard/model/EnvironmentComponent.java
  src/main/java/com/capitalone/dashboard/model/Service.java
  src/main/java/com/capitalone/dashboard/model/CloudInstanceHistory.java
  src/main/java/com/capitalone/dashboard/model/Monitor2.java
  src/main/java/com/capitalone/dashboard/model/ConfigHistOperationType.java
  src/main/java/com/capitalone/dashboard/model/SprintEstimate.java
  src/main/java/com/capitalone/dashboard/model/CommitStatus.java
  src/main/java/com/capitalone/dashboard/model/ServiceStatus.java
  src/main/java/com/capitalone/dashboard/model/CloudSubNetwork.java
  src/main/java/com/capitalone/dashboard/model/CloudVolumeStorage.java
  src/main/java/com/capitalone/dashboard/model/Owner.java
  src/main/java/com/capitalone/dashboard/model/AuditType.java
  src/main/java/com/capitalone/dashboard/model/EnvironmentStatus.java
  src/main/java/com/capitalone/dashboard/model/TestCaseCondition.java
  src/main/java/com/capitalone/dashboard/model/CollectorType.java
  src/main/java/com/capitalone/dashboard/model/ApiToken.java
  src/main/java/com/capitalone/dashboard/model/AuthType.java
  src/main/java/com/capitalone/dashboard/model/Template.java
  src/main/java/com/capitalone/dashboard/model/CommitType.java
  src/main/java/com/capitalone/dashboard/model/Incident.java
  src/main/java/com/capitalone/dashboard/model/BinaryArtifact.java
  src/main/java/com/capitalone/dashboard/model/SCM.java
  src/main/java/com/capitalone/dashboard/model/TestCapability.java
  src/main/java/com/capitalone/dashboard/model/KeyValueLog.java
  src/main/java/com/capitalone/dashboard/model/CollectionError.java
  src/main/java/com/capitalone/dashboard/model/RallyFeature.java
  src/main/java/com/capitalone/dashboard/model/Widget.java
  src/main/java/com/capitalone/dashboard/model/TestResult.java
  src/main/java/com/capitalone/dashboard/model/TeamInventory.java
  src/main/java/com/capitalone/dashboard/model/CodeQualityMetric.java
  src/main/java/com/capitalone/dashboard/model/ScopeOwnerCollectorItem.java
  src/main/java/com/capitalone/dashboard/model/TestCase.java
  src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatDisposition.java
  src/main/java/com/capitalone/dashboard/model/ArtifactIdentifier.java
  src/main/java/com/capitalone/dashboard/model/FeatureStatus.java
  src/main/java/com/capitalone/dashboard/model/package-info.java
  src/main/java/com/capitalone/dashboard/model/NameValueCount.java
  src/main/java/com/capitalone/dashboard/model/FeatureHistory.java
  src/main/java/com/capitalone/dashboard/model/TestSuite.java
  src/main/java/com/capitalone/dashboard/model/FortifyScanReport.java
  src/main/java/com/capitalone/dashboard/request/CloudVirtualNetworkListRefreshRequest.java
  src/main/java/com/capitalone/dashboard/request/CodeQualityCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/GitRequestCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/DeployDataCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/TestDataCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/PerformanceCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/CloudInstanceCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/CloudSubnetListRefreshRequest.java
  src/main/java/com/capitalone/dashboard/request/CloudVolumeCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/GenericCollectorItemCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/CloudSubnetCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/PerfTestDataCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/BinaryArtifactCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/ConfigurationCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/Monitor2DataCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/CommitCreateRequest.java
  src/main/java/com/capitalone/dashboard/request/CloudInstanceListRefreshRequest.java
  src/main/java/com/capitalone/dashboard/request/CloudVolumeListRefreshRequest.java
  src/main/java/com/capitalone/dashboard/request/BuildDataCreateRequest.java
  src/main/java/com/capitalone/dashboard/event/DashboardEventListener.java
  src/main/java/com/capitalone/dashboard/event/HygieiaMongoEventListener.java
  src/main/java/com/capitalone/dashboard/event/CodeQualityEventListener.java
  src/main/java/com/capitalone/dashboard/event/BuildEventListener.java
  src/main/java/com/capitalone/dashboard/event/RelatedCollectorItemEventListener.java
  src/main/java/com/capitalone/dashboard/event/EnvironmentComponentEventListener.java
  src/main/java/com/capitalone/dashboard/event/sync/SyncException.java
  src/main/java/com/capitalone/dashboard/event/sync/SyncDashboard.java
  src/main/java/com/capitalone/dashboard/event/TestResultEventListener.java
  src/main/java/com/capitalone/dashboard/event/CommitEventListener.java
  src/main/java/com/capitalone/dashboard/testutil/FongoConfig.java
  src/main/java/com/capitalone/dashboard/testutil/TestRestOperations.java
  src/main/java/com/capitalone/dashboard/testutil/TestRestTemplate.java
  src/main/java/com/capitalone/dashboard/testutil/GsonUtil.java
  src/main/java/com/capitalone/dashboard/testutil/BaseCollectorTestConfig.java
  src/main/java/com/capitalone/dashboard/testutil/TestResponse.java
  src/main/java/com/capitalone/dashboard/client/RestAuthType.java
  src/main/java/com/capitalone/dashboard/client/RestUserInfo.java
  src/main/java/com/capitalone/dashboard/client/RestClient.java

*****************************************************

*****************************************************
  Files with Apache License headers will be marked AL
  Binary files (which do not require any license headers) will be marked B
  Compressed archives will be marked A
  Notices, licenses etc. will be marked N
  N     LICENSE
  AL    pom.xml
 !????? MAINTAINERS
 !????? README.md
  N     site-content/LICENSE
 !????? site-content/pom.xml
 !????? site-content/pmd.xml
 !????? site-content/MAINTAINERS
 !????? site-content/README.md
  B     site-content/travis-utilities/keys.gpg.enc
 !????? site-content/travis-utilities/release.sh
 !????? site-content/travis-utilities/deploy-snapshot.sh
 !????? site-content/travis-utilities/.travis.settings.xml
 !????? site-content/checkstyle.xml
 !????? site-content/create_collector.md
 !????? site-content/.travis.yml
 !????? site-content/src/test/resources/artifacts/artifacts.json
 !????? site-content/src/test/resources/collectors/coll.json
 !????? site-content/src/test/resources/component/component.json
 !????? site-content/src/test/resources/builds/builds.json
 !????? site-content/src/test/resources/librarypolicy/librarypolicy.json
 !????? site-content/src/test/resources/dashboard/dashboard.json
 !????? site-content/src/test/resources/codequality/codequality.json
 !????? site-content/src/test/resources/test_results/test_results.json
 !????? site-content/src/test/resources/collector_items/items.json
 !????? site-content/src/test/resources/securityscan/securityscan.json
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/FongoBaseRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/CollectorTaskTests.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/CollectorItemRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/FongoConfig.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/TemplateRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/AuthenticationRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/FeatureRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/ScopeOwnerRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/DashboardCreateTests.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/TeamRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/repository/ScopeRepositoryTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/util/HygieiaUtilsTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/util/TestUtils.java
 !????? site-content/src/test/java/com/capitalone/dashboard/util/EncryptionTests.java
 !????? site-content/src/test/java/com/capitalone/dashboard/util/PipelineUtilsTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/util/DashboardUtilsTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/util/LoadTestData.java
 !????? site-content/src/test/java/com/capitalone/dashboard/util/GitBranchSpecTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskTwoWithGenericItem.java
 !????? site-content/src/test/java/com/capitalone/dashboard/collector/CollectorTaskTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItemTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskWithGenericItem.java
 !????? site-content/src/test/java/com/capitalone/dashboard/model/DashboardTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/model/LibraryPolicyResultTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/model/StandardWidgetTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/model/ComponentTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/event/EnvironmentComponentEventListenerTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/event/TestResultEventListenerTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/event/CommitEventListenerTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/event/BuildEventListenerTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/event/sync/SyncDashboardTest.java
 !????? site-content/src/test/java/com/capitalone/dashboard/MarkdownTest.java
 !????? site-content/src/main/resources/logback.xml
 !????? site-content/src/main/java/com/capitalone/dashboard/misc/HygieiaException.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/AuditResultRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CollectorItemRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ChangeOrderRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/RequestLogRepository.java
  AL    site-content/src/main/java/com/capitalone/dashboard/repository/FeatureRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryCustom.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/EnvironmentComponentRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/GitHubRepoRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/AuthenticationRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/GenericCollectorItemRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/RallyBurnDownRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CloudVolumeRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/BuildRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ApiTokenRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQuery.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CloudInstanceHistoryRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/FortifyScanRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/IncidentRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/JobRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/LibraryPolicyResultsRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryImpl.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ServiceAccountRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ScopeRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ScoreCriteriaSettingsRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CloudSubNetworkRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CollItemConfigHistoryRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/BaseCollectorItemRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/TeamRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CodeQualityRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryImpl.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryCustom.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/DashboardRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/TemplateRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ScoreRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CloudInstanceRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CmdbRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CloudVirtualNetworkRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ScoreCollectorItemRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/UserInfoRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ScopeOwnerRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/Monitor2Repository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/PipelineRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ConfigurationRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/RallyFeatureRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CommitRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CodeReposBuildsRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/MaturityModelRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/RepositoryPackage.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/EnvironmentStatusRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/TeamInventoryRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/PerformanceRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CollectorRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/ServiceRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/GitRequestRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/BaseCollectorRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQueryImpl.java
 !????? site-content/src/main/java/com/capitalone/dashboard/repository/TestResultRepository.java
 !????? site-content/src/main/java/com/capitalone/dashboard/response/BuildDataCreateResponse.java
 !????? site-content/src/main/java/com/capitalone/dashboard/response/CloudVolumeAggregatedResponse.java
 !????? site-content/src/main/java/com/capitalone/dashboard/response/CloudVirtualNetworkAggregatedResponse.java
 !????? site-content/src/main/java/com/capitalone/dashboard/response/RallyBurnDownResponse.java
 !????? site-content/src/main/java/com/capitalone/dashboard/response/CloudSubNetworkAggregatedResponse.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/PipelineUtils.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/EncryptionException.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/FeatureCollectorConstants.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/CoreFeatureSettings.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/Supplier.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/HygieiaUtils.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/SuperFeatureComparator.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/Encryption.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/DashboardUtils.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/GitHubParsedUrl.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/GitBranchSpec.java
 !????? site-content/src/main/java/com/capitalone/dashboard/util/UnsafeDeleteException.java
 !????? site-content/src/main/java/com/capitalone/dashboard/config/CollectorConfig.java
 !????? site-content/src/main/java/com/capitalone/dashboard/config/collector/CloudConfig.java
 !????? site-content/src/main/java/com/capitalone/dashboard/config/MongoConfig.java
 !????? site-content/src/main/java/com/capitalone/dashboard/collector/CollectorTask.java
 !????? site-content/src/main/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItem.java
 !????? site-content/src/main/java/com/capitalone/dashboard/collector/RestOperationsSupplier.java
 !????? site-content/src/main/java/com/capitalone/dashboard/status/LibraryPolicyAuditStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/status/CodeReviewAuditStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/status/CodeQualityAuditStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/status/ArtifactAuditStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/status/TestResultAuditStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/status/PerformanceTestAuditStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/status/BuildAuditStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/status/DashboardAuditStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/JobCollectorItem.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubRepo.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubParsed.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/MergeEvent.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/RallyFeatureType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/BaseModel.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Build.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestCaseStep.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/GitRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/DashboardType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Pipeline.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/GenericCollectorItem.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/UserRole.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Stage.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Team.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestCaseStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/relation/RelatedCollectorItem.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ChangeOrder.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/FeatureIssueLink.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/PipelineStageType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestCaseConditionResult.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Review.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Application.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ScopeOwner.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/PerformanceMetric.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatLevel.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CodeReposBuilds.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/RepoBranch.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/quality/FindBugsXmlReport.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/quality/PmdReport.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/quality/JacocoXmlReport.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/quality/ArtifactType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitor.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitee.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/quality/JunitXmlReport.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/quality/CheckstyleReport.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/UserStory.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/StandardWidget.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/BuildStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CloudVirtualNetwork.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentStage.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/RallyBurnDownData.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/PerformanceMetricStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ScoreDisplayType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/RequestLog.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Configuration.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Collector.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/NameValue.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CodeQuality.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityMetricStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/RallyStoryStages.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TeamMember.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CollectorItem.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TeamLevelDetails.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyResult.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Performance.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Component.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/StoryIndicator.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/PipelineStage.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Dashboard.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ServiceAccount.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Commit.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/PipelineCommit.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestSuiteType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/AuditResult.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CollectorItemConfigHistory.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/PerformanceType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Authentication.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CloudInstance.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/MaturityModel.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreTypeValue.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreComponentSettings.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreThresholdSettings.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteriaSettings.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScmScoreSettings.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/QualityScoreSettings.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/BuildScoreSettings.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/PropagateType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/DeployScoreSettings.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ComponentAlert.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteria.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreCollectorItem.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreValueType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetric.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetricBase.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreMetric.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/UserInfo.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/PolicyScanMetric.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Cmdb.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Comment.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentComponent.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Service.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CloudInstanceHistory.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Monitor2.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ConfigHistOperationType.java
  AL    site-content/src/main/java/com/capitalone/dashboard/model/Scope.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/SprintEstimate.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CommitStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ServiceStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CloudSubNetwork.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CloudVolumeStorage.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Owner.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/AuditType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentStatus.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestCaseCondition.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CollectorType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ApiToken.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/AuthType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Template.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CommitType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Incident.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/BinaryArtifact.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/SCM.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestCapability.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/KeyValueLog.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CollectionError.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/RallyFeature.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/Widget.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestResult.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TeamInventory.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityMetric.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ScopeOwnerCollectorItem.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestCase.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatDisposition.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/ArtifactIdentifier.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/FeatureStatus.java
  AL    site-content/src/main/java/com/capitalone/dashboard/model/Feature.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/package-info.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/NameValueCount.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/FeatureHistory.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/TestSuite.java
 !????? site-content/src/main/java/com/capitalone/dashboard/model/FortifyScanReport.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CloudVirtualNetworkListRefreshRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CodeQualityCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/GitRequestCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/DeployDataCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/TestDataCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/PerformanceCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CloudInstanceCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CloudSubnetListRefreshRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CloudVolumeCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/GenericCollectorItemCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CloudSubnetCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/PerfTestDataCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/BinaryArtifactCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/ConfigurationCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/Monitor2DataCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CommitCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CloudInstanceListRefreshRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/CloudVolumeListRefreshRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/request/BuildDataCreateRequest.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/DashboardEventListener.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/HygieiaMongoEventListener.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/CodeQualityEventListener.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/BuildEventListener.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/RelatedCollectorItemEventListener.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/EnvironmentComponentEventListener.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/sync/SyncException.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/sync/SyncDashboard.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/TestResultEventListener.java
 !????? site-content/src/main/java/com/capitalone/dashboard/event/CommitEventListener.java
 !????? site-content/src/main/java/com/capitalone/dashboard/testutil/FongoConfig.java
 !????? site-content/src/main/java/com/capitalone/dashboard/testutil/TestRestOperations.java
 !????? site-content/src/main/java/com/capitalone/dashboard/testutil/TestRestTemplate.java
 !????? site-content/src/main/java/com/capitalone/dashboard/testutil/GsonUtil.java
 !????? site-content/src/main/java/com/capitalone/dashboard/testutil/BaseCollectorTestConfig.java
 !????? site-content/src/main/java/com/capitalone/dashboard/testutil/TestResponse.java
 !????? site-content/src/main/java/com/capitalone/dashboard/client/RestAuthType.java
 !????? site-content/src/main/java/com/capitalone/dashboard/client/RestUserInfo.java
 !????? site-content/src/main/java/com/capitalone/dashboard/client/RestClient.java
 !????? create_collector.md
 !????? .travis.yml
  B     src/devops/keys.gpg.enc
 !????? src/devops/pmd.xml
  AL    src/devops/checkstyle-suppressions.xml
  AL    src/devops/checkstyle.xml
 !????? src/devops/release.sh
 !????? src/devops/deploy-snapshot.sh
 !????? src/devops/.travis.settings.xml
 !????? src/test/resources/artifacts/artifacts.json
 !????? src/test/resources/collectors/coll.json
 !????? src/test/resources/component/component.json
 !????? src/test/resources/builds/builds.json
 !????? src/test/resources/librarypolicy/librarypolicy.json
 !????? src/test/resources/dashboard/dashboard.json
 !????? src/test/resources/codequality/codequality.json
 !????? src/test/resources/test_results/test_results.json
 !????? src/test/resources/collector_items/items.json
 !????? src/test/resources/securityscan/securityscan.json
 !????? src/test/java/com/capitalone/dashboard/repository/FongoBaseRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/repository/CollectorTaskTests.java
 !????? src/test/java/com/capitalone/dashboard/repository/CollectorItemRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/repository/FongoConfig.java
 !????? src/test/java/com/capitalone/dashboard/repository/TemplateRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/repository/AuthenticationRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/repository/FeatureRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/repository/ScopeOwnerRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/repository/DashboardCreateTests.java
 !????? src/test/java/com/capitalone/dashboard/repository/TeamRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/repository/ScopeRepositoryTest.java
 !????? src/test/java/com/capitalone/dashboard/util/HygieiaUtilsTest.java
 !????? src/test/java/com/capitalone/dashboard/util/TestUtils.java
 !????? src/test/java/com/capitalone/dashboard/util/EncryptionTests.java
 !????? src/test/java/com/capitalone/dashboard/util/PipelineUtilsTest.java
 !????? src/test/java/com/capitalone/dashboard/util/DashboardUtilsTest.java
 !????? src/test/java/com/capitalone/dashboard/util/LoadTestData.java
 !????? src/test/java/com/capitalone/dashboard/util/GitBranchSpecTest.java
 !????? src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskTwoWithGenericItem.java
 !????? src/test/java/com/capitalone/dashboard/collector/CollectorTaskTest.java
 !????? src/test/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItemTest.java
 !????? src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskWithGenericItem.java
 !????? src/test/java/com/capitalone/dashboard/model/DashboardTest.java
 !????? src/test/java/com/capitalone/dashboard/model/LibraryPolicyResultTest.java
 !????? src/test/java/com/capitalone/dashboard/model/StandardWidgetTest.java
 !????? src/test/java/com/capitalone/dashboard/model/ComponentTest.java
 !????? src/test/java/com/capitalone/dashboard/event/EnvironmentComponentEventListenerTest.java
 !????? src/test/java/com/capitalone/dashboard/event/TestResultEventListenerTest.java
 !????? src/test/java/com/capitalone/dashboard/event/CommitEventListenerTest.java
 !????? src/test/java/com/capitalone/dashboard/event/BuildEventListenerTest.java
 !????? src/test/java/com/capitalone/dashboard/event/sync/SyncDashboardTest.java
 !????? src/test/java/com/capitalone/dashboard/MarkdownTest.java
  AL    src/changes/changes.xml
  AL    src/site/xdoc/index.xml
  AL    src/site/site.xml
 !????? src/main/resources/logback.xml
 !????? src/main/java/com/capitalone/dashboard/misc/HygieiaException.java
 !????? src/main/java/com/capitalone/dashboard/repository/AuditResultRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CollectorItemRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ChangeOrderRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/RequestLogRepository.java
  AL    src/main/java/com/capitalone/dashboard/repository/FeatureRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryCustom.java
 !????? src/main/java/com/capitalone/dashboard/repository/EnvironmentComponentRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/GitHubRepoRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/AuthenticationRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/GenericCollectorItemRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/RallyBurnDownRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CloudVolumeRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/BuildRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ApiTokenRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQuery.java
 !????? src/main/java/com/capitalone/dashboard/repository/CloudInstanceHistoryRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/FortifyScanRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/IncidentRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/JobRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/LibraryPolicyResultsRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryImpl.java
 !????? src/main/java/com/capitalone/dashboard/repository/ServiceAccountRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ScopeRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ScoreCriteriaSettingsRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CloudSubNetworkRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CollItemConfigHistoryRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/BaseCollectorItemRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/TeamRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CodeQualityRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryImpl.java
 !????? src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryCustom.java
 !????? src/main/java/com/capitalone/dashboard/repository/DashboardRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/TemplateRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ScoreRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CloudInstanceRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CmdbRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CloudVirtualNetworkRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ScoreCollectorItemRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/UserInfoRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ScopeOwnerRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/Monitor2Repository.java
 !????? src/main/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/PipelineRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ConfigurationRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/RallyFeatureRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CommitRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CodeReposBuildsRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/MaturityModelRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/RepositoryPackage.java
 !????? src/main/java/com/capitalone/dashboard/repository/EnvironmentStatusRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/TeamInventoryRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/PerformanceRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CollectorRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/ServiceRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/GitRequestRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/BaseCollectorRepository.java
 !????? src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQueryImpl.java
 !????? src/main/java/com/capitalone/dashboard/repository/TestResultRepository.java
 !????? src/main/java/com/capitalone/dashboard/response/BuildDataCreateResponse.java
 !????? src/main/java/com/capitalone/dashboard/response/CloudVolumeAggregatedResponse.java
 !????? src/main/java/com/capitalone/dashboard/response/CloudVirtualNetworkAggregatedResponse.java
 !????? src/main/java/com/capitalone/dashboard/response/RallyBurnDownResponse.java
 !????? src/main/java/com/capitalone/dashboard/response/CloudSubNetworkAggregatedResponse.java
 !????? src/main/java/com/capitalone/dashboard/util/PipelineUtils.java
 !????? src/main/java/com/capitalone/dashboard/util/EncryptionException.java
 !????? src/main/java/com/capitalone/dashboard/util/FeatureCollectorConstants.java
 !????? src/main/java/com/capitalone/dashboard/util/CoreFeatureSettings.java
 !????? src/main/java/com/capitalone/dashboard/util/Supplier.java
 !????? src/main/java/com/capitalone/dashboard/util/HygieiaUtils.java
 !????? src/main/java/com/capitalone/dashboard/util/SuperFeatureComparator.java
 !????? src/main/java/com/capitalone/dashboard/util/Encryption.java
 !????? src/main/java/com/capitalone/dashboard/util/DashboardUtils.java
 !????? src/main/java/com/capitalone/dashboard/util/GitHubParsedUrl.java
 !????? src/main/java/com/capitalone/dashboard/util/GitBranchSpec.java
 !????? src/main/java/com/capitalone/dashboard/util/UnsafeDeleteException.java
 !????? src/main/java/com/capitalone/dashboard/config/CollectorConfig.java
 !????? src/main/java/com/capitalone/dashboard/config/collector/CloudConfig.java
 !????? src/main/java/com/capitalone/dashboard/config/MongoConfig.java
 !????? src/main/java/com/capitalone/dashboard/collector/CollectorTask.java
 !????? src/main/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItem.java
 !????? src/main/java/com/capitalone/dashboard/collector/RestOperationsSupplier.java
 !????? src/main/java/com/capitalone/dashboard/status/LibraryPolicyAuditStatus.java
 !????? src/main/java/com/capitalone/dashboard/status/CodeReviewAuditStatus.java
 !????? src/main/java/com/capitalone/dashboard/status/CodeQualityAuditStatus.java
 !????? src/main/java/com/capitalone/dashboard/status/ArtifactAuditStatus.java
 !????? src/main/java/com/capitalone/dashboard/status/TestResultAuditStatus.java
 !????? src/main/java/com/capitalone/dashboard/status/PerformanceTestAuditStatus.java
 !????? src/main/java/com/capitalone/dashboard/status/BuildAuditStatus.java
 !????? src/main/java/com/capitalone/dashboard/status/DashboardAuditStatus.java
 !????? src/main/java/com/capitalone/dashboard/model/JobCollectorItem.java
 !????? src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubRepo.java
 !????? src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubParsed.java
 !????? src/main/java/com/capitalone/dashboard/model/webhook/github/MergeEvent.java
 !????? src/main/java/com/capitalone/dashboard/model/RallyFeatureType.java
 !????? src/main/java/com/capitalone/dashboard/model/BaseModel.java
 !????? src/main/java/com/capitalone/dashboard/model/Build.java
 !????? src/main/java/com/capitalone/dashboard/model/TestCaseStep.java
 !????? src/main/java/com/capitalone/dashboard/model/GitRequest.java
 !????? src/main/java/com/capitalone/dashboard/model/DashboardType.java
 !????? src/main/java/com/capitalone/dashboard/model/Pipeline.java
 !????? src/main/java/com/capitalone/dashboard/model/GenericCollectorItem.java
 !????? src/main/java/com/capitalone/dashboard/model/UserRole.java
 !????? src/main/java/com/capitalone/dashboard/model/Stage.java
 !????? src/main/java/com/capitalone/dashboard/model/Team.java
 !????? src/main/java/com/capitalone/dashboard/model/TestCaseStatus.java
 !????? src/main/java/com/capitalone/dashboard/model/relation/RelatedCollectorItem.java
 !????? src/main/java/com/capitalone/dashboard/model/ChangeOrder.java
 !????? src/main/java/com/capitalone/dashboard/model/FeatureIssueLink.java
 !????? src/main/java/com/capitalone/dashboard/model/PipelineStageType.java
 !????? src/main/java/com/capitalone/dashboard/model/TestCaseConditionResult.java
 !????? src/main/java/com/capitalone/dashboard/model/Review.java
 !????? src/main/java/com/capitalone/dashboard/model/Application.java
 !????? src/main/java/com/capitalone/dashboard/model/ScopeOwner.java
 !????? src/main/java/com/capitalone/dashboard/model/PerformanceMetric.java
 !????? src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatLevel.java
 !????? src/main/java/com/capitalone/dashboard/model/CodeReposBuilds.java
 !????? src/main/java/com/capitalone/dashboard/model/RepoBranch.java
 !????? src/main/java/com/capitalone/dashboard/model/quality/FindBugsXmlReport.java
 !????? src/main/java/com/capitalone/dashboard/model/quality/PmdReport.java
 !????? src/main/java/com/capitalone/dashboard/model/quality/JacocoXmlReport.java
 !????? src/main/java/com/capitalone/dashboard/model/quality/ArtifactType.java
 !????? src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitor.java
 !????? src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitee.java
 !????? src/main/java/com/capitalone/dashboard/model/quality/JunitXmlReport.java
 !????? src/main/java/com/capitalone/dashboard/model/quality/CheckstyleReport.java
 !????? src/main/java/com/capitalone/dashboard/model/UserStory.java
 !????? src/main/java/com/capitalone/dashboard/model/StandardWidget.java
 !????? src/main/java/com/capitalone/dashboard/model/BuildStatus.java
 !????? src/main/java/com/capitalone/dashboard/model/CloudVirtualNetwork.java
 !????? src/main/java/com/capitalone/dashboard/model/EnvironmentStage.java
 !????? src/main/java/com/capitalone/dashboard/model/RallyBurnDownData.java
 !????? src/main/java/com/capitalone/dashboard/model/PerformanceMetricStatus.java
 !????? src/main/java/com/capitalone/dashboard/model/LibraryPolicyType.java
 !????? src/main/java/com/capitalone/dashboard/model/ScoreDisplayType.java
 !????? src/main/java/com/capitalone/dashboard/model/RequestLog.java
 !????? src/main/java/com/capitalone/dashboard/model/Configuration.java
 !????? src/main/java/com/capitalone/dashboard/model/Collector.java
 !????? src/main/java/com/capitalone/dashboard/model/NameValue.java
 !????? src/main/java/com/capitalone/dashboard/model/CodeQuality.java
 !????? src/main/java/com/capitalone/dashboard/model/CodeQualityMetricStatus.java
 !????? src/main/java/com/capitalone/dashboard/model/RallyStoryStages.java
 !????? src/main/java/com/capitalone/dashboard/model/TeamMember.java
 !????? src/main/java/com/capitalone/dashboard/model/CollectorItem.java
 !????? src/main/java/com/capitalone/dashboard/model/TeamLevelDetails.java
 !????? src/main/java/com/capitalone/dashboard/model/LibraryPolicyResult.java
 !????? src/main/java/com/capitalone/dashboard/model/Performance.java
 !????? src/main/java/com/capitalone/dashboard/model/Component.java
 !????? src/main/java/com/capitalone/dashboard/model/StoryIndicator.java
 !????? src/main/java/com/capitalone/dashboard/model/PipelineStage.java
 !????? src/main/java/com/capitalone/dashboard/model/Dashboard.java
 !????? src/main/java/com/capitalone/dashboard/model/ServiceAccount.java
 !????? src/main/java/com/capitalone/dashboard/model/Commit.java
 !????? src/main/java/com/capitalone/dashboard/model/PipelineCommit.java
 !????? src/main/java/com/capitalone/dashboard/model/TestSuiteType.java
 !????? src/main/java/com/capitalone/dashboard/model/AuditResult.java
 !????? src/main/java/com/capitalone/dashboard/model/CollectorItemConfigHistory.java
 !????? src/main/java/com/capitalone/dashboard/model/PerformanceType.java
 !????? src/main/java/com/capitalone/dashboard/model/Authentication.java
 !????? src/main/java/com/capitalone/dashboard/model/CodeQualityType.java
 !????? src/main/java/com/capitalone/dashboard/model/CloudInstance.java
 !????? src/main/java/com/capitalone/dashboard/model/MaturityModel.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/ScoreTypeValue.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/ScoreComponentSettings.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/ScoreType.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/ScoreThresholdSettings.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteriaSettings.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/ScmScoreSettings.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/QualityScoreSettings.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/BuildScoreSettings.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/PropagateType.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/DeployScoreSettings.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/ComponentAlert.java
 !????? src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteria.java
 !????? src/main/java/com/capitalone/dashboard/model/score/ScoreCollectorItem.java
 !????? src/main/java/com/capitalone/dashboard/model/score/ScoreValueType.java
 !????? src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetric.java
 !????? src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetricBase.java
 !????? src/main/java/com/capitalone/dashboard/model/score/ScoreMetric.java
 !????? src/main/java/com/capitalone/dashboard/model/UserInfo.java
 !????? src/main/java/com/capitalone/dashboard/model/PolicyScanMetric.java
 !????? src/main/java/com/capitalone/dashboard/model/Cmdb.java
 !????? src/main/java/com/capitalone/dashboard/model/Comment.java
 !????? src/main/java/com/capitalone/dashboard/model/EnvironmentComponent.java
 !????? src/main/java/com/capitalone/dashboard/model/Service.java
 !????? src/main/java/com/capitalone/dashboard/model/CloudInstanceHistory.java
 !????? src/main/java/com/capitalone/dashboard/model/Monitor2.java
 !????? src/main/java/com/capitalone/dashboard/model/ConfigHistOperationType.java
  AL    src/main/java/com/capitalone/dashboard/model/Scope.java
 !????? src/main/java/com/capitalone/dashboard/model/SprintEstimate.java
 !????? src/main/java/com/capitalone/dashboard/model/CommitStatus.java
 !????? src/main/java/com/capitalone/dashboard/model/ServiceStatus.java
 !????? src/main/java/com/capitalone/dashboard/model/CloudSubNetwork.java
 !????? src/main/java/com/capitalone/dashboard/model/CloudVolumeStorage.java
 !????? src/main/java/com/capitalone/dashboard/model/Owner.java
 !????? src/main/java/com/capitalone/dashboard/model/AuditType.java
 !????? src/main/java/com/capitalone/dashboard/model/EnvironmentStatus.java
 !????? src/main/java/com/capitalone/dashboard/model/TestCaseCondition.java
 !????? src/main/java/com/capitalone/dashboard/model/CollectorType.java
 !????? src/main/java/com/capitalone/dashboard/model/ApiToken.java
 !????? src/main/java/com/capitalone/dashboard/model/AuthType.java
 !????? src/main/java/com/capitalone/dashboard/model/Template.java
 !????? src/main/java/com/capitalone/dashboard/model/CommitType.java
 !????? src/main/java/com/capitalone/dashboard/model/Incident.java
 !????? src/main/java/com/capitalone/dashboard/model/BinaryArtifact.java
 !????? src/main/java/com/capitalone/dashboard/model/SCM.java
 !????? src/main/java/com/capitalone/dashboard/model/TestCapability.java
 !????? src/main/java/com/capitalone/dashboard/model/KeyValueLog.java
 !????? src/main/java/com/capitalone/dashboard/model/CollectionError.java
 !????? src/main/java/com/capitalone/dashboard/model/RallyFeature.java
 !????? src/main/java/com/capitalone/dashboard/model/Widget.java
 !????? src/main/java/com/capitalone/dashboard/model/TestResult.java
 !????? src/main/java/com/capitalone/dashboard/model/TeamInventory.java
 !????? src/main/java/com/capitalone/dashboard/model/CodeQualityMetric.java
 !????? src/main/java/com/capitalone/dashboard/model/ScopeOwnerCollectorItem.java
 !????? src/main/java/com/capitalone/dashboard/model/TestCase.java
 !????? src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatDisposition.java
 !????? src/main/java/com/capitalone/dashboard/model/ArtifactIdentifier.java
 !????? src/main/java/com/capitalone/dashboard/model/FeatureStatus.java
  AL    src/main/java/com/capitalone/dashboard/model/Feature.java
 !????? src/main/java/com/capitalone/dashboard/model/package-info.java
 !????? src/main/java/com/capitalone/dashboard/model/NameValueCount.java
 !????? src/main/java/com/capitalone/dashboard/model/FeatureHistory.java
 !????? src/main/java/com/capitalone/dashboard/model/TestSuite.java
 !????? src/main/java/com/capitalone/dashboard/model/FortifyScanReport.java
 !????? src/main/java/com/capitalone/dashboard/request/CloudVirtualNetworkListRefreshRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/CodeQualityCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/GitRequestCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/DeployDataCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/TestDataCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/PerformanceCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/CloudInstanceCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/CloudSubnetListRefreshRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/CloudVolumeCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/GenericCollectorItemCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/CloudSubnetCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/PerfTestDataCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/BinaryArtifactCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/ConfigurationCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/Monitor2DataCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/CommitCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/CloudInstanceListRefreshRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/CloudVolumeListRefreshRequest.java
 !????? src/main/java/com/capitalone/dashboard/request/BuildDataCreateRequest.java
 !????? src/main/java/com/capitalone/dashboard/event/DashboardEventListener.java
 !????? src/main/java/com/capitalone/dashboard/event/HygieiaMongoEventListener.java
 !????? src/main/java/com/capitalone/dashboard/event/CodeQualityEventListener.java
 !????? src/main/java/com/capitalone/dashboard/event/BuildEventListener.java
 !????? src/main/java/com/capitalone/dashboard/event/RelatedCollectorItemEventListener.java
 !????? src/main/java/com/capitalone/dashboard/event/EnvironmentComponentEventListener.java
 !????? src/main/java/com/capitalone/dashboard/event/sync/SyncException.java
 !????? src/main/java/com/capitalone/dashboard/event/sync/SyncDashboard.java
 !????? src/main/java/com/capitalone/dashboard/event/TestResultEventListener.java
 !????? src/main/java/com/capitalone/dashboard/event/CommitEventListener.java
 !????? src/main/java/com/capitalone/dashboard/testutil/FongoConfig.java
 !????? src/main/java/com/capitalone/dashboard/testutil/TestRestOperations.java
 !????? src/main/java/com/capitalone/dashboard/testutil/TestRestTemplate.java
 !????? src/main/java/com/capitalone/dashboard/testutil/GsonUtil.java
 !????? src/main/java/com/capitalone/dashboard/testutil/BaseCollectorTestConfig.java
 !????? src/main/java/com/capitalone/dashboard/testutil/TestResponse.java
 !????? src/main/java/com/capitalone/dashboard/client/RestAuthType.java
 !????? src/main/java/com/capitalone/dashboard/client/RestUserInfo.java
 !????? src/main/java/com/capitalone/dashboard/client/RestClient.java
 
*****************************************************

 Printing headers for text files without a valid license header...
 
=====================================================
== File: MAINTAINERS
=====================================================
amitmawkin
tabladrum
mrpudn
satishc1

=====================================================
== File: README.md
=====================================================
The README is in the [gh-pages](https://github.com/capitalone/Hygieia/blob/gh-pages/pages/hygieia/core/core.md) branch. Please update it there.

=====================================================
== File: site-content/pom.xml
=====================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.capitalone.dashboard</groupId>
    <artifactId>core</artifactId>
    <packaging>jar</packaging>
    <version>3.1.1-SNAPSHOT</version>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>Core package shared by API layer and Microservices</description>
    <url>https://github.com/capitalone/Hygieia</url>

    <properties>
        <guava.version>16.0.1</guava.version>
        <hamcrest.version>1.3</hamcrest.version>
        <jacoco.version>0.7.6.201602180812</jacoco.version>
        <joda-time.version>2.7</joda-time.version>
        <joda-convert.version>1.8.1</joda-convert.version>
        <jackson.version>2.5.0</jackson.version>
        <junit.version>4.11</junit.version>
        <mongo>3.0.2</mongo>
        <mongodb.version>3.0.2</mongodb.version>
        <pmd.version>3.6</pmd.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.version>4.1.7.RELEASE</spring.version>
        <spring.data.version>1.8.0.RELEASE</spring.data.version>
        <spring-data-releasetrain.version>Gosling-RELEASE</spring-data-releasetrain.version>
        <spring.version>4.2.5.RELEASE</spring.version>
        <spring.cloud.version>1.3.1.RELEASE</spring.cloud.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.0.RELEASE</version>
    </parent>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <plugins>

=====================================================
== File: site-content/pmd.xml
=====================================================
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
    xmlns="http://pmd.sf.net/ruleset/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
  <description>
  Exclude noisy rules.
  </description>

  <rule ref="rulesets/internal/all-java.xml">
    <exclude name="AbstractNaming"/>
    <exclude name="AddEmptyString"/>
    <exclude name="AppendCharacterWithChar"/>
    <exclude name="ArrayIsStoredDirectly"/>
    <exclude name="AssignmentInOperand"/>
    <exclude name="AtLeastOneConstructor"/>
    <exclude name="AvoidCatchingGenericException"/>
    <exclude name="AvoidDuplicateLiterals"/>
    <exclude name="AvoidFieldNameMatchingMethodName"/>
    <exclude name="AvoidFinalLocalVariable"/>
    <exclude name="AvoidInstantiatingObjectsInLoops"/>
    <exclude name="AvoidLiteralsInIfCondition"/>
    <exclude name="AvoidPrefixingMethodParameters"/>
    <exclude name="AvoidSynchronizedAtMethodLevel"/>
    <exclude name="AvoidThrowingNullPointerException"/>
    <exclude name="AvoidThrowingRawExceptionTypes"/>
    <exclude name="AvoidUsingShortType"/>
    <exclude name="BeanMembersShouldSerialize"/>
    <exclude name="CallSuperInConstructor"/>
    <exclude name="CommentRequired"/>
    <exclude name="CommentSize"/>
    <exclude name="CompareObjectsWithEquals"/>
    <exclude name="ConfusingTernary"/>
    <exclude name="CyclomaticComplexity"/>
    <exclude name="DataflowAnomalyAnalysis"/>
    <exclude name="DefaultPackage"/>
    <exclude name="DoNotUseThreads"/>
    <exclude name="DuplicateImports"/>
    <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
    <exclude name="ExcessiveImports"/>
    <exclude name="ExcessivePublicCount"/>
    <exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
    <exclude name="ForLoopsMustUseBraces"/>
    <exclude name="GodClass"/>
    <exclude name="GuardDebugLogging"/>
    <exclude name="GuardLogStatement"/>
    <exclude name="GuardLogStatementJavaUtil"/>
    <exclude name="IfStmtsMustUseBraces"/>
    <exclude name="ImmutableField"/>

=====================================================
== File: site-content/MAINTAINERS
=====================================================
amitmawkin
tabladrum
mrpudn
satishc1

=====================================================
== File: site-content/README.md
=====================================================
The README is in the [gh-pages](https://github.com/capitalone/Hygieia/blob/gh-pages/pages/hygieia/core/core.md) branch. Please update it there.

=====================================================
== File: site-content/travis-utilities/release.sh
=====================================================
#!/bin/bash

cp travis-utilities/.travis.settings.xml $HOME/.m2/settings.xml

openssl aes-256-cbc -K $encrypted_00b218189f3e_key -iv $encrypted_00b218189f3e_iv -in travis-utilities/keys.gpg.enc -out keys.gpg -d

gpg --fast-import keys.gpg

shred keys.gpg

sed -i 's|-SNAPSHOT||g' pom.xml

mvn deploy -q -P release

=====================================================
== File: site-content/travis-utilities/deploy-snapshot.sh
=====================================================
#!/bin/bash

cp travis-utilities/.travis.settings.xml $HOME/.m2/settings.xml

mvn deploy -q

=====================================================
== File: site-content/travis-utilities/.travis.settings.xml
=====================================================
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <servers>
    <server>
      <id>ossrh</id>
      <username>${env.OSSRH_USERNAME}</username>
      <password>${env.OSSRH_PASSWORD}</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>release</id>
      <properties>
        <gpg.keyname>${env.GPG_KEYNAME}</gpg.keyname>
        <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
      </properties>
    </profile>
  </profiles>
</settings>

=====================================================
== File: site-content/checkstyle.xml
=====================================================
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">

    <!-- Checks that a package-info.java file exists for each package.     -->
    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
    <!--
    <module name="JavadocPackage">
      <property name="allowLegacy" value="true"/>
    </module>
    -->

    <!-- Checks whether files end with a new line.                        -->
    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
    <module name="NewlineAtEndOfFile"/>

    <!-- Checks that property files contain the same keys.         -->
    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
    <module name="Translation"/>

    <!-- Checks for Size Violations.                    -->
    <!-- See http://checkstyle.sf.net/config_sizes.html -->
    <module name="FileLength"/>

    <!-- Checks for whitespace                               -->
    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
    <module name="FileTabCharacter"/>

    <!-- Miscellaneous other checks.                   -->
    <!-- See http://checkstyle.sf.net/config_misc.html -->
<!--
    <module name="RegexpSingleline">
       <property name="format" value="\s+$"/>
       <property name="minimum" value="0"/>
       <property name="maximum" value="0"/>
       <property name="message" value="Line has trailing spaces."/>
       <property name="severity" value="info"/>
    </module>
-->

    <module name="TreeWalker">

        <!-- Checks for Javadoc comments.                     -->
        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
        <!--
        <module name="JavadocMethod">
          <property name="scope" value="package"/>

=====================================================
== File: site-content/create_collector.md
=====================================================
Create New Collector
==================================================

Copy skeleton collector project
--------------------------------------
Copy the sample collector project into a new directory in the collectors folder and give it a name to match the collector
you are building (eg pivotalTracker). In the pom.xml file, change the artifactId, name and optionally the groupId elements, like so:

    <project>
        <groupId>com.capitalone.dashboard</groupId>
        <artifactId>pivotal-tracker-collector</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <name>Pivotal Tracker Collector</name>

        ...
    </project>

The pom file includes all of the dependencies you will need to interact with the Dashboard Application MongoDB instance,
such as Model classes and Repositories.

Extending Collector
--------------------------------------

If you need to store extra configuration for your collector, you can create a class that extends Collector and add new
fields to store configuration information that is specific to your collector.

    package com.capitalone.dashboard.collector;

    import com.capitalone.dashboard.model.Collector;

    /**
     * Collect Features from PivotalTracker
     */
    public class PivotalTrackerCollector extends Collector {
        private String apiToken;

        public String getApiToken() {
            return apiToken;
        }

        public void setApiToken(String apiToken) {
            this.apiToken = apiToken;
        }
    }

If you decide to take this approach, you will also need to create a Spring Data repository interface that extends from
BaseCollectorRepository.

    package com.capitalone.dashboard.repository;


=====================================================
== File: site-content/.travis.yml
=====================================================
language: java
jdk:
  - openjdk8

branches:
  only:
    - master
    - gerrit-integration
    - "/^v[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+.*$/"

cache:
  directories:
    - "$TRAVIS_BUILD_DIR/UI/node_modules"

install: true

before_script:
  - sudo chown -R $USER:$GROUP $TRAVIS_BUILD_DIR

script:
  - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mvn clean install -q; fi
  - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then cp ./travis-utilities/deploy-snapshot.sh . && ./deploy-snapshot.sh; fi
  - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [[ "$TRAVIS_BRANCH" =~ ^v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then cp ./travis-utilities/release.sh . && ./release.sh; fi

notifications:
  webhooks:
    urls: https://webhooks.gitter.im/e/48597b0f75dd571734bc
    on_success: always
    on_failure: always
    on_start: always
  email:
    recipients:
      - tapabrata.pal@capitalone.com
      - nireesh.thiruveedula@capitalone.com
      - Stephen.Hughes@capitalone.com
      - Prashant.Parekh@capitalone.com
      - Matthew.Beasley@capitalone.com
      - Subodh.Battina@capitalone.com
      - Ragha.Vema@capitalone.com
    on_success: always
    on_failure: always

=====================================================
== File: site-content/src/test/resources/artifacts/artifacts.json
=====================================================
[{
    "id": "56ccb7a57fab7c3eac031aac",
    "_class": "com.capitalone.dashboard.model.BinaryArtifact",
    "timestamp": 1456256819843,
    "artifactName": "api.jar",
    "canonicalName": "api-1.0.0.0.jar",
    "artifactGroupId": "com.lightningcd.api",
    "artifactVersion": "1.0.0.0",
    "buildInfo":  {
      "id": "5ba51c320be2d3f98f795044",
      "_class": "com.capitalone.dashboard.model.Build",
      "collectorItemId": "5ba136220be2d32568777fa5",
      "timestamp": 1537547314372,
      "number": "148",
      "buildUrl": "http://localhost:8082/job/c1usercheck/148/",
      "startTime": 1537547300387,
      "endTime": 1537547314338,
      "duration": 13951,
      "buildStatus": "Success",
      "codeRepos": [
        {
          "url": "https://mygithub.com/myOrg/myRepo",
          "branch": "refs/remotes/origin/master",
          "type": "GIT"
        }
      ],
      "sourceChangeSet": []
    }
  }
]

=====================================================
== File: site-content/src/test/resources/collectors/coll.json
=====================================================
[
{
  "id" : "5ba136220be2d32568777fa4",
  "_class" : "com.capitalone.dashboard.model.Collector",
  "name" : "Hudson",
  "collectorType" : "Build",
  "enabled" : true,
  "online" : true,
  "errors" : [],
  "uniqueFields" : {
    "jobName" : "",
    "jobUrl" : ""
  },
  "allFields" : {
    "jobName" : "",
    "jobUrl" : "",
    "instanceUrl" : ""
  },
  "lastExecuted" : 1537838340823,
  "searchFields" : [
    "options.jobName",
    "niceName"
  ]
},
{
  "id" : "5ba136290be2d32568777fa8",
  "_class" : "com.capitalone.dashboard.model.Collector",
  "name" : "Sonar",
  "collectorType" : "CodeQuality",
  "enabled" : true,
  "online" : true,
  "errors" : [],
  "uniqueFields" : {},
  "allFields" : {},
  "lastExecuted" : 1537838341109,
  "searchFields" : [
    "description"
  ]
},
{
  "id" : "5ba155280be2d339d2f2461e",
  "_class" : "com.capitalone.dashboard.model.Collector",
  "name" : "Product",
  "collectorType" : "Product",
  "enabled" : true,
  "online" : true,
  "errors" : [],
  "uniqueFields" : {},
  "allFields" : {},
  "lastExecuted" : 0,

=====================================================
== File: site-content/src/test/resources/component/component.json
=====================================================
[
  {
    "id": "5ba155820be2d339d2f24626",
    "_class": "com.capitalone.dashboard.model.Component",
    "name": "Testing",
    "collectorItems": {
      "SCM": [
        {
          "id": "5ba16a200be2d349ddf7fc80",
          "enabled": true,
          "errors": [],
          "pushed": false,
          "collectorId": "5ba16a0b0be2d34a64291205",
          "lastUpdated": 0,
          "options": {
            "password": "",
            "personalAccessToken": "",
            "branch": "master",
            "userID": "",
            "url": "https://mygithub.com/myOrg/myRepo"
          }
        }
      ],
      "Build": [
        {
          "id": "5ba136220be2d32568777fa5",
          "description": "job/c1usercheck/",
          "niceName": "TopoJenkins",
          "enabled": false,
          "errors": [],
          "pushed": true,
          "collectorId": "5ba136220be2d32568777fa4",
          "lastUpdated": 1537305331713,
          "options": {
            "jobName": "job/c1usercheck/",
            "jobUrl": "http://localhost:8082/job/c1usercheck/",
            "instanceUrl": "http://localhost:8082/"
          }
        }
      ],
      "CodeQuality": [
        {
          "id": "5ba136290be2d32568777fa9",
          "description": "C1 Custom Env Var Inject",
          "niceName": "TopoJenkins",
          "enabled": false,
          "errors": [],
          "pushed": true,
          "collectorId": "5ba136290be2d32568777fa8",
          "lastUpdated": 1537305335290,

=====================================================
== File: site-content/src/test/resources/builds/builds.json
=====================================================
[
  {
    "id": "5ba51c320be2d3f98f795044",
    "_class": "com.capitalone.dashboard.model.Build",
    "collectorItemId": "5ba136220be2d32568777fa5",
    "timestamp": 1537547314372,
    "number": "148",
    "buildUrl": "http://localhost:8082/job/c1usercheck/148/",
    "startTime": 1537547300387,
    "endTime": 1537547314338,
    "duration": 13951,
    "buildStatus": "Success",
    "codeRepos": [
      {
        "url": "https://mygithub.com/myOrg/myRepo",
        "branch": "refs/remotes/origin/master",
        "type": "GIT"
      }
    ],
    "sourceChangeSet": []
  },
  {
    "id": "5ba51d120be2d3f98f79504c",
    "_class": "com.capitalone.dashboard.model.Build",
    "collectorItemId": "5ba136220be2d32568777fa5",
    "timestamp": 1537547538123,
    "number": "149",
    "buildUrl": "http://localhost:8082/job/c1usercheck/149/",
    "startTime": 1537547525358,
    "endTime": 1537547538098,
    "duration": 12740,
    "buildStatus": "Success",
    "codeRepos": [
      {
        "url": "https://mygithub.com/myOrg/myRepo",
        "branch": "refs/remotes/origin/master",
        "type": "GIT"
      }
    ],
    "sourceChangeSet": []
  },
  {
    "id": "5ba520c40be2d3f98f795054",
    "_class": "com.capitalone.dashboard.model.Build",
    "collectorItemId": "5ba136220be2d32568777fa5",
    "timestamp": 1537548484349,
    "number": "150",
    "buildUrl": "http://localhost:8082/job/c1usercheck/150/",
    "startTime": 1537548473383,
    "endTime": 1537548484312,

=====================================================
== File: site-content/src/test/resources/librarypolicy/librarypolicy.json
=====================================================
[{
  "id": "5ad626cfc23b392c8f61ea1b",
  "_class": "com.capitalone.dashboard.model.LibraryPolicyResult",
  "collectorItemId": "5ad5f605c23b391cfa1c01a4",
  "timestamp": 1523984079768,
  "evaluationTimestamp": 1522879797193,
  "threats": {
    "License": [
      {
        "level": "Medium",
        "components": [
          "com.amazonaws:aws-java-sdk-sqs-1.11.28.jar",
          "ch.qos.logback:logback-classic-1.1.11.jar",
          "ch.qos.logback:logback-core-1.1.11.jar",
          "junit:junit-4.11.jar",
          "highcharts:highcharts-3d-4.2.1.js",
          "highcharts:highcharts-4.2.1.js",
          "net.masterthought:cucumber-reporting-2.0.0.jar"
        ],
        "count": 7
      },
      {
        "level": "None",
        "components": [
          "org.springframework:spring-test-4.3.10.RELEASE.jar",
          "org.jsoup:jsoup-1.8.3.jar",
          "com.amazonaws:jmespath-java-1.0.jar",
          "org.springframework.retry:spring-retry-1.2.1.RELEASE.jar",
          "com.amazonaws:aws-java-sdk-kms-1.11.28.jar",
          "com.fasterxml.jackson.core:jackson-core-2.8.9.jar",
          "org.springframework.batch:spring-batch-infrastructure-3.0.8.RELEASE.jar",
          "com.fasterxml.jackson.core:jackson-annotations-2.8.0.jar",
          "com.google.code.gson:gson-2.8.1.jar",
          "org.slf4j:slf4j-api-1.7.25.jar",
          "org.springframework.boot:spring-boot-test-autoconfigure-1.5.6.RELEASE.jar",
          "com.vaadin.external.google:android-json-0.0.20131108.vaadin1.jar",
          "com.jayway.jsonpath:json-path-2.2.0.jar",
          "org.springframework.batch:spring-batch-core-3.0.8.RELEASE.jar",
          "org.apache.logging.log4j:log4j-api-2.7.jar",
          "org.apache.httpcomponents:httpclient-4.5.3.jar",
          "org.springframework.boot:spring-boot-starter-logging-1.5.6.RELEASE.jar",
          "org.assertj:assertj-core-2.6.0.jar",
          "org.slf4j:jul-to-slf4j-1.7.25.jar",
          "jquery:jquery-1.12.1.min.js",
          ":aws-temporary-credentials-provider-2.1.3.jar",
          "com.fasterxml.jackson.core:jackson-databind-2.8.9.jar",
          "org.springframework:spring-beans-4.3.10.RELEASE.jar",
          "org.apache.velocity:velocity-1.7.jar",
          "org.springframework.boot:spring-boot-starter-test-1.5.6.RELEASE.jar",
          "commons-logging:commons-logging-1.1.3.jar",

=====================================================
== File: site-content/src/test/resources/dashboard/dashboard.json
=====================================================
[
  {
    "id": "5ba155820be2d339d2f24627",
    "_class": "com.capitalone.dashboard.model.Dashboard",
    "template": "widgets",
    "title": "TestPlugin",
    "widgets": [
      {
        "id": "5ba16a200be2d349ddf7fc82",
        "name": "repo",
        "componentId": "5ba155820be2d339d2f24626",
        "options": {
          "password": "",
          "id": "repo0",
          "personalAccessToken": "",
          "branch": "master",
          "userID": "",
          "url": "https://mygithub.com/myOrg/myRepo"
        }
      },
      {
        "id": "5ba16af70be2d34a77757045",
        "name": "build",
        "componentId": "5ba155820be2d339d2f24626",
        "options": {
          "buildDurationThreshold": 3,
          "id": "build0",
          "consecutiveFailureThreshold": 5
        }
      },
      {
        "id": "5ba16b060be2d34a77757048",
        "name": "codeanalysis",
        "componentId": "5ba155820be2d339d2f24626",
        "options": {
          "id": "codeanalysis0"
        }
      }
    ],
    "owners": [
      {
        "username": "topo",
        "authType": "STANDARD"
      }
    ],
    "type": "Team",
    "application": {
      "name": "Testing",
      "components": [
        {

=====================================================
== File: site-content/src/test/resources/codequality/codequality.json
=====================================================
[
  {
    "id": "5ba950da0be2d3128858d322",
    "_class": "com.capitalone.dashboard.model.CodeQuality",
    "collectorItemId": "5ba136290be2d32568777fa9",
    "timestamp": 1537822938615,
    "name": "C1 Custom Env Var Inject",
    "url": "http://localhost:9000/dashboard/index/org.jenkins-ci.plugins:CustomC1EnvVarInject",
    "type": "StaticAnalysis",
    "version": "1.0.0-SNAPSHOT",
    "buildId": "5ba51c320be2d3f98f795044",
    "metrics": [
      {
        "name": "coverage",
        "value": "0.0",
        "formattedValue": "0.0%"
      },
      {
        "name": "new_vulnerabilities",
        "value": "",
        "formattedValue": ""
      },
      {
        "name": "violations",
        "value": "28",
        "formattedValue": "28"
      },
      {
        "name": "quality_gate_details",
        "value": "{\"level\":\"ERROR\",\"conditions\":[{\"metric\":\"new_security_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"new_reliability_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"new_maintainability_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"coverage\",\"op\":\"LT\",\"warning\":\"\",\"error\":\"80\",\"actual\":\"0.0\",\"level\":\"ERROR\"}]}",
        "formattedValue": "{\"level\":\"ERROR\",\"conditions\":[{\"metric\":\"new_security_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"new_reliability_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"new_maintainability_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"coverage\",\"op\":\"LT\",\"warning\":\"\",\"error\":\"80\",\"actual\":\"0.0\",\"level\":\"ERROR\"}]}%"
      },
      {
        "name": "sqale_index",
        "value": "203",
        "formattedValue": "3h 23min"
      },
      {
        "name": "critical_violations",
        "value": "1",
        "formattedValue": "1"
      },
      {
        "name": "blocker_violations",
        "value": "0",
        "formattedValue": "0"
      },
      {
        "name": "new_major_violations",
        "value": "",

=====================================================
== File: site-content/src/test/resources/test_results/test_results.json
=====================================================
[

  {
    "id" : "5803cd02edb9650aa33d205a",
    "collectorItemId" : "57f2a0193b55670a9e06d63a",
    "timestamp" : 1476644087024,
    "executionId" : "94",
    "buildId" : "5803cd02edb9650aa33d2059",
    "description" : " TEST-UI",
    "url" : "https://myjenkins.com/myjenkins/job/TEST-UI/",
    "startTime" : 1476643852954,
    "endTime" : 1476644086910,
    "duration" : 233956,
    "failureCount" : 0,
    "successCount" : 1,
    "skippedCount" : 0,
    "totalCount" : 1,
    "unknownStatusCount" : 0,
    "type" : "Functional",
    "targetAppName" : " -UI-SLATE",
    "targetEnvName" : "QAMB",
    "testCapabilities" : [
      {
        "timestamp" : 0,
        "executionId" : "94",
        "description" : "/json",
        "startTime" : 0,
        "endTime" : 0,
        "duration" : 161998,
        "failedTestSuiteCount" : 0,
        "successTestSuiteCount" : 1,
        "skippedTestSuiteCount" : 0,
        "totalTestSuiteCount" : 1,
        "unknownStatusTestSuiteCount" : 0,
        "status" : "Success",
        "type" : "Functional",
        "testSuites" : [
          {
            "id" : "validate-auto-loan-account-details",
            "description" : "Feature:Validate Auto Loan Account Details",
            "type" : "Functional",
            "startTime" : 0,
            "endTime" : 0,
            "duration" : 161998,
            "totalTestCaseCount" : 2,
            "failedTestCaseCount" : 0,
            "successTestCaseCount" : 2,
            "skippedTestCaseCount" : 0,
            "unknownStatusCount" : 0,
            "status" : "Success",

=====================================================
== File: site-content/src/test/resources/collector_items/items.json
=====================================================
[
  {
    "id": "5ba136220be2d32568777fa5",
    "_class": "com.capitalone.dashboard.model.CollectorItem",
    "description": "job/c1usercheck/",
    "niceName": "TopoJenkins",
    "enabled": false,
    "errors": [],
    "pushed": true,
    "collectorId": "5ba136220be2d32568777fa4",
    "lastUpdated": 1537548484342,
    "options": {
      "jobName": "job/c1usercheck/",
      "jobUrl": "http://localhost:8082/job/c1usercheck/",
      "instanceUrl": "http://localhost:8082/"
    }
  },
  {
    "id": "5ba136220be2d32568777fa6",
    "_class": "com.capitalone.dashboard.model.CollectorItem",
    "description": "job/c1usercheck2/",
    "niceName": "TopoJenkins",
    "enabled": false,
    "errors": [],
    "pushed": true,
    "collectorId": "5ba136220be2d32568777fa4",
    "lastUpdated": 1537548484342,
    "options": {
      "jobName": "job/c1usercheck2/",
      "jobUrl": "http://localhost:8082/job/c1usercheck2/",
      "instanceUrl": "http://localhost:8082/"
    }
  },
  {
    "id": "5ba136290be2d32568777fa9",
    "_class": "com.capitalone.dashboard.model.CollectorItem",
    "description": "C1 Custom Env Var Inject",
    "niceName": "TopoJenkins",
    "enabled": false,
    "errors": [],
    "pushed": true,
    "collectorId": "5ba136290be2d32568777fa8",
    "lastUpdated": 1537548487364,
    "options": {
      "projectName": "C1 Custom Env Var Inject",
      "projectId": "AWUfseU7tTiUsfWMVoi8",
      "instanceUrl": "http://localhost:9000"
    }
  },
  {

=====================================================
== File: site-content/src/test/resources/securityscan/securityscan.json
=====================================================
[
  {
    "_id": "5ac4f4e95470fb75445daaf6",
    "collectorItemId": "5b4e524333ec296b81c3935f",
    "timestamp": 1522855896054,
    "type": "SecurityAnalysis",
    "metrics": [
      {
        "name": "Score",
        "value": "89",
        "formattedValue": "89"
      },
      {
        "name": "Low",
        "value": "1",
        "formattedValue": "1",
        "status": "Ok"
      },
      {
        "name": "Medium",
        "value": "4",
        "formattedValue": "4",
        "status": "Warning"
      },
      {
        "name": "Critical",
        "value": "3",
        "formattedValue": "3",
        "status": "Alert"
      },
      {
        "name": "High",
        "value": "21",
        "formattedValue": "21",
        "status": "Alert"
      }
    ]
  }
]

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/FongoBaseRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import org.junit.Rule;
import org.junit.runner.RunWith;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.github.fakemongo.junit.FongoRule;

@ContextConfiguration(classes = { FongoConfig.class })
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public abstract class FongoBaseRepositoryTest {

    @Rule
    public FongoRule fongoRule = new FongoRule();
}

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/CollectorTaskTests.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.collector.CollectorTask;
import com.capitalone.dashboard.model.Collector;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.support.CronTrigger;

import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class CollectorTaskTests {

    @Mock private TaskScheduler taskScheduler;
    @Mock private BaseCollectorRepository<Collector> baseCollectorRepository;

    private CollectorTask<Collector> task;

    private static final String COLLECTOR_NAME = "Test Collector";

    @Before
    public void init() {
        task = new TestCollectorTask();
    }

    @Test
    public void run_collectorNotRegistered_savesNewCollector() {
        Collector c = new Collector();
        when(baseCollectorRepository.findByName(COLLECTOR_NAME)).thenReturn(null);
        when(baseCollectorRepository.save(any(Collector.class))).thenReturn(c);
        task.run();
        verify(baseCollectorRepository).save(any(Collector.class));
    }

    @Test
    public void run_enabled() {
    	Collector c = new Collector();
        c.setEnabled(true);
        long prevLastExecuted = c.getLastExecuted();

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/CollectorItemRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.testutil.FongoConfig;
import com.capitalone.dashboard.util.LoadTestData;
import com.github.fakemongo.junit.FongoRule;
import com.google.common.collect.Lists;
import org.bson.types.ObjectId;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static org.junit.Assert.assertEquals;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {FongoConfig.class})
@DirtiesContext
public class CollectorItemRepositoryTest {

    @Rule
    public FongoRule fongoRule = new FongoRule();

    @Autowired
    private CollectorItemRepository collectorItemRepository;

    @Test
    public void findAllByOptionNameValueAndCollectorIdsInReturns0() throws IOException {
        collectorItemRepository.deleteAll();
        LoadTestData.loadCollectorItems(collectorItemRepository);
        Iterable<CollectorItem> items = collectorItemRepository.findAllByOptionNameValueAndCollectorIdsIn("jobName", "job/", Collections.singletonList(new ObjectId("5ba136220be2d32568777fa4")));
        List<CollectorItem> itemList = Lists.newArrayList(items);
        assertEquals(itemList.size(),0);
    }

    @Test
    public void findAllByOptionNameValueAndCollectorIdsInReturns1() throws IOException {
        collectorItemRepository.deleteAll();
        LoadTestData.loadCollectorItems(collectorItemRepository);
        Iterable<CollectorItem> items = collectorItemRepository.findAllByOptionNameValueAndCollectorIdsIn("jobName", "job/c1usercheck/", Collections.singletonList(new ObjectId("5ba136220be2d32568777fa4")));

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/FongoConfig.java
=====================================================
package com.capitalone.dashboard.repository;

import org.springframework.context.annotation.Bean;

import com.capitalone.dashboard.config.MongoConfig;
import com.github.fakemongo.Fongo;
import com.mongodb.MongoClient;

public class FongoConfig extends MongoConfig {

    @Override
    @Bean
    public MongoClient mongo() throws Exception {
        return new Fongo(getDatabaseName()).getMongo();
    }
    
    @Override
    protected String getDatabaseName() {
        return "test-db";
    }
}

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/TemplateRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Template;
import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

public class TemplateRepositoryTest extends FongoBaseRepositoryTest {

    private static Template mockTemplate;

    @Autowired
    private TemplateRepository templateRepository;

    @Before
    public void setUp() {
        mockTemplate = new Template("template1", getWidgetsAndOrder(), getWidgetsAndOrder());
    }

    @After
    public void tearDown() {
        mockTemplate = null;
        templateRepository.deleteAll();
    }

    @Test
    public void validate_save() {
        templateRepository.save(mockTemplate);
        assertTrue(
                "Happy-path MongoDB connectivity validation for the FeatureRepository has failed",
                templateRepository.findAll().iterator().hasNext());
    }

    @Test
    public void validate_get() {
        templateRepository.save(mockTemplate);
        Template actual = templateRepository.findByTemplate("template1");
        assertEquals(actual.getTemplate(), mockTemplate.getTemplate());
    }

    @Test

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/AuthenticationRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.lang.reflect.Field;

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;

import com.capitalone.dashboard.model.Authentication;

public class AuthenticationRepositoryTest extends FongoBaseRepositoryTest {

	private static int testNumber = 0;

	private static String username  ;

	@Before
	public void updateUsername(){
		username = "usernameTest" + testNumber;
		testNumber++;
	}

    @Autowired
    private AuthenticationRepository authenticationRepository;


    /*
     * This test checks that adding a duplicate username will create an exception
     */
    @Test(expected=DuplicateKeyException.class)
    public void createDuplicateUserTest() {

    	String username = "username";

    	Authentication user1 = new Authentication(username, "pass1");

    	authenticationRepository.save(user1);

    	Authentication user2 = new Authentication(username, "pass2");

    	// This line should throw a DuplicateKeyException
    	authenticationRepository.save(user2);
    }


=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/FeatureRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.capitalone.dashboard.model.Feature;

public class FeatureRepositoryTest extends FongoBaseRepositoryTest {
	private static Feature mockV1Feature;
	private static Feature mockJiraFeature;
	private static Feature mockJiraFeature2;
	private static Feature mockJiraFeature3;
	private static Feature mockJiraFeature4;
	private static final String generalUseDate = "2015-11-01T00:00:00Z";
	private static final String generalUseDate2 = "2015-12-01T00:00:00Z";
	private static final String generalUseDate3 = "2015-12-15T00:00:00Z";
	private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
	private static Calendar cal = Calendar.getInstance();
	private static final String maxDateWinner = df.format(new Date());
	private static String maxDateLoser = new String();
	private static String currentSprintEndDate = new String();
	private static final ObjectId jiraCollectorId = new ObjectId();
//	private static final ObjectId v1CollectorId = new ObjectId();

	@Autowired
	private FeatureRepository featureRepo;

	@Before
	public void setUp() {
		// Date-time modifications
		cal.setTime(new Date());
		cal.add(Calendar.DAY_OF_YEAR, -1);
		maxDateLoser = df.format(cal.getTime());
		cal.add(Calendar.DAY_OF_YEAR, +13);
		currentSprintEndDate = df.format(cal.getTime());

		// Helper mock data

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/ScopeOwnerRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.ScopeOwnerCollectorItem;

public class ScopeOwnerRepositoryTest extends FongoBaseRepositoryTest {
	private static ScopeOwnerCollectorItem mockV1ScopeOwner;
	private static ScopeOwnerCollectorItem mockJiraScopeOwner;
	private static ScopeOwnerCollectorItem mockJiraScopeOwner2;
	private static CollectorItem mockBadItem;
	private static final String generalUseDate = "2015-11-01T00:00:00Z";
	private static final String olderThanGeneralUseDate = "2015-10-30T00:00:00Z";
	private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
	private static Calendar cal = Calendar.getInstance();
	private static final String maxDateWinner = df.format(new Date());
	private static String maxDateLoser = new String();
	private static final ObjectId jiraCollectorId = new ObjectId();
	private static final ObjectId v1CollectorId = new ObjectId();

	@Autowired
	private ScopeOwnerRepository scopeOwnerRepo;
	@Autowired
	private CollectorItemRepository badItemRepo;

	@Before
	public void setUp() {
		// Date-time modifications
		cal.setTime(new Date());
		cal.add(Calendar.DAY_OF_YEAR, -1);
		maxDateLoser = df.format(cal.getTime());

		// VersionOne Mock Scope
		mockV1ScopeOwner = new ScopeOwnerCollectorItem();
		mockV1ScopeOwner.setCollectorId(v1CollectorId);

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.testutil.FongoConfig;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;
import java.util.Objects;

import static org.junit.Assert.*;


public class RelatedCollectorItemRepositoryTest extends FongoBaseRepositoryTest {

    @Autowired
    private RelatedCollectorItemRepository relatedCollectorItemRepository;

    @Test
    public void saveRelatedItems() {
        relatedCollectorItemRepository.deleteAll();
        ObjectId left = ObjectId.get();
        ObjectId right = ObjectId.get();
        relatedCollectorItemRepository.saveRelatedItems(left, right, "some source", "some reason");
        List<RelatedCollectorItem> relatedCollectorItemList = Lists.newArrayList(relatedCollectorItemRepository.findAll());
        assertFalse(CollectionUtils.isEmpty(relatedCollectorItemList));
        assertEquals(1, relatedCollectorItemList.size());
        assertEquals(relatedCollectorItemList.get(0).getLeft(), left);
        assertEquals(relatedCollectorItemList.get(0).getRight(), right);
        assertTrue(relatedCollectorItemList.get(0).getReason().equalsIgnoreCase("some reason"));
        assertTrue(relatedCollectorItemList.get(0).getSource().equalsIgnoreCase("some source"));

    }

    @Test
    public void saveRelatedItemsDuplicate() {
        relatedCollectorItemRepository.deleteAll();
        ObjectId left = ObjectId.get();
        ObjectId right = ObjectId.get();
        RelatedCollectorItem rc = new RelatedCollectorItem();
        rc.setLeft(left);
        rc.setRight(right);

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/DashboardCreateTests.java
=====================================================

package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.*;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;

public class DashboardCreateTests extends FongoBaseRepositoryTest {

    @Autowired
    private DashboardRepository dashboardRepository;

    @Autowired
    private ComponentRepository componentRepository;

    @Autowired
    private CmdbRepository cmdbRepository;

    @Test
    public void createTeamDashboardTest() {
        Component component = new Component("Jay's component");
        component.setOwner("Jay");

        component = componentRepository.save(component);
        System.out.println(component.getId());

        Cmdb configItemApp = new Cmdb();
        configItemApp.setConfigurationItem("ASVTEST");
        configItemApp = cmdbRepository.save(configItemApp);


        Cmdb configItemComp = new Cmdb();
        configItemComp.setConfigurationItem("BAPTEST");
        configItemComp = cmdbRepository.save(configItemComp);


        Application application = new Application("Jay's App", component);

        List<String> activeWidgets = new ArrayList<>();
        List<Owner> owners = new ArrayList<Owner>();
        owners.add(new Owner("owner", AuthType.STANDARD));
        Dashboard dashboard = new Dashboard("Topo", "Jays's Dashboard", application, owners, DashboardType.Team,  configItemApp.getConfigurationItem(), configItemComp.getConfigurationItem(), activeWidgets, false, ScoreDisplayType.HEADER);

        Widget build = new Widget();

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/TeamRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.Team;
import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class TeamRepositoryTest extends FongoBaseRepositoryTest {
    private static Team mockV1Team;
    private static Team mockJiraTeam;
    private static Team mockJiraTeam2;
    private static CollectorItem mockBadItem;
    private static final String generalUseDate = "2015-11-01T00:00:00Z";
    private static final String olderThanGeneralUseDate = "2015-10-30T00:00:00Z";
    private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    private static Calendar cal = Calendar.getInstance();
    private static final String maxDateWinner = df.format(new Date());
    private static String maxDateLoser = new String();
    private static final ObjectId jiraCollectorId = new ObjectId();
    private static final ObjectId v1CollectorId = new ObjectId();

    @Autowired
    private TeamRepository teamRepo;
    @Autowired
    private CollectorItemRepository badItemRepo;

    @Before
    public void setUp() {
        // Date-time modifications
        cal.setTime(new Date());
        cal.add(Calendar.DAY_OF_YEAR, -1);
        maxDateLoser = df.format(cal.getTime());

        // VersionOne Mock Scope
        mockV1Team = new Team("", "");
        mockV1Team.setCollectorId(v1CollectorId);

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/repository/ScopeRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.capitalone.dashboard.model.Scope;

public class ScopeRepositoryTest extends FongoBaseRepositoryTest {
	private static Scope mockV1Scope;
	private static Scope mockJiraScope;
	private static Scope mockJiraScope2;
	private static final String generalUseDate = "2015-11-01T00:00:00Z";
	private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
	private static Calendar cal = Calendar.getInstance();
	private static final String maxDateWinner = df.format(new Date());
	private static String maxDateLoser = new String();
	private static String currentScopeEndDate = new String();
	private static final ObjectId jiraCollectorId = new ObjectId();
	private static final ObjectId v1CollectorId = new ObjectId();

	@Autowired
	private ScopeRepository scopeRepo;

	@Before
	public void setUp() {
		// Date-time modifications
		cal.setTime(new Date());
		cal.add(Calendar.DAY_OF_YEAR, -1);
		maxDateLoser = df.format(cal.getTime());
		cal.add(Calendar.DAY_OF_YEAR, +13);
		currentScopeEndDate = df.format(cal.getTime());

		// VersionOne Mock Scope
		mockV1Scope = new Scope();
		mockV1Scope.setCollectorId(v1CollectorId);
		mockV1Scope.setIsDeleted("False");
		mockV1Scope.setChangeDate(maxDateLoser);
		mockV1Scope.setAssetState("Active");
		mockV1Scope.setBeginDate(maxDateLoser);

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/util/HygieiaUtilsTest.java
=====================================================
package com.capitalone.dashboard.util;

import org.junit.Assert;
import org.junit.Test;

public class HygieiaUtilsTest {
    @Test
    public void checkForEmptyStringValuesTest() {
        boolean result = HygieiaUtils.checkForEmptyStringValues("", "test1", "test2");
        Assert.assertTrue(result);

        result = HygieiaUtils.checkForEmptyStringValues("test0", "test1", "test2");
        Assert.assertFalse(result);
    }
}

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/util/TestUtils.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.BinaryArtifact;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.BuildStatus;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.CommitType;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.RepoBranch;
import com.capitalone.dashboard.model.SCM;
import org.bson.types.ObjectId;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


/**
 * Created by syq410 on 2/23/17.
 */
@Ignore
public class TestUtils {

    private static final ObjectId DASHBOARD_ID = new ObjectId();

    public static Commit createCommit(String revisionNumber,String scmUrl) {
        Commit commit = new Commit();
        commit.setScmRevisionNumber(revisionNumber);
        commit.setCollectorItemId(ObjectId.get());
        commit.setType(CommitType.New);
        commit.setScmUrl(scmUrl);
        return commit;
    }

    public static Pipeline getPipeline(ObjectId collectorItemId) {
        Pipeline pipeline = new Pipeline();
        pipeline.addCommit(PipelineStage.COMMIT.getName(), createPipelineCommit("scmRev3"));
        EnvironmentStage environmentStage = new EnvironmentStage();
        environmentStage.setLastArtifact(getBinaryArtifact());
        pipeline.getEnvironmentStageMap().put("DEV",environmentStage);
        Set<Build> failedBuilds = new HashSet<>();
        Build failedBuild = createBuild();
        failedBuild.setCollectorItemId(collectorItemId);

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/util/EncryptionTests.java
=====================================================
package com.capitalone.dashboard.util;

import org.junit.Test;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

public class EncryptionTests {

	private final String THING_TO_BE_ENCRYPTED = "AKIAJ24MI4VLOIR72NVA";
	private final String A_GOOD_STRING_KEY = "5XBoZ7li2W5wzhOULEqtQzdkufjsVFs4";
	private final String A_LONG_KEY = "0ED1C7B771C9BBAB2583C364AFE8FB0C2F23A6FC8157EE3601ABB53D9CEA9893";
	private final String A_SHORT_KEY = "F55CC56E8DB6056EB4085263";
	private final String A_BAD_STRING_KEY = "c/t/nuBFwTgvB+lwzS/q5W0ZkQhhxCB1";
	private static final String ALGO = "DESede";
	private static final SecretKey GOOD_KEY = getKey();
	private static final SecretKey BAD_KEY = getKey();

	private static SecretKey getKey() {
		SecretKey key = null;
		try {
			key = KeyGenerator.getInstance(ALGO).generateKey();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
//		String stringKey = Base64.encodeBase64String(key.getEncoded());
		return key;
	}


	@Test
	public void testGetStringKey() {
		String key = null;
		try {
			key = Encryption.getStringKey();
		} catch (EncryptionException e) {
			e.printStackTrace();
		}
		assertNotEquals(null, key);
		assertNotEquals("", key);
	}

	@Test
	public void testGetSecretKey() {
		SecretKey key = null;
		try {

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/util/PipelineUtilsTest.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.*;
import com.capitalone.dashboard.repository.CommitRepository;
import org.bson.types.ObjectId;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.capitalone.dashboard.util.TestUtils.createBuild;
import static com.capitalone.dashboard.util.TestUtils.createCommit;
import static com.capitalone.dashboard.util.TestUtils.getPipeline;
import static com.capitalone.dashboard.util.TestUtils.getScm;
import static org.junit.Assert.assertEquals;

/**
 * Created by syq410 on 2/23/17.
 */
@RunWith(MockitoJUnitRunner.class)
public class PipelineUtilsTest {

    private static final ObjectId DASHBOARD_ID = new ObjectId();
    @Mock
    private CommitRepository commitRepository;

    @Test
    public void testOrderForStages() {
        Map<String, String> ordermap = PipelineUtils.getOrderForStages(setupDashboard());
        assertEquals(ordermap.get("0"), "Commit");
        assertEquals(ordermap.get("1"), "Build");
        assertEquals(ordermap.get("2"), "dev");
        assertEquals(ordermap.get("3"), "qa");
        assertEquals(ordermap.get("4"), "int");

    }

    private Dashboard setupDashboard() {
        ObjectId configItemAppId = new ObjectId();
        ObjectId configItemComponetId = new ObjectId();
        List<String> activeWidgets = new ArrayList<>();
        List<Owner> owners = new ArrayList<Owner>();
        owners.add(new Owner("owner", AuthType.STANDARD));

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/util/DashboardUtilsTest.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.FongoBaseRepositoryTest;
import org.bson.types.ObjectId;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Arrays;
import java.util.Set;

import static org.junit.Assert.*;

public class DashboardUtilsTest extends FongoBaseRepositoryTest{

    @Autowired
    private ComponentRepository componentRepository;

    @Autowired
    private CollectorRepository collectorRepository;

    @Autowired
    private CollectorItemRepository collectorItemRepository;


    @Test
    public void getUniqueCollectorItemIDsFromAllComponents() throws Exception {
        Component component1 = getComponent("TestComponent1");
        Collector collector1 = getCollector("TestCollector1",CollectorType.Build);
        CollectorItem collectorItem1 = getCollectorItem("TestCollectorItem1",collector1);
        component1.addCollectorItem(collector1.getCollectorType(), collectorItem1);
        Collector collector11 = getCollector("TestCollector1",CollectorType.SCM);
        CollectorItem collectorItem11 = getCollectorItem("TestCollectorItem11",collector11);
        component1.addCollectorItem(collector11.getCollectorType(), collectorItem11);

        Component component2 = getComponent("TestComponent2");
        CollectorItem collectorItem2 = getCollectorItem("TestCollectorItem2",collector11);
        component2.addCollectorItem(collector11.getCollectorType(), collectorItem2);


        Component component3 = getComponent("TestComponent2");
        component3.addCollectorItem(collector11.getCollectorType(), collectorItem2);

        componentRepository.save(Arrays.asList(component1,component2,component3));

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/util/LoadTestData.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.LibraryPolicyResult;
import com.capitalone.dashboard.model.TestResult;
import com.capitalone.dashboard.repository.BuildRepository;
import com.capitalone.dashboard.repository.CodeQualityRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.LibraryPolicyResultsRepository;
import com.capitalone.dashboard.repository.TestResultRepository;
import com.capitalone.dashboard.testutil.GsonUtil;
import com.google.common.io.Resources;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.util.List;

public class LoadTestData {

    public static void loadDashBoard(DashboardRepository dashboardRepository) throws IOException {
        Gson gson = GsonUtil.getGson();
        String json = IOUtils.toString(Resources.getResource("./dashboard/dashboard.json"));
        List<Dashboard> dashboards = gson.fromJson(json, new TypeToken<List<Dashboard>>(){}.getType());
        dashboardRepository.save(dashboards);
    }

    public static void loadCollector (CollectorRepository collectorRepository) throws IOException {
        Gson gson = GsonUtil.getGson();
        String json = IOUtils.toString(Resources.getResource("./collectors/coll.json"));
        List<Collector> collector = gson.fromJson(json, new TypeToken<List<Collector>>(){}.getType());
        collectorRepository.save(collector);
    }

    public static void loadComponent(ComponentRepository componentRepository) throws IOException {
        Gson gson = GsonUtil.getGson();
        String json = IOUtils.toString(Resources.getResource("./component/component.json"));
        List<Component> components = gson.fromJson(json, new TypeToken<List<Component>>(){}.getType());
        componentRepository.save(components);
    }


=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/util/GitBranchSpecTest.java
=====================================================
package com.capitalone.dashboard.util;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;



public class GitBranchSpecTest {
    @Test
    public void testMatch() {

        GitBranchSpec l = new GitBranchSpec("master");
        assertTrue(l.matches("origin/master"));
        assertFalse(l.matches("origin/something/master"));
        assertTrue(l.matches("master"));
        assertFalse(l.matches("dev"));
        
        
        GitBranchSpec est = new GitBranchSpec("origin/*/dev");
        
        assertFalse(est.matches("origintestdev"));
        assertTrue(est.matches("origin/test/dev"));
        assertFalse(est.matches("origin/test/release"));
        assertFalse(est.matches("origin/test/somthing/release"));
        
        GitBranchSpec s = new GitBranchSpec("origin/*");
        
        assertTrue(s.matches("origin/master"));
      
        GitBranchSpec m = new GitBranchSpec("**/magnayn/*");
        
        assertTrue(m.matches("origin/magnayn/b1"));
        assertTrue(m.matches("remote/origin/magnayn/b1"));
        assertTrue(m.matches("remotes/origin/magnayn/b1"));
      
        GitBranchSpec n = new GitBranchSpec("*/my.branch/*");
        
        assertTrue(n.matches("origin/my.branch/b1"));
        assertFalse(n.matches("origin/my-branch/b1"));
        assertFalse(n.matches("remote/origin/my.branch/b1"));
        assertTrue(n.matches("remotes/origin/my.branch/b1"));
      
        GitBranchSpec o = new GitBranchSpec("**");
        
        assertTrue(o.matches("origin/my.branch/b1"));
        assertTrue(o.matches("origin/my-branch/b1"));
        assertTrue(o.matches("remote/origin/my.branch/b1"));

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskTwoWithGenericItem.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.GenericCollectorItem;
import com.capitalone.dashboard.repository.BaseCollectorRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.GenericCollectorItemRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class TestCollectorTaskTwoWithGenericItem extends CollectorTaskWithGenericItem<Collector> {

    private final CollectorRepository collectorRepository;

    @Autowired
    public TestCollectorTaskTwoWithGenericItem(TaskScheduler taskScheduler, CollectorItemRepository collectorItemRepository, GenericCollectorItemRepository genericCollectorItemRepository, RelatedCollectorItemRepository relatedCollectorItemRepository,
                                               CollectorRepository collectorRepository) {
        super(taskScheduler, "MyTool", collectorItemRepository, genericCollectorItemRepository, relatedCollectorItemRepository);
        this.collectorRepository = collectorRepository;
    }

    @Override
    public Map<String, Object> getGenericCollectorItemOptions(String serverUrl, GenericCollectorItem genericCollectorItem) {
        Map<String, Object> options = new HashMap<>();
        options.put("projectName", "C1 Custom Env Var Inject");
        options.put("instanceUrl", "http://localhost:9000");
        return options;
    }

    @Override
    public Collector getCollector() {
        Collector collector = new Collector();
        collector.setId(new ObjectId("5ba136290be2d32568777fa8"));
        collector.setName("MyTool");
        return collector;
    }

    @Override
    public BaseCollectorRepository<Collector> getCollectorRepository() {
        return collectorRepository;
    }


=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/collector/CollectorTaskTest.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.repository.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.scheduling.TaskScheduler;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;


@RunWith(MockitoJUnitRunner.class)
public class CollectorTaskTest {
    @Mock private TaskScheduler taskScheduler;

    private static final String COLLECTOR_NAME = "Test Collector";
    private CollectorTask<Collector> collector;

    @Before
    public void init() {
        collector = new CollectorTaskTest.TestCollectorTask();
    }

    @Test
    public void throttleRequestsTest_ratelimit_exceeded() {
        long startTime = System.currentTimeMillis() - 500;
        int requestCount = 5;
        long waitTime = 500;
        int requestRateLimit = 3;
        long requestRateLimitTimeWindow = 1000;

        CollectorTask<Collector> collectorSpy = Mockito.spy(collector);
        boolean result = collectorSpy.throttleRequests(startTime, requestCount,
                                                waitTime, requestRateLimit,
                                                requestRateLimitTimeWindow);
        assertEquals(true, result);
        verify(collectorSpy, times(1)).sleep(Mockito.anyLong());
    }

    @Test
    public void throttleRequestsTest_ratelimit_not_exceeded() {
        long startTime = System.currentTimeMillis() - 500;
        int requestCount = 2;
        long waitTime = 500;

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItemTest.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.GenericCollectorItem;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.GenericCollectorItemRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import com.capitalone.dashboard.testutil.BaseCollectorTestConfig;
import com.capitalone.dashboard.testutil.FongoConfig;
import com.capitalone.dashboard.util.LoadTestData;
import com.github.fakemongo.junit.FongoRule;
import com.google.common.collect.Lists;
import org.bson.types.ObjectId;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {FongoConfig.class, BaseCollectorTestConfig.class})
public class CollectorTaskWithGenericItemTest {

    @Rule
    public FongoRule fongoRule = new FongoRule();

    @Autowired
    private CollectorItemRepository collectorItemRepository;

    @Autowired
    private GenericCollectorItemRepository genericCollectorItemRepository;

    @Autowired
    RelatedCollectorItemRepository relatedCollectorItemRepository;

    @Autowired
    TestCollectorTaskWithGenericItem testCollectorTaskWithGenericItem;


=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskWithGenericItem.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.GenericCollectorItem;
import com.capitalone.dashboard.repository.BaseCollectorRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.GenericCollectorItemRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class TestCollectorTaskWithGenericItem extends CollectorTaskWithGenericItem<Collector> {

    private final CollectorRepository collectorRepository;

    @Autowired
    public TestCollectorTaskWithGenericItem(TaskScheduler taskScheduler, CollectorItemRepository collectorItemRepository, GenericCollectorItemRepository genericCollectorItemRepository, RelatedCollectorItemRepository relatedCollectorItemRepository,
                                            CollectorRepository collectorRepository) {
        super(taskScheduler, "Sonar", collectorItemRepository, genericCollectorItemRepository, relatedCollectorItemRepository);
        this.collectorRepository = collectorRepository;
    }

    @Override
    public Map<String, Object> getGenericCollectorItemOptions(String serverUrl, GenericCollectorItem genericCollectorItem) {
        Map<String, Object> options = new HashMap<>();
        options.put("projectName", "C1 Custom Env Var Inject");
        options.put("instanceUrl", "http://localhost:9000");
        return options;
    }

    @Override
    public Collector getCollector() {
        Collector collector = new Collector();
        collector.setId(new ObjectId("5ba136290be2d32568777fa8"));
        collector.setName("Sonar");
        return collector;
    }

    @Override
    public BaseCollectorRepository<Collector> getCollectorRepository() {
        return collectorRepository;
    }


=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/model/DashboardTest.java
=====================================================
package com.capitalone.dashboard.model;

import com.capitalone.dashboard.util.PipelineUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertEquals;

@RunWith(MockitoJUnitRunner.class)
public class DashboardTest {

    @Test
    public void findEnvironmentMappings(){
        Dashboard dashboard = makeTeamDashboard("template", "title", "appName","" ,"ASVTEST","BAPTEST", "comp1", "comp2");
        dashboard.getWidgets().add(makePipelineWidget("DEV", "QA", null, null, "PROD"));
        Widget buildWidget = new Widget();
        buildWidget.setName("build");
        dashboard.getWidgets().add(buildWidget);

        Widget commitWidget = new Widget();
        commitWidget.setName("repo");
        dashboard.getWidgets().add(commitWidget);

        Map<PipelineStage, String> expected = new HashMap<>();
        expected.put(PipelineStage.valueOf("COMMIT"), "Commit");
        expected.put(PipelineStage.valueOf("BUILD"), "Build");
        expected.put(PipelineStage.valueOf("DEV"), "DEV");
        expected.put(PipelineStage.valueOf("QA"), "QA");
        expected.put(PipelineStage.valueOf("PROD"), "PROD");

        Map<PipelineStage, String> actual = PipelineUtils.getStageToEnvironmentNameMap(dashboard);
        assertEquals(expected, actual);
    }

    @Test
    public void findEnvironmentMappings_no_mappings_configured(){
        Dashboard dashboard = makeTeamDashboard("template", "title", "appName","","ASVTEST", "BAPTEST","comp1", "comp2");
        Map<PipelineStage, String> expected = new HashMap<>();

        Map<PipelineStage, String> actual = PipelineUtils.getStageToEnvironmentNameMap(dashboard);
        assertEquals(expected, actual);
    }

    private Dashboard makeTeamDashboard(String template, String title, String appName, String owner, String configItemAppName, String configItemComponentName, String... compNames) {

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/model/LibraryPolicyResultTest.java
=====================================================
package com.capitalone.dashboard.model;

import org.junit.Test;

import java.util.Objects;
import java.util.Set;

import static org.junit.Assert.*;

public class LibraryPolicyResultTest {

    @Test
    public void addThreat() {
        LibraryPolicyResult result = new LibraryPolicyResult();
        result.addThreat(LibraryPolicyType.License, LibraryPolicyThreatLevel.Critical, LibraryPolicyThreatDisposition.Open, "component1");

        assertEquals(result.getThreats().size(), 1);
        assertEquals(result.getThreats().keySet().size(), 1);
        assertEquals(result.getThreats().values().size(), 1);
        assertEquals(result.getThreats().keySet().iterator().next(), LibraryPolicyType.License);
        Set<LibraryPolicyResult.Threat> threats = result.getThreats().get(LibraryPolicyType.License);
        LibraryPolicyResult.Threat threat = threats.iterator().next();
        assertEquals(threat.getCount(), 1);
        assertEquals(threat.getLevel(), LibraryPolicyThreatLevel.Critical);
        assertEquals(threat.getComponents().iterator().next(), "component1##Open");
        assertEquals(threat.getDispositionCounts().size(), 1);
        assertEquals(threat.getDispositionCounts().get(LibraryPolicyThreatDisposition.Open).intValue(), 1);


        result.addThreat(LibraryPolicyType.License, LibraryPolicyThreatLevel.Critical, LibraryPolicyThreatDisposition.Open, "component2");
        assertEquals(result.getThreats().size(), 1);
        assertEquals(result.getThreats().keySet().size(), 1);
        assertEquals(result.getThreats().values().size(), 1);
        assertEquals(result.getThreats().keySet().iterator().next(), LibraryPolicyType.License);
        threats = result.getThreats().get(LibraryPolicyType.License);
        assertEquals(threats.size(), 1);
        threat = threats.iterator().next();
        assertEquals(threat.getCount(), 2);
        assertEquals(threat.getLevel(), LibraryPolicyThreatLevel.Critical);
        assertTrue(threat.getComponents().contains( "component1##Open"));
        assertTrue(threat.getComponents().contains( "component2##Open"));
        assertEquals(threat.getDispositionCounts().size(), 1);
        assertEquals(threat.getDispositionCounts().get(LibraryPolicyThreatDisposition.Open).intValue(), 2);


        result.addThreat(LibraryPolicyType.License, LibraryPolicyThreatLevel.Critical, LibraryPolicyThreatDisposition.Closed, "component3");
        assertEquals(result.getThreats().size(), 1);
        assertEquals(result.getThreats().keySet().size(), 1);
        assertEquals(result.getThreats().values().size(), 1);
        assertEquals(result.getThreats().keySet().iterator().next(), LibraryPolicyType.License);

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/model/StandardWidgetTest.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.junit.Test;

import java.util.Objects;

import static org.junit.Assert.*;

public class StandardWidgetTest {

    @Test
    public void getOptions() {
    }

    @Test
    public void testStandardwidget() {
        StandardWidget sw = new StandardWidget(CollectorType.Build, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("build"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "build0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("build"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "build0"));

        sw = new StandardWidget(CollectorType.SCM, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("repo"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "repo0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("repo"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "repo0"));

        sw = new StandardWidget(CollectorType.CodeQuality, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "codeanalysis0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "codeanalysis0"));

        sw = new StandardWidget(CollectorType.Test, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "codeanalysis0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "codeanalysis0"));

        sw = new StandardWidget(CollectorType.StaticSecurityScan, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "codeanalysis0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "codeanalysis0"));


        sw = new StandardWidget(CollectorType.LibraryPolicy, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("codeanalysis"));

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/model/ComponentTest.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.junit.Assert;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class ComponentTest {

    @Test
    public void testGetLastUpdatedCollectorItemForType() {
        Component component = new Component();
        List<CollectorItem> cItems = new ArrayList<>();
        cItems.add(makeCollectorItem(1537476665987L));
        cItems.add(makeCollectorItem(0));
        cItems.add(makeCollectorItem(1537471111111L));
        cItems.add(makeCollectorItem(1537472222222L));
        cItems.add(makeCollectorItem(1537473333333L));
        component.getCollectorItems().put(CollectorType.SCM, cItems);
        CollectorItem c = component.getLastUpdatedCollectorItemForType(CollectorType.SCM);
        Assert.assertArrayEquals(new long[]{1537476665987L}, new long[]{c.getLastUpdated()});

    }

    @Test
    public void testGetLastUpdatedCollectorItemForTypeForOneItem() {
        Component component = new Component();
        List<CollectorItem> cItems = new ArrayList<>();
        cItems.add(makeCollectorItem(1537473333333L));
        component.getCollectorItems().put(CollectorType.SCM, cItems);
        CollectorItem c = component.getLastUpdatedCollectorItemForType(CollectorType.SCM);
        Assert.assertArrayEquals(new long[]{1537473333333L}, new long[]{c.getLastUpdated()});

    }

    @Test
    public void testGetLastUpdatedCollectorItemForTypeForZero() {
        Component component = new Component();
        List<CollectorItem> cItems = new ArrayList<>();
        cItems.add(makeCollectorItem(1537473333333L));
        cItems.add(makeCollectorItem(0));
        component.getCollectorItems().put(CollectorType.SCM, cItems);
        CollectorItem c = component.getLastUpdatedCollectorItemForType(CollectorType.SCM);
        Assert.assertArrayEquals(new long[]{1537473333333L}, new long[]{c.getLastUpdated()});

    }

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/event/EnvironmentComponentEventListenerTest.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.Application;
import com.capitalone.dashboard.model.AuthType;
import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.BinaryArtifact;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.model.EnvironmentComponent;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Owner;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.ScoreDisplayType;
import com.capitalone.dashboard.repository.BinaryArtifactRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.CommitRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.capitalone.dashboard.util.TestUtils.createBuild;
import static com.capitalone.dashboard.util.TestUtils.createCommit;
import static com.capitalone.dashboard.util.TestUtils.createPipelineCommit;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class EnvironmentComponentEventListenerTest {

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/event/TestResultEventListenerTest.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.TestResult;
import com.capitalone.dashboard.model.TestCapability;
import com.capitalone.dashboard.model.TestSuiteType;
import com.capitalone.dashboard.model.TestCase;
import com.capitalone.dashboard.model.TestCaseStatus;
import com.capitalone.dashboard.model.TestCaseStep;
import com.capitalone.dashboard.model.TestSuite;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Performance;
import com.capitalone.dashboard.model.PerformanceType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PerformanceRepository;
import org.bson.types.ObjectId;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;

import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class TestResultEventListenerTest {

    @Mock
    private CollectorRepository collectorRepository;
    @Mock
    private CollectorItemRepository collectorItemRepository;
    @Mock
    private PerformanceRepository performanceRepository;
    @InjectMocks
    private TestResultEventListener testResultEventListener;
    private static final String COLLECTOR_NAME = "PerfTools";

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/event/CommitEventListenerTest.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.Application;
import com.capitalone.dashboard.model.AuthType;
import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.CommitType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.model.Owner;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.ScoreDisplayType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class CommitEventListenerTest {

    @Mock
    private ComponentRepository componentRepository;

    @Mock
    private DashboardRepository dashboardRepository;

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/event/BuildEventListenerTest.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.event.sync.SyncDashboard;
import com.capitalone.dashboard.model.Application;
import com.capitalone.dashboard.model.AuthType;
import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Owner;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.ScoreDisplayType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.CommitRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.capitalone.dashboard.util.TestUtils.createBuild;
import static com.capitalone.dashboard.util.TestUtils.createCommit;
import static com.capitalone.dashboard.util.TestUtils.createPipelineCommit;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;


@RunWith(MockitoJUnitRunner.class)
public class BuildEventListenerTest {


=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/event/sync/SyncDashboardTest.java
=====================================================
package com.capitalone.dashboard.event.sync;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.Widget;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.BuildRepository;
import com.capitalone.dashboard.repository.CodeQualityRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.LibraryPolicyResultsRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import com.capitalone.dashboard.repository.TestResultRepository;
import com.capitalone.dashboard.testutil.FongoConfig;
import com.capitalone.dashboard.util.LoadTestData;
import com.github.fakemongo.junit.FongoRule;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {FongoConfig.class})
@DirtiesContext

public class SyncDashboardTest {

=====================================================
== File: site-content/src/test/java/com/capitalone/dashboard/MarkdownTest.java
=====================================================
package com.capitalone.dashboard;

import com.google.common.base.Predicate;
import com.google.common.io.Files;
import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;

import javax.annotation.Nullable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.util.Locale;
import java.util.regex.Pattern;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class MarkdownTest {

    private Pattern absoluteLinkPattern = Pattern.compile(".*github.com/capitalone/Hygieia.*", Pattern.DOTALL);
    private File root;

    @Before
    public void before(){
        root = getProjectRoot();
    }

    @Test
    public void licenseInRoot(){
        File license = new File(root, "LICENSE");
        assertTrue(license.exists());
        license = null;
    }

    private static final Predicate<File> MARK_DOWN_PREDICATE = new Predicate<File>() {
        @Override
        public boolean apply(@Nullable File file) {
            return file != null && file.getName().endsWith(".md");
        }
    };

    //TODO: Review: disabled so we can explain how to setup a test example pointing to the Hygieia github, not sure this is really necessary.
    @Ignore
    @Test
    public void noAbsoluteLinksInMarkdown() throws Exception {

=====================================================
== File: site-content/src/main/resources/logback.xml
=====================================================
<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
      <pattern>%d %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>
  <root level="INFO">
      <appender-ref ref="STDOUT" />
  </root>

  <logger name="com.mongodb.FongoDBCollection" level="INFO"/>
  <logger name="com.github.fakemongo.impl.ExpressionParser" level="INFO"/>
</configuration>

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/misc/HygieiaException.java
=====================================================
package com.capitalone.dashboard.misc;

public class HygieiaException extends Exception {
	private static final long serialVersionUID = 4596406816345733781L;
	public static final int NOTHING_TO_UPDATE = 0;
    public static final int JSON_FORMAT_ERROR = -1;
    public static final int COLLECTOR_CREATE_ERROR = -10;
    public static final int COLLECTOR_ITEM_CREATE_ERROR = -11;
    public static final int ERROR_INSERTING_DATA = -12;
    public static final int DUPLICATE_DATA = -13;
    public static final int BAD_DATA = -14;
    public static final int API_RATE_LIMIT_ERROR = -15;
    
    public static final int INVALID_CONFIGURATION = -999;
    
    private int errorCode = 0;

    public HygieiaException(String message, int errorCode) {
        super(message);
        this.errorCode = errorCode;
    }

    public HygieiaException(String message, Throwable cause, int errorCode) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public HygieiaException(Throwable cause) {
        super(cause);
    }

    public HygieiaException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public int getErrorCode() {
        return errorCode;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/AuditResultRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.AuditResult;
import com.capitalone.dashboard.model.AuditType;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;

public interface AuditResultRepository extends PagingAndSortingRepository<AuditResult, ObjectId> {

    AuditResult findById(ObjectId id);
    Page<AuditResult> findByAuditType(AuditType auditType, Pageable pageable);
    Iterable<AuditResult> findByDashboardTitle(String dashboardTitle);
    Iterable<AuditResult> findByDashboardTitleAndAuditType(String dashboardTitle, AuditType auditType);
    Iterable<AuditResult> findByConfigItemBusServNameAndConfigItemBusAppName(String configItemBusServName, String configItemBusAppName);
    Iterable<AuditResult> findByConfigItemBusServNameAndConfigItemBusAppNameAndAuditType(String configItemBusServName, String configItemBusAppName, AuditType auditType);
    Page<AuditResult> findByLineOfBusiness(String lineOfBusiness, Pageable pageable);
    Page<AuditResult> findByLineOfBusinessAndAuditType(String lineOfBusiness, AuditType auditType, Pageable pageable);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorItem;
import com.mysema.query.BooleanBuilder;
import com.mysema.query.types.path.PathBuilder;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * A {@link CollectorItem} repository
 */
public interface CollectorItemRepository extends BaseCollectorItemRepository<CollectorItem>, QueryDslPredicateExecutor<CollectorItem> {

    //// FIXME: 1/20/16 I really hate this dashboard specific method in the collectoritem repository, should we move the dashboardcollectoritem repository into core?
    @Query(value="{'options.dashboardId': ?1, 'collectorId': ?0 }")
    CollectorItem findTeamDashboardCollectorItemsByCollectorIdAndDashboardId(ObjectId collectorId, String dashboardId);
    @Query(value="{'options.applicationName' : ?1, 'collectorId' : ?0}")
    List<CollectorItem> findByOptionsAndDeployedApplicationName(ObjectId collectorId, String applicationName);

    // FIXME: 3/1/16 Really need to refactor this. Do not want collector specific lookups here.
    @Query(value="{'options.jobName' : ?2, 'niceName' : ?1, 'collectorId' : ?0}")
    CollectorItem findByCollectorIdNiceNameAndJobName(ObjectId collectorId, String niceName, String jobName);
    @Query(value="{'options.projectId' : ?2, 'niceName' : ?1, 'collectorId' : ?0}")
    CollectorItem findByCollectorIdNiceNameAndProjectId(ObjectId collectorId, String niceName, String projectId);

    @Query(value="{ 'collectorId' : ?0, options.url : {$regex : '^?1$', $options: 'i'}, options.branch : {$regex : '^?2$', $options: 'i'}, enabled : ?3}")
    CollectorItem findRepoByUrlAndBranch(ObjectId collectorId, String url, String branch, boolean enabled);

    @Query(value="{ 'collectorId': { $in: ?0 }, ?1 : {$regex : '.*?2.*', $options: 'i'}}")
    Page<CollectorItem> findByCollectorIdAndSearchField(List<ObjectId> collectorId, String searchField, String searchFieldValue, Pageable pageable);

    @Query(value="{ 'collectorId': { $in: ?0 }, ?1 : {$regex : '.*?2.*', $options: 'i'} ,  ?3 : {$regex : '.*?4.*', $options: 'i'}}")
    Page<CollectorItem> findByCollectorIdAndSearchFields(List<ObjectId> collectorId,String searchField1, String searchFieldValue1, String searchField2,String searchFieldValue2,  Pageable pageable);

    @Query(value="{'options.teamId' : ?0}")
    CollectorItem findByJiraTeamId(String teamId);

    @Query(value="{'options.projectId' : ?0}")
    CollectorItem findByJiraProjectId(String projectId);

    List<CollectorItem> findByDescription(String description);

    default Iterable<CollectorItem> findAllByOptionNameValue(String optionName, String optionValue) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ChangeOrderRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.ChangeOrder;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

/**
 * Repository for {@link ChangeOrder} data.
 */
public interface ChangeOrderRepository extends CrudRepository<ChangeOrder, ObjectId> {
    ChangeOrder findByChangeID(String changeItem);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/RequestLogRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.RequestLog;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

public interface RequestLogRepository extends CrudRepository<RequestLog, ObjectId> {
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryCustom.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.Map;

import com.capitalone.dashboard.model.BinaryArtifact;

public interface BinaryArtifactRepositoryCustom {
	String CANONICAL_NAME = "canonicalName";
	String ARTIFACT_GROUP_ID = "artifactGroupId";
	String ARTIFACT_MODULE = "artifactModule";
	String ARTIFACT_VERSION = "artifactVersion";
	String ARTIFACT_NAME = "artifactName";
	String ARTIFACT_CLASSIFIER = "artifactClassifier";
	String ARTIFACT_EXTENSION = "artifactExtension";
	String BUILD_INFO_ID = "buildInfo.id";
			
	Iterable<BinaryArtifact> findByAttributes(Map<String, Object> attributes);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/EnvironmentComponentRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.EnvironmentComponent;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * {@link EnvironmentComponent} repository.
 */
public interface EnvironmentComponentRepository extends CrudRepository<EnvironmentComponent, ObjectId> {

    /**
     * Finds the {@link EnvironmentComponent} collector item id, environment name and component name.
     *
     * @param collectorItemId collector item id
     * @param environmentName environment name
     * @param componentName component name
     * @return a {@link EnvironmentComponent}
     */
    @Query(value="{ collectorItemId : ?0, environmentName : ?1, componentName : ?2}")
    EnvironmentComponent findComponent(ObjectId collectorItemId, String environmentName, String componentName);

    /**
     * Finds all {@link EnvironmentComponent}s for a given {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @return list of {@link EnvironmentComponent}
     */
    List<EnvironmentComponent> findByCollectorItemId(ObjectId collectorItemId);

    @Query(value="{ 'collectorItemId': {$in: ?0 }, 'deployed': true}")
    List<EnvironmentComponent> findDeployedByCollectorItemIds(List<ObjectId> collectorItemIds);

    @Query(value="{ 'collectorItemId': ?0, 'componentName': ?1, 'componentVersion': ?2, 'deployed':true}")
    List<EnvironmentComponent> findDeployedByCollectorItemIdAndComponentNameAndComponentVersion(ObjectId dashboardCollectorItemId, String componentName, String componentVersion);

    @Query(value="{ 'collectorItemId': ?0, 'componentName': ?1, 'componentVersion': ?2, 'deployTime':?3}")
    EnvironmentComponent findByUniqueKey(ObjectId collectorItemId, String componentName, String componentVersion, long deployTime);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/GitHubRepoRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.webhook.github.GitHubRepo;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;

import java.util.List;

public interface GitHubRepoRepository extends BaseCollectorItemRepository<GitHubRepo>, QueryDslPredicateExecutor<GitHubRepo> {
    @Query(value="{ 'collectorId' : ?0, options.url : ?1, options.branch : ?2}")
    GitHubRepo findGitHubRepo(ObjectId collectorId, String url, String branch);

    @Query(value="{ 'collectorId' : ?0, enabled: true}")
    List<GitHubRepo> findEnabledGitHubRepos(ObjectId collectorId);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/AuthenticationRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import org.bson.types.ObjectId;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.capitalone.dashboard.model.Authentication;

public interface AuthenticationRepository extends PagingAndSortingRepository<Authentication, ObjectId>{
	
	
	 Authentication findByUsername(String username);


}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/GenericCollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.GenericCollectorItem;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Build} data.
 */
public interface GenericCollectorItemRepository extends CrudRepository<GenericCollectorItem, ObjectId>, QueryDslPredicateExecutor<GenericCollectorItem> {
    List<GenericCollectorItem> findAllByToolName(String toolName);
    List<GenericCollectorItem> findAllByRelatedCollectorItem (ObjectId relatedCollectorItemId);
    GenericCollectorItem findByToolNameAndRawDataAndRelatedCollectorItem(String toolName, String rawData, ObjectId relatedCollectorItem);
    List<GenericCollectorItem> findAllByToolNameAndProcessTimeEquals(String toolName, long processTime);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/RallyBurnDownRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.RallyBurnDownData;

public interface RallyBurnDownRepository extends CrudRepository<RallyBurnDownData, ObjectId>{
	
	RallyBurnDownData findByIterationIdAndProjectId(String iterationId, String projectId);
	
}
	

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CloudVolumeRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudVolumeStorage;
import com.capitalone.dashboard.model.NameValue;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;
import java.util.List;

public interface CloudVolumeRepository extends
        CrudRepository<CloudVolumeStorage, ObjectId>,
        QueryDslPredicateExecutor<CloudVolumeStorage> {

    @Query(value = "{ collectorItemId:  ?0 }")
    Collection<CloudVolumeStorage> findByCollectorItemId(ObjectId collectorItemId);

    @Query(value = "{volumeId : ?0}")
    CloudVolumeStorage findByVolumeId(String volumeId);

    @Query(value = "{ tags: ?0 }")
    Collection<CloudVolumeStorage> findByTags(List<NameValue> tags);

    @Query(value = "{ 'tags.name' : ?0, 'tags.value' : ?1 }")
    Collection<CloudVolumeStorage> findByTagNameAndValue(String name, String value);

    Collection<CloudVolumeStorage> findByVolumeIdIn(List<String> volumeId);

    Collection<CloudVolumeStorage> findByAttachInstancesIn(List<String> attachInstances);

    @Query(value = "{accountNumber : ?0}")
    Collection<CloudVolumeStorage> findByAccountNumber(String accountNumber);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/BuildRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.BuildStatus;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Build} data.
 */
public interface BuildRepository extends CrudRepository<Build, ObjectId>, QueryDslPredicateExecutor<Build> {

    /**
     * Finds the {@link Build} with the given number for a specific {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param number buld number
     * @return a {@link Build}
     */
    Build findByCollectorItemIdAndNumber(ObjectId collectorItemId, String number);

    @Query(value="{'sourceChangeSet.scmRevisionNumber' : {$exists: true, $in: ?0}, 'collectorItemId': { $in: ?1 }}")
    List<Build> findBuildsForRevisionNumbersAndBuildCollectorItemIds(List<String> scmRevisionNumbers, List<ObjectId> buildCollectorItemId);

    Build findTop1ByCollectorItemIdOrderByTimestampDesc(ObjectId collectorItemId);

    Build findTop1ByCollectorItemIdAndBuildStatusOrderByTimestampDesc(ObjectId collectorItemId, BuildStatus buildStatus);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ApiTokenRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.ApiToken;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface ApiTokenRepository extends CrudRepository<ApiToken, ObjectId> {
    ApiToken findByApiUserAndExpirationDt(String apiUser, Long expirationDt);
    ApiToken findByApiUserAndApiKey(String apiUser, String apiKey);
    List<ApiToken> findByApiUser(String apiUser);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQuery.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import org.bson.types.ObjectId;

import java.util.List;
import java.util.Map;


public interface CustomRepositoryQuery {
    List<CollectorItem> findCollectorItemsBySubsetOptions(ObjectId id, Map<String, Object> allOptions, Map<String, Object> uniqueOptions,Map<String,Object> uniqueOptionsFromCollector);
    List<Component> findComponents(Collector collector);
    List<Component> findComponents(CollectorType collectorType);
    List<Component> findComponents(Collector collector, CollectorItem collectorItem);
    List<Component> findComponents(ObjectId collectorId, CollectorType collectorType, CollectorItem collectorItem);
    List<Component> findComponents(ObjectId collectorId, CollectorType collectorType, ObjectId collectorItemId);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CloudInstanceHistoryRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudInstanceHistory;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;

public interface CloudInstanceHistoryRepository extends
        CrudRepository<CloudInstanceHistory, ObjectId> {

    Collection<CloudInstanceHistory> findByAccountNumber(String accountNumber);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/FortifyScanRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.FortifyScanReport;

public interface FortifyScanRepository extends CrudRepository<FortifyScanReport, ObjectId>{
	
	FortifyScanReport findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);

	List<FortifyScanReport> findByCollectorItemId(ObjectId id);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/IncidentRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Incident;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

/**
 * Repository for {@link Incident} data.
 */

public interface IncidentRepository extends MongoRepository<Incident, ObjectId> {
    Incident findByIncidentID(String incidentID);

    @Query("{ 'severity' : {$in : ?0} }")
    List<Incident> findBySeverity(String[] severityValues);

    @Query(value = "{'severity' : {$in : ?0}, 'openTime' : {$gt : ?1, $lt : ?2}}")
    Page<Incident> findIncidentsBySeverityAndOpenTimeBetween (String[] severityValues, long startDate, long endDate, Pageable pageable);

    @Query(value = "{'severity' : {$in : ?0}, 'openTime' : {$gt : ?1, $lt : ?2}}", count = true)
    long countIncidentsBySeverityAndOpenTimeBetween (String[] severityValues, long startDate, long endDate);

    @Query("{ 'collectorItemId' : {$in : ?0} }")
    List<Incident> findByCollectorItemId(List<ObjectId> collectorItemIds);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/JobRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;

import com.capitalone.dashboard.model.JobCollectorItem;

public interface JobRepository<T extends JobCollectorItem> extends BaseCollectorItemRepository<T> {
    @Query(value="{ 'collectorId' : ?0, options.instanceUrl : ?1, options.jobName : ?2}")
    T findJob(ObjectId collectorId, String instanceUrl, String jobName);

    @Query(value="{ 'collectorId' : ?0, options.jobUrl : ?1, options.jobName : ?2}")
    T findJobByJobUrl(ObjectId collectorId, String jobUrl, String jobName);

    @Query(value="{ 'collectorId' : ?0, options.instanceUrl : ?1, enabled: true}")
    List<T> findEnabledJobs(ObjectId collectorId, String instanceUrl);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.BinaryArtifact;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface BinaryArtifactRepository extends CrudRepository<BinaryArtifact, ObjectId>, BinaryArtifactRepositoryCustom {

    Iterable<BinaryArtifact> findByCollectorItemId(ObjectId collectorItemId);
    
    @Query("{ 'collectorItemId': ?0, 'artifactGroupId' : ?1, 'artifactModule' : ?2, 'artifactVersion' : ?3, 'artifactName' : ?4, 'artifactClassifier' : ?5, 'artifactExtension' : ?6 }")
    Iterable<BinaryArtifact> findByAttributes(Object collectorItemId, String artifactGroupId, String artifactModule, String artifactVersion, String artifactName, String artifactClassifier, String artifactExtension);
    
    @Query("{ 'artifactGroupId' : ?0, 'artifactModule' : ?1, 'artifactVersion' : ?2, 'artifactName' : ?3, 'artifactClassifier' : ?4, 'artifactExtension' : ?5 }")
    Iterable<BinaryArtifact> findByAttributes(String artifactGroupId, String artifactModule, String artifactVersion, String artifactName, String artifactClassifier, String artifactExtension);

    Iterable<BinaryArtifact> findByBuildInfoId (ObjectId artifactBuildId);

    Iterable<BinaryArtifact> findByArtifactNameAndTimestampGreaterThan(String artifactName, Long timestamp);
    Iterable<BinaryArtifact> findByArtifactNameAndArtifactExtensionAndTimestampGreaterThan(String artifactName, String artifactExtension, Long timestamp);

    @Query(value="{'metadata.buildUrl' : ?0}")
    Iterable<BinaryArtifact> findByMetadataBuildUrl(String buildUrl);

    List<BinaryArtifact> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/LibraryPolicyResultsRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.LibraryPolicyResult;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link CodeQuality} data.
 */
public interface LibraryPolicyResultsRepository extends CrudRepository<LibraryPolicyResult, ObjectId>, QueryDslPredicateExecutor<LibraryPolicyResult> {


    LibraryPolicyResult findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
    LibraryPolicyResult findByCollectorItemId(ObjectId collectorItemId);
    List<LibraryPolicyResult> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);
    List<LibraryPolicyResult> findByCollectorItemIdAndEvaluationTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryImpl.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

import com.capitalone.dashboard.model.BinaryArtifact;

public class BinaryArtifactRepositoryImpl implements BinaryArtifactRepositoryCustom {	
	@Autowired
	MongoTemplate template;
	
	@Override
	public Iterable<BinaryArtifact> findByAttributes(Map<String, Object> attributes) {
		Criteria c = null;
		
		boolean first = true;
		for (Map.Entry<String, Object> e : attributes.entrySet()) {
			if (first) {
				c = Criteria.where(e.getKey()).is(e.getValue());
			} else {
				c = c.and(e.getKey()).is(e.getValue());
			}
			
			first = false;
		}
		
		return template.find(new Query(c), BinaryArtifact.class);
	}
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ServiceAccountRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.ServiceAccount;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

public interface ServiceAccountRepository extends CrudRepository<ServiceAccount, ObjectId> {

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ScopeRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.Scope;

/**
 * Repository for {@link Scope}.
 */
public interface ScopeRepository extends CrudRepository<Scope, ObjectId>,
		QueryDslPredicateExecutor<Scope> {
	/**
	 * This essentially returns the max change date from the collection, based
	 * on the last change date (or default delta change date property) available
	 * 
	 * @param collectorId
	 *            Collector ID of source system collector
	 * @param changeDate
	 *            Last available change date or delta begin date property
	 * @return A single Change Date value that is the maximum value of the
	 *         existing collection
	 */
	@Query
	List<Scope> findTopByCollectorIdAndChangeDateGreaterThanOrderByChangeDateDesc(
			ObjectId collectorId, String changeDate);

	@Query(value = "{'pId' : ?0}", fields="{'pId' : 1}")
	List<Scope> getScopeIdById(String pId);

	@Query
	List<Scope> findByOrderByProjectPathDesc();

	@Query(value = "{'pId' : ?0 }")
	List<Scope> getScopeById(String pId);

	@Query(value = "{ 'collectorId' : ?0 }")
	List<Scope> findByCollectorId(ObjectId collectorId);

	Page<Scope> findAllByCollectorIdAndNameContainingIgnoreCase(ObjectId collectorId, String name, Pageable pageable);

	Scope findByCollectorIdAndPId(ObjectId collectorId, String pId);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ScoreCriteriaSettingsRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.score.ScoreMetric;
import com.capitalone.dashboard.model.score.ScoreValueType;
import com.capitalone.dashboard.model.score.settings.ScoreCriteriaSettings;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

/**
 * Repository for {@link ScoreCriteriaSettings} data.
 */
public interface ScoreCriteriaSettingsRepository extends CrudRepository<ScoreCriteriaSettings, ObjectId>, QueryDslPredicateExecutor<ScoreMetric> {

    /**
     * Finds {@link ScoreCriteriaSettings}s for a given type {@link com.capitalone.dashboard.model.score.ScoreValueType}.
     *
     * @param type Score Value Type
     * @return a {@link ScoreCriteriaSettings}
     */
    ScoreCriteriaSettings findByType(ScoreValueType type);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CloudSubNetworkRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudInstance;
import com.capitalone.dashboard.model.CloudSubNetwork;
import com.capitalone.dashboard.model.NameValue;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;
import java.util.List;

public interface CloudSubNetworkRepository extends
        CrudRepository<CloudSubNetwork, ObjectId>,
        QueryDslPredicateExecutor<CloudInstance> {

    @Query(value = "{ collectorItemId:  ?0 }")
    CloudSubNetwork findByCollectorItemId(ObjectId collectorItemId);

    @Query(value= "{ tags: ?0 }")
    Collection<CloudSubNetwork> findByTags(List<NameValue> tags);


    @Query(value = "{subnetId : ?0}")
    CloudSubNetwork findBySubnetId(String subnetId);

    @Query(value = "{ 'tags.name' : ?0, 'tags.value' : ?1 }")
    Collection<CloudSubNetwork> findByTagNameAndValue(String name, String value);

    Collection<CloudSubNetwork> findBySubnetIdIn(List<String> subnetId);

    Collection<CloudSubNetwork> findByAccountNumber(String accountNumber);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CollItemConfigHistoryRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorItemConfigHistory;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface CollItemConfigHistoryRepository extends CrudRepository<CollectorItemConfigHistory, ObjectId>  {
	List<CollectorItemConfigHistory> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);
	CollectorItemConfigHistory findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/BaseCollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.capitalone.dashboard.model.CollectorItem;

/**
 * Base {@link CollectorItem} repository that provides methods useful for any {@link CollectorItem}
 * implementation.
 *
 * @param <T> Class that extends {@link CollectorItem}
 */
public interface BaseCollectorItemRepository<T extends CollectorItem> extends PagingAndSortingRepository<T, ObjectId> {

    /**
     * Finds all {@link CollectorItem}s that are enabled.
     *
     * @return list of {@link CollectorItem}s
     */
    List<T> findByEnabledIsTrue();

    /**
     * Finds all {@link CollectorItem}s that match the provided id's.
     *
     * @param ids {@link Collection} of ids
     * @return list of {@link CollectorItem}s
     */
    List<T> findByCollectorIdIn(Collection<ObjectId> ids);
    
    /**
     * Finds paged results of {@link CollectorItem}s that match the provided id's.
     *
     * @param ids {@link Collection} of ids
     * @param {@link org.springframework.data.domain.Pageable} object to determine which page to return
     * @return page of {@link CollectorItem}s
     */
    Page<T> findByCollectorIdInAndDescriptionContainingIgnoreCase(Collection<ObjectId> ids, String description, Pageable pageable);

    /**
     * Finds the {@link CollectorItem} for a given collector and options. This should represent a unique
     * instance of a {@link CollectorItem} for a given {@link com.capitalone.dashboard.model.Collector}.
     *

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/TeamRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Team;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Team}.
 */
public interface TeamRepository extends CrudRepository<Team, ObjectId>,
        QueryDslPredicateExecutor<Team> {

    Team findByTeamId(String teamId);

    Team findByName(String name);

    /**
     * This essentially returns the max change date from the collection, based
     * on the last change date (or default delta change date property) available
     *
     * @param collectorId
     *            Collector ID of source system collector
     * @param changeDate
     *            Last available change date or delta begin date property
     * @return A single Change Date value that is the maximum value of the
     *         existing collection
     */
    @Query(value = "{ 'collectorId' : ?0, 'changeDate' : {$gt: ?1}, '_class' : 'com.capitalone.dashboard.model.Team', 'assetState': 'Active'}")
    List<Team> findTopByChangeDateDesc(ObjectId collectorId, String changeDate);

    @Query(value = "{ 'collectorId' : ?0 }")
    List<Team> findByCollectorId(ObjectId collectorId);

    Page<Team> findAllByCollectorIdAndNameContainingIgnoreCase(ObjectId collectorId, String name, Pageable pageable);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CodeQualityRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CodeQuality;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link CodeQuality} data.
 */
public interface CodeQualityRepository extends CrudRepository<CodeQuality, ObjectId>, QueryDslPredicateExecutor<CodeQuality> {

    /**
     * Finds the {@link CodeQuality} data point at the given timestamp for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param timestamp timestamp
     * @return a {@link CodeQuality}
     */
    CodeQuality findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
    
    List<CodeQuality> findByCollectorItemIdAndVersionOrderByTimestampDesc (ObjectId collectorItemId,String version);

    List<CodeQuality> findByCollectorItemIdAndNameAndVersionOrderByTimestampDesc (ObjectId collectorItemId,String name,String version);
    
    List<CodeQuality> findByCollectorItemIdOrderByTimestampDesc (ObjectId collectorItemId);
    
    List<CodeQuality> findByNameAndVersion(String name,String version);

    List<CodeQuality> findByNameAndVersionOrderByTimestampDesc(String name,String version);

    List<CodeQuality> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);

    CodeQuality findTop1ByCollectorItemIdOrderByTimestampDesc(ObjectId collectorItemId);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryImpl.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import javax.xml.bind.DatatypeConverter;

import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.util.StringUtils;

import com.capitalone.dashboard.model.Feature;
import com.capitalone.dashboard.util.FeatureCollectorConstants;

/**
 * Repository for {@link Feature} with custom methods implementation.
 */
public class FeatureRepositoryImpl implements FeatureRepositoryCustom {

    @Autowired
    private MongoOperations operations;
    
    @Override
    @SuppressWarnings("PMD.NPathComplexity")
    public List<Feature> findByActiveEndingSprints(String sTeamId, String sProjectId, ObjectId collectorId, String currentISODateTime, boolean minimal) {
        boolean dateTimeValid = true;
        try {
            DatatypeConverter.parseDateTime(currentISODateTime);
        } catch (IllegalArgumentException e) {
            // invalid datetime string
            dateTimeValid = false;
        }
        String queryStr = dateTimeValid 
                ? "{'isDeleted' : 'False', $and : [{'sSprintID' : {$ne : null}}, {'sSprintID' : {$ne : ''}}, {'sSprintAssetState': { $regex: '^active$', $options: 'i' }}, {'sSprintEndDate' : {$gte : '" + currentISODateTime + "'}}, {'sSprintEndDate' : {$lt : '9999-12-31T59:59:59.999999'}}] }, $orderby: { 'sStatus' :-1 }" 
                : "{'isDeleted' : 'False', $and : [{'sSprintID' : {$ne : null}}, {'sSprintID' : {$ne : ''}}, {'sSprintAssetState': { $regex: '^active$', $options: 'i' }}, {'sSprintEndDate' : {$lt : '9999-12-31T59:59:59.999999'}}] }, $orderby: { 'sStatus' :-1 }";
        BasicQuery query = null;
        if (minimal) {
            query = new BasicQuery(queryStr,
                    "{'sStatus': 1, 'sNumber': 1, 'sName': 1, 'changeDate': 1, 'sUrl': 1, 'sSprintID': 1, 'sSprintName': 1, 'sSprintUrl': 1, 'sSprintBeginDate': 1, 'sSprintEndDate': 1, 'sEpicID' : 1,'sEpicNumber' : 1, 'sEpicName' : 1, 'sEpicUrl' : 1, 'sEstimate': 1, 'sEstimateTime': 1}");
        } else {
            query = new BasicQuery(queryStr);
        }
        if (collectorId != null) {
            query.addCriteria(Criteria.where("collectorId").is(collectorId));
        }
        if (!StringUtils.isEmpty(sTeamId) && !FeatureCollectorConstants.TEAM_ID_ANY.equalsIgnoreCase(sTeamId)) {
            query.addCriteria(Criteria.where("sTeamID").is(sTeamId));
        }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryCustom.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;

import com.capitalone.dashboard.model.Feature;

/**
 * Repository for {@link FeatureCollector} with custom methods.
 */
public interface FeatureRepositoryCustom {
    
    /**
     * Find all features with active sprints that are between the provided date and that have an end date < 9999-12-31 EOD
     * 
     * @param sTeamId
     * @param sProjectId
     * @param currentISODateTime
     * @param minimal
     * @return
     */
    List<Feature> findByActiveEndingSprints(String sTeamId, String sProjectId, ObjectId collectorId, String currentISODateTime, boolean minimal);

    /**
     * Find all features that have sprints set but without an end date (or an end date >= 9999-12-31 EOD)
     * 
     * @param sTeamId
     * @param sProjectId
     * @param minimal
     * @return
     */
    List<Feature> findByUnendingSprints(String sTeamId, String sProjectId, ObjectId collectorId, boolean minimal);
    
    /**
     * Find all features without sprints set
     * 
     * @param sTeamId
     * @param sProjectId
     * @param minimal
     * @return
     */
    List<Feature> findByNullSprints(String sTeamId, String sProjectId, ObjectId collectorId, boolean minimal);
    
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/DashboardRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.model.Owner;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.Collection;
import java.util.List;

/**
 * {@link Dashboard} repository.
 */
public interface DashboardRepository extends PagingAndSortingRepository<Dashboard, ObjectId> {
	
	List<Dashboard> findByOwner(String owner);

	List<Dashboard> findByOwners(Owner owner);
	List<Dashboard> findByOwnersAndTypeContainingIgnoreCase(Owner owner, String type);

	List<Dashboard> findByTitle(String title);
	Dashboard findByTitleAndType(String title, DashboardType type);

    List<Dashboard> findByApplicationComponentsIn(Collection<Component> components);

    @Query(value="{'application.components.$id': {$in : ?0 }}")
    List<Dashboard> findByApplicationComponentIdsIn(Collection<ObjectId> componentIds);

	@Query(value="{'type': {$in : [null, 'Team']}}")
	List<Dashboard> findTeamDashboards();

	@Query(value="{'widgets.options.teams.collectorItemId': ?0 }")
	List<Dashboard> findProductDashboardsByTeamDashboardCollectorItemId(String teamDashboardCollectorItemId);

	Iterable<Dashboard> findAllByConfigurationItemBusServName(String configurationItem);

	Iterable<Dashboard> findAllByConfigurationItemBusAppName(String configurationItem);

	Iterable<Dashboard> findAllByConfigurationItemBusServNameIn(List<String> configurationItemList);

	Iterable<Dashboard> findAllByConfigurationItemBusServNameAndConfigurationItemBusAppName(String appName, String compName);

	Dashboard findByConfigurationItemBusServNameIgnoreCaseAndConfigurationItemBusAppNameIgnoreCase(String appName, String compName);
	List<Dashboard> findAllByTypeAndConfigurationItemBusServNameContainingIgnoreCase(DashboardType type, String appName);
	List<Dashboard> findAllByConfigurationItemBusServNameContainingIgnoreCaseAndConfigurationItemBusAppNameContainingIgnoreCase(String appName, String compName);

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/TemplateRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Template;
import org.bson.types.ObjectId;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * {@link Template} repository.
 */
public interface TemplateRepository extends PagingAndSortingRepository<Template, ObjectId> {

    Template findByTemplate(String template);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ScoreRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.score.ScoreMetric;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.CodeQuality;

/**
 * Repository for {@link CodeQuality} data.
 */
public interface ScoreRepository extends CrudRepository<ScoreMetric, ObjectId>, QueryDslPredicateExecutor<ScoreMetric> {

    /**
     * Finds the {@link ScoreMetric} data point at the given timestamp for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param timestamp timstamp
     * @return a {@link CodeQuality}
     */
    ScoreMetric findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);

    /**
     * Finds all {@link ScoreMetric}s for a given {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @return list of {@link ScoreMetric}
     */
    ScoreMetric findByCollectorItemId(ObjectId collectorItemId);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CloudInstanceRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudInstance;
import com.capitalone.dashboard.model.NameValue;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;
import java.util.List;

public interface CloudInstanceRepository extends
        CrudRepository<CloudInstance, ObjectId>,
        QueryDslPredicateExecutor<CloudInstance> {

    @Query(value = "{instanceId : ?0}")
    CloudInstance findByInstanceId(String instanceId);

    @Query(value = "{ tags: ?0 }")
    Collection<CloudInstance> findByTags(List<NameValue> tags);

    @Query(value = "{ 'tags.name' : ?0, 'tags.value' : ?1 }")
    Collection<CloudInstance> findByTagNameAndValue(String name, String value);

    Collection<CloudInstance> findByInstanceIdIn(List<String> instanceId);

    @Query(value = "{accountNumber : ?0}")
    Collection<CloudInstance> findByAccountNumber(String accountNumber);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CmdbRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Cmdb;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
/**
 * Repository for {@link Cmdb} data.
 */
public interface CmdbRepository extends CrudRepository<Cmdb, ObjectId>  {

    Cmdb findByConfigurationItem(String configurationItem);

    List<Cmdb> findAllByConfigurationItemContainingOrCommonNameContainingAllIgnoreCase(String configItemFilter, String commonNameFilter);

    Page<Cmdb> findAllByItemTypeAndValidConfigItemAndIdIn(String itemType, boolean valid, List<ObjectId> idList, Pageable pageable);

    Page<Cmdb> findAllByItemTypeAndConfigurationItemContainingIgnoreCaseAndValidConfigItem(String itemType, String configurationItem, Pageable pageable, boolean valid);

    Cmdb findByConfigurationItemIgnoreCase(String configurationItem);

    List<Cmdb> findAllByItemType(String type);

    List<Cmdb> findAllByItemTypeAndValidConfigItem(String type, boolean valid);

    Cmdb findByConfigurationItemAndItemType(String confiugrationItem, String itemType);

    Iterable<Cmdb> findAllByValidConfigItem(boolean validFlag);

    Cmdb findByConfigurationItemIgnoreCaseOrCommonNameIgnoreCase(String configurationItem, String commonName);

    Cmdb findByItemTypeAndCommonNameContainingIgnoreCase(String itemType, String commonName);

    Cmdb findByItemTypeAndConfigurationItemIgnoreCase(String itemType, String configurationItem);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CloudVirtualNetworkRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudInstance;
import com.capitalone.dashboard.model.CloudVirtualNetwork;
import com.capitalone.dashboard.model.NameValue;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;
import java.util.List;

public interface CloudVirtualNetworkRepository extends
        CrudRepository<CloudVirtualNetwork, ObjectId>,
        QueryDslPredicateExecutor<CloudInstance> {

    @Query(value = "{ collectorItemId:  ?0 }")
    CloudVirtualNetwork findByCollectorItemId(ObjectId collectorItemId);

    @Query(value= "{ tags: ?0 }")
    Collection<CloudVirtualNetwork> findByTags(List<NameValue> tags);


    @Query(value = "{virtualNetorkId : ?0}")
    CloudVirtualNetwork findByVirtualNetworkId(String virtualNetworkId);

    @Query(value = "{ 'tags.name' : ?0, 'tags.value' : ?1 }")
    Collection<CloudVirtualNetwork> findByTagNameAndValue(String name, String value);

    Collection<CloudVirtualNetwork> findByvirtualNetworkIdIn(List<String> virtualNetworkId);

    @Query(value = "{accountNumber : ?0}")
    Collection<CloudVirtualNetwork> findByAccountNumber(String accountNumber);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ScoreCollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;

import com.capitalone.dashboard.model.score.ScoreCollectorItem;

/**
 * Repository for {@link ScoreCollectorItem}s.
 */
public interface ScoreCollectorItemRepository extends BaseCollectorItemRepository<ScoreCollectorItem> {

  /**
   * Finds all enabled {@link ScoreCollectorItem}s
   *
   * @param collectorId ID
   * @return list of {@link ScoreCollectorItem}s
   */
  @Query(value = "{ 'collectorId' : ?0, enabled: true}")
  List<ScoreCollectorItem> findEnabledScores(ObjectId collectorId);

  @Query(value="{'collectorId': ?0, 'options.dashboardId': ?1}")
  ScoreCollectorItem findCollectorItemByCollectorIdAndDashboardId(ObjectId collectorId, ObjectId dashboardId);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/UserInfoRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.Collection;

import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.AuthType;
import com.capitalone.dashboard.model.UserInfo;
import com.capitalone.dashboard.model.UserRole;

public interface UserInfoRepository extends CrudRepository<UserInfo, ObjectId>{

	UserInfo findByUsernameAndAuthType(String username, AuthType authType);

    Collection<UserInfo> findByAuthoritiesIn(UserRole roleAdmin);

    Iterable<UserInfo> findByOrderByUsernameAsc();

    UserInfo findByUsername(String userName);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ScopeOwnerRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;

import com.capitalone.dashboard.model.ScopeOwnerCollectorItem;

/**
 * CollectorItem repository for {@link ScopeOwnerCollectorItem}.
 */
public interface ScopeOwnerRepository extends BaseCollectorItemRepository<ScopeOwnerCollectorItem> {
	@Query(value = "{ 'collectorId' : ?0, 'options.teamId' : ?1, 'options.assetState': 'Active'}")
	ScopeOwnerCollectorItem findTeamCollector(ObjectId collectorId, String teamId);
	
	@Query(value = "{ 'collectorId' : ?0, 'options.teamId' : ?1, options.name : ?2, 'options.assetState': 'Active'}")
	ScopeOwnerCollectorItem findTeamCollector(ObjectId collectorId, String teamId, String name);

	@Query(value = "{ 'collectorId' : ?0, 'options.teamId' : ?1, enabled: true, 'options.assetState': 'Active'}")
	List<ScopeOwnerCollectorItem> findEnabledTeamCollectors(ObjectId collectorId, String teamId);

	/**
	 * This essentially returns the max change date from the collection, based
	 * on the last change date (or default delta change date property) available
	 * 
	 * @param collectorId
	 *            Collector ID of source system collector
	 * @param changeDate
	 *            Last available change date or delta begin date property
	 * @return A single Change Date value that is the maximum value of the
	 *         existing collection
	 */
	@Query(value = "{ 'collectorId' : ?0, 'options.changeDate' : {$gt: ?1}, '_class' : 'com.capitalone.dashboard.model.ScopeOwnerCollectorItem', 'options.assetState': 'Active'}")
	List<ScopeOwnerCollectorItem> findTopByChangeDateDesc(ObjectId collectorId, String changeDate);

	@Query(value = "{'options.teamId' : ?0}", fields = "{'options.teamId' : 1}")
	List<ScopeOwnerCollectorItem> getTeamIdById(String teamId);

	@Query(value = "{'options.assetState' : ?0}", delete = true)
	List<ScopeOwnerCollectorItem> delete(String assetState);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.mysema.query.BooleanBuilder;
import com.mysema.query.types.path.PathBuilder;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
import java.util.Map;

/**
 * {@link Component} repository.
 */
public interface ComponentRepository extends CrudRepository<Component, ObjectId>,QueryDslPredicateExecutor<Component> {


    @Query(value = "{'collectorItems.SCM._id': ?0}")
    List<Component> findBySCMCollectorItemId(ObjectId scmCollectorItemId);

    @Query(value="{'collectorItems.Build._id': ?0}")
    List<Component> findByBuildCollectorItemId(ObjectId buildCollectorItemId);

    @Query(value="{'collectorItems.Deployment._id': ?0}")
    List<Component> findByDeployCollectorItemId(ObjectId deployCollectorItemId);

    @Query(value="{'collectorItems.Incident.enabled' : ?0}")
    List<Component> findByIncidentCollectorItems(boolean enabled);


    default List<Component> findByCollectorTypeAndItemIdIn(CollectorType collectorType, List<ObjectId> collectorItemIds) {
        BooleanBuilder builder = new BooleanBuilder();
        PathBuilder<Component> path = new PathBuilder<>(Component.class, "components");
        builder.and(path.get("collectorItems", Map.class).get(collectorType.toString(),List.class).get("id", ObjectId.class).in(collectorItemIds));
        return (List<Component>) findAll(builder.getValue());
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/Monitor2Repository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Monitor2;
import org.bson.types.ObjectId;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface Monitor2Repository extends PagingAndSortingRepository<Monitor2, ObjectId> {

    /**
     * Find all {@link Monitor2}s for a given {@link com.capitalone.dashboard.model.Dashboard}.
     *
     * @param dashboardId dashboard id
     * @return list of {@link Monitor2}s
     */
    List<Monitor2> findByDashboardId(ObjectId dashboardId);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Build} data.
 */
public interface RelatedCollectorItemRepository extends CrudRepository<RelatedCollectorItem, ObjectId>, QueryDslPredicateExecutor<RelatedCollectorItem> {
    List<RelatedCollectorItem> findRelatedCollectorItemByLeft(ObjectId left);
    List<RelatedCollectorItem> findRelatedCollectorItemByRight(ObjectId right);
    List<RelatedCollectorItem> findAllByLeftAndRight(ObjectId left, ObjectId right);

    default RelatedCollectorItem saveRelatedItems(ObjectId left, ObjectId right, String source, String reason) {
        List<RelatedCollectorItem> items = findAllByLeftAndRight(left, right);
        if (!CollectionUtils.isEmpty(items)) {
            this.delete(items);
        }
        RelatedCollectorItem related = new RelatedCollectorItem();
        related.setLeft(left);
        related.setRight(right);
        related.setCreationTime(System.currentTimeMillis());
        related.setSource(source);
        related.setReason(reason);
        return save(related);
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/PipelineRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Pipeline;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface PipelineRepository extends CrudRepository<Pipeline, ObjectId>, QueryDslPredicateExecutor<Pipeline> {

    Pipeline findByCollectorItemId(ObjectId collectorItemId);

    List<Pipeline> findByCollectorItemIdIn(List<ObjectId> collectorItemIds);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ConfigurationRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.Configuration;


public interface ConfigurationRepository extends CrudRepository<Configuration, ObjectId> , QueryDslPredicateExecutor<Configuration>{

	Configuration findByCollectorName(String collectorNiceName);
	
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/RallyFeatureRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.RallyFeature;

/**
 * Repository for {@link CodeQuality} data.
 */
public interface RallyFeatureRepository extends CrudRepository<RallyFeature, ObjectId>, QueryDslPredicateExecutor<RallyFeature> {

    /**
     * Finds the {@link Rallyfeature} data point at the given timestamp for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param timestamp timstamp
     * @return a {@link RallyFeature}
     */
    RallyFeature findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
    
    
    @Query(value="{'projectId' : ?0}")
    List<RallyFeature> findByIterationLists(String projectId);
  
    @Query(value="{'projectId' : ?0, options.iterationId : ?1}")
    RallyFeature findByRallyWidgetDetails(String projectId,String iterationId);
    
    @Query(value="{'collectorItemId' :?0}")
    List<RallyFeature> findByProjectIterationId(Object collectorItemId);
    
    List<RallyFeature> findByCollectorItemIdAndRemainingDaysNot(Object collectorItemId, int remainginDays);
    

	List<RallyFeature> findByProjectId(String projectId);
    
}


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CommitRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Commit;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Commit} data.
 */
public interface CommitRepository extends CrudRepository<Commit, ObjectId>, QueryDslPredicateExecutor<Commit> {

    /**
     * Finds the {@link Commit} with the given revision number for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param revisionNumber revision number
     * @return a {@link Commit}
     */
    Commit findByCollectorItemIdAndScmRevisionNumber(ObjectId collectorItemId, String revisionNumber);

    Long countCommitsByCollectorItemId(ObjectId collectorItemId);

    Commit findByScmUrlIgnoreCaseAndScmBranchIgnoreCaseAndScmRevisionNumber (String scmUrl, String scmBranch, String scmRevisionNumber);

    List<Commit> findByScmRevisionNumber (String scmUrl);

    List<Commit> findByScmUrlIgnoreCaseAndScmBranch (String scmUrl, String scmBranch);

    Commit findByScmRevisionNumberAndScmUrlIgnoreCaseAndScmBranchIgnoreCase(String scmRevisionNumber, String scmUrl, String branch);

    List<Commit> findAllByScmRevisionNumberAndScmUrlIgnoreCaseAndScmBranchIgnoreCaseOrderByTimestampAsc (String scmRevisionNumber, String scmUrl, String branch);

    @Query(value="{ 'collectorItemId': ?0, 'scmCommitTimestamp': { $gt: ?1 }}")
    List<Commit> findByCollectorItemIdAndScmCommitTimestamp(ObjectId collectorItemid, Long scmCommitTimestampThreshold);

    List<Commit> findByScmUrlIgnoreCaseAndScmBranchIgnoreCaseAndScmCommitTimestampIsBetween(String scmUrl, String scmBranch, long beginDate, long endDate);

    List<Commit> findByCollectorItemIdAndScmCommitTimestampIsBetween(ObjectId collectorItemId, long beginDate, long endDate);

    List<Commit> findCommitsByCollectorItemIdAndTimestampAfterAndPullNumberIsNull(ObjectId collectorItemId, long beginDate);

    Commit findByScmRevisionNumberAndScmAuthorIgnoreCaseAndScmCommitLogAndScmCommitTimestamp(String scmRevisionNumber, String scmAuthor, String scmCommitLog, long scmCommitTimestamp);

    List<Commit> findAllByScmRevisionNumberAndScmAuthorIgnoreCaseAndScmCommitLogAndScmCommitTimestamp(String scmRevisionNumber, String scmAuthor, String scmCommitLog, long scmCommitTimestamp);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CodeReposBuildsRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CodeReposBuilds;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

/**
 * Repository for {@link CodeReposBuilds} data.
 */
public interface CodeReposBuildsRepository extends CrudRepository<CodeReposBuilds, ObjectId>, QueryDslPredicateExecutor<CodeReposBuilds> {

    CodeReposBuilds findByCodeRepo(String codeRepo);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/MaturityModelRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.MaturityModel;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface MaturityModelRepository extends CrudRepository<MaturityModel, ObjectId>, QueryDslPredicateExecutor<MaturityModel> {
    MaturityModel findByProfile(String profile);

    @Query(value="{}", fields="{ profile : 1 }")
    List<String> getAllProfiles();
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/RepositoryPackage.java
=====================================================
package com.capitalone.dashboard.repository;

/**
 * Marker interface for repository scanning
 */
public interface RepositoryPackage {
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/EnvironmentStatusRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.EnvironmentStatus;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * {@link EnvironmentStatus} repository.
 */
public interface EnvironmentStatusRepository extends CrudRepository<EnvironmentStatus, ObjectId> {

    /**
     * Finds all {@link EnvironmentStatus}es for a given {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @return list of {@link EnvironmentStatus}es.
     */
    List<EnvironmentStatus> findByCollectorItemId(ObjectId collectorItemId);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/TeamInventoryRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Scope;
import com.capitalone.dashboard.model.TeamInventory;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Scope}.
 */
public interface TeamInventoryRepository extends CrudRepository<TeamInventory, ObjectId>,
		QueryDslPredicateExecutor<TeamInventory> {

	@Query(value = "{ 'collectorId' : ?0 }")
	List<TeamInventory> findByCollectorId(ObjectId collectorId);

	TeamInventory findByNameAndTeamId(String name, String teamId);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/PerformanceRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Performance;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface PerformanceRepository extends CrudRepository<Performance, ObjectId>, QueryDslPredicateExecutor<Performance> {

    Performance findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
    List<Performance> findByCollectorItemId (ObjectId collectorItemId);


}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CollectorRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorType;
import org.bson.types.ObjectId;

import java.util.List;

/**
 * A {@link Collector} repository
 */
public interface CollectorRepository extends BaseCollectorRepository<Collector> {

    List<Collector> findById(ObjectId id);
    List<Collector> findAllByCollectorType(CollectorType collectorType);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/ServiceRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Service;
import org.bson.types.ObjectId;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * A {@link Service} repository
 */
public interface ServiceRepository extends PagingAndSortingRepository<Service, ObjectId> {

    /**
     * Find all {@link Service}s for a given {@link com.capitalone.dashboard.model.Dashboard}.
     *
     * @param dashboardId dashboard id
     * @return list of {@link Service}s
     */
    List<Service> findByDashboardId(ObjectId dashboardId);

    /**
     * Find all dependent {@link Service}s for a given {@link com.capitalone.dashboard.model.Dashboard}.
     *
     * @param dashboardId dashboard id
     * @return list of {@link Service}s
     */
    List<Service> findByDependedBy(ObjectId dashboardId);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/GitRequestRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.GitRequest;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link GitRequest} data.
 */
public interface GitRequestRepository  extends CrudRepository<GitRequest, ObjectId>, QueryDslPredicateExecutor<GitRequest> {


    List<GitRequest> findByCollectorItemIdAndRequestType(ObjectId collectorItemId, String requestType);

    @Query(value="{ 'collectorItemId' : ?0, 'requestType' : ?1}", fields="{ 'number' : 2, 'updatedAt' : 3 }")
    List<GitRequest> findRequestNumberAndLastUpdated(ObjectId collectorItemId, String requestType);

    @Query(value="{ 'collectorItemId' : ?0, 'state' : { $ne : 'merged' }}", fields="{ 'requestType' : 1, 'number' : 2, 'updatedAt' : 3, 'id' : 4}")
    List<GitRequest> findNonMergedRequestNumberAndLastUpdated(ObjectId collectorItemId);

    @Query(value="{ 'collectorItemId' : ?0}", fields="{ 'requestType' : 1, 'number' : 2, 'updatedAt' : 3, 'id' : 4}")
    List<GitRequest> findRequestNumberAndLastUpdated(ObjectId collectorItemId);

    GitRequest findByCollectorItemIdAndScmRevisionNumber(ObjectId collectorItemId, String revisionNumber);

    GitRequest findByCollectorItemIdAndNumberAndRequestType(ObjectId collectorItemId, String number, String requestType);

    @Query(value="{ 'collectorItemId': ?0, 'scmCommitTimestamp': { $gt: ?1 }}")
    List<GitRequest> findByCollectorItemIdAndScmCommitTimestamp(ObjectId collectorItemid,
                                                          Long scmCommitTimestampThreshold);

    GitRequest findByCollectorItemIdAndNumber(ObjectId collectorItemId, String number);

    List<GitRequest> findByScmUrlIgnoreCaseAndScmBranchIgnoreCaseAndCreatedAtGreaterThanEqualAndMergedAtLessThanEqual(String scmUrl, String scmBranch, long beginDt, long endDt);

    List<GitRequest> findByScmUrlIgnoreCaseAndScmBranchIgnoreCase(String scmUrl, String scmBranch);

    List<GitRequest> findByScmRevisionNumber(String revisionNumber);

    List<GitRequest> findByCollectorItemIdAndMergedAtIsBetween(ObjectId collectorItemId, long beginDate, long endDate);

    GitRequest findByScmUrlIgnoreCaseAndScmBranchIgnoreCaseAndNumberAndRequestTypeIgnoreCase(String scmUrl, String scmBranch, String number, String requestType);

    @Query(value="{'$or':[{'scmRevisionNumber' : ?0}, {'scmMergeEventRevisionNumber' : ?0}]}")
    GitRequest findByScmRevisionNumberOrScmMergeEventRevisionNumber(String revisionNumber);


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/BaseCollectorRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorType;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Generic Collector repository that contains methods common to any model that extends from
 * Collector.
 *
 * @param <T> Class that extends {@link Collector}
 */
public interface BaseCollectorRepository<T extends Collector> extends CrudRepository<T, ObjectId> {

    /**
     * Finds a {@link Collector} by its name.
     *
     * @param name name
     * @return a {@link Collector}
     */
    T findByName(String name);

    /**
     * Finds all {@link Collector}s of a given {@link CollectorType}.
     *
     * @param collectorType a {@link CollectorType}
     * @return list of {@link Collector}s of a given {@link CollectorType}
     */
    List<T> findByCollectorType(CollectorType collectorType);

    /**
     * Finds all {@link Collector}s of a given {@link CollectorType}.
     *
     * @param collectorType a {@link CollectorType}
     * @param  name
     * @return list of {@link Collector}s of a given {@link CollectorType}
     */

    List<T> findByCollectorTypeAndName(CollectorType collectorType, String name);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQueryImpl.java
=====================================================
package com.capitalone.dashboard.repository;


import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.util.GitHubParsedUrl;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

@Component
public class CustomRepositoryQueryImpl implements CustomRepositoryQuery {

    private final MongoTemplate template;
    private static final String REGEX_ANY_STRING_INCLUDING_EMPTY = "^$|^.*";

    @Autowired
    public CustomRepositoryQueryImpl(MongoTemplate template) {
        this.template = template;
    }


    @Override
    public List<CollectorItem> findCollectorItemsBySubsetOptions(ObjectId id, Map<String, Object> allOptions, Map<String, Object> uniqueOptions,Map<String, Object> uniqueOptionsFromCollector) {
        Criteria c = Criteria.where("collectorId").is(id);
        uniqueOptions.values().removeIf(d-> d.equals(null) || ((d instanceof String) && StringUtils.isEmpty((String) d)));
        for (Map.Entry<String, Object> e : allOptions.entrySet()) {
            if (uniqueOptionsFromCollector.containsKey(e.getKey())) {
                c = getCriteria(uniqueOptions, c, e);
            }
        }
        List<CollectorItem> items =  template.find(new Query(c), CollectorItem.class);
        return items;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/repository/TestResultRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.TestResult;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

/**
 * Repository for {@link TestResult} data.
 */
public interface TestResultRepository extends CrudRepository<TestResult, ObjectId>, QueryDslPredicateExecutor<TestResult> {

    /**
     * Finds the {@link TestResult} with the given execution ID for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item ID
     * @param executionId execution ID
     * @return a TestSuite
     */
    TestResult findByCollectorItemIdAndExecutionId(ObjectId collectorItemId, String executionId);

    TestResult findByCollectorItemId(ObjectId collectorItemId);
    
    List<TestResult> findByUrlAndTimestampGreaterThanEqualAndTimestampLessThanEqual(String jobUrl,long beginDt,long endDt);
    List<TestResult> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/response/BuildDataCreateResponse.java
=====================================================
package com.capitalone.dashboard.response;

import com.capitalone.dashboard.model.BuildStatus;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.bson.types.ObjectId;

public class BuildDataCreateResponse {
    private ObjectId id;
    private ObjectId collectorItemId;
    private ObjectId dashboardId;
    private long timestamp;
    private String number;
    private String buildUrl;
    private long startTime;
    private long endTime;
    private long duration;
    private BuildStatus buildStatus;
    private String startedBy;
    private String log;

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public ObjectId getDashboardId() {
        return dashboardId;
    }

    public void setDashboardId(ObjectId dashboardId) {
        this.dashboardId = dashboardId;
    }

    public long getTimestamp() {
        return timestamp;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/response/CloudVolumeAggregatedResponse.java
=====================================================
package com.capitalone.dashboard.response;

public class CloudVolumeAggregatedResponse {
    private int nonEncryptedCount;
    private int noAttachmentCount;
    private int noAccountCount;
    private int nonTaggedCount;
    private int totalCount;
    private long lastUpdated;

    public int getNonEncryptedCount() {
        return nonEncryptedCount;
    }

    public void setNonEncryptedCount(int nonEncryptedCount) {
        this.nonEncryptedCount = nonEncryptedCount;
    }

    public int getNoAttachmentCount() {
        return noAttachmentCount;
    }

    public void setNoAttachmentCount(int noAttachmentCount) {
        this.noAttachmentCount = noAttachmentCount;
    }

    public int getNoAccountCount() {
        return noAccountCount;
    }

    public void setNoAccountCount(int noAccountCount) {
        this.noAccountCount = noAccountCount;
    }

    public int getNonTaggedCount() {
        return nonTaggedCount;
    }

    public void setNonTaggedCount(int nonTaggedCount) {
        this.nonTaggedCount = nonTaggedCount;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/response/CloudVirtualNetworkAggregatedResponse.java
=====================================================
package com.capitalone.dashboard.response;

public class CloudVirtualNetworkAggregatedResponse {

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/response/RallyBurnDownResponse.java
=====================================================
package com.capitalone.dashboard.response;

import java.util.List;

public class RallyBurnDownResponse {
	private List<String> iterationDates;
	private List<String> toDoHours;
	private List<Double> acceptedPoints;
	private List<Double> totalTaskEstimate;
	
	public List<Double> getTotalTaskEstimate() {
		return totalTaskEstimate;
	}
	public void setTotalTaskEstimate(List<Double> totalTaskEstimate) {
		this.totalTaskEstimate = totalTaskEstimate;
	}
	public List<String> getIterationDates() {
		return iterationDates;
	}
	public void setIterationDates(List<String> iterationDates) {
		this.iterationDates = iterationDates;
	}
	public List<String> getToDoHours() {
		return toDoHours;
	}
	public void setToDoHours(List<String> toDoHours) {
		this.toDoHours = toDoHours;
	}
	public List<Double> getAcceptedPoints() {
		return acceptedPoints;
	}
	@Override
	public String toString() {
		return "RallyBurnDownResponse [iterationDates=" + iterationDates + ", toDoHours=" + toDoHours
				+ ", acceptedPoints=" + acceptedPoints + "]";
	}
	public void setAcceptedPoints(List<Double> acceptedPoints) {
		this.acceptedPoints = acceptedPoints;
	}
	
	

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/response/CloudSubNetworkAggregatedResponse.java
=====================================================
package com.capitalone.dashboard.response;

public class CloudSubNetworkAggregatedResponse {
    
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/PipelineUtils.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.RepoBranch;
import com.capitalone.dashboard.model.SCM;
import com.capitalone.dashboard.model.Widget;
import com.capitalone.dashboard.repository.CommitRepository;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public final class PipelineUtils {

    private PipelineUtils(){

    }

    public static Map<String, PipelineCommit> commitSetToMap(Set<PipelineCommit> set){
        Map<String, PipelineCommit> returnMap = new HashMap<>();
        for(PipelineCommit commit : set){
            returnMap.put(commit.getScmRevisionNumber(), commit);
        }
        return returnMap;
    }

    public static Map<PipelineStage, String> getStageToEnvironmentNameMap(Dashboard dashboard) {
        Map<PipelineStage, String> rt = new LinkedHashMap<>();

        for(Widget widget : dashboard.getWidgets()) {
            if(widget.getName().equalsIgnoreCase("build")){
                rt.put(PipelineStage.valueOf("Build"), "Build");
            }if(widget.getName().equalsIgnoreCase("repo")){
                rt.put(PipelineStage.valueOf("Commit"), "Commit");
            }
            if (widget.getName().equalsIgnoreCase("pipeline")) {
                Map<?,?> gh = (Map<?,?>) widget.getOptions().get("mappings");
                for (Map.Entry<?, ?> entry : gh.entrySet()) {
                    rt.put(PipelineStage.valueOf((String) entry.getKey()), (String) entry.getValue());

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/EncryptionException.java
=====================================================
package com.capitalone.dashboard.util;

public class EncryptionException extends Exception {
	private static final long serialVersionUID = -4472911532254883259L;

	/**
     * Constructs a {@code EncrytionException} with no detail message.
     */
    public EncryptionException() {
        super();
    }

    /**
     * Constructs a {@code EncrytionException} with the specified
     * detail message.
     *
     * @param   s   the detail message.
     */
    public EncryptionException(String s) {
        super(s);
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/FeatureCollectorConstants.java
=====================================================

package com.capitalone.dashboard.util;

/**
 * This class is established to house any globally-referenced constant values.
 * Most values that can or should be modifiable at deploy-time should be kept in
 * a properties file, but valid use cases for constant values should be added
 * here.
 *
 * @author kfk884
 *
 */
public final class FeatureCollectorConstants {
    public static final String JIRA = "Jira";
    public static final String JIRA_XRAY = "Jira XRay";

    public static final String VERSIONONE = "VersionOne";
    public static final String GITLAB = "GitlabFeature";
    @SuppressWarnings("PMD.AvoidUsingHardCodedIP")
    // not an IP
    public static final String AGENT_VER = "01.00.00.01";
    public static final String AGENT_NAME = "Hygieia Dashboard - VersionOne Feature Collector";

    public static final String STORY_HOURS_ESTIMATE = "hours";
    public static final String STORY_POINTS_ESTIMATE = "storypoints";
    public static final String STORY_COUNT_ESTIMATE = "count";

    public static final String SPRINT_SCRUM = "scrum";
    public static final String SPRINT_KANBAN = "kanban";

    public static final String TEAM_ID_ANY = "any";
    public static final String PROJECT_ID_ANY = "any";

    public static final String TOOL_TYPE = "featureTool";
    public static final String PROJECT_NAME = "projectName";
    public static final String PROJECT_ID = "projectId";
    public static final String TEAM_NAME = "teamName";
    public static final String TEAM_ID = "teamId";
    public static final String ESTIMATE_METRIC_TYPE = "estimateMetricType";
    public static final String SPRINT_TYPE = "sprintType";
    public static final String LIST_TYPE = "listType";
    public static final String SHOW_STATUS = "showStatus";

    private FeatureCollectorConstants() {
        // This class should not be instantiable
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/CoreFeatureSettings.java
=====================================================
package com.capitalone.dashboard.util;

import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "feature")
public class CoreFeatureSettings {
	private List<String> todoStatuses;
	private List<String> doingStatuses;
	private List<String> doneStatuses;

	public List<String> getTodoStatuses() {
		return todoStatuses;
	}

	public void setTodoStatuses(List<String> todoStatuses) {
		this.todoStatuses = todoStatuses;
	}

	public List<String> getDoingStatuses() {
		return doingStatuses;
	}

	public void setDoingStatuses(List<String> doingStatuses) {
		this.doingStatuses = doingStatuses;
	}

	public List<String> getDoneStatuses() {
		return doneStatuses;
	}

	public void setDoneStatuses(List<String> doneStatuses) {
		this.doneStatuses = doneStatuses;
	}
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/Supplier.java
=====================================================
package com.capitalone.dashboard.util;

/**
 * A class that can supply objects of a single type.  Semantically, this could
 * be a factory, generator, builder, closure, or something else entirely. No
 * guarantees are implied by this interface.
 *
 */
public interface Supplier<T> {

    /**
     * Retrieves an instance of the appropriate type. The returned object may or
     * may not be a new instance, depending on the implementation.
     *
     * @return an instance of the appropriate type
     */
    T get();
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/HygieiaUtils.java
=====================================================
package com.capitalone.dashboard.util;


import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.lang3.StringUtils;
import org.jboss.logging.Logger;

import java.lang.reflect.InvocationTargetException;
import java.net.URI;

public class HygieiaUtils {
	private static final Logger LOGGER = Logger.getLogger(HygieiaUtils.class);

    public static void mergeObjects(Object dest, Object source) throws IllegalAccessException, InvocationTargetException {
        new BeanUtilsBean() {
            @Override
            public void copyProperty(Object dest, String name, Object value)
                    throws IllegalAccessException, InvocationTargetException {
                if (value != null) {
                    super.copyProperty(dest, name, value);
                }
            }
        }.copyProperties(dest, source);
    }
    
    /**
     * Determines if two urls are equal accounting for load balancers and variations in schemes.
     * <p>
     * Two urls are equal if:
     * <ul>
     * <li>the root domain is the same</li>
     * <li>the path is the same (ignoring .git at the end)</li>
     * <li>the query is the same</li>
     * </ul>
     * <p>
     * It is assumed that load balancers use a distinct subdomain in a url.
     * 
     * @param url1
     * @param url2
     * @return		if the two urls are equal ignoring load balancers, url schemes, and path endings.
     */
    @SuppressWarnings("PMD.NPathComplexity")
    public static boolean smartUrlEquals(String url1, String url2) {
    	String u1 = nullSafe(url1);
    	String u2 = nullSafe(url2);
    	
    	String u1Host = null;
    	String u1Path = null;
    	String u1Query = null;
    	

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/SuperFeatureComparator.java
=====================================================
package com.capitalone.dashboard.util;

import java.util.Comparator;

import com.capitalone.dashboard.model.Feature;

/**
 * Comparator utility class for handling comparisons of Super Features (epics)
 * to other Super Features. This is used when manipulating results of MongoDB
 * repository responses and sorting them in an efficient manner within memory.
 * 
 * @author kfk884
 * 
 */
public class SuperFeatureComparator implements Comparator<Feature> {

	public SuperFeatureComparator() {
		// No instantiation requirements
	}

	/**
	 * Compares two feature object models and sorts based on their subsequent
	 * epic IDs, as a string comparator
	 * 
	 * @return A list of Features sorted by EpicID, descending
	 */
	@Override
	public int compare(Feature f, Feature ff) {
		if (f.getsEpicID().compareToIgnoreCase(ff.getsEpicID()) <= -1) {
			return -1;
		} else if (f.getsEpicID().compareToIgnoreCase(ff.getsEpicID()) >= 1) {
			return 1;
		} else {
			return 0;
		}
	}

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/Encryption.java
=====================================================
package com.capitalone.dashboard.util;

import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

@SuppressWarnings("PMD.AvoidCatchingNPE") // TODO: Avoid catching NullPointerException; consider removing the cause of the NPE
public final class Encryption {

    private static final String ALGO = "DESede";
    private static final Logger LOGGER = LoggerFactory.getLogger(Encryption.class);

    private Encryption() {
        // util class.
    }

    public static String getStringKey() throws EncryptionException {
        SecretKey key = null;
        try {
            key = KeyGenerator.getInstance(ALGO).generateKey();
        } catch (NoSuchAlgorithmException e) {
            throw new EncryptionException("Cannot generate a secret key" + '\n' + e.getMessage());
        }
        return Base64.encodeBase64String(key.getEncoded());
    }

    public static SecretKey getSecretKey() throws EncryptionException {
        SecretKey key = null;
        try {
            key = KeyGenerator.getInstance(ALGO).generateKey();
        } catch (NoSuchAlgorithmException e) {
            throw new EncryptionException("Cannot generate a secret key" + '\n' + e.getMessage());
        }
        return key;
    }

    public static String encryptString(String message, SecretKey key)
            throws EncryptionException {
        String encryptedMessage = "";
        try {
            Cipher cipher = Cipher.getInstance(ALGO);
            cipher.init(Cipher.ENCRYPT_MODE, key);
            byte[] encryptedBytes = cipher.doFinal(message.getBytes());
            encryptedMessage = Base64.encodeBase64String(encryptedBytes);


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/DashboardUtils.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.repository.ComponentRepository;
import org.bson.types.ObjectId;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

public final class DashboardUtils {


    /**
     * Gets a unique set of collector item ids for a given collector from all components in the Hygieia instance.
     * @param componentRepository component repo
     * @param collector collector
     * @return unique set of collector item ids
     */
    public static Set<ObjectId> getUniqueCollectorItemIDsFromAllComponents(ComponentRepository componentRepository, Collector collector) {
        Set<ObjectId> uniqueIDs = new HashSet<>();
        for (com.capitalone.dashboard.model.Component comp : componentRepository.findAll()) {
            if (comp.getCollectorItems() == null || comp.getCollectorItems().isEmpty()) continue;
            List<CollectorItem> itemList = comp.getCollectorItems().get(collector.getCollectorType());
            if (itemList == null) continue;
            for (CollectorItem ci : itemList) {
                if (ci != null && ci.getCollectorId().equals(collector.getId())) {
                    uniqueIDs.add(ci.getId());
                }
            }
        }
        return uniqueIDs;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/GitHubParsedUrl.java
=====================================================
package com.capitalone.dashboard.util;

public class GitHubParsedUrl {
    private String url;
    private String host;
    private String apiUrl;
    private String orgName;
    private String repoName;


    public GitHubParsedUrl(String url){
        this.url = url;
        parse();
    }

    private void parse(){
        if (url.endsWith(".git")) {
            url = url.substring(0, url.lastIndexOf(".git"));
        }
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getApiUrl() {
        return apiUrl;
    }

    public void setApiUrl(String apiUrl) {
        this.apiUrl = apiUrl;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/GitBranchSpec.java
=====================================================
package com.capitalone.dashboard.util;


import java.util.StringTokenizer;
import java.util.regex.Pattern;


public class GitBranchSpec {
    private String name;

    public String getName() {
        return name;
    }

    private void setName(String name) {
        if (name == null) {
            throw new IllegalArgumentException();
        } else if (name.length() == 0) {
            this.name = "**";
        } else {
            this.name = name.trim();
        }
    }


    public GitBranchSpec(String name) {
        setName(name);
    }

    public String toString() {
        return name;
    }

    public boolean matches(String item) {
        return getPattern().matcher(item).matches();
    }


    private Pattern getPattern() {
        String expandedName = name;
        // use regex syntax directly if name starts with colon
        if ((expandedName.charAt(0) == ':') && (expandedName.length() > 1)) {
            String regexSubstring = expandedName.substring(1, expandedName.length());
            return Pattern.compile(regexSubstring);
        }
        // build a pattern into this builder
        StringBuilder builder = new StringBuilder(100);

        // for legacy reasons (sic) we do support various branch spec format to declare remotes / branches
        builder.append("(refs/heads/");

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/util/UnsafeDeleteException.java
=====================================================
package com.capitalone.dashboard.util;

/**
 * Created by jkc on 1/20/16.
 */
public class UnsafeDeleteException extends RuntimeException {
	private static final long serialVersionUID = -664077740219817001L;
	public UnsafeDeleteException() {
        super();
    }
    public UnsafeDeleteException(String s) {
        super(s);
    }
    public UnsafeDeleteException(String s, Throwable throwable) {
        super(s, throwable);
    }
    public UnsafeDeleteException(Throwable throwable) {
        super(throwable);
    }

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/config/CollectorConfig.java
=====================================================
package com.capitalone.dashboard.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * Configuration class that creates Beans common to any Collector implementation
 */
@Configuration
public class CollectorConfig {

    @Bean
    public TaskScheduler taskScheduler() {
        return new ThreadPoolTaskScheduler();
    }

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/config/collector/CloudConfig.java
=====================================================
package com.capitalone.dashboard.config.collector;

import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.NameValue;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class CloudConfig extends CollectorItem {
    private static final String CLOUD_PROVIDER = "provider";
    private static final List<NameValue> TAGS = new ArrayList<>();

    private static final int AGE_ERROR_THRESHOLD_DEFAULT = 60;
    private static final int AGE_ALERT_THRESHOLD_DEFAULT = 45;

    private static final double CPU_ERROR_THRESHOLD_DEFAULT = 80.0;
    private static final double CPU_ALERT_THRESHOLD_DEFAULT = 50.0;

    private static final double MEMORY_ERROR_THRESHOLD_DEFAULT = 80.0;
    private static final double MEMORY_ALERT_THRESHOLD_DEFAULT = 50.0;

    private static final int DISK_IO_ERROR_THRESHOLD_DEFAULT = 80;
    private static final int DISK_IO_ALERT_THRESHOLD_DEFAULT = 50;

    private static final int NETWORK_IO_ERROR_THRESHOLD_DEFAULT = 80;
    private static final int NETWORK_IO_ALERT_THRESHOLD_DEFAULT = 50;

//    private static final int SUBNET_IP_ERROR_THRESHOLD_DEFAULT = 80;
//    private static final int SUBNET_IP_ALERT_THRESHOLD_DEFAULT = 50;

    private static final String AGE_ERROR = "ageError";
    private static final String AGE_ALERT = "ageAlert";
    private static final String CPU_ERROR = "cpuError";
    private static final String CPU_ALERT = "cpuAlert";
    private static final String MEMORY_ERROR = "memoryError";
    private static final String MEMORY_ALERT = "memoryAlert";
    private static final String DISKIO_ERROR = "diskIOError";
    private static final String DISKIO_ALERT = "diskIOAlert";
    private static final String NETWORKIO_ERROR = "networkIOError";
    private static final String NETWORKIO_ALERT = "networkIOAlert";

    public String getCloudProvider() {
        return (String) getOptions().get(CLOUD_PROVIDER);
    }

    public void setCloudProvider(String cloudProvider) {
        getOptions().put(CLOUD_PROVIDER, cloudProvider);
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/config/MongoConfig.java
=====================================================
package com.capitalone.dashboard.config;

import com.capitalone.dashboard.repository.RepositoryPackage;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Component
@EnableMongoRepositories(basePackageClasses = RepositoryPackage.class)
public class MongoConfig extends AbstractMongoConfiguration {
    private static final Logger LOGGER = LoggerFactory.getLogger(MongoConfig.class);

    @Value("${dbname:dashboard}")
    private String databaseName;
    @Value("${dbhost:localhost}")
    private String host;
    @Value("${dbport:27017}")
    private int port;
    @Value("${dbreplicaset:false}")
    private String dbreplicaset;
    @Value("#{'${dbhostport:localhost:27017}'.split(',')}")
    private List<String> hostport;
    @Value("${dbusername:}")
    private String userName;
    @Value("${dbpassword:}")
    private String password;



    @Override
    protected String getDatabaseName() {
        return databaseName;
    }

    @Override

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/collector/CollectorTask.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.repository.BaseCollectorRepository;
import com.google.common.base.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * Base class for Collector task implementation which provides subclasses with
 * the following:
 * <p>
 * <ol>
 * <li>Creates a Collector instance the first time the collector runs.</li>
 * <li>Uses TaskScheduler to schedule the job based on the provided cron when the process starts.</li>
 * <li>Saves the last execution time on the collector when the collection run finishes.</li>
 * <li>Sets the collector online/offline when the collector process starts/stops</li>
 * </ol>
 *
 * @param <T> Class that extends Collector
 */
@Component
public abstract class CollectorTask<T extends Collector> implements Runnable {
    private static final Logger LOGGER = LoggerFactory.getLogger(CollectorTask.class);

    private final TaskScheduler taskScheduler;
    private final String collectorName;

    @Autowired
    protected CollectorTask(TaskScheduler taskScheduler, String collectorName) {
        this.taskScheduler = taskScheduler;
        this.collectorName = collectorName;
    }

    @Override
    public final void run() {
        LOGGER.info("Running Collector: {}", collectorName);
        T collector = getCollectorRepository().findByName(collectorName);
        if (collector == null) {
            // Register new collector
            collector = getCollectorRepository().save(getCollector());
        } else {
            // In case the collector options changed via collectors properties setup.

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItem.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.GenericCollectorItem;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.GenericCollectorItemRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Component
public abstract class CollectorTaskWithGenericItem<T extends Collector> extends CollectorTask<T> {

    private final CollectorItemRepository collectorItemRepository;
    private final GenericCollectorItemRepository genericCollectorItemRepository;
    private final RelatedCollectorItemRepository relatedCollectorItemRepository;

    @Autowired
    public CollectorTaskWithGenericItem(TaskScheduler taskScheduler, String collectorName, CollectorItemRepository collectorItemRepository, GenericCollectorItemRepository genericCollectorItemRepository, RelatedCollectorItemRepository relatedCollectorItemRepository) {
        super(taskScheduler, collectorName);
        this.collectorItemRepository = collectorItemRepository;
        this.genericCollectorItemRepository = genericCollectorItemRepository;
        this.relatedCollectorItemRepository = relatedCollectorItemRepository;
    }


    public Map<ObjectId, Set<ObjectId>> processGenericItems(List<String> toolServers) {
        List<GenericCollectorItem> genericCollectorItems = genericCollectorItemRepository.findAllByToolNameAndProcessTimeEquals(getCollector().getName(), 0L);
        if (CollectionUtils.isEmpty(genericCollectorItems)) {
            return Collections.emptyMap();
        }
        Map<ObjectId, Set<ObjectId>> collectorItemBuildIds = new HashMap<>();
        genericCollectorItems.forEach(gci -> {
            toolServers.stream()
                    .map(server -> Lists.newArrayList(collectorItemRepository.findAllByOptionMapAndCollectorIdsIn(getGenericCollectorItemOptions(server, gci), Lists.newArrayList(getCollector().getId()))))
                    .forEach(collectorItems -> collectorItems.forEach(item -> {
                        //Save as related item. Related Item event listener will process it.
                        if (!collectorItemBuildIds.containsKey(item.getId())) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/collector/RestOperationsSupplier.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.util.Supplier;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;

/**
 * Supplier that returns an instance of RestOperations
 */
@Component
public class RestOperationsSupplier implements Supplier<RestOperations> {
    @Override
    public RestOperations get() {
        return new RestTemplate();
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/status/LibraryPolicyAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum LibraryPolicyAuditStatus {
    LIBRARY_POLICY_AUDIT_FAIL,
    LIBRARY_POLICY_SCAN_FAIL,
    LIBRARY_POLICY_AUDIT_MISSING,
    LIBRARY_POLICY_AUDIT_DETAIL_MISSING,
    LIBRARY_POLICY_AUDIT_OK,
    LIBRARY_POLICY_FOUND_HIGH_SECURITY,
    LIBRARY_POLICY_FOUND_HIGH_LICENSE,
    LIBRARY_POLICY_FOUND_CRITICAL_SECURITY,
    LIBRARY_POLICY_FOUND_CRITICAL_LICENSE
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/status/CodeReviewAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum CodeReviewAuditStatus {
    //peer review type LGTM, GH REVIEW, COMMENTS ONLY
    PEER_REVIEW_LGTM_SELF_APPROVAL,
    PEER_REVIEW_LGTM_ERROR,
    PEER_REVIEW_LGTM_PENDING,
    PEER_REVIEW_LGTM_UNKNOWN,
    PEER_REVIEW_LGTM_SUCCESS,
    PEER_REVIEW_BY_SERVICEACCOUNT,

    PEER_REVIEW_GHR,
    PEER_REVIEW_GHR_SELF_APPROVAL,
    PEER_REVIEW_REG_COMMENTS,
    PEER_REVIEW_REV_COMMENTS,
    //no pull requests for queried date range
    NO_PULL_REQ_FOR_DATE_RANGE,
    //direct commits to master
    DIRECT_COMMITS_TO_BASE,
    DIRECT_COMMITS_TO_BASE_FIRST_COMMIT,
    COMMIT_AUTHOR_EQ_SYSTEM_USER,
    DIRECT_COMMIT_NONCODE_CHANGE,
    DIRECT_COMMIT_NONCODE_CHANGE_SERVICE_ACCOUNT,
    DIRECT_COMMIT_NONCODE_CHANGE_USER_ACCOUNT,
    //commit author v/s who merged the pr
    COMMITAUTHOR_NE_MERGECOMMITER,
    COMMITAUTHOR_EQ_MERGECOMMITER,
    MERGECOMMITER_NOT_FOUND,
    COMMITAUTHOR_EQ_SERVICEACCOUNT,
    MERGECOMMITER_EQ_SERVICEACCOUNT,

    //peer review of a pull request
    PULLREQ_REVIEWED_BY_PEER,
    PULLREQ_NOT_PEER_REVIEWED,
    BASE_FIRST_COMMIT,

    //type of git workflow
    GIT_FORK_STRATEGY,
    GIT_BRANCH_STRATEGY,
    GIT_NO_WORKFLOW,

    REPO_NOT_CONFIGURED,
    PENDING_DATA_COLLECTION,

    NO_COMMIT_FOR_DATE_RANGE, //Removew this later when we can remove legacy peer review
    COMMIT_AFTER_PR_MERGE, COLLECTOR_ITEM_ERROR,
    SCM_AUTHOR_LOGIN_INVALID, //passed when SCM AUTHOR is unavailable
    DIRECT_COMMIT_CHANGE_WHITELISTED_ACCOUNT
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/status/CodeQualityAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum CodeQualityAuditStatus {
    CODE_QUALITY_AUDIT_FAIL,
    STATIC_SECURITY_SCAN_FAIL,
    CODE_QUALITY_AUDIT_GATE_MISSING,
    QUALITY_PROFILE_VALIDATION_AUDIT_OK,
    QUALITY_PROFILE_VALIDATION_AUDIT_FAIL,
    QUALITY_PROFILE_VALIDATION_AUDIT_NO_CHANGE,
    CODE_QUALITY_AUDIT_OK,
    CODE_QUALITY_DETAIL_MISSING,
    STATIC_SECURITY_SCAN_AUDIT_NO_CHANGE,
    STATIC_SECURITY_SCAN_MISSING,
    STATIC_SECURITY_SCAN_OK,
    STATIC_SECURITY_SCAN_NO_CLOSED_FINDINGS,
    STATIC_SECURITY_SCAN_FOUND_CRITICAL,
    STATIC_SECURITY_SCAN_FOUND_HIGH,
    COLLECTOR_ITEM_ERROR,
    CODE_QUALITY_NOT_CONFIGURED,
    CODE_QUALITY_GATES_FOUND,
    CODE_QUALITY_CHECK_IS_CURRENT,
    CODE_QUALITY_THRESHOLD_BLOCKER_MET,
    CODE_QUALITY_THRESHOLD_CRITICAL_MET,
    CODE_QUALITY_THRESHOLD_UNIT_TEST_MET,
    CODE_QUALITY_THRESHOLD_CODE_COVERAGE_MET,
    CODE_QUALITY_THRESHOLD_BLOCKER_FOUND,
    CODE_QUALITY_THRESHOLD_CRITICAL_FOUND,
    CODE_QUALITY_THRESHOLD_UNIT_TEST_FOUND,
    CODE_QUALITY_THRESHOLD_CODE_COVERAGE_FOUND


}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/status/ArtifactAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum ArtifactAuditStatus {
    ART_SYS_ACCT_BUILD_AUTO,
    ART_SYS_ACCT_BUILD_USER,
    ART_DOCK_IMG_FOUND,
    ART_SYS_ACCT_BUILD_THIRD_PARTY,
    COLLECTOR_ITEM_ERROR,
    NO_ACTIVITY,
    UNAVAILABLE,
    ART_PROD_DEPLOY_OK,
    ART_PROD_DEPLOY_FAIL,
    ART_TEST_FOUND,
    ART_TEST_NOT_FOUND,
    ARTIFACT_NOT_CONFIGURED
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/status/TestResultAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum TestResultAuditStatus {
    TEST_RESULT_AUDIT_FAIL,
    TEST_RESULT_AUDIT_MISSING,
    TEST_RESULT_MISSING,
    TEST_RESULT_AUDIT_OK,
    TEST_RESULT_SKIPPED,
    TEST_RESULTS_TRACEABILITY_NOT_FOUND,
    TEST_RESULTS_TRACEABILITY_STORY_NOT_FOUND,
    TEST_RESULTS_TRACEABILITY_STORY_MATCH,
    TEST_RESULTS_TRACEABILITY_THRESHOLD_DEFAULT,
    TEST_RESULTS_TRACEABILITY_STORY_STATUS_INVALID,
    TEST_RESULTS_TRACEABILITY_NOT_FOUND_IN_GIVEN_DATE_RANGE
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/status/PerformanceTestAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum PerformanceTestAuditStatus {
    PERF_RESULT_AUDIT_FAIL,
    PERF_RESULT_AUDIT_MISSING,
    PERF_RESULT_AUDIT_OK,
    PERFORMANCE_THRESHOLD_RESPONSE_TIME_MET,
    PERFORMANCE_THRESHOLD_TRANSACTIONS_PER_SECOND_MET,
    PERFORMANCE_THRESHOLD_ERROR_RATE_MET,
    PERFORMANCE_COMMIT_IS_CURRENT,
    PERFORMANCE_THRESHOLDS_ERROR_RATE_FOUND,
    PERFORMANCE_THRESHOLDS_TRANSACTIONS_PER_SECOND_FOUND,
    PERFORMANCE_THRESHOLDS_RESPONSE_TIME_FOUND,
    PERFORMANCE_MET,
    PERFORMANCE_CHANGE_UNAUTHORIZED,
    COLLECTOR_ITEM_ERROR
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/status/BuildAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum BuildAuditStatus{
    BUILD_JOB_IS_NON_PROD,
    BUILD_JOB_CONFIGURATION_REVIEW_FAIL,
    BUILD_JOB_CONFIGURATION_REVIEW_PASS,
    BUILD_JOB_CONFIGURATION_NO_CHANGE,
    COLLECTOR_ITEM_ERROR, BUILD_MATCHES_REPO, BUILD_REPO_MISMATCH, BUILD_AUTHOR_EQ_REPO_AUTHOR, BUILD_AUTHOR_NE_REPO_AUTHOR, NO_BUILD_FOUND, BUILD_JOB_IS_PROD
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/status/DashboardAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum DashboardAuditStatus {
    DASHBOARD_BAD_LOOKUP_DATA,
    DASHBOARD_REPO_NOT_CONFIGURED,
    DASHBOARD_BUILD_CONFIGURED,
    DASHBOARD_BUILD_NOT_CONFIGURED,
    DASHBOARD_CODEQUALITY_CONFIGURED,
    DASHBOARD_CODEQUALITY_NOT_CONFIGURED,
    DASHBOARD_STATIC_SECURITY_ANALYSIS_CONFIGURED,
    DASHBOARD_STATIC_SECURITY_ANALYSIS_NOT_CONFIGURED,
    DASHBOARD_LIBRARY_POLICY_ANALYSIS_CONFIGURED,
    DASHBOARD_LIBRARY_POLICY_ANALYSIS_NOT_CONFIGURED,
    DASHBOARD_NOT_REGISTERED,
    DASHBOARD_TEST_CONFIGURED,
    DASHBOARD_TEST_NOT_CONFIGURED,
    DASHBOARD_REPO_BUILD_VALID,
    DASHBOARD_REPO_BUILD_INVALID,
    DASHBOARD_REPO_PR_AUTHOR_EQ_BUILD_AUTHOR,
    DASHBOARD_REPO_PR_AUTHOR_NE_BUILD_AUTHOR,
    // Error collecting from repo
    COLLECTOR_ITEM_ERROR, // Git repo not configured
    DASHBOARD_PERFORMANCE_TEST_CONFIGURED, DASHBOARD_PERFORMANCE_TEST_NOT_CONFIGURED, DASHBOARD_REPO_CONFIGURED,
    DASHBOARD_ARTIFACT_CONFIGURED,DASHBOARD_ARTIFACT_NOT_CONFIGURED
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/JobCollectorItem.java
=====================================================
package com.capitalone.dashboard.model;

public class JobCollectorItem extends CollectorItem {
    protected static final String INSTANCE_URL = "instanceUrl";
    protected static final String JOB_NAME = "jobName";
    protected static final String JOB_URL = "jobUrl";

    public String getInstanceUrl() {
        return (String) getOptions().get(INSTANCE_URL);
    }

    public void setInstanceUrl(String instanceUrl) {
        getOptions().put(INSTANCE_URL, instanceUrl);
    }

    public String getJobName() {
        return (String) getOptions().get(JOB_NAME);
    }

    public void setJobName(String jobName) {
        getOptions().put(JOB_NAME, jobName);
    }

    public String getJobUrl() {
        return (String) getOptions().get(JOB_URL);
    }

    public void setJobUrl(String jobUrl) {
        getOptions().put(JOB_URL, jobUrl);
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubRepo.java
=====================================================
package com.capitalone.dashboard.model.webhook.github;

import com.capitalone.dashboard.model.CollectorItem;

/**
 * CollectorItem extension to store the github repo url and branch.
 */
public class GitHubRepo extends CollectorItem {
    public static final String REPO_URL = "url"; // http://github.company.com/jack/somejavacode
    public static final String BRANCH = "branch"; // master, development etc.
    public static final String USER_ID = "userID";
    public static final String PASSWORD = "password";
    public static final String PERSONAL_ACCESS_TOKEN = "personalAccessToken";

    public String getUserId() {
        return (String) getOptions().get(USER_ID);
    }

    public String getPassword() {
        return (String) getOptions().get(PASSWORD);
    }


    public String getRepoUrl() {
        return (String) getOptions().get(REPO_URL);
    }

    public void setRepoUrl(String instanceUrl) {
        getOptions().put(REPO_URL, instanceUrl);
    }
    
    public String getBranch() {
        return (String) getOptions().get(BRANCH);
    }

    public void setBranch(String branch) {
        getOptions().put(BRANCH, branch);
    }

    public String getPersonalAccessToken() {
        return String.valueOf(getOptions().get(PERSONAL_ACCESS_TOKEN));
    }

    public void setPersonalAccessToken(String personalAccessToken) {
        getOptions().put(PERSONAL_ACCESS_TOKEN, personalAccessToken);
    }


    @Override
    public boolean equals(Object o) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubParsed.java
=====================================================
package com.capitalone.dashboard.model.webhook.github;

import com.capitalone.dashboard.misc.HygieiaException;

import java.net.MalformedURLException;
import java.net.URL;

public class GitHubParsed {
    private String url;
    private String apiUrl;
    private String baseApiUrl;
    private String graphQLUrl;
    private String orgName;
    private String repoName;

    private static final String SEGMENT_API = "/api/v3/repos";
    private static final String BASE_API = "/api/v3/";
    private static final String PUBLIC_GITHUB_BASE_API = "api.github.com/";
    private static final String PUBLIC_GITHUB_REPO_HOST = "api.github.com/repos";
    private static final String PUBLIC_GITHUB_HOST_NAME = "github.com";

    private static final String SEGMENT_GRAPHQL = "/api/graphql";
    private static final String PUBLIC_GITHUB_GRAPHQL = "api.github.com/graphql";



    public GitHubParsed(String url) throws MalformedURLException, HygieiaException {
        this.url = url;
        parse();
    }

    private void parse() throws MalformedURLException, HygieiaException {
        if (url.endsWith(".git")) {
            url = url.substring(0, url.lastIndexOf(".git"));
        }
        URL u = new URL(url);
        String host = u.getHost();
        String protocol = u.getProtocol();
        String path = u.getPath();
        String[] parts = path.split("/");
        if (parts.length < 3) {
            throw new HygieiaException("Bad github repo URL: " + url, HygieiaException.BAD_DATA);
        }
        orgName = parts[1];
        repoName = parts[2];
        if (host.startsWith(PUBLIC_GITHUB_HOST_NAME)) {
            baseApiUrl = protocol + "://" + PUBLIC_GITHUB_BASE_API;
            apiUrl = protocol + "://" + PUBLIC_GITHUB_REPO_HOST + path;
            graphQLUrl = protocol + "://" + PUBLIC_GITHUB_GRAPHQL;
        } else {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/webhook/github/MergeEvent.java
=====================================================
package com.capitalone.dashboard.model.webhook.github;

import java.util.Objects;

public class MergeEvent {
    private String mergeSha;
    private String gitRequestNumber;
    private String mergeRef;
    private String mergeAuthor;
    private String mergeAuthorLDAPDN;
    private long mergedAt;

    public String getMergeSha() {
        return mergeSha;
    }

    public void setMergeSha(String mergeSha) {
        this.mergeSha = mergeSha;
    }

    public String getGitRequestNumber() {
        return gitRequestNumber;
    }

    public void setGitRequestNumber(String gitRequestNumber) {
        this.gitRequestNumber = gitRequestNumber;
    }

    public String getMergeRef() {
        return mergeRef;
    }

    public void setMergeRef(String mergeRef) {
        this.mergeRef = mergeRef;
    }

    public String getMergeAuthor() {
        return mergeAuthor;
    }

    public void setMergeAuthor(String mergeAuthor) {
        this.mergeAuthor = mergeAuthor;
    }

    public String getMergeAuthorLDAPDN() {
        return mergeAuthorLDAPDN;
    }

    public void setMergeAuthorLDAPDN(String mergeAuthorLDAPDN) {
        this.mergeAuthorLDAPDN = mergeAuthorLDAPDN;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/RallyFeatureType.java
=====================================================
package com.capitalone.dashboard.model;

public enum RallyFeatureType {
	Feature(CollectorType.Feature);
	private final CollectorType collectorType;
	
	RallyFeatureType(CollectorType collectorType) {
        this.collectorType = collectorType;
    }
    public static RallyFeatureType fromString(String value) {
        for (RallyFeatureType rallyFeatureType : values()) {
            if (rallyFeatureType.toString().equalsIgnoreCase(value)) {
                return rallyFeatureType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid RallyFeatureType.");
    }
    
    public CollectorType collectorType() {
        return collectorType;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/BaseModel.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;

/**
 * Base class for all Mongo model classes that has an id property.
 */
public class BaseModel {
    @Id
    private ObjectId id;

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    /*
     * Note:
     * 
     * Having hashcode + equals is more complicated than simply comparing ObjectIds since
     * it does not provide a way to properly compare models that have not been saved yet.
     */
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Build.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

/**
 * The result of a Continuous Integration build execution. Typically produces binary artifacts.
 * Often triggered by one or more SCM commits.
 *
 * Possible collectors:
 *  Hudson (in scope)
 *  Team City
 *  TFS
 *  Go
 *  Bamboo
 *  TravisCI
 *
 */
@Document(collection="builds")
public class Build extends BaseModel {
    private ObjectId collectorItemId;
    private long timestamp;

    private String number;
    private String buildUrl;
    private long startTime;
    private long endTime;
    private long duration;
    private BuildStatus buildStatus;
    private String startedBy;
    private String log;
    private List<RepoBranch> codeRepos = new ArrayList<>();
    private List<SCM> sourceChangeSet = new ArrayList<>();

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public void setSourceChangeSet(List<SCM> sourceChangeSet) {
        this.sourceChangeSet = sourceChangeSet;
    }

    public long getTimestamp() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestCaseStep.java
=====================================================
package com.capitalone.dashboard.model;


public class TestCaseStep {

    /**
     * Identifies this test case step in the source system
     */
    private String id;

    /**
     * Description of the test case step that might make sense to a human
     */
    private String description;

    /**
     * Test case duration in milliseconds
     */
    private long duration;

    /**
     * Status of the test case step
     */
    private TestCaseStatus status;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/GitRequest.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;


@Document(collection="gitrequests")
public class GitRequest  {

    // fields added from SCM class that we are not extending anymore
    private String scmUrl;
    private String scmBranch;
    private String scmRevisionNumber;
    //squash merge commit may be different from pr commit
    private String scmMergeEventRevisionNumber;
    private String scmCommitLog;
    private long scmCommitTimestamp;
    private String scmAuthor;
    private long numberOfChanges;
    // fields added above are from SCM class that we are not extending anymore

    @Id
    private ObjectId id;
    private String orgName;
    private String repoName;
    private String sourceRepo;
    private String sourceBranch;
    private String targetRepo;
    private String targetBranch;
    private String number;
    @Indexed
    private ObjectId collectorItemId;
    private long updatedAt;
    private long createdAt;
    private long closedAt;
    private String state;
    private long mergedAt;
    private String mergeAuthor;
    private String mergeAuthorLDAPDN;
    private long timestamp;
    private long resolutiontime;
    private String userId = null;
    private String commentsUrl;
    private String reviewCommentsUrl;
    private List<Comment> comments;
    private List<Review> reviews;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/DashboardType.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Defines the type of {@link Dashboard}.
 */
public enum DashboardType {
    Product,
    Team;

    public static DashboardType fromString(String value){
        for(DashboardType dashboardType : values()){
            if(dashboardType.toString().equalsIgnoreCase(value)){
                return dashboardType;
            }
        }
        throw new IllegalArgumentException(value+" is not a valid DashboardType");
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Pipeline.java
=====================================================
package com.capitalone.dashboard.model;

import com.capitalone.dashboard.util.PipelineUtils;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.*;

/**
 * Document containing the details of a Pipeline for a TeamDashboardCollectorItem
 */
@Document(collection="pipelines")
public class Pipeline extends BaseModel{
    /**
     * {@link CollectorItem} teamdashboard collector item id
     * */
    private ObjectId collectorItemId;

    /**
     * Map of environment names to EnvironmentStage objects. "Build" and "Commit" are
     * treated as environments.
     * */
    @Field("stages") 
    private Map<String, EnvironmentStage> environmentStageMap = new HashMap<>();

    /**
     * not including this in the map above because the enum allows us to
     * use ordinals to iterate through pipeline progression
     * */
    private Set<Build> failedBuilds = new HashSet<>();

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public Map<String, EnvironmentStage> getEnvironmentStageMap() {
        return environmentStageMap;
    }

    public void setEnvironmentStageMap(Map<String, EnvironmentStage> environmentStageMap) {
        this.environmentStageMap = environmentStageMap;
    }

    /**
     * Adds a commit to a given environment.  Will create a new stage if it doesn't exist.

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/GenericCollectorItem.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;

/**
 * A generic structure to hold a generic collector item info for a given tool that only that tool collector can
 * decipher. This will be used in creating collector item via API for non-standard tools.
 */
@Document(collection = "generic_collector_items")
public class GenericCollectorItem extends BaseModel {
    @NotNull
    private String toolName;
    @NotNull
    private ObjectId collectorId;
    @NotNull
    private String rawData;
    @NotNull
    private long creationTime;
    private long processTime;
    @NotNull
    private String source;
    private ObjectId relatedCollectorItem; //To build relations if needed
    private ObjectId buildId; //if started  off by some build - connects to build collection



    public ObjectId getBuildId() {
        return buildId;
    }

    public void setBuildId(ObjectId buildId) {
        this.buildId = buildId;
    }

    public ObjectId getRelatedCollectorItem() {
        return relatedCollectorItem;
    }

    public void setRelatedCollectorItem(ObjectId relatedCollectorItem) {
        this.relatedCollectorItem = relatedCollectorItem;
    }

    public long getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(long creationTime) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/UserRole.java
=====================================================
package com.capitalone.dashboard.model;

public enum UserRole {

	ROLE_USER,
	ROLE_ADMIN,
	ROLE_API;
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Stage.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.HashSet;
import java.util.Set;


public class Stage {
	
    public Stage(){

    }

    public Stage(Set<PipelineCommit> commits){
        this.commits = commits;
    }
    /** A collection that includes all commits ever to come into the stage */
    private Set<PipelineCommit> commits = new HashSet<>();

    public Set<PipelineCommit> getCommits() {
        return commits;
    }

    public void setCommits(Set<PipelineCommit> commits) {
        this.commits = commits;
    }

    public void addCommit(PipelineCommit commit){
        this.commits.add(commit);
    }

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Team.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents a Tempo Team in JIRA.
 */
@Document(collection="team")
public class Team extends BaseModel {
    private ObjectId collectorId;
    @Indexed
    private String teamId;
    @Indexed
    private String name;
    private String changeDate;
    private String assetState;
    private String isDeleted;
    private boolean enabled;
    private String teamType;

    private long lastCollected;

    @Transient
    private Collector collector;

    public Collector getCollector() {
        return collector;
    }

    public void setCollector(Collector collector) {
        this.collector = collector;
    }

    public Team(String teamId, String name) {
        this.teamId = (teamId != null ? teamId.trim() : "");
        this.name = (name != null ? name.trim() : "");
    }

    public ObjectId getCollectorId() {
        return collectorId;
    }

    public void setCollectorId(ObjectId collectorId) {
        this.collectorId = collectorId;
    }

    public String getTeamId() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestCaseStatus.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Denotes the status of a given {@link TestCase}.
 */
public enum TestCaseStatus {
    Success, Failure, Skipped, Unknown
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/relation/RelatedCollectorItem.java
=====================================================
package com.capitalone.dashboard.model.relation;

import com.capitalone.dashboard.model.BaseModel;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;

@Document(collection = "related_items")
public class RelatedCollectorItem extends BaseModel{
    @NotNull
    private ObjectId left;
    @NotNull
    private ObjectId right;
    @NotNull
    private String source;
    @NotNull
    private String reason;
    @NotNull
    private long creationTime;

    public ObjectId getLeft() {
        return left;
    }

    public void setLeft(ObjectId left) {
        this.left = left;
    }

    public ObjectId getRight() {
        return right;
    }

    public void setRight(ObjectId right) {
        this.right = right;
    }

    public long getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(long creationTime) {
        this.creationTime = creationTime;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ChangeOrder.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Objects;

@Document(collection="changeorder")
public class ChangeOrder extends BaseModel{

    private ObjectId collectorItemId;
    private Long timestamp;
    private String changeOrderItem;

    private String changeID;
    private String category;
    private String status;
    private String approvalStatus;
    private String initiatedBy;
    private String assignedTo;
    private String assignmentGroup;
    private String changeCoordinator;
    private String coordinatorPhone;
    private Long plannedStart;
    private Long plannedEnd;
    private String reason;
    private String phase;
    private String riskAssessment;
    private String priority;
    private Long dateEntered;
    private boolean open;
    private String backoutDuration;
    private Long closeTime;
    private String extProjectRef;
    private String rFCType2;
    private String company;
    private String title;
    private String subcategory;
    private String sLAAgreementID;
    private String changeModel;
    private String service;

    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ");

    public ObjectId getCollectorItemId() { return collectorItemId; }

    public void setCollectorItemId(ObjectId collectorItemId) { this.collectorItemId = collectorItemId; }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/FeatureIssueLink.java
=====================================================

package com.capitalone.dashboard.model;

/**
 * Represents an issue link of a jira story.
 */
public class FeatureIssueLink {

	private String targetIssueKey;
	private String targetIssueUri;
	private String issueLinkName;
	private String issueLinkType;
	private String issueLinkDirection;

	public String getTargetIssueKey() {
		return targetIssueKey;
	}

	public void setTargetIssueKey(String targetIssueKey) {
		this.targetIssueKey = targetIssueKey;
	}

	public String getTargetIssueUri() {
		return targetIssueUri;
	}

	public void setTargetIssueUri(String targetIssueUri) {
		this.targetIssueUri = targetIssueUri;
	}

	public String getIssueLinkName() {
		return issueLinkName;
	}

	public void setIssueLinkName(String issueLinkName) {
		this.issueLinkName = issueLinkName;
	}

	public String getIssueLinkType() {
		return issueLinkType;
	}

	public void setIssueLinkType(String issueLinkType) {
		this.issueLinkType = issueLinkType;
	}

	public String getIssueLinkDirection() {
		return issueLinkDirection;
	}


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/PipelineStageType.java
=====================================================
package com.capitalone.dashboard.model;

public enum PipelineStageType {
	BUILD, COMMIT, DEPLOY
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestCaseConditionResult.java
=====================================================
package com.capitalone.dashboard.model;

public class TestCaseConditionResult {
    private TestCaseStatus status;
    private long duration;

    public TestCaseStatus getStatus() {
        return status;
    }

    public void setStatus(TestCaseStatus status) {
        this.status = status;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Review.java
=====================================================
package com.capitalone.dashboard.model;

public class Review {
    private String body;
    private String state;
    private String author;
    private String authorLDAPDN;
    private long createdAt;
    private long updatedAt;

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getAuthorLDAPDN() {
        return authorLDAPDN;
    }

    public void setAuthorLDAPDN(String authorLDAPDN) {
        this.authorLDAPDN = authorLDAPDN;
    }

    public long getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(long createdAt) {
        this.createdAt = createdAt;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Application.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.DBRef;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * The software application the team is developing and/or operating. Consists of one or more software
 * components and may exist in one or more environments.
 */
public class Application {
    private String name;
    private String owner;
    private String lineOfBusiness;
    @DBRef
    private List<Component> components = new ArrayList<>();

    Application() {
    }

    public Application(String name, Component... componentsArray) {
        this.name = name;
        Collections.addAll(components, componentsArray);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getLineOfBusiness() {
        return lineOfBusiness;
    }

    public void setLineOfBusiness(String lineOfBusiness) {
        this.lineOfBusiness = lineOfBusiness;
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ScopeOwner.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents a team in a content management system that works with features.
 *
 * Possible collectors: VersionOne PivotalTracker Rally Trello Jira
 *
 * @author kfk884
 *
 */
@Document(collection = "scope-owner")
public class ScopeOwner extends CollectorItem {
	private ObjectId collectorItemId;
	@Indexed
	private String teamId;
	@Indexed
	private String name;
	private String changeDate;
	private String assetState;
	private String isDeleted;

	public ObjectId getCollectorItemId() {
		return collectorItemId;
	}

	public void setCollectorItemId(ObjectId collectorItemId) {
		this.collectorItemId = collectorItemId;
	}

	public String getTeamId() {
		return this.teamId;
	}

	public void setTeamId(String teamId) {
		this.teamId = teamId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getChangeDate() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/PerformanceMetric.java
=====================================================
package com.capitalone.dashboard.model;

public class PerformanceMetric {
    private String name;
    private Object value;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatLevel.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumerates the possible statuses.
 */
public enum LibraryPolicyThreatLevel {
    Critical, High, Medium, Low, None;

    public static LibraryPolicyThreatLevel fromString(String value){
        for(LibraryPolicyThreatLevel threatLevel : values()){
            if(threatLevel.toString().equalsIgnoreCase(value)){
                return threatLevel;
            }
        }
        throw new IllegalArgumentException(value+" is not a valid LibraryPolicyThreatLevel");
    }

    public static LibraryPolicyThreatLevel fromDouble(double value){
        if ((value == 10)) return LibraryPolicyThreatLevel.Critical;
        if ((value < 10.0) && (value >= 7.0)) return LibraryPolicyThreatLevel.High;
        if ((value < 7.0) && (value >= 4.0)) return LibraryPolicyThreatLevel.Medium;
        if ((value < 4.0) && (value > 0.0)) return LibraryPolicyThreatLevel.Low;
        if (value == 0.0) return LibraryPolicyThreatLevel.None;

        throw new IllegalArgumentException(value+" is not a valid LibraryPolicyThreatLevel");
    }

    public static LibraryPolicyThreatLevel fromInt(int value){
        double dv = (double) value;
        return fromDouble(dv);
    }

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CodeReposBuilds.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

@Document(collection = "code_repos_builds")
public class CodeReposBuilds extends BaseModel {

    @Indexed(unique = true)
    private String codeRepo;

    private Set<ObjectId> buildCollectorItems = new HashSet<>();

    @Indexed
    private long timestamp;

    public String getCodeRepo() {
        return codeRepo.toLowerCase(Locale.US);
    }

    public void setCodeRepo(String codeRepo) {
        this.codeRepo = codeRepo.toLowerCase(Locale.US);
    }

    public Set<ObjectId> getBuildCollectorItems() {
        return buildCollectorItems;
    }

    public void setBuildCollectorItems(Set<ObjectId> buildCollectorItems) {
        this.buildCollectorItems = buildCollectorItems;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/RepoBranch.java
=====================================================
package com.capitalone.dashboard.model;


import javax.validation.constraints.NotNull;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;

public class RepoBranch {
    private String url = "";
    private String branch = "";
    private RepoType type = RepoType.Unknown;

    public enum RepoType {
        SVN,
        GIT,
        Unknown;

        public static com.capitalone.dashboard.model.RepoBranch.RepoType fromString(String value) {
            if (value ==  null) return RepoType.Unknown;
            for (com.capitalone.dashboard.model.RepoBranch.RepoType repoType : values()) {
                if (repoType.toString().equalsIgnoreCase(value)) {
                    return repoType;
                }
            }
            throw new IllegalArgumentException(value + " is not a valid RepoType.");
        }
    }

    public RepoBranch(String url, String branch, RepoType repoType) {
        this.url = url;
        this.branch = branch;
        this.type = repoType;
    }

    public RepoBranch() {
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url.toLowerCase(Locale.US);
    }

    public String getBranch() {
        switch (this.getType()) {
            case GIT: return getGITNormalizedBranch(branch);
            case SVN: return branch;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/quality/FindBugsXmlReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import java.util.List;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "BugCollection")
public class FindBugsXmlReport implements CodeQualityVisitee {
    @Override
    public void accept(CodeQualityVisitor visitor) {
        visitor.visit(this);
    }

    @XmlElement(name = "file")
    private List<BugFile> files;

    public List<BugFile> getFiles() {
        return files;
    }

    public void setFiles(List<BugFile> files) {
        this.files = files;
    }


    @XmlAccessorType(XmlAccessType.FIELD)
    public static class BugFile {
        @XmlElement(name = "BugInstance")
        private List<BugInstance> bugCollection;

        public List<BugInstance> getBugCollection() {
            return bugCollection;
        }

        public void setBugCollection(List<BugInstance> bugCollection) {
            this.bugCollection = bugCollection;
        }
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class BugInstance {

        @XmlAttribute
        private String type;

        @XmlAttribute
        private BugPriority priority;

        @XmlAttribute
        private BugCategory category;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/quality/PmdReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import java.util.List;

@XmlRootElement(name="pmd")
@XmlAccessorType(XmlAccessType.FIELD)
public class PmdReport implements CodeQualityVisitee {

    @XmlElement(name="file")
    private List<PmdFile> files;

    @Override
    public void accept(CodeQualityVisitor visitor) {
        visitor.visit(this);
    }

    public List<PmdFile> getFiles() {
        return files;
    }

    public void setFiles(List<PmdFile> files) {
        this.files = files;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class PmdFile{

        @XmlElement(name="violation")
        private List<PmdViolation> violations;

        public List<PmdViolation> getViolations() {
            return violations;
        }

        public void setViolations(List<PmdViolation> violations) {
            this.violations = violations;
        }
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class PmdViolation {

        @XmlAttribute(name="priority")
        private int priority;

        public int getPriority() {
            return priority;
        }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/quality/JacocoXmlReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import java.util.List;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "report")
public class JacocoXmlReport implements CodeQualityVisitee{

    @XmlElement(name="counter")
    private List<Counter> counters;


    @Override
    public void accept(CodeQualityVisitor visitor) {
        visitor.visit(this);
    }

    public List<Counter> getCounters() {
        return counters;
    }

    public void setCounters(List<Counter> counters) {
        this.counters = counters;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Counter {
        @XmlAttribute(name="type")
        private CounterType type;

        @XmlAttribute(name="missed")
        private int missed;

        @XmlAttribute(name="covered")
        private int covered;

        public int getMissed() {
            return missed;
        }

        public void setMissed(int missed) {
            this.missed = missed;
        }

        public int getCovered() {
            return covered;
        }

        public void setCovered(int covered) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/quality/ArtifactType.java
=====================================================
package com.capitalone.dashboard.model.quality;

public enum ArtifactType {
    junit, findbugs, jacoco, pmd, checkstyle;
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitor.java
=====================================================
package com.capitalone.dashboard.model.quality;

import com.capitalone.dashboard.model.CodeQuality;

public interface CodeQualityVisitor {

    CodeQuality produceResult();

    void visit(JunitXmlReport junitXmlReport);

    void visit(FindBugsXmlReport findBugsXmlReport);

    void visit(JacocoXmlReport jacocoXmlReport);

    void visit(PmdReport pmdReport);

    void visit(CheckstyleReport checkstyleReport);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitee.java
=====================================================
package com.capitalone.dashboard.model.quality;

public interface CodeQualityVisitee {

    void accept(CodeQualityVisitor visitor);
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/quality/JunitXmlReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.XMLGregorianCalendar;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * Contains the results of exexuting a testsuite
 * <p>
 * <p>Java class for testsuite complex type.
 * <p>
 * <p>The following schema fragment specifies the expected content contained within this class.
 * <p>
 * <pre>
 * &lt;complexType name="testsuite">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="properties">
 *           &lt;complexType>
 *             &lt;complexContent>
 *               &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 &lt;sequence>
 *                   &lt;element name="property" maxOccurs="unbounded" minOccurs="0">
 *                     &lt;complexType>
 *                       &lt;complexContent>
 *                         &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                           &lt;attribute name="name" use="required">
 *                             &lt;simpleType>
 *                               &lt;restriction base="{http://www.w3.org/2001/XMLSchema}token">
 *                                 &lt;minLength value="1"/>
 *                               &lt;/restriction>
 *                             &lt;/simpleType>
 *                           &lt;/attribute>
 *                           &lt;attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *                         &lt;/restriction>
 *                       &lt;/complexContent>
 *                     &lt;/complexType>
 *                   &lt;/element>
 *                 &lt;/sequence>
 *               &lt;/restriction>
 *             &lt;/complexContent>
 *           &lt;/complexType>
 *         &lt;/element>
 *         &lt;element name="testcase" maxOccurs="unbounded" minOccurs="0">
 *           &lt;complexType>

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/quality/CheckstyleReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import java.util.List;

@XmlRootElement(name="checkstyle")
@XmlAccessorType(XmlAccessType.FIELD)
public class CheckstyleReport implements CodeQualityVisitee {

    @XmlElement(name="file")
    private List<CheckstyleFile> files;

    @Override
    public void accept(CodeQualityVisitor visitor) {
        visitor.visit(this);
    }

    public List<CheckstyleFile> getFiles() {
        return files;
    }

    public void setFiles(List<CheckstyleFile> files) {
        this.files = files;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class CheckstyleFile {

        @XmlElement(name="error")
        private List<CheckstyleError> errors;

        public List<CheckstyleError> getErrors() {
            return errors;
        }

        public void setErrors(List<CheckstyleError> errors) {
            this.errors = errors;
        }
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class CheckstyleError {

        @XmlAttribute(name="severity")
        private CheckstyleSeverity severity;


        public CheckstyleSeverity getSeverity() {
            return severity;
        }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/UserStory.java
=====================================================
package com.capitalone.dashboard.model;

public class UserStory {
	
	private String storyId;
	private String storyName;
	private String ownerName;
	private String storyUrl;
	private long lastUpdateDate;
	private String state;
	
	
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public long getLastUpdateDate() {
		return lastUpdateDate;
	}
	public void setLastUpdateDate(long lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}
	public String getStoryUrl() {
		return storyUrl;
	}
	public void setStoryUrl(String storyUrl) {
		this.storyUrl = storyUrl;
	}
	public String getStoryId() {
		return storyId;
	}
	public void setStoryId(String storyId) {
		this.storyId = storyId;
	}
	public String getStoryName() {
		return storyName;
	}
	public void setStoryName(String storyName) {
		this.storyName = storyName;
	}
	public String getOwnerName() {
		return ownerName;
	}
	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}
	
	

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/StandardWidget.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.collections.MapUtils;
import org.bson.types.ObjectId;

import java.util.HashMap;
import java.util.Map;

public class StandardWidget {
    private CollectorType collectorType;
    private static final String REPO = "repo";
    private static final String BUILD = "build";
    private static final String CODEQUALITY = "codeanalysis";
    private static final String FEATURE = "feature";
    private static final String DEPLOY = "deploy";

    private static final String REPO_ID = "repo0";
    private static final String BUILD_ID = "build0";
    private static final String CODEQUALITY_ID = "codeanalysis0";
    private static final String FEATURE_ID = "feature0";
    private static final String DEPLOY_ID = "deploy0";

    private Map<String, Object> options = new HashMap<>();
    private String name;
    private ObjectId componentId;

    public StandardWidget(CollectorType collectorType, ObjectId componentId) {
        this.collectorType = collectorType;
        this.componentId = componentId;
        setNameAndId();
    }

    /**
     * Setup the standard name, id etc for the widget
     */

    private void setNameAndId() {
        switch (collectorType) {
            case SCM:
                name = REPO;
                options.put("id", REPO_ID);
                break;

            case Build:
                name = BUILD;
                options.put("id", BUILD_ID);
                options.put("buildDurationThreshold", 3);
                options.put("consecutiveFailureThreshold", 5);
                break;


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/BuildStatus.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumeration of valid build statuses.
 */
public enum BuildStatus {
    Success,
    Failure,
    Unstable,
    Aborted,
    InProgress,
    Unknown;

    public static BuildStatus fromString(String value) {
        for (BuildStatus buildStatus : values()) {
            if (buildStatus.toString().equalsIgnoreCase(value)) {
                return buildStatus;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid BuildStatus.");
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CloudVirtualNetwork.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;


@Document(collection = "cloud_virtual_network")
public class CloudVirtualNetwork extends BaseModel{
    @Indexed
    @NotNull
    @NotBlank
    private String virtualNetworkId;
    @NotNull
    @NotBlank
    private String accountNumber;
    private ObjectId collectorItemId;
    private String cidrBlock;
    private boolean defaultNetwork;
    private String state; //pending, available etc.
    private Map<String, String> tags = new HashMap<>();
    private long creationDate;
    private long lastUpdateDate;

    public String getVirtualNetworkId() {
        return virtualNetworkId;
    }

    public void setVirtualNetworkId(String virtualNetworkId) {
        this.virtualNetworkId = virtualNetworkId;
    }

    public String getCidrBlock() {
        return cidrBlock;
    }

    public void setCidrBlock(String cidrBlock) {
        this.cidrBlock = cidrBlock;
    }

    public boolean isDefaultNetwork() {
        return defaultNetwork;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentStage.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Class representing any stage of a {@link Pipeline}
 */
public class EnvironmentStage extends Stage{
    /** {@link BinaryArtifact} The last artifact to be processed */
    private BinaryArtifact lastArtifact;

    public BinaryArtifact getLastArtifact() {
        return lastArtifact;
    }

    public void setLastArtifact(BinaryArtifact lastArtifact) {
        this.lastArtifact = lastArtifact;
    }


}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/RallyBurnDownData.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection="rally_burndown")

public class RallyBurnDownData extends BaseModel{
	
	public static final String ITERATION_TO_DO_HOURS = "iterationToDoHours";
	public static final String ACCEPTED_POINTS = "acceptedPoints";
	public static final String ITERATION_DATE = "iterationDate";
	
	private List<Map<String,String>> burnDownData; 
	private String iterationId;
	private String projectName;
	private String iterationName;
	private String projectId;
	private Double totalEstimate;
	private long lastUpdated;
	
	
	public long getLastUpdated() {
		return lastUpdated;
	}
	public void setLastUpdated(long timestamp) {
		this.lastUpdated = timestamp;
	}
	
	public List<Map<String, String>> getBurnDownData() {
		if(burnDownData==null){
			burnDownData = new ArrayList<>();
		}
		return burnDownData;
	}
	public void setBurnDownData(List<Map<String, String>> burnDownData) {
		this.burnDownData = burnDownData;
	}
	public String getIterationId() {
		return iterationId;
	}
	public void setIterationId(String iterationId) {
		this.iterationId = iterationId;
	}
	public String getProjectName() {
		return projectName;
	}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/PerformanceMetricStatus.java
=====================================================
package com.capitalone.dashboard.model;

public enum PerformanceMetricStatus {
    OK, WARNING, CRITICAL
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyType.java
=====================================================
package com.capitalone.dashboard.model;


public enum LibraryPolicyType {
    Security,
    License,
    Other;

    public static LibraryPolicyType fromString(String value) {
        for (LibraryPolicyType policyType : values()) {
            if (policyType.toString().equalsIgnoreCase(value)) {
                return policyType;
            }
        }
        return Other;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ScoreDisplayType.java
=====================================================
package com.capitalone.dashboard.model;

public enum ScoreDisplayType {
    HEADER,
    WIDGET;

    public static ScoreDisplayType fromString(String value){
        for(ScoreDisplayType scoreDisplay : values()){
            if(scoreDisplay.toString().equalsIgnoreCase(value)){
                return scoreDisplay;
            }
        }
        return ScoreDisplayType.HEADER;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/RequestLog.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.Document;


@Document(collection = "requests")
public class RequestLog extends BaseModel {
    private String client;
    private String endpoint;
    private String method;
    private String parameter;
    private long requestSize;
    private String requestContentType;
    private Object requestBody;
    private long responseSize;
    private String responseContentType;
    private Object responseBody;
    private int responseCode;
    private long timestamp;
    private long responseTime;

    public String getClient() {
        return client;
    }

    public void setClient(String client) {
        this.client = client;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getParameter() {
        return parameter;
    }

    public void setParameter(String parameter) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Configuration.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.Base64;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "configuration")
public class Configuration extends BaseModel {

	private final static String PREFIX = "BASE64:";

	public Configuration(String collectorName, Set<Map<String, String>> info) {
		super();
		this.collectorName = collectorName;
		this.info = info;
	}

	public Set<Map<String, String>> decryptOrEncrptInfo() {
		for (Map<String, String> info : info) {
			if (!info.isEmpty()) {
				String password = info.get("password").toString();
				if(password.contains(PREFIX)){
					Base64.Decoder decoder = Base64.getDecoder();
					password = new String(decoder.decode(password.replaceFirst(PREFIX, "").trim()));
				} else {
					Base64.Encoder encoder = Base64.getEncoder();
					password = PREFIX + encoder.encodeToString(password.getBytes());
				}
				info.replace("password", password);
			}
		}
		return info;
	}

	public Configuration() {
	}

	private String collectorName;
	private Set<Map<String, String>> info = new HashSet<>();

	public String getCollectorName() {
		return collectorName;
	}

	public void setCollectorName(String collectorName) {
		this.collectorName = collectorName;
	}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Collector.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The collectors that have been registered in the given Dashboard app instance.
 */
@Document(collection = "collectors")
public class Collector extends BaseModel {
    private String name;
    private CollectorType collectorType;
    private boolean enabled;
    private boolean online;
    private List<CollectionError> errors = new ArrayList<>();
    //Every collector will have its own set of required and all fields depending upon the specific tool.
    private Map<String, Object> uniqueFields = new HashMap<>();
    private Map<String, Object> allFields = new HashMap<>();

    private long lastExecuted;
    private List<String> searchFields = Arrays.asList("description");
    private Map<String, Object> properties = new HashMap<>(); //general purpose name-value properties

    public Collector() {
    }

    public Collector(String name, CollectorType collectorType) {
        this.name = name;
        this.collectorType = collectorType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public CollectorType getCollectorType() {
        return collectorType;
    }

    public void setCollectorType(CollectorType collectorType) {
        this.collectorType = collectorType;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/NameValue.java
=====================================================
package com.capitalone.dashboard.model;


public class NameValue {

    private String name;
    private String value;

    public NameValue () {
    }

    public NameValue(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NameValue nameValue = (NameValue) o;

        if (!name.equals(nameValue.name)) return false;
        return value.equals(nameValue.value);

    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + value.hashCode();
        return result;
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CodeQuality.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashSet;
import java.util.Set;

/**
 * Represents code quality at a specific point in time. This could include
 * a unit test run, a security scan, static analysis, functional tests,
 * manual acceptance tests or bug reports.
 *
 * Possible Collectors:
 *  Sonar (in scope)
 *  Fortify
 *  ALM
 *  Various build system test results
 *
 */
@Document(collection="code_quality")
public class CodeQuality extends BaseModel {
    private ObjectId collectorItemId;
    private long timestamp;

    private String name;
    private String url;
    private CodeQualityType type;
    private String version;
    private  ObjectId buildId;

    private Set<CodeQualityMetric> metrics = new HashSet<>();

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getName() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityMetricStatus.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumerates the possible {@link CodeQualityMetric} statuses.
 */
public enum CodeQualityMetricStatus {
    Ok, Warning, Alert, Error
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/RallyStoryStages.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.List;

public class RallyStoryStages {
	
	private String backlog;
	private String defined;
	private String inProgress;
	private String completed;
	private String accepted;
	private String defects;
	private List<UserStory> userStories;
	
	
	public List<UserStory> getUserStories() {
		return userStories;
	}
	public void setUserStories(List<UserStory> userStories) {
		this.userStories = userStories;
	}
	public String getDefects() {
		return defects;
	}
	public void setDefects(String defects) {
		this.defects = defects;
	}
	public String getBacklog() {
		return backlog;
	}
	public void setBacklog(String backlog) {
		this.backlog = backlog;
	}
	public String getDefined() {
		return defined;
	}
	public void setDefined(String defined) {
		this.defined = defined;
	}
	public String getInProgress() {
		return inProgress;
	}
	public void setInProgress(String inProgress) {
		this.inProgress = inProgress;
	}
	public String getCompleted() {
		return completed;
	}
	public void setCompleted(String completed) {
		this.completed = completed;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TeamMember.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.List;

/**
 * Class representing any team members of a {@link TeamInventory}
 */
public class TeamMember {

    private String orgId;
    private String allocation;
    private String teamId;
    private String name;
    private List<TeamLevelDetails> teams;


    private String regOrTemp ;

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public String getAllocation() {
        return allocation;
    }

    public void setAllocation(String allocation) {
        this.allocation = allocation;
    }

    public String getTeamId() {
        return teamId;
    }

    public void setTeamId(String teamId) {
        this.teamId = teamId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CollectorItem.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.collections.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * <p>
 *      Represents a unique collection in an external tool. For example, for a CI tool
 *      the collector item would be a Job. For a project management tool, the collector item
 *      might be a Scope.
 * </p>
 * <p>
 *      Each {@link Collector} is responsible for specifying how it's {@link CollectorItem}s are
 *      uniquely identified by storing key/value pairs in the options Map. The description field will
 *      be visible to users in the UI to aid in selecting the correct {@link CollectorItem} for their dashboard.
 *      Ideally, the description will be unique for a given {@link Collector}.
 * </p>
 */
@Document(collection="collector_items")
public class CollectorItem extends BaseModel {

    private String description;
    private String niceName;
    private String environment;
    private boolean enabled;
    private List<CollectionError> errors = new ArrayList<>();
    private boolean pushed;
    private ObjectId collectorId;
    private long lastUpdated;
    private Map<String,Object> options = new HashMap<>();

    @Transient
    private Collector collector;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TeamLevelDetails.java
=====================================================
package com.capitalone.dashboard.model;

public class TeamLevelDetails extends CollectorItem {


    public String getInstanceUrl() {
        return (String) getOptions().get("instanceUrl");
    }

    public void setInstanceUrl(String url) {
        getOptions().put("instanceUrl", url);
    }

    public String getTeamId() {
        return (String) getOptions().get("teamId");
    }

    public void setTeamId(String teamId) {
        getOptions().put("teamId", teamId);
    }

    public String getTeamName() {
        return (String) getOptions().get("teamName");
    }

    public void setTeamName(String teamName) {
        getOptions().put("teamName", teamName);
    }

    public String getUrl() {
        return (String) getOptions().get("url");
    }

    public void setUrl(String url) {
        getOptions().put("url", url);
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TeamLevelDetails that = (TeamLevelDetails) o;
        return getTeamId().equals(that.getTeamId()) && getTeamName().equals(that.getTeamName());
    }

    @Override
    public int hashCode() {
        int result = getTeamId().hashCode();

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyResult.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.collections.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;


@Document(collection = "library_policy")
public class LibraryPolicyResult extends BaseModel {
    private ObjectId collectorItemId;
    private long timestamp;
    private long evaluationTimestamp;
    private Map<LibraryPolicyType, Set<Threat>> threats = new HashMap<>();
    private String reportUrl;
    private Integer totalComponentCount;
    private Integer knownComponentCount;
    private List<PolicyScanMetric> policyAlert = new ArrayList<>();
    private ObjectId buildId;

    public static class Threat {
        LibraryPolicyThreatLevel level;
        List<String> components = new ArrayList<>();
        int count;
        private Map<LibraryPolicyThreatDisposition, Integer> dispositionCounts = new HashMap<>();

        public Threat(LibraryPolicyThreatLevel level, int count) {
            this.level = level;
            this.count = count;
        }

        public LibraryPolicyThreatLevel getLevel() {
            return level;
        }

        public void setLevel(LibraryPolicyThreatLevel level) {
            this.level = level;
        }

        public int getCount() {
            return count;
        }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Performance.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;

@Document(collection="performance")
public class Performance extends BaseModel{

    private ObjectId collectorItemId;
    private long timestamp;
    private String url;
    private PerformanceType type;
    private String version;
    private  ObjectId executionId;
    private String targetAppName;
    private String targetEnvName;
    private Map<String,Object> metrics = new HashMap<>();

    public Map<String,Object> getMetrics() {
        return metrics;
    }

    public void setMetrics(Map<String,Object> metrics) {
        this.metrics = metrics;
    }

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Component.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * A self-contained, independently deployable piece of the larger application. Each component of an application
 * has a different source repo, build job, deploy job, etc.
 *
 */
@Document(collection="components")
public class Component extends BaseModel {
    private String name; // must be unique to the application
    private String owner;
    private Map<CollectorType, List<CollectorItem>> collectorItems = new HashMap<>();

    public Component() {
    }

    public Component(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public Map<CollectorType, List<CollectorItem>> getCollectorItems() {
        return collectorItems;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/StoryIndicator.java
=====================================================
package com.capitalone.dashboard.model;
public class StoryIndicator {
    private String storyId;
    private String storyNumber;
    private String storyName;
    private String storyStatus;
    private String storyState;
    private String storyType;
    private String epicNumber;
    private String epicName;
    private String projectName;
    private String teamName;
    private String sprintName;
    public String getStoryId() {
        return storyId;
    }
    public void setStoryId(String storyId) {
        this.storyId = storyId;
    }
    public String getStoryNumber() {
        return storyNumber;
    }
    public void setStoryNumber(String storyNumber) {
        this.storyNumber = storyNumber;
    }
    public String getStoryName() {
        return storyName;
    }
    public void setStoryName(String storyName) {
        this.storyName = storyName;
    }
    public String getStoryStatus() {
        return storyStatus;
    }
    public void setStoryStatus(String storyStatus) {
        this.storyStatus = storyStatus;
    }
    public String getStoryState() {
        return storyState;
    }
    public void setStoryState(String storyState) {
        this.storyState = storyState;
    }
    public String getStoryType() {
        return storyType;
    }
    public void setStoryType(String storyType) {
        this.storyType = storyType;
    }
    public String getEpicNumber() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/PipelineStage.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.Locale;

public final class PipelineStage {

	public static final PipelineStage COMMIT = new PipelineStage("Commit", PipelineStageType.COMMIT);
	public static final PipelineStage BUILD = new PipelineStage("Build", PipelineStageType.BUILD);

	private final String name;
	private final PipelineStageType type;
	
	private PipelineStage(String name, PipelineStageType type) { 
		this.name = name;
		this.type = type;
	}
	
	public String getName() {
		return name;
	}
	
	public PipelineStageType getType() {
		return type;
	}
	
	public static PipelineStage valueOf(String name) {
		if (name == null) {
			throw new IllegalArgumentException();
		}
		
		if (COMMIT.name.equalsIgnoreCase(name)) {
			return COMMIT;
		} else if (BUILD.name.equalsIgnoreCase(name)) {
			return BUILD;
		} else {
			return new PipelineStage(name, PipelineStageType.DEPLOY);
		}
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.toLowerCase(Locale.getDefault()).hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@SuppressWarnings("PMD.SimplifyBooleanReturns")
	@Override

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Dashboard.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

/**
 * A collection of widgets, collectors and application components that represent a software
 * project under development and/or in production use.
 *
 */
@Document(collection="dashboards")
public class Dashboard extends BaseModel {

    private String template;

    //NOTE Mongodb treats strings as different if they have different case
    @Indexed(unique=true)
    private String title;

    private List<Widget> widgets = new ArrayList<>();

    // multiple owner references for backwards compatibility
    // TODO: remove once impacts of breaking change are assessed
    private String owner;
    private List<Owner> owners = new ArrayList<Owner>();
    
    private DashboardType type;

    private Application application;

    private String configurationItemBusServName;

    private String configurationItemBusAppName;

    private boolean validServiceName;

    private boolean validAppName;

    private boolean remoteCreated;

    //Enable/Disable scoring for the dashboard
    private boolean scoreEnabled;

    //Display position for score.
    //Default to HEADER
    private ScoreDisplayType scoreDisplay = ScoreDisplayType.HEADER;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ServiceAccount.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection="service_accounts")
public class ServiceAccount extends BaseModel {

    private String serviceAccountName;
    private String fileNames;

    public ServiceAccount(String serviceAccountName, String fileNames) {
       this.serviceAccountName = serviceAccountName;
       this.fileNames = fileNames;
    }

    public String getServiceAccountName() {
        return serviceAccountName;
    }

    public void setServiceAccountName(String serviceAccountName) {
        this.serviceAccountName = serviceAccountName;
    }

    public String getFileNames() {
        return fileNames;
    }

    public void setFileNames(String fileNames) {
        this.fileNames = fileNames;
    }

    @Override
    public String toString() {
        return "ServiceAccount [serviceAccount=" + serviceAccountName + ", fileNames=" + fileNames + "]";
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Commit.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * A specific commit in a version control repository.
 *
 * Possible collectors:
 *  Subversion (in scope)
 *  Git (in scope)
 *  GitHub
 *  TFS
 *  BitBucket
 *  Unfuddle
 *
 */
@Document(collection="commits")
@CompoundIndexes({
        @CompoundIndex(name = "unique_scm_key", def = "{'collectorItemId' : 1, 'scmRevisionNumber': 1}")
})
public class Commit extends SCM {
    @Id
    private ObjectId id;
    @Indexed
    private ObjectId collectorItemId;
    private long timestamp;

    private boolean firstEverCommit;

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/PipelineCommit.java
=====================================================
package com.capitalone.dashboard.model;

public class PipelineCommit extends SCM{
	
    public PipelineCommit() {
    }

    public PipelineCommit(long timestamp) {
        this.timestamp = timestamp;
    }

    public PipelineCommit(SCM scm, long timestamp){
        super(scm);
        this.timestamp = timestamp;
    }
    private long timestamp;

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((scmRevisionNumber == null) ? 0 : scmRevisionNumber.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PipelineCommit other = (PipelineCommit) obj;
		if (scmRevisionNumber == null) {
			if (other.scmRevisionNumber != null)
				return false;
		} else if (!scmRevisionNumber.equals(other.scmRevisionNumber))
			return false;
		return true;
	}
    

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestSuiteType.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Denotes the type of tests in a given {@link TestSuite}.
 */
public enum TestSuiteType {
    Unit, Functional, Regression, Performance, Integration, Security, Manual;

    public static TestSuiteType fromString(String value) {
        for (TestSuiteType type : values()) {
            if (type.toString().equalsIgnoreCase(value)) {
                return type;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid TestSuiteType.");
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/AuditResult.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;

@Document(collection = "audit_results")
public class AuditResult extends BaseModel {

    private ObjectId dashboardId;
    private String dashboardTitle;
    private String lineOfBusiness;
    private String configItemBusServName;
    private String configItemBusAppName;
    private String configItemBusServOwner;
    private String configItemBusAppOwner;
    private AuditType auditType;
    private String auditTypeStatus;
    private String auditStatus;
    private String url;
    private String auditDetails;
    private Map traceability;
    private long timestamp;
    private Map<String, Object> options = new HashMap<>();

    public AuditResult() { }

    @SuppressWarnings("PMD.ExcessiveParameterList")
    public AuditResult(ObjectId dashboardId, String dashboardTitle, String lineOfBusiness, String configItemBusServName,
                       String configItemBusAppName, String configItemBusServOwner, String configItemBusAppOwner, AuditType auditType,
                       String auditTypeStatus, String auditStatus, String auditDetails, String url, Map traceability, long timestamp) {
        this.dashboardId = dashboardId;
        this.dashboardTitle = dashboardTitle;
        this.lineOfBusiness = lineOfBusiness;
        this.configItemBusServName = configItemBusServName;
        this.configItemBusAppName = configItemBusAppName;
        this.configItemBusServOwner = configItemBusServOwner;
        this.configItemBusAppOwner = configItemBusAppOwner;
        this.auditType = auditType;
        this.auditTypeStatus = auditTypeStatus;
        this.auditStatus = auditStatus;
        this.url = url;
        this.auditDetails = auditDetails;
        this.traceability = traceability;
        this.timestamp = timestamp;
    }

    @SuppressWarnings("PMD.ExcessiveParameterList")

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CollectorItemConfigHistory.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;

@Document(collection="collitem_cfghist")
public class CollectorItemConfigHistory extends BaseModel {

    private ObjectId collectorItemId;
    private long timestamp;
    private ConfigHistOperationType operation;
    private String userName;
    private String userID;
    private Map<String, Object> changeMap = new HashMap<>();

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public ConfigHistOperationType getOperation() {
        return operation;
    }

    public void setOperation(ConfigHistOperationType operation) {
        this.operation = operation;
    }

    public Map<String, Object> getChangeMap() {
        return changeMap;
    }

    public void setChangeMap(Map<String, Object> changeMap) {
        this.changeMap = changeMap;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/PerformanceType.java
=====================================================
package com.capitalone.dashboard.model;


public enum PerformanceType {
    ApplicationPerformance(CollectorType.AppPerformance),
    InfrastructurePerformance(CollectorType.InfraPerformance);

    private final CollectorType collectorType;
    PerformanceType(CollectorType collectorType) {
        this.collectorType = collectorType;
    }

    public static PerformanceType fromString(String value) {
        for (PerformanceType performanceType : values()) {
            if (performanceType.toString().equalsIgnoreCase(value)) {
                return performanceType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid PerformanceType.");
    }

    public CollectorType collectorType() {
        return collectorType;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Authentication.java
=====================================================
package com.capitalone.dashboard.model;

import com.google.common.hash.Hashing;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.nio.charset.StandardCharsets;

/**
 * This class serves as the model for storing credential used for login & Signup.
 */


@Document(collection = "authentication")
public class Authentication extends BaseModel {
    static final String HASH_PREFIX = "sha512:";

    @Indexed(unique = true)
    private String username;

    private String password;


    public Authentication(String username, String password) {
        this.username = username;
        this.password = hash(password);
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = hash(password);
    }


    static String hash(String password) {
        if (!password.startsWith(HASH_PREFIX)) {
            return HASH_PREFIX + Hashing.sha512().hashString(password, StandardCharsets.UTF_8).toString();
        }
        return password;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityType.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumerates the possible {@link CodeQuality} types.
 */
public enum CodeQualityType {
    StaticAnalysis(CollectorType.CodeQuality),
    SecurityAnalysis(CollectorType.StaticSecurityScan);

    private final CollectorType collectorType;
    CodeQualityType(CollectorType collectorType) {
        this.collectorType = collectorType;
    }

    public static CodeQualityType fromString(String value) {
        for (CodeQualityType qualityType : values()) {
            if (qualityType.toString().equalsIgnoreCase(value)) {
                return qualityType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid CodeQualityType.");
    }

    public CollectorType collectorType() {
        return collectorType;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CloudInstance.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * Represents an EC2 instance from AWS
 */
@Document(collection = "cloud_instance")
public class CloudInstance extends BaseModel{
    @Indexed
    private String instanceId;

    @Indexed
    private String accountNumber;
    private String instanceType;
    private String imageId;
    private long imageExpirationDate;
    private boolean imageApproved;
    private String instanceOwner;
    private boolean isMonitored;
    private String privateDns;
    private String privateIp;
    private String publicDns;
    private String publicIp;
    private String subnetId;
    private String virtualNetworkId;
    private int age;
    private String status;
    private boolean isStopped;
    private boolean isTagged;
    private double cpuUtilization;
    private long lastUpdatedDate;
    private List<String> securityGroups = new ArrayList<>();
    private List<NameValue> tags = new ArrayList<>();
    private double networkIn;
    private double networkOut;
    private double diskRead;
    private double diskWrite;
    private String rootDeviceName;
    private String autoScaleName;
    private String lastAction;


    public String getInstanceId() {
        return instanceId;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/MaturityModel.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "maturity_model")
public class MaturityModel {
    @Indexed
    private String profile;
    private String rules;

    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    public String getRules() {
        return rules;
    }

    public void setRules(String rules) {
        this.rules = rules;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreTypeValue.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Score Value with Type Details
 */
public class ScoreTypeValue {

  private ScoreType scoreType = ScoreType.value_percent;

  private Double scoreValue;

  //Propagate the score
  private PropagateType propagate = PropagateType.no;

  public ScoreTypeValue() {}

  public static ScoreTypeValue noScore() {
    ScoreTypeValue scoreTypeValue = new ScoreTypeValue();
    scoreTypeValue.setScoreType(ScoreType.no_score);
    return scoreTypeValue;
  }

  public static ScoreTypeValue zeroScore() {
    ScoreTypeValue scoreTypeValue = new ScoreTypeValue();
    scoreTypeValue.setScoreType(ScoreType.zero_score);
    return scoreTypeValue;
  }

  public ScoreTypeValue(Double scoreValue) {
    this.scoreValue = scoreValue;
  }

  public static ScoreTypeValue cloneScoreTypeValue(ScoreTypeValue scoreTypeValue) {
    if (null == scoreTypeValue) {
      return null;
    }
    ScoreTypeValue scoreTypeValueClone = new ScoreTypeValue();
    scoreTypeValueClone.setScoreType(scoreTypeValue.getScoreType());
    scoreTypeValueClone.setScoreValue(scoreTypeValue.getScoreValue());
    scoreTypeValueClone.setPropagate(scoreTypeValue.getPropagate());
    return scoreTypeValueClone;
  }

  public ScoreType getScoreType() {
    return scoreType;
  }

  public boolean isNoScore() {
    return scoreType == ScoreType.no_score;
  }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreComponentSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Score Settings for a Component
 */
public class ScoreComponentSettings {

  //If component is disabled, this can be set true
  private boolean disabled = false;

  //Weight for component in score (0-100)
  private int weight = 0;

  //Score Criterias for component
  private ScoreCriteria criteria;

  public static ScoreComponentSettings cloneScoreComponentSettings(ScoreComponentSettings scoreComponentSettings) {
    if (null == scoreComponentSettings) {
      return null;
    }
    ScoreComponentSettings scoreComponentSettingsClone = new ScoreComponentSettings();
    copyScoreComponentSettings(scoreComponentSettings, scoreComponentSettingsClone);
    return scoreComponentSettingsClone;
  }

  public static void copyScoreComponentSettings(ScoreComponentSettings from, ScoreComponentSettings to) {
    if (null == from || null == to) {
      return;
    }
    to.setDisabled(from.isDisabled());
    to.setWeight(from.getWeight());
    ScoreCriteria criteria = from.getCriteria();
    if (null == criteria) {
      return;
    }
    to.setCriteria(
      ScoreCriteria.cloneScoreCriteria(criteria)
    );
  }

  public boolean isDisabled() {
    return disabled;
  }

  public void setDisabled(boolean disabled) {
    this.disabled = disabled;
  }

  public int getWeight() {
    return weight;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreType.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Score Type
 */
public enum ScoreType {
  //When Type is no_score component is not considered for scoring
  no_score,
  //When Type is zero_score component component score is `0`
  zero_score,
  //When Type is value_percent component score is a defined value
  value_percent
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreThresholdSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Score Threshold Settings
 */
public class ScoreThresholdSettings {

  //Compare with these operators
  public enum ComparatorType {
    equals,
    less,
    greater,
    less_or_equal,
    greater_or_equal
  }

  //The value can be of type percent for percent of days, Or days for number of days
  public enum ValueType {
    percent,
    days
  }

  private ComparatorType comparator = ComparatorType.less_or_equal;

  private ValueType type = ValueType.percent;

  //If the threshold is met set the score
  private ScoreTypeValue score;

  //Number of days to check for while applying threshold
  private Integer numDaysToCheck;

  //Value to compare
  private Double value;

  public static ScoreThresholdSettings cloneScoreThresholdSettings(ScoreThresholdSettings scoreThresholdSettings) {
    if (null == scoreThresholdSettings) {
      return scoreThresholdSettings;
    }

    ScoreThresholdSettings scoreThresholdSettingsClone = new ScoreThresholdSettings();
    scoreThresholdSettingsClone.setComparator(scoreThresholdSettings.getComparator());
    scoreThresholdSettingsClone.setType(scoreThresholdSettings.getType());
    scoreThresholdSettingsClone.setValue(scoreThresholdSettings.getValue());
    scoreThresholdSettingsClone.setNumDaysToCheck(scoreThresholdSettings.getNumDaysToCheck());
    scoreThresholdSettingsClone.setScore(
      ScoreTypeValue.cloneScoreTypeValue(scoreThresholdSettings.getScore())
      );
    return scoreThresholdSettingsClone;
  }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteriaSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.score.ScoreValueType;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "score_criteria_settings")
public class ScoreCriteriaSettings extends BaseModel {

  //Max Score
  private int maxScore;

  //Build Score Settings
  private BuildScoreSettings build;

  //Quality Score Settings
  private QualityScoreSettings quality;

  //Deploy Score Settings
  private DeployScoreSettings deploy;

  //SCM Score Settings
  private ScmScoreSettings scm;

  //Alert Score Component Settings
  private ComponentAlert componentAlert;

  //Score can be calculated for types defined in ScoreValueType
  private ScoreValueType type = ScoreValueType.DASHBOARD;

  //Time when score was calculated
  private long timestamp;

  public int getMaxScore() {
    return maxScore;
  }

  public void setMaxScore(int maxScore) {
    this.maxScore = maxScore;
  }

  public BuildScoreSettings getBuild() {
    return build;
  }

  public void setBuild(BuildScoreSettings build) {
    this.build = build;
  }

  public QualityScoreSettings getQuality() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScmScoreSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Bean to hold score settings specific to scm
 */
public class ScmScoreSettings extends ScoreComponentSettings {

  public static final int SCM_NUM_OF_DAYS = 14;

  private ScoreComponentSettings commitsPerDay;

  private int numberOfDays = SCM_NUM_OF_DAYS;

  public static ScmScoreSettings cloneScmScoreSettings(ScmScoreSettings scmScoreSettings) {
    if (null == scmScoreSettings) {
      return null;
    }

    ScmScoreSettings scmScoreSettingsClone = new ScmScoreSettings();
    ScoreComponentSettings.copyScoreComponentSettings(scmScoreSettings, scmScoreSettingsClone);
    scmScoreSettingsClone.setNumberOfDays(
      scmScoreSettings.getNumberOfDays()
    );
    scmScoreSettingsClone.setCommitsPerDay(
      ScoreComponentSettings.cloneScoreComponentSettings(scmScoreSettings.getCommitsPerDay())
    );

    return scmScoreSettingsClone;
  }

  public int getNumberOfDays() {
    return numberOfDays;
  }

  public void setNumberOfDays(int numberOfDays) {
    this.numberOfDays = numberOfDays;
  }

  public ScoreComponentSettings getCommitsPerDay() {
    return commitsPerDay;
  }

  public void setCommitsPerDay(ScoreComponentSettings commitsPerDay) {
    this.commitsPerDay = commitsPerDay;
  }

  @Override public String toString() {
    return "ScmScoreSettings{" +
      "commitsPerDay=" + commitsPerDay +
      ", numberOfDays=" + numberOfDays +

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/QualityScoreSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Bean to hold score settings specific to quality
 */
public class QualityScoreSettings extends ScoreComponentSettings {

  //Settings for Code Coverage
  private ScoreComponentSettings codeCoverage;

  //Settings for Unit Tests
  private ScoreComponentSettings unitTests;

  //Settings for Violations
  private ViolationsScoreSettings violations;

  public static QualityScoreSettings cloneQualityScoreSettings(QualityScoreSettings qualityScoreSettings) {
    if (null == qualityScoreSettings) {
      return null;
    }

    QualityScoreSettings qualityScoreSettingsClone = new QualityScoreSettings();
    ScoreComponentSettings.copyScoreComponentSettings(qualityScoreSettings, qualityScoreSettingsClone);
    qualityScoreSettingsClone.setCodeCoverage(
      ScoreComponentSettings.cloneScoreComponentSettings(qualityScoreSettings.getCodeCoverage())
    );
    qualityScoreSettingsClone.setUnitTests(
      ScoreComponentSettings.cloneScoreComponentSettings(qualityScoreSettings.getUnitTests())
    );
    qualityScoreSettingsClone.setViolations(
      ViolationsScoreSettings.cloneViolationsScoreSettings(qualityScoreSettings.getViolations())
    );

    return qualityScoreSettingsClone;
  }


  public ScoreComponentSettings getCodeCoverage() {
    return codeCoverage;
  }

  public void setCodeCoverage(ScoreComponentSettings codeCoverage) {
    this.codeCoverage = codeCoverage;
  }

  public ScoreComponentSettings getUnitTests() {
    return unitTests;
  }

  public void setUnitTests(ScoreComponentSettings unitTests) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/BuildScoreSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Bean to hold score settings specific to build
 */
public class BuildScoreSettings extends ScoreComponentSettings {

  public static final long BUILD_DURATION_THRESHOLD_MILLIS = 300000;

  public static final int BUILD_STATUS_NUM_OF_DAYS = 14;

  //Settings for Build Threshold Duration
  private BuildDurationScoreSettings duration;

  //Settings for Build Status
  private ScoreComponentSettings status;

  //Number Of Days to calculate build score
  private int numberOfDays = BUILD_STATUS_NUM_OF_DAYS;

  public static BuildScoreSettings cloneBuildScoreSettings(BuildScoreSettings buildScoreSettings) {
    if (null == buildScoreSettings) {
      return null;
    }
    BuildScoreSettings buildScoreSettingsClone = new BuildScoreSettings();
    ScoreComponentSettings.copyScoreComponentSettings(buildScoreSettings, buildScoreSettingsClone);
    buildScoreSettingsClone.setNumberOfDays(buildScoreSettings.getNumberOfDays());
    buildScoreSettingsClone.setStatus(
      ScoreComponentSettings.cloneScoreComponentSettings(buildScoreSettings.getStatus())
    );

    buildScoreSettingsClone.setDuration(
      BuildDurationScoreSettings.cloneBuildDurationScoreSettings(buildScoreSettings.getDuration())
    );

    return buildScoreSettingsClone;
  }


  public int getNumberOfDays() {
    return numberOfDays;
  }

  public void setNumberOfDays(int numberOfDays) {
    this.numberOfDays = numberOfDays;
  }

  public BuildDurationScoreSettings getDuration() {
    return duration;
  }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/PropagateType.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

public enum PropagateType {
  no(1),
  widget(2),
  dashboard(3);

  private final int value;

  private PropagateType(int value) {
    this.value = value;
  }

  public int getValue() {
    return value;
  }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/DeployScoreSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Bean to hold score settings specific to deploy
 */
public class DeployScoreSettings extends ScoreComponentSettings {

  //Settings for Deploy Success Instances
  private ScoreComponentSettings deploySuccess;

  //Settings for Instances Online
  private ScoreComponentSettings intancesOnline;

  public static DeployScoreSettings cloneDeployScoreSettings(DeployScoreSettings deployScoreSettings) {
    if (null == deployScoreSettings) {
      return null;
    }
    DeployScoreSettings deployScoreSettingsClone = new DeployScoreSettings();
    ScoreComponentSettings.copyScoreComponentSettings(deployScoreSettings, deployScoreSettingsClone);
    deployScoreSettingsClone.setDeploySuccess(
      ScoreComponentSettings.cloneScoreComponentSettings(deployScoreSettings.getDeploySuccess())
    );
    deployScoreSettingsClone.setIntancesOnline(
      ScoreComponentSettings.cloneScoreComponentSettings(deployScoreSettings.getIntancesOnline())
    );
    return deployScoreSettingsClone;
  }

  public ScoreComponentSettings getDeploySuccess() {
    return deploySuccess;
  }

  public void setDeploySuccess(ScoreComponentSettings deploySuccess) {
    this.deploySuccess = deploySuccess;
  }

  public ScoreComponentSettings getIntancesOnline() {
    return intancesOnline;
  }

  public void setIntancesOnline(ScoreComponentSettings intancesOnline) {
    this.intancesOnline = intancesOnline;
  }

  @Override public String toString() {
    return "DeployScoreSettings{" +
      "deploySuccess=" + deploySuccess +
      ", intancesOnline=" + intancesOnline +
      ", disabled=" + isDisabled() +
      ", weight=" + getWeight() +

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ComponentAlert.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Alert Settings for Scoring component
 */
public class ComponentAlert {

  private ScoreThresholdSettings.ComparatorType comparator = ScoreThresholdSettings.ComparatorType.less_or_equal;

  //Value to compare
  private Double value;

  public static ComponentAlert cloneComponentAlert(ComponentAlert componentAlert) {
    if (null == componentAlert) {
      return null;
    }

    ComponentAlert componentAlertClone = new ComponentAlert();
    componentAlertClone.setComparator(componentAlert.getComparator());
    componentAlertClone.setValue(componentAlert.getValue());
    return componentAlertClone;
  }

  public ScoreThresholdSettings.ComparatorType getComparator() {
    return comparator;
  }

  public void setComparator(ScoreThresholdSettings.ComparatorType comparator) {
    this.comparator = comparator;
  }

  public Double getValue() {
    return value;
  }

  public void setValue(Double value) {
    this.value = value;
  }

  @Override public String toString() {
    return "WidgetAlert{" +
      "comparator=" + comparator +
      ", value=" + value +
      '}';
  }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteria.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Score Criteria
 * Criteria Conditions
 * - No Widget Found
 * - No Data Found in Widget
 * Threshold Settings for data
 */
public class ScoreCriteria {

  //Score when no widget is found
  private ScoreTypeValue noWidgetFound;

  //Score when no data is found in widget
  private ScoreTypeValue noDataFound;

  //List of threshold conditions
  private List<ScoreThresholdSettings> dataRangeThresholds;

  public static ScoreCriteria cloneScoreCriteria(ScoreCriteria scoreCriteria) {
    if (null == scoreCriteria) {
      return null;
    }

    ScoreCriteria scoreCriteriaClone = new ScoreCriteria();

    scoreCriteriaClone.setNoDataFound(
      ScoreTypeValue.cloneScoreTypeValue(scoreCriteria.getNoDataFound())
    );
    scoreCriteriaClone.setNoWidgetFound(
      ScoreTypeValue.cloneScoreTypeValue(scoreCriteria.getNoWidgetFound())
    );

    List<ScoreThresholdSettings> dataRangeThresholds = scoreCriteria.getDataRangeThresholds();
    if (CollectionUtils.isEmpty(dataRangeThresholds)) {
      return scoreCriteriaClone;
    }

    List<ScoreThresholdSettings> dataRangeThresholdsClone = new ArrayList<>();
    for (ScoreThresholdSettings dataRangeThreshold : dataRangeThresholds) {
      dataRangeThresholdsClone.add(
        ScoreThresholdSettings.cloneScoreThresholdSettings(dataRangeThreshold)
      );
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreCollectorItem.java
=====================================================
package com.capitalone.dashboard.model.score;

import com.capitalone.dashboard.model.CollectorItem;
import org.bson.types.ObjectId;

public class ScoreCollectorItem extends CollectorItem {

  private static final String DASHBOARD_ID = "dashboardId";

  public ObjectId getDashboardId() {
    return (ObjectId) getOptions().get(DASHBOARD_ID);
  }

  public void setDashboardId(ObjectId dashboardId) {
    getOptions().put(DASHBOARD_ID, dashboardId);
  }

  @Override
  public boolean equals(Object o) {
    if (this == o)
      return true;
    if (o == null || getClass() != o.getClass())
      return false;
    ScoreCollectorItem that = (ScoreCollectorItem) o;
    return getDashboardId().equals(that.getDashboardId());
  }

  @Override
  public int hashCode() {
    int result = getDashboardId().hashCode();
    return result;
  }


}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreValueType.java
=====================================================
package com.capitalone.dashboard.model.score;

/*
  Score Type for calculating scores
 */
public enum ScoreValueType {
  DASHBOARD;

  public static ScoreValueType fromString(String value) {
    for (ScoreValueType scoreValueType : values()) {
      if (scoreValueType.toString().equalsIgnoreCase(value)) {
        return scoreValueType;
      }
    }
    throw new IllegalArgumentException(value + " is not a valid ScoreValueType.");
  }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetric.java
=====================================================
package com.capitalone.dashboard.model.score;

import java.util.List;

/*
  Score for a component like widget
 */
public class ScoreComponentMetric extends ScoreComponentMetricBase {
  //Individual components within a component, with scores for them
  private List<ScoreComponentMetricBase> children;

  public List<ScoreComponentMetricBase> getChildren() {
    return children;
  }

  public void setChildren(List<ScoreComponentMetricBase> children) {
    this.children = children;
  }

  @Override public String toString() {
    return "ScoreComponentMetric{" +
      "score='" + getScore() + '\'' +
      ", total='" + getTotal() + '\'' +
      ", weight='" + getWeight() + '\'' +
      ", refId='" + getRefId() + '\'' +
      ", displayId='" + getDisplayId() + '\'' +
      ", displayName='" + getDisplayName() + '\'' +
      ", message='" + getMessage() + '\'' +
      ", propagate='" + getPropagate() + '\'' +
      ", state='" + getState() + '\'' +
      ", noScore=" + isNoScore() +
      ", children=" + children + '\'' +
      ", options=" + getOptions() + '\'' +
      ", alert='" + isAlert() +
      '}';
  }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetricBase.java
=====================================================
package com.capitalone.dashboard.model.score;

import com.google.common.collect.Maps;
import org.bson.types.ObjectId;

import java.util.Map;

public class ScoreComponentMetricBase {
  //Score for the widget/component
  private String score;

  //Score total
  private String total;

  //Weight in percent for a widget/component
  private String weight;

  //Reference Id. When score is for type Dashboard, value is Widget Id
  private ObjectId refId;

  //Unique display id for widget/component
  private String displayId;

  //Display name for the widget/component
  private String displayName;

  //Propagate type value for widget/component
  private String propagate;

  //Status of score calculation
  private String state;

  //If widget/component has no score, flag is true
  private boolean noScore;

  //Alert is true if there is message to alert
  private boolean alert = false;

  //Message to display
  private String message;

  //Additional options to save data
  public Map<String, Object> options = Maps.newHashMap();

  public Map<String, Object> getOptions() {
    return options;
  }

  public String getScore() {
    return score;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/score/ScoreMetric.java
=====================================================
package com.capitalone.dashboard.model.score;

import com.capitalone.dashboard.model.BaseModel;
import com.google.common.collect.Maps;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Collection;
import java.util.Map;

/*
  Collection for scores based on type dashboard/team
 */
@Document(collection = "score_metric")
public class ScoreMetric extends BaseModel {
  //Collector Item Id for score
  private ObjectId collectorItemId;

  //Id for score type as Dashboard/Team
  //If type is DASHBOARD, value should be id of dashboard
  private ObjectId scoreTypeId;

  //Score can be calculated for types defined in ScoreValueType
  private ScoreValueType type = ScoreValueType.DASHBOARD;

  //Time when score was calculated
  private long timestamp;

  //Score value
  private String score;

  //Score total
  private String total;

  //Failure message
  private String failureMssg;

  //If the dashboard has no score, the flag is set as true
  private boolean noScore;

  //Options to save additional properties
  public Map<String, String> options = Maps.newHashMap();

  //Collection of scores for individual components (widgets for dashboard score)
  private Collection<ScoreComponentMetric> componentMetrics;

  public Map<String, String> getOptions() {
    return options;
  }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/UserInfo.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.Collection;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import com.google.common.collect.Sets;

@Document(collection="user_info")
@CompoundIndexes({
    @CompoundIndex(name = "username_authType", def = "{'username' : 1, 'authType': 1}")
})
public class UserInfo {
	
	@Id
	private ObjectId id;
	private String username;
	private Collection<UserRole> authorities;
	private AuthType authType;
	private String firstName;
	private String middleName;
	private String lastName;
	private String displayName;
	private String emailAddress;
	
	public UserInfo() {
	    authorities = Sets.newHashSet();
	}
	
	public ObjectId getId() {
		return id;
	}
	
	public void setId(ObjectId id) {
		this.id = id;
	}
	
	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	
	public Collection<UserRole> getAuthorities() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/PolicyScanMetric.java
=====================================================
package com.capitalone.dashboard.model;

public class PolicyScanMetric {
	
	private Integer policycriticalCount;
    private Integer policysevereCount;
	private Integer polimoderateCount;
	private Integer policyAffectedCount;
	
	public Integer getPolicyAffectedCount() {
		return policyAffectedCount;
	}
	public void setPolicyAffectedCount(Integer policyAffectedCount) {
		this.policyAffectedCount = policyAffectedCount;
	}
	public Integer getPolicycriticalCount() {
		return policycriticalCount;
	}
	public void setPolicycriticalCount(Integer policycriticalCount) {
		this.policycriticalCount = policycriticalCount;
	}
	public Integer getPolicysevereCount() {
		return policysevereCount;
	}
	public void setPolicysevereCount(Integer policysevereCount) {
		this.policysevereCount = policysevereCount;
	}
	public Integer getPolimoderateCount() {
		return polimoderateCount;
	}
	public void setPolimoderateCount(Integer polimoderateCount) {
		this.polimoderateCount = polimoderateCount;
	}

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Cmdb.java
=====================================================
package com.capitalone.dashboard.model;


import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;

@Document(collection="cmdb")
public class Cmdb extends BaseModel{

    private ObjectId collectorItemId;
    private long timestamp;

    /**
     * configurationItem unique system generated id
     */
    @NotNull
    private String configurationItem;
    /**
     * configurationItemSubType SubType of the CI
     */
    private String configurationItemSubType;
    /**
     * configurationItemType Type of the CI
     */
    private String configurationItemType;
    private String assignmentGroup;
    /**
     * A owner assigned to the CI usually the id associated with the owner when provided
     */
    private String appServiceOwner;
    /**
     * A owner assigned to the CI usually the id associated with the owner when provided
     */
    private String businessOwner;
    /**
     * A owner assigned to the CI usually the id associated with the owner when provided
     */
    private String supportOwner;
    /**
     * A owner assigned to the CI usually the id associated with the owner when provided
     */
    private String developmentOwner;
    /**
     * A owner assigned to the CI usually the fullName of the owner when provided
     */
    private String appServiceOwnerUserName;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Comment.java
=====================================================
package com.capitalone.dashboard.model;

public class Comment {
    private String user;
    private String userLDAPDN;
    private long createdAt;
    private long updatedAt;
    private String body;
    private String status;

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getUserLDAPDN() {
        return userLDAPDN;
    }

    public void setUserLDAPDN(String userLDAPDN) {
        this.userLDAPDN = userLDAPDN;
    }

    public long getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(long createdAt) {
        this.createdAt = createdAt;
    }

    public long getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(long updatedAt) {
        this.updatedAt = updatedAt;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentComponent.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents deployable units (components) deployed to an environment.
 */
@Document(collection = "environment_components")
public class EnvironmentComponent extends BaseModel {
    /**
     * Deploy collectorItemId
     */
    private ObjectId collectorItemId;
    private String environmentID;
    private String environmentName;
    private String environmentUrl;
    private String componentID;
	private String componentName;
    private String componentVersion;
    private String jobUrl;
    private boolean deployed;
    private long deployTime;
    private long asOfDate;


	
    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }
    
    public String getEnvironmentID() {
    	return environmentID;
    }
    
    public void setEnvironmentID(String environmentID) {
    	this.environmentID = environmentID;
    }

    public String getEnvironmentName() {
        return environmentName;
    }

    public void setEnvironmentName(String environmentName) {
        this.environmentName = environmentName;
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Service.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashSet;
import java.util.Set;

/**
 * A product or service offered by an Application.
 */
@Document(collection="services")
public class Service extends BaseModel {
    private String name;
    private String url;
    private String applicationName;
    private ObjectId dashboardId;
    private ServiceStatus status;
    private String message;
    private long lastUpdated;
    private Set<ObjectId> dependedBy = new HashSet<>();

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public ObjectId getDashboardId() {
        return dashboardId;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CloudInstanceHistory.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents an EC2 instance from AWS
 */
@Document(collection = "cloud_instance_history")
public class CloudInstanceHistory extends BaseModel{
    @Indexed
    private String accountNumber;
    @Indexed
    private long time;
    private int total;
    private int nonTagged;
    private int stopped;
    private int expiredImage;
    private double estimatedCharge;
    private double cpu;
    private double diskRead;
    private double diskWrite;
    private double networkIn;
    private double networkOut;
    private String currency = "USD";

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Monitor2.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

/*
Represents the getters and setters for the Aws Server Status object.
 */
@Document(collection = "monitor2")
public class Monitor2 extends BaseModel {
    private String name;
    private String url;
    private int status;
    private ObjectId dashboardId;
    private long lastUpdated;
    private String applicationName;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() { return this.url; }

    public void setUrl(String url) { this.url = url; }

    public int getStatus() { return this.status; }

    public void setStatus(int status) { this.status = status; }

    public ObjectId getDashboardId() {
        return dashboardId;
    }

    public void setDashboardId(ObjectId dashboardId) {
        this.dashboardId = dashboardId;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public long getLastUpdated() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ConfigHistOperationType.java
=====================================================
package com.capitalone.dashboard.model;

public enum ConfigHistOperationType {
    CREATED,
    CHANGED,
    RENAMED,
    DELETED;

    public static ConfigHistOperationType fromString(String value) {
        for (ConfigHistOperationType opType : values()) {
            if (opType.toString().equalsIgnoreCase(value)) {
                return opType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid operation Type");
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/SprintEstimate.java
=====================================================
package com.capitalone.dashboard.model;

public class SprintEstimate {
	private int openEstimate;
	private int inProgressEstimate;
	private int completeEstimate;
	private int totalEstimate;
	/**
	 * @return the openEstimate
	 */
	public int getOpenEstimate() {
		return openEstimate;
	}
	/**
	 * @param openEstimate the openEstimate to set
	 */
	public void setOpenEstimate(int openEstimate) {
		this.openEstimate = openEstimate;
	}
	/**
	 * @return the inProgressEstimate
	 */
	public int getInProgressEstimate() {
		return inProgressEstimate;
	}
	/**
	 * @param inProgressEstimate the inProgressEstimate to set
	 */
	public void setInProgressEstimate(int inProgressEstimate) {
		this.inProgressEstimate = inProgressEstimate;
	}
	/**
	 * @return the completeEstimate
	 */
	public int getCompleteEstimate() {
		return completeEstimate;
	}
	/**
	 * @param completeEstimate the completeEstimate to set
	 */
	public void setCompleteEstimate(int completeEstimate) {
		this.completeEstimate = completeEstimate;
	}
	/**
	 * @return the totalEstimate
	 */
	public int getTotalEstimate() {
		return totalEstimate;
	}
	/**

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CommitStatus.java
=====================================================
package com.capitalone.dashboard.model;

public class CommitStatus {
    private String state;
    private String context;
    private String author;
    private String authorLDAPDN;
    private String description;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getAuthorLDAPDN() {
        return authorLDAPDN;
    }

    public void setAuthorLDAPDN(String authorLDAPDN) {
        this.authorLDAPDN = authorLDAPDN;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ServiceStatus.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Denotes the status of a product or service
 */
public enum ServiceStatus {
    Ok(200, 200),
    Warning(300, 400),
    Unauth(401, 401),
    Alert(0, 999);

	private int low;
	private int high;
	
	private ServiceStatus(int low, int high) {
		this.low = low;
		this.high = high;
	}
	
	public static ServiceStatus fromString(String value) {
        for(ServiceStatus status : ServiceStatus.values()) {
            if (status.toString().equalsIgnoreCase(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid ServiceStatus.");
    }
	
	public static ServiceStatus getServiceStatus(int statusCode) {
		for(ServiceStatus status : ServiceStatus.values()) {
			if(status.low <= statusCode && status.high >= statusCode) {
				return status;
			}
		}
		
		return Alert;
	}

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CloudSubNetwork.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@Document(collection = "cloud_subnetwork")
public class CloudSubNetwork extends BaseModel{
    @Indexed
    private String subnetId;
    private String accountNumber;
    private String virtualNetworkId;
    private String cidrBlock;
    private int cidrCount;
    private String zone;
    private int availableIPCount;
    private int subscribedIPCount;
    private int usedIPCount;
    private boolean defaultForZone;
    private String state;
    private long creationDate;
    private long lastUpdateDate;
    private List<NameValue> tags = new ArrayList<>();
    private Map<String, Integer> ipUsage;
    private Map<String, Integer> subscribedIPUsage;


    public Map<String, Integer> getIpUsage() {
        return ipUsage;
    }

    public void setIpUsage(Map<String, Integer> ipUsage) {
        this.ipUsage = ipUsage;
    }

    public String getSubnetId() {
        return subnetId;
    }

    public void setSubnetId(String subnetId) {
        this.subnetId = subnetId;
    }

    public String getVirtualNetworkId() {
        return virtualNetworkId;
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CloudVolumeStorage.java
=====================================================
package com.capitalone.dashboard.model;


import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

@Document(collection = "cloud_volume")
public class CloudVolumeStorage extends BaseModel{
    @Indexed
    private String volumeId;

    @Indexed
    private String accountNumber;
    private String status;
    private long creationDate;
    private int size;
    private List<NameValue> tags = new ArrayList<>();
    private boolean encrypted;
    private String type;
    private String zone;
    private List<String> attachInstances = new ArrayList<>();


    public String getVolumeId() {
        return volumeId;
    }

    public void setVolumeId(String volumeId) {
        this.volumeId = volumeId;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Owner.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class Owner {

	private String username;
	private AuthType authType;
	
	public Owner() {}
	
	public Owner(String username, AuthType authType) {
		this.username = username;
		this.authType = authType;
	}

	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	
	public AuthType getAuthType() {
		return authType;
	}
	
	public void setAuthType(AuthType authType) {
		this.authType = authType;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj == this) {
			return true;
		}
		if (obj.getClass() != getClass()) {
			return false;
		}
		
		Owner rhs = (Owner) obj;
		
		return new EqualsBuilder().append(username, rhs.username).append(authType, rhs.authType).isEquals();
	}


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/AuditType.java
=====================================================
package com.capitalone.dashboard.model;

public enum AuditType {

    ALL,
    CODE_REVIEW,
    BUILD_REVIEW,
    CODE_QUALITY,
    STATIC_SECURITY_ANALYSIS,
    LIBRARY_POLICY,
    TEST_RESULT,
    PERF_TEST,
    ARTIFACT;


    public static AuditType fromString(String value) {
        for (AuditType auditType : values()) {
            if (auditType.toString().equalsIgnoreCase(value)) {
                return auditType;
            }
        }
        throw new IllegalArgumentException(value + " is not a Audit Type");
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/EnvironmentStatus.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents the status (online/offline) of a server for a given component and environment.
 */
@Document(collection = "environment_status")
public class EnvironmentStatus extends BaseModel {
    private ObjectId collectorItemId;
    private String componentID;
	private String environmentName;
    private String componentName;
    private String resourceName;
    private String parentAgentName;
    private boolean online;

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public String getComponentID() {
		return componentID;
	}

	public void setComponentID(String componentID) {
		this.componentID = componentID;
	}
	
    public String getEnvironmentName() {
        return environmentName;
    }

    public void setEnvironmentName(String environmentName) {
        this.environmentName = environmentName;
    }

    public String getComponentName() {
        return componentName;
    }

    public void setComponentName(String componentName) {
        this.componentName = componentName;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestCaseCondition.java
=====================================================
package com.capitalone.dashboard.model;

public class TestCaseCondition {
    private String condition;
    private TestCaseConditionResult result;


    public String getCondition() {
        return condition;
    }

    public void setCondition(String condition) {
        this.condition = condition;
    }

    public TestCaseConditionResult getResult() {
        return result;
    }

    public void setResult(TestCaseStatus status, long duration) {
        TestCaseConditionResult result = new TestCaseConditionResult();
        result.setDuration(duration);
        result.setStatus(status);
        this.result = result;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CollectorType.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumerates the possible {@link Collector} types.
 */
public enum CollectorType {
    SCM,
    CMDB,
    Incident,
    Build,
    Artifact,
    Deployment,
    AgileTool,
    @Deprecated
    Feature,
    TestResult,
    @Deprecated
    ScopeOwner,
    @Deprecated
    Scope,
    CodeQuality,
    Test,
    StaticSecurityScan,
    LibraryPolicy,
    ChatOps,
    Cloud,
    Product,
    AppPerformance,
    InfraPerformance,
    Score,
    TEAM,
    Audit;

    public static CollectorType fromString(String value) {
        for (CollectorType collectorType : values()) {
            if (collectorType.toString().equalsIgnoreCase(value)) {
                return collectorType;
            }
        }
        throw new IllegalArgumentException(value + " is not a CollectorType");
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ApiToken.java
=====================================================
package com.capitalone.dashboard.model;

import com.google.common.hash.Hashing;
import org.springframework.data.mongodb.core.mapping.Document;

import java.nio.charset.StandardCharsets;

@Document(collection="apitoken")
public class ApiToken extends BaseModel {

    static final String HASH_PREFIX = "sha512:";
    private String apiUser;
    private String apiKey;
    private Long expirationDt;

    public ApiToken(String apiUser, String apiKey, Long expirationDt) {
        this.apiUser = apiUser;
        this.apiKey = hash(apiKey);
        this.expirationDt = expirationDt;
    }

    public String getApiUser() {
        return apiUser;
    }

    public void setApiUser(String apiUser) {
        this.apiUser = apiUser;
    }

    public String getApiKey() {
        return apiKey;
    }

    public void setApiKey(String apiKey) {
        this.apiKey = hash(apiKey);
    }

    public Long getExpirationDt() {
        return expirationDt;
    }

    public void setExpirationDt(Long expirationDt) {
        this.expirationDt = expirationDt;
    }

    static String hash(String apiKey) {
        if (!apiKey.startsWith(HASH_PREFIX)) {
            return HASH_PREFIX + Hashing.sha512().hashString(apiKey, StandardCharsets.UTF_8).toString();
        }
        return apiKey;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/AuthType.java
=====================================================
package com.capitalone.dashboard.model;

public enum AuthType {

	STANDARD,
	LDAP,
	APIKEY;
	
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Template.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

/**
 * A collection of templates represent a software
 * project under development and/or in production use.
 */
@Document(collection = "templates")
public class Template extends BaseModel {
    @Indexed(unique = true)
    private String template;

    private List<String> widgets = new ArrayList<>();

    private List<String> order = new ArrayList<>();

    public Template(String template, List<String> widgets, List<String> order) {
        this.template = template;
        this.widgets = widgets;
        this.order = order;
    }

    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    public List<String> getWidgets() {
        return widgets;
    }

    public void setWidgets(List<String> widgets) {
        this.widgets = widgets;
    }

    public List<String> getOrder() {
        return order;
    }

    public void setOrder(List<String> order) {
        this.order = order;
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CommitType.java
=====================================================
package com.capitalone.dashboard.model;

public enum CommitType {
    NotBuilt, //maven release commits that are not built
    Merge, //github merge commits that dont show up in build change set
    New;

    public static CommitType fromString(String value) {
        for (CommitType commitType : values()) {
            if (commitType.toString().equalsIgnoreCase(value)) {
                return commitType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid Commit Type");
    }
}



=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Incident.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Objects;

@Document(collection="incident")
public class Incident extends BaseModel {

    private ObjectId collectorItemId;
    private Long timestamp;
    private String incidentItem;
    private String incidentID;
    private String category;
    private Long openTime;
    private String openedBy;
    private String severity;
    private Long updatedTime;
    private String primaryAssignmentGroup;
    private String status;
    private Long closedTime;
    private String closedBy;
    private String closureCode;
    private String affectedItem;
    private String incidentDescription;
    private String incidentSysID;
    private String affectedItemType;
    private String affectedItemSysId;
    private String affectedBusinessServiceItem;
    private String affectedBusinessServiceItemType;
    private String affectedBusinessServiceItemSysId;
    private boolean attachedToBusinessServiceOrEnvironmentOnly;

    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ");

    public ObjectId getCollectorItemId() { return collectorItemId; }

    public void setCollectorItemId(ObjectId collectorItemId) { this.collectorItemId = collectorItemId; }

    public long getTimestamp() { return timestamp; }

    public void setTimestamp(long timestamp) { this.timestamp = timestamp; }

    public void setTimestamp(String timestamp) { this.timestamp = DATE_FORMATTER.parseMillis(timestamp); }

    public String getIncidentItem() { return incidentItem; }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/BinaryArtifact.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Binary artifacts produced by build jobs and stored in an artifact repository.
 *
 * Possible collectors:
 *  Nexus (in scope)
 *  Artifactory
 *  npm
 *  nuget
 *  rubygems
 *
 */
@Document(collection = "artifacts")
public class BinaryArtifact extends BaseModel {
	
	// list of known metadata properties
	// Note: these may be hard coded in other modules and external tools
	private static final String METADATA_BUILD_URL = "buildUrl";
	private static final String METADATA_BUILD_NUMBER = "buildNumber";
	private static final String METADATA_JOB_URL = "jobUrl";
	private static final String METADATA_JOB_NAME = "jobName";
	private static final String METADATA_INSTANCE_URL = "instanceUrl";
	
	private static final String METADATA_SCM_URL = "scmUrl";
	private static final String METADATA_SCM_BRANCH = "scmBranch";
	private static final String METADATA_SCM_REVISION_NUMBER = "scmRevisionNumber";
	
    /**
     * CollectorItemId for the {@link Build} that produced the artifact
     */
    private ObjectId collectorItemId;
    private long timestamp;

    private String canonicalName;
    private String artifactGroupId;
    private String artifactModule;
    private String artifactVersion;
    private String artifactName;
    private String artifactClassifier;
    private String artifactExtension;
    private String type;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/SCM.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.List;
import java.util.Objects;

/**
 * Base class to represent the details of a change in a source code management
 * system.
 */
public class SCM {
    protected String scmUrl;
    protected String scmBranch; // For SCM that don't have branch in the url
	protected String scmRevisionNumber;
    protected String scmCommitLog;
    protected String scmAuthor;
    protected String scmAuthorLogin;
    protected String scmAuthorLDAPDN;
    protected String scmCommitter;
    protected String scmCommitterLogin;
    protected List<String> scmParentRevisionNumbers;
    protected long scmCommitTimestamp;
    protected long numberOfChanges;
    protected CommitType type;
    protected String pullNumber;
    protected List<String> filesAdded;
    protected List<String> filesRemoved;
    protected List<String> filesModified;

    public SCM(){

    }
    
    public SCM(SCM scm) {
        this.scmUrl = scm.scmUrl;
        this.scmBranch = scm.scmBranch;
        this.scmRevisionNumber = scm.scmRevisionNumber;
        this.scmCommitLog = scm.scmCommitLog;
        this.scmAuthor = scm.scmAuthor;
        this.scmAuthorLogin = scm.scmAuthorLogin;
        this.scmParentRevisionNumbers = scm.scmParentRevisionNumbers;
        this.scmCommitTimestamp = scm.scmCommitTimestamp;
        this.numberOfChanges = scm.numberOfChanges;
        this.type = scm.type;
        this.filesAdded = scm.filesAdded;
        this.filesRemoved = scm.filesRemoved;
        this.filesModified = scm.filesModified;
    }

    @SuppressWarnings({"PMD.ExcessiveParameterList"})
    public SCM(String scmUrl, String scmBranch, String scmRevisionNumber, String scmCommitLog, String scmAuthor, String scmAuthorLogin, List<String> scmParentRevisionNumbers, long scmCommitTimestamp, long numberOfChanges, CommitType type) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestCapability.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.Collection;

public class TestCapability {

    /**
     * Creation timestamp
     */
    private long timestamp;

    /**
     * Identifies this test result in the source system
     */
    private String executionId;

    /**
     * Description of the test result that might make sense to a human
     */
    private String description;

    /**
     * Optional URL to test results
     */
    private String url;

    /**
     * Start test execution time {@link java.util.Date#getTime()}
     */
    private long startTime;

    /**
     * End test execution time {@link java.util.Date#getTime()}
     */
    private long endTime;

    /**
     * Test duration in milliseconds
     */
    private long duration;

    /**
     * Count of test cases that failed in all test suites
     */
    private int failedTestSuiteCount;

    /**
     * Count of test cases that generated an error in all test suites
     */

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/KeyValueLog.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

public class KeyValueLog {
    
    private static final char SEPERATOR = ' ';
    private static final char EQUALS = '=';
    private static final char QUOTE = '"';
    
    private StringBuilder builder = new StringBuilder();
    
    private Map<String, Object> attributes = new LinkedHashMap<>();
    
    public KeyValueLog with(String key, Object value) {
        attributes.put(key, value);
        return this;
    }
    
    @Override
    public String toString() {
        
        Set<String> keySet = attributes.keySet();
        for(String key : keySet) {
            builder.append(key).append(EQUALS).append(QUOTE).append(attributes.get(key)).append(QUOTE).append(SEPERATOR);
        }
        
        return builder.toString().trim();
    }

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CollectionError.java
=====================================================
package com.capitalone.dashboard.model;


public class CollectionError {

    private String errorCode;
    private String errorMessage;
    private long timestamp;

    public static final String UNKNOWN_HOST = "Unreachable";

    public CollectionError(String errorCode, String errorMessage) {
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
        this.timestamp = System.currentTimeMillis();
    }

    public String getErrorCode() {
        return errorCode;
    }


    public String getErrorMessage() {
        return errorMessage;
    }


    public long getTimestamp() {
        return timestamp;
    }

}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/RallyFeature.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents the rally metrics data for a particular iteration with remaining days calculated 
 * by start date and end date.
 */
@Document(collection = "rally_feature")
public class RallyFeature extends BaseModel {
	private long timestamp;
	private Object endDate;
	private int remainingDays;
	private Object startDate;
	private long lastUpdated;

	private ObjectId collectorItemId;
	private String plannedVelocity;
	private String state;
	private String taskActualTotal;
	private String taskEstimateTotal;
	private String taskRemainingTotal;
	private String projectId;
	private String projectName;
	private String planEstimate;
	private static final String INSTANCE_URL = "instanceUrl";
	private static final String ITERATION_NAME = "iterationName";
	private static final String ITERATION_ID = "iterationId";
	private String userListCount;
	private String lastExecuted;
	private Map<String, Object> options = new HashMap<>();

	private Set<RallyStoryStages> storyStages = new HashSet<>();
	
	public Object getStartDate() {
		return startDate;
	}

	public void setStartDate(Object startDate) {
		this.startDate = startDate;
	}

	public int getRemainingDays() {
		return remainingDays;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/Widget.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;

import java.util.HashMap;
import java.util.Map;

/**
 * Represents a widget on the dashboard. Each widget is associated with a specific component. The id, name and options
 * should be provided by the UI.
 */
public class Widget {
    private ObjectId id;
    private String name;
    private ObjectId componentId;
    private Map<String,Object> options = new HashMap<>();

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ObjectId getComponentId() {
        return componentId;
    }

    public void setComponentId(ObjectId componentId) {
        this.componentId = componentId;
    }

    public Map<String, Object> getOptions() {
        return options;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestResult.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Collection;

/**
 * Represents a collection of test suites that have been executed. This may include
 * a unit test run, a security scan, static analysis, functional tests,
 * manual acceptance tests or bug reports.
 *
 * Possible Collectors:
 *  Hudson (in scope)
 *  ALM
 *  Various build system test results
 *
 */
@Document(collection="test_results")
@CompoundIndexes({
        @CompoundIndex(name = "test_results_collItemId_ts_idx", def = "{'collectorItemId' : 1, 'timestamp': -1}")
})
public class TestResult extends BaseModel {
    /**
     * ID of {@link CollectorItem}
     */
    private ObjectId collectorItemId;

    /**
     * Creation timestamp
     */
    private long timestamp;

    /**
     * Identifies this test result in the source system
     */
    private String executionId;

    //Object ID of the build event - if say build happens via Jenkins
    private ObjectId buildId;
    /**
     * Description of the test result that might make sense to a human
     */
    private String description;

    /**
     * Optional URL to test results

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TeamInventory.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;


@Document(collection="teamInventory")
public class TeamInventory extends BaseModel {
    private ObjectId collectorId;
    private ObjectId collectorItemId;
    @Indexed
    private String teamId;
    private String name;
     private String lob;
    private List<TeamMember> teamMembers;
     private long timestamp;

    @Transient
    private Collector collector;

    public Collector getCollector() {
        return collector;
    }

    public void setCollector(Collector collector) {
        this.collector = collector;
    }

    public TeamInventory(String teamId, String name) {
        this.teamId = (teamId != null ? teamId.trim() : "");
        this.name = (name != null ? name.trim() : "");
    }

    public ObjectId getCollectorId() {
        return collectorId;
    }

    public void setCollectorId(ObjectId collectorId) {
        this.collectorId = collectorId;
    }

    public String getTeamId() {
        return teamId;
    }

    public void setTeamId(String teamId) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/CodeQualityMetric.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Represents a {@link CodeQuality} metric. Each metric should have a unique name property.
 */
public class CodeQualityMetric {
    private String name;
    private String value;
    private String formattedValue;
    private CodeQualityMetricStatus status;
    private String statusMessage;

    public CodeQualityMetric(String name) {
        this.name = name;
    }

    public CodeQualityMetric() {}

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String getValue() { return value; }

    public void setValue(String value) { this.value = value; }

    public String getFormattedValue() {
        return formattedValue;
    }

    public void setFormattedValue(String formattedValue) {
        this.formattedValue = formattedValue;
    }

    public CodeQualityMetricStatus getStatus() {
        return status;
    }

    public void setStatus(CodeQualityMetricStatus status) {
        this.status = status;
    }

    public String getStatusMessage() {
        return statusMessage;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ScopeOwnerCollectorItem.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.data.mongodb.core.index.Indexed;

/**
 * Collector implementation for Feature that stores system configuration
 * settings required for source system data connection (e.g., API tokens, etc.)
 *
 * @author KFK884
 */
public class ScopeOwnerCollectorItem extends CollectorItem {
	@Indexed
	private static final String TEAM_ID = "teamId";
	@Indexed
	private static final String PROJECT_ID = "projectId";
	private static final String CHANGE_DATE = "changeDate";
	private static final String ASSET_STATE = "assetState";
	private static final String IS_DELETED = "isDeleted";

	public String getTeamId() {
		return (String) getOptions().get(TEAM_ID);
	}

	public void setTeamId(String teamId) {
		getOptions().put(TEAM_ID, teamId);
	}

	public String getProjectId() {
		return (String) getOptions().get(PROJECT_ID);
	}

	public void setProjectId(String projectId) {
		getOptions().put(PROJECT_ID, projectId);
	}

	public String getName() {
		return getDescription();
	}

	public void setName(String name) {
		setDescription(name);
	}

	public String getChangeDate() {
		return (String) getOptions().get(CHANGE_DATE);
	}

	public void setChangeDate(String changeDate) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestCase.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
 * An individual test case in a {@link TestSuite}.
 */
public class TestCase {
    /**
     * Identifies this test case in the source system
     */
    private String id;

    /**
     * Description of the test case that might make sense to a human
     */
    private String description;

    private long duration;

    private int totalTestStepCount;
    /**
     * Count of test cases that failed
     */
    private int failedTestStepCount;

    /**
     * Count of test cases that generated an error
     */
    private int successTestStepCount;

    /**
     * Count of test cases that were skipped
     */
    private int skippedTestStepCount;

    private int unknownStatusTestStepCount;
    /**
     * Status of the test case
     */
    private TestCaseStatus status = TestCaseStatus.Unknown;

    private Collection<TestCaseStep> testSteps = new ArrayList<>();

    private Set<String> tags = new HashSet<>();

    /**

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatDisposition.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.Arrays;

public enum LibraryPolicyThreatDisposition {
    Open,
    Closed,
    FalsePositive,
    WillNotFix,
    NotUsed,
    Challenged,
    ReviewRequested,
    Unknown;

    public static LibraryPolicyThreatDisposition fromString(String value) {
        return Arrays.stream(values())
                .filter(disposition -> disposition.toString()
                        .equalsIgnoreCase(value))
                .findFirst().orElse(Unknown);
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/ArtifactIdentifier.java
=====================================================
package com.capitalone.dashboard.model;

@SuppressWarnings("PMD.NPathComplexity")
public class ArtifactIdentifier {
	private final String group;
	private final String name;
	private final String version;
	private final String classifier;
	private final String extension;
	
	public ArtifactIdentifier(String group, String name, String version, String classifier, String extension) {
		super();
		this.group = group;
		this.name = name;
		this.version = version;
		this.classifier = classifier;
		this.extension = extension;
	}

	/**
	 * @return the group
	 */
	public String getGroup() {
		return group;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the version
	 */
	public String getVersion() {
		return version;
	}

	/**
	 * @return the classifier
	 */
	public String getClassifier() {
		return classifier;
	}

	/**
	 * @return the extension
	 */

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/FeatureStatus.java
=====================================================
package com.capitalone.dashboard.model;

public enum FeatureStatus {
	BACKLOG("Backlog"), GROOMING("Grooming"), WAITING("Waiting"), IN_PROGRESS("In Progress"), IMPEDED(
			"Impeded"), DONE("Done"), ACCEPTED("Accepted");

	private String status;

	FeatureStatus(String status) {
		this.status = status;
	}

	public String getStatus() {
		return this.status;
	}

	@Override
	public String toString() {
		return this.status;
	}
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/package-info.java
=====================================================
package com.capitalone.dashboard.model;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/NameValueCount.java
=====================================================
package com.capitalone.dashboard.model;

public class NameValueCount {
    private NameValue keyValue;
    private int count;

    public NameValueCount(NameValue keyValue, int count) {
        this.keyValue = keyValue;
        this.count = count;
    }

    public NameValue getKeyValue() {
        return keyValue;
    }

    public void setKeyValue(NameValue keyValue) {
        this.keyValue = keyValue;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/FeatureHistory.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents a trending history of features (story/requirement) from a content management system.
 *
 * Possible collectors: VersionOne PivotalTracker Rally Trello Jira
 *
 * @author kfk884
 *
 */
@Document(collection = "feature-history")
public class FeatureHistory extends BaseModel {
	/*
	 * Sprint data
	 */
	@Indexed
	private String sprintID;
	private String sprintBeginDate;
	private String sprintEndDate;
	/*
	 * Scope data
	 */
	@Indexed
	private String projectID;
	/*
	 * ScopeOwner data
	 */
	@Indexed
	private String teamID;
	/*
	 * Story data
	 */
	private String sStatus;
	private String sEstimate;
	private String sToDo;
	private String sAssetState;
	private String sSoftwareTesting;
	private String isDeleted;
	@Indexed
	private String changeDate;
	private String reportedDate;
	@Indexed
	private String storyID;

	public String getStoryID() {
		return storyID;
	}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/TestSuite.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.Collection;

/**
 * A collection of {@link TestCase}s of a particular {@link TestSuiteType}.
 */
public class TestSuite {

    private String id;
    /**
     * Description of the test suite that might make sense to a human
     */
    private String description;

    /**
     * Type of test
     */
    private TestSuiteType type;

    /**
     * Start test suite execution time {@link java.util.Date#getTime()}
     */
    private long startTime;

    /**
     * End test suite execution time {@link java.util.Date#getTime()}
     */
    private long endTime;

    /**
     * Test suite duration in milliseconds
     */
    private long duration;

    private int totalTestCaseCount;
    /**
     * Count of test cases that failed
     */
    private int failedTestCaseCount;

    /**
     * Count of test cases that generated an error
     */
    private int successTestCaseCount;

    /**
     * Count of test cases that were skipped
     */

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/model/FortifyScanReport.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "fortify_report")
@CompoundIndexes(value = { @CompoundIndex(name = "project_id", def = "{'projectId' : 1, 'collectorItemId': 1}") })
public class FortifyScanReport extends BaseModel {

	private ObjectId collectorItemId;
	private long timestamp;
	private String name;
	private String url;
	private long projectId;
	private String version;
	private Map<String, Threat> threats = new HashMap<>();

	public static class Threat {
		List<String> components = new ArrayList<>();
		int count;

		public Threat(int count) {
			this.count = count;
		}

		public Threat() {
			// TODO Auto-generated constructor stub
		}

		public int getCount() {
			return count;
		}

		public void setCount(int count) {
			this.count = count;
		}

		public List<String> getComponents() {
			return components;
		}

		public void setComponents(List<String> components) {
			this.components = components;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CloudVirtualNetworkListRefreshRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;


public class CloudVirtualNetworkListRefreshRequest {

    @NotNull
    private String accountNumber;
    @NotNull
    private List<String> virtualNetworkIds;
    private Date refreshDate;

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public List<String> getVirtualNetworkIds() {
        return virtualNetworkIds;
    }

    public void setVirtualNetworkIds(List<String> virtualNetworkIds) {
        this.virtualNetworkIds = virtualNetworkIds;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CodeQualityCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.CodeQualityMetric;
import com.capitalone.dashboard.model.CodeQualityType;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

public class CodeQualityCreateRequest {
    private String hygieiaId;
    @NotNull
    private long timestamp;
    @NotNull
    private String projectName;
    @NotNull
    private String projectId;
    @NotNull
    private String projectUrl;
    @NotNull
    private String serverUrl;
    @NotNull
    private CodeQualityType type;
    @NotNull
    private String projectVersion;

    private String toolName;

    private String niceName;

    private List<CodeQualityMetric> metrics = new ArrayList<>();



    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }


    public CodeQualityType getType() {
        return type;
    }

    public void setType(CodeQualityType type) {
        this.type = type;
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/GitRequestCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.SCM;

public class GitRequestCreateRequest extends SCM {
    private String hygieiaId;

    private long timestamp;

    public String getHygieiaId() {
        return hygieiaId;
    }

    public void setHygieiaId(String hygieiaId) {
        this.hygieiaId = hygieiaId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/DeployDataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;

public class DeployDataCreateRequest {
    @NotNull
    private String executionId;
    @NotNull
    private String jobUrl;
    @NotNull
    private String appName;
    @NotNull
    private String envName;
    @NotNull
    private String artifactName;
    @NotNull
    private String artifactVersion;
    @NotNull
    private String jobName;
    @NotNull
    private String instanceUrl;
    @NotNull
    private String deployStatus;
    @NotNull
    private long startTime;

    private String artifactGroup;
    private String hygieiaId;
    private long endTime;
    private long duration;
    private String startedBy;
    private String collectorName;
    private String niceName;


    public String getExecutionId() {
        return executionId;
    }

    public void setExecutionId(String executionId) {
        this.executionId = executionId;
    }

    public String getJobUrl() {
        return jobUrl;
    }

    public void setJobUrl(String jobUrl) {
        this.jobUrl = jobUrl;
    }

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/TestDataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.TestCapability;
import com.capitalone.dashboard.model.TestSuite;
import com.capitalone.dashboard.model.TestSuiteType;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collection;


public class TestDataCreateRequest {

    /**
     * ID of job
     */
    @NotNull
    private String testJobId;

    @NotNull
    private String testJobName;

    @NotNull
    private String serverUrl;
    /**
     * Optional URL to test results
     */
    @NotNull
    private String testJobUrl;

    /**
     * Identifies this test result in the source system
     */
    @NotNull
    private String executionId;

    private String niceName;

    /**
     * Creation timestamp
     */
    private long timestamp;

    /**
     * Description of the test result that might make sense to a human
     */
    private String description;

    /**
     * Start test execution time {@link java.util.Date#getTime()}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/PerformanceCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.PerformanceType;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;

public class PerformanceCreateRequest {
    private String hygieiaId;
    @NotNull
    private long timestamp;
    @NotNull
    private String projectName;
    @NotNull
    private String projectId;
    @NotNull
    private String projectUrl;
    @NotNull
    private String serverUrl;
    @NotNull
    private PerformanceType type;
    @NotNull
    private String projectVersion;
    @NotNull
    private String collectorName;

    private String niceName;

    private String targetAppName;

    private String targetEnvName;

    private Map<String,Object> metrics = new HashMap<>();



    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }


    public PerformanceType getType() {
        return type;
    }


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CloudInstanceCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;


import com.capitalone.dashboard.model.NameValue;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

public class CloudInstanceCreateRequest {
    @NotNull
    private String instanceId;
    @NotNull
    private String accountNumber;
    private String instanceType;
    private String imageId;
    private String imageExpirationDate;
    private String imageApproved;
    private String instanceOwner;
    private String isMonitored;
    private String privateDns;
    private String privateIp;
    private String publicDns;
    private String publicIp;
    private String subnetId;
    private String virtualNetworkId;
    private String age;
    private String isEncrypted;
    private String status;
    private String isStopped;
    private String isTagged;
    private String cpuUtilization;
    private String lastUpdatedDate;
    private List<String> securityGroups = new ArrayList<>();
    private List<NameValue> tags = new ArrayList<>();
    private String networkIn;
    private String networkOut;
    private String diskRead;
    private String diskWrite;
    private String rootDeviceName;
    private String lastAction;
    private String autoScaleName;


    public String getInstanceId() {
        return instanceId;
    }

    public void setInstanceId(String instanceId) {
        this.instanceId = instanceId;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CloudSubnetListRefreshRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;


public class CloudSubnetListRefreshRequest {

    @NotNull
    private String accountNumber;
    @NotNull
    private List<String> subnetIds;
    private Date refreshDate;

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public List<String> getSubnetIds() {
        return subnetIds;
    }

    public void setSubnetIds(List<String> subnetIds) {
        this.subnetIds = subnetIds;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CloudVolumeCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;


import com.capitalone.dashboard.model.NameValue;
import org.springframework.data.mongodb.core.index.Indexed;

import java.util.ArrayList;
import java.util.List;

public class CloudVolumeCreateRequest {
    @Indexed
    private String volumeId;

    @Indexed
    private String accountNumber;
    private String status;
    private long creationDate;
    private int size;
    private List<NameValue> tags = new ArrayList<>();
    private boolean encrypted;
    private String type;
    private String zone;
    private List<String> attchInstances = new ArrayList<>();


    public String getVolumeId() {
        return volumeId;
    }

    public void setVolumeId(String volumeId) {
        this.volumeId = volumeId;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public long getCreationDate() {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/GenericCollectorItemCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;

/**
 * A request to create a Generic Collector Item.
 *
 */
public class GenericCollectorItemCreateRequest {
    private String buildId;
    @NotNull
    private String relatedCollectorItemId;
    @NotNull
    private String toolName;
    @NotNull
    private String rawData;
    @NotNull
    private String source;


    public String getBuildId() {
        return buildId;
    }

    public void setBuildId(String buildId) {
        this.buildId = buildId;
    }

    public String getToolName() {
        return toolName;
    }

    public void setToolName(String toolName) {
        this.toolName = toolName;
    }

    public String getRawData() {
        return rawData;
    }

    public void setRawData(String rawData) {
        this.rawData = rawData;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CloudSubnetCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.NameValue;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class CloudSubnetCreateRequest {
    @NotNull
    private String subnetId;
    private String accountNumber;
    private String virtualNetworkId;
    private String cidrBlock;
    private String cidrCount;
    private String zone;
    private String availableIPCount;
    private String subscribedIPCount;
    private String usedIPCount;
    private String defaultForZone;
    private String state;
    private String creationDate;
    private String lastUpdateDate;
    private List<NameValue> tags = new ArrayList<>();
    private Map<String, Integer> ipUsage;
    private Map<String, Integer> subscribedIPUsage;


    public String getSubnetId() {
        return subnetId;
    }

    public void setSubnetId(String subnetId) {
        this.subnetId = subnetId;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getVirtualNetworkId() {
        return virtualNetworkId;
    }

    public void setVirtualNetworkId(String virtualNetworkId) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/PerfTestDataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;


import com.capitalone.dashboard.model.TestCapability;
import com.capitalone.dashboard.model.TestSuite;
import com.capitalone.dashboard.model.TestSuiteType;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collection;

public class PerfTestDataCreateRequest {



    /**
     * perf test runID should be unique for each execution.
     */
    @NotNull
    private String runId;

    /**
     * Provide a test name, a new testname will create a new collector Item
     */
    @NotNull
    private String testName;



    /**
     * Provide a  platform name, a new platformName will create a new collector Item. default should be Jmeter.
     */
    @NotNull
    private String perfTool;

    /**
     * Type of test should be performance
     */
    @NotNull
    private TestSuiteType type;

    /**
     * Provide the test result status
     */
    private String resultStatus;

    /**
     * Provide a report URL if available
     */
    private String reportUrl;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/BinaryArtifactCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.SCM;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * A request to create a BinaryArtifact.
 *
 */
public class BinaryArtifactCreateRequest {

    @NotNull
    private String artifactName;
    @NotNull
    String canonicalName;
    @NotNull
    private String artifactGroup;
    @NotNull
    private String artifactVersion;
    private String artifactModule;
    private String artifactClassifier;
    private String artifactExtension;
    
    // May be null if comes in from rest call outside of jenkins
    private String buildId;
    
    private long timestamp;
    
    // Used by the jenkins plugin
	// May be null if comes in from rest call outside of jenkins
    private List<SCM> sourceChangeSet = new ArrayList<>();
    
    // See usage of metadata in BinaryArtifactServiceImpl for defined property names
    private Map<String, Object> metadata = new HashMap<>();


    public String getArtifactName() {
        return artifactName;
    }

    public String getCanonicalName() {
        return canonicalName;
    }

    public void setCanonicalName(String canonicalName) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/ConfigurationCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.capitalone.dashboard.model.Configuration;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class ConfigurationCreateRequest {
	
	private String collectorName;
	private Set<Map<String,String>> info = new HashSet<>();
	
	public String getCollectorName() {
		return collectorName;
	}
	public void setCollectorName(String collectorName) {
		this.collectorName = collectorName;
	}
	public Set<Map<String, String>> getInfo() {
		return info;
	}
	public void setInfo(Set<Map<String, String>> info) {
		this.info = info;
	}
	
	public Configuration toConfiguration() {
		return new Configuration(collectorName,info);
	}
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/Monitor2DataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;

public class Monitor2DataCreateRequest {
    @NotNull
    private String name;
    private String url;
    private int status;

    public String getName() { return this.name; }

    public void setName(String name) { this.name = name; }

    public String getUrl() { return this.url; }

    public void setUrl(String url) { this.url = url; }

    public int getStatus() { return this.status; }

    public void setStatus(int status) { this.status = status; }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CommitCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.SCM;

public class CommitCreateRequest extends SCM {
    private String hygieiaId;

    private long timestamp;

    public String getHygieiaId() {
        return hygieiaId;
    }

    public void setHygieiaId(String hygieiaId) {
        this.hygieiaId = hygieiaId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CloudInstanceListRefreshRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;


public class CloudInstanceListRefreshRequest {

    @NotNull
    private String accountNumber;
    @NotNull
    private List<String> instanceIds;
    private Date refreshDate;

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public List<String> getInstanceIds() {
        return instanceIds;
    }

    public void setInstanceIds(List<String> instanceIds) {
        this.instanceIds = instanceIds;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/CloudVolumeListRefreshRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;


public class CloudVolumeListRefreshRequest {

    @NotNull
    private String accountNumber;
    @NotNull
    private List<String> volumeIds;
    private Date refreshDate;

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public List<String> getVolumeIds() {
        return volumeIds;
    }

    public void setVolumeIds(List<String> volumeIds) {
        this.volumeIds = volumeIds;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/request/BuildDataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.RepoBranch;
import com.capitalone.dashboard.model.SCM;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;


public class BuildDataCreateRequest {

    @NotNull
    private String number;
    @NotNull
    private String buildUrl;
    @NotNull
    private String jobName;
    @NotNull
    private String buildStatus;
    @NotNull
    private long startTime;
    @NotNull
    private String jobUrl;
    @NotNull
    private String instanceUrl;

    private String niceName;

    private long endTime;
    private long duration;
    private String startedBy;
    private String log;
    private List<RepoBranch> codeRepos = new ArrayList<>();
    private List<SCM> sourceChangeSet = new ArrayList<>();

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getBuildUrl() {
        return buildUrl;
    }

    public void setBuildUrl(String buildUrl) {
        this.buildUrl = buildUrl;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/DashboardEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.mongodb.DBObject;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
import org.springframework.data.mongodb.core.mapping.event.AfterDeleteEvent;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;
import org.springframework.stereotype.Component;

/**
 * Listens for Dashboard lifecycle events to create and delete Product collector CollectorItems
 * whenever a Team Dashboard is created or deleted.
 */
@Component
public class DashboardEventListener extends AbstractMongoEventListener<Dashboard> {

    private final CollectorRepository collectorRepository;
    private final CollectorItemRepository collectorItemRepository;

    @Autowired
    public DashboardEventListener(CollectorRepository collectorRepository,
                                  CollectorItemRepository collectorItemRepository) {
        this.collectorRepository = collectorRepository;
        this.collectorItemRepository = collectorItemRepository;
    }

    /**
     * Creates a collector item for new team dashboards
     * @param event
     */
    @Override
    public void onAfterSave(AfterSaveEvent<Dashboard> event) {
        Dashboard dashboard = event.getSource();
        // Ignore product dashboards
        if (DashboardType.Product.equals(dashboard.getType())) {
            return;
        }

        Collector productCollector = getProductCollector();
        CollectorItem item = getDashboardCollectorItem(dashboard.getId().toString(), productCollector.getId());

        if (item == null) {
            // Create a new Collector Item

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/HygieiaMongoEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;

import java.util.List;

public abstract class HygieiaMongoEventListener<T> extends AbstractMongoEventListener<T> {

    protected final CollectorItemRepository collectorItemRepository;
    protected final PipelineRepository pipelineRepository;
    protected final CollectorRepository collectorRepository;

    public HygieiaMongoEventListener(CollectorItemRepository collectorItemRepository,
                                     PipelineRepository pipelineRepository,
                                     CollectorRepository collectorRepository) {
        this.collectorItemRepository = collectorItemRepository;
        this.pipelineRepository = pipelineRepository;
        this.collectorRepository = collectorRepository;
    }

    private Collector getProductCollector(){
        List<Collector> productCollectors = collectorRepository.findByCollectorType(CollectorType.Product);
        if(productCollectors.isEmpty()){
            return null;
        }
        return productCollectors.get(0);
    }

    /**
     * Finds the team dashboard collectoritem by dashboard id and product collectorid
     * @param teamDashboard
     * @return
     */
    protected CollectorItem getTeamDashboardCollectorItem(Dashboard teamDashboard) {
        ObjectId productCollectorId = getProductCollector().getId();
        ObjectId dashboardId = teamDashboard.getId();
        return collectorItemRepository.findTeamDashboardCollectorItemsByCollectorIdAndDashboardId(productCollectorId, dashboardId.toString());
    }

    /**

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/CodeQualityEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.event.sync.SyncDashboard;
import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

@org.springframework.stereotype.Component
public class CodeQualityEventListener extends HygieiaMongoEventListener<CodeQuality> {
    private final SyncDashboard syncDashboard;


    @Autowired
    public CodeQualityEventListener(
            CollectorItemRepository collectorItemRepository,
            PipelineRepository pipelineRepository,
            CollectorRepository collectorRepository, SyncDashboard syncDashboard) {
        super(collectorItemRepository, pipelineRepository, collectorRepository);
        this.syncDashboard = syncDashboard;
    }

    @Override
    public void onAfterSave(AfterSaveEvent<CodeQuality> event) {
        CodeQuality codeQuality = event.getSource();
        syncDashboard.sync(codeQuality);
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/BuildEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.event.sync.SyncDashboard;
import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.BuildStatus;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.SCM;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.CommitRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.capitalone.dashboard.util.PipelineUtils.isMoveCommitToBuild;
import static com.capitalone.dashboard.util.PipelineUtils.processPreviousFailedBuilds;

@org.springframework.stereotype.Component
public class BuildEventListener extends HygieiaMongoEventListener<Build> {
    private final DashboardRepository dashboardRepository;
    private final ComponentRepository componentRepository;
    private final CommitRepository commitRepository;
    private final SyncDashboard syncDashboard;

    @Autowired
    public BuildEventListener(DashboardRepository dashboardRepository,
                              CollectorItemRepository collectorItemRepository,
                              ComponentRepository componentRepository,
                              PipelineRepository pipelineRepository,
                              CollectorRepository collectorRepository, CommitRepository commitRepository, SyncDashboard syncDashboard) {
        super(collectorItemRepository, pipelineRepository, collectorRepository);
        this.dashboardRepository = dashboardRepository;
        this.componentRepository = componentRepository;
        this.commitRepository = commitRepository;
        this.syncDashboard = syncDashboard;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/RelatedCollectorItemEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.event.sync.SyncDashboard;
import com.capitalone.dashboard.event.sync.SyncException;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

@org.springframework.stereotype.Component
public class RelatedCollectorItemEventListener extends HygieiaMongoEventListener<RelatedCollectorItem> {
    private static final Log LOG = LogFactory.getLog(RelatedCollectorItemEventListener.class);
    private final SyncDashboard syncDashboard;


    @Autowired
    public RelatedCollectorItemEventListener(
            CollectorItemRepository collectorItemRepository,
            PipelineRepository pipelineRepository,
            CollectorRepository collectorRepository, SyncDashboard syncDashboard) {
        super(collectorItemRepository, pipelineRepository, collectorRepository);
        this.syncDashboard = syncDashboard;
    }

    @Override
    public void onAfterSave(AfterSaveEvent<RelatedCollectorItem> event) {
        RelatedCollectorItem relatedCollectorItem = event.getSource();
        try {
            syncDashboard.sync(relatedCollectorItem);
        } catch (SyncException e) {
            LOG.error("Error processing related collector item. ID = " + relatedCollectorItem.getId() + ". Reason " + e.getMessage());
        }
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/EnvironmentComponentEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.BinaryArtifact;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.EnvironmentComponent;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.SCM;
import com.capitalone.dashboard.repository.BinaryArtifactRepository;
import com.capitalone.dashboard.repository.BuildRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.CommitRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.JobRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import com.capitalone.dashboard.util.PipelineUtils;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.bson.types.ObjectId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@org.springframework.stereotype.Component
public class EnvironmentComponentEventListener extends HygieiaMongoEventListener<EnvironmentComponent> {
    private static final Logger LOGGER = LoggerFactory.getLogger(EnvironmentComponentEventListener.class);

    private final DashboardRepository dashboardRepository;
    private final ComponentRepository componentRepository;
    private final BinaryArtifactRepository binaryArtifactRepository;
    private final BuildRepository buildRepository;

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/sync/SyncException.java
=====================================================
package com.capitalone.dashboard.event.sync;

public class SyncException extends Exception{
    public SyncException(String message) {
        super(message);
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/sync/SyncDashboard.java
=====================================================
package com.capitalone.dashboard.event.sync;

import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.RepoBranch;
import com.capitalone.dashboard.model.StandardWidget;
import com.capitalone.dashboard.model.Widget;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.BuildRepository;
import com.capitalone.dashboard.repository.CodeQualityRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

@org.springframework.stereotype.Component
public class SyncDashboard {
    private final DashboardRepository dashboardRepository;
    private final ComponentRepository componentRepository;
    private final CollectorRepository collectorRepository;
    private final CollectorItemRepository collectorItemRepository;
    private final BuildRepository buildRepository;
    private final RelatedCollectorItemRepository relatedCollectorItemRepository;
    private final CodeQualityRepository codeQualityRepository;

    private static final String BUILD_REPO_REASON = "Code Repo build";
    private static final String CODEQUALITY_TRIGGERED_REASON = "Code scan triggered by build";

    @Autowired
    public SyncDashboard(DashboardRepository dashboardRepository, ComponentRepository componentRepository,
                         CollectorRepository collectorRepository, CollectorItemRepository collectorItemRepository,

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/TestResultEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.TestResult;
import com.capitalone.dashboard.model.TestCapability;
import com.capitalone.dashboard.model.TestSuiteType;
import com.capitalone.dashboard.model.TestCase;
import com.capitalone.dashboard.model.TestCaseStatus;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Performance;
import com.capitalone.dashboard.model.PerformanceType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PerformanceRepository;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.bson.types.ObjectId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;
import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.concurrent.TimeUnit;
import java.util.Map;
import java.util.Optional;

@Component
public class TestResultEventListener extends AbstractMongoEventListener<TestResult> {

    private static final Logger LOGGER = LoggerFactory.getLogger(TestResultEventListener.class);

    private static final String STR_RESP_TIME_THRESHOLD = "KPI : Avg response times";
    private static final String STR_ACTUAL_RESP_TIME = "Actual Response Time";
    private static final String STR_TARGET_RESP_TIME = "Target Response Time";
    private static final String STR_TXN_PER_SEC_THRESHOLD = "KPI : Transaction Per Second";
    private static final String STR_ACTUAL_TXN_PER_SEC = "Actual Transactions per sec";
    private static final String STR_TARGET_TXN_PER_SEC = "Target Transactions per sec";
    private static final String STR_ERROR_RATE_THRESHOLD = "KPI : Error Rate Threshold";
    private static final String STR_ACTUAL_ERROR_RATE = "Actual Error Rate";
    private static final String STR_TARGET_ERROR_RATE = "Target Error Rate";
    private static final String STR_CRITICAL = "CRITICAL";
    private static final String STR_OPEN = "OPEN";
    private static final String COLLECTOR_NAME = "PerfTools";

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/event/CommitEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.CommitType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@org.springframework.stereotype.Component
public class CommitEventListener extends HygieiaMongoEventListener<Commit> {

    private final ComponentRepository componentRepository;
    private final DashboardRepository dashboardRepository;

    @Autowired
    public CommitEventListener(ComponentRepository componentRepository,
                               DashboardRepository dashboardRepository,
                               CollectorRepository collectorRepository,
                               CollectorItemRepository collectorItemRepository,
                               PipelineRepository pipelineRepository) {
        super(collectorItemRepository, pipelineRepository, collectorRepository);
        this.componentRepository = componentRepository;
        this.dashboardRepository = dashboardRepository;
    }

    @Override
    public void onAfterSave(AfterSaveEvent<Commit> event) {
        Commit commit = event.getSource();

        // Add the commit to all pipelines associated with the team dashboards
        // this commit is part of. But only if there is a build collector item
        // configured on that dashboard. Otherwise, the commit will be orphaned
        // in the commit stage.

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/testutil/FongoConfig.java
=====================================================
package com.capitalone.dashboard.testutil;

import com.capitalone.dashboard.config.MongoConfig;
import com.github.fakemongo.Fongo;
import com.mongodb.MongoClient;
import org.springframework.context.annotation.Bean;

public class FongoConfig extends MongoConfig {

    @Override
    @Bean
    public MongoClient mongo()  {
        return new Fongo(getDatabaseName()).getMongo();
    }
    
    @Override
    protected String getDatabaseName() {
        return "test-db";
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/testutil/TestRestOperations.java
=====================================================
package com.capitalone.dashboard.testutil;

import com.capitalone.dashboard.collector.RestOperationsSupplier;
import org.springframework.http.HttpStatus;
import org.springframework.web.client.RestOperations;

import java.util.HashMap;
import java.util.Map;

public class TestRestOperations<T> extends RestOperationsSupplier {
    TestRestTemplate<? extends T> template;

    private Map<String, TestResponse<T>> response;

    public TestRestOperations(Map<String, TestResponse<T>> response) {
        this.response = response;
    }

    public Map<String, TestResponse<T>> getResponse() {
        return response;
    }

    public void addResponse(String key, TestResponse testResponse) {
        if (response == null) {
            response = new HashMap<>();
        }
        this.response.put(key, testResponse);
    }

    public void addResponse(String key, T body, HttpStatus httpStatus) {
        if (response == null) {
            response = new HashMap<>();
        }
        this.response.put(key, new TestResponse<>(body, httpStatus));
        if (template != null) {
            template.addResponse(key, new TestResponse<>(body, httpStatus));
        }
    }

    public TestRestTemplate<? extends T> getTemplate() {
        return template;
    }

    public void setTemplate(TestRestTemplate<? extends T> template) {
        this.template = template;
    }

    @Override
    public RestOperations get() {
        if (template == null) {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/testutil/TestRestTemplate.java
=====================================================
package com.capitalone.dashboard.testutil;

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

public class TestRestTemplate<T> extends RestTemplate {

    private Map<String, TestResponse<T>> response;

    public TestRestTemplate(Map<String, TestResponse<T>> response) {
        this.response = response;
    }

    public Map<String, TestResponse<T>> getResponse() {
        return response;
    }


    public void addResponse(String key, TestResponse testResponse) {
        if (response == null) {
            response = new HashMap<>();
        }
        this.response.put(key, testResponse);
    }

    public void addResponse(String key, T body, HttpStatus httpStatus) {
        if (response == null) {
            response = new HashMap<>();
        }
        this.response.put(key, new TestResponse<>(body, httpStatus));
    }

    public void clearResponse() {
        if (response != null) {
            response.clear();
        }
    }
    @Override
    public <T> ResponseEntity<T> exchange(String var1, HttpMethod var2, HttpEntity<?> var3, Class<T> var4, Object... var5) throws RestClientException {

        if (response.containsKey(var1)) {
            return new ResponseEntity(response.get(var1).getBody(),response.get(var1).getStatus());
        } else {

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/testutil/GsonUtil.java
=====================================================
package com.capitalone.dashboard.testutil;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializer;
import org.bson.types.ObjectId;

import java.lang.reflect.Type;

public class GsonUtil {
    private static final GsonBuilder gsonBuilder = new GsonBuilder()
            .registerTypeAdapter(ObjectId.class, (JsonSerializer<ObjectId>) (src, typeOfSrc, context) -> new JsonPrimitive(src.toHexString()))
            .registerTypeAdapter(ObjectId.class, (JsonDeserializer<ObjectId>) GsonUtil::deserialize);

    private static ObjectId deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
        if (json instanceof JsonObject) {
            JsonObject jo = (JsonObject) json;
            return new ObjectId(jo.get("timestamp").getAsInt(), jo.get("machineIdentifier").getAsInt(), jo.get("processIdentifier").getAsShort(), jo.get("counter").getAsInt());
        }
        return new ObjectId(json.getAsString());
    }


    public static Gson getGson() {
        return gsonBuilder.create();
    }
}


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/testutil/BaseCollectorTestConfig.java
=====================================================
package com.capitalone.dashboard.testutil;

import com.capitalone.dashboard.collector.RestOperationsSupplier;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.scheduling.TaskScheduler;

import java.util.HashMap;
import java.util.Map;

@ComponentScan(basePackages ={ "com.capitalone.dashboard.collector", "com.capitalone.dashboard.model"}, includeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value=TaskScheduler.class),
        @ComponentScan.Filter(type = FilterType.REGEX, pattern="com.capitalone.dashboard.collector.*CollectorTask.class"), @ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.capitalone.dashboard.collector.*Settings.class")})
public class BaseCollectorTestConfig {


    @Bean
    public RestOperationsSupplier restOperationsSupplier()  {
        Map<String, TestResponse<String>> responseMap = new HashMap<>();
        return new TestRestOperations(responseMap);
    }


    @Bean
    public TaskScheduler taskScheduler() {
        return Mockito.mock(TaskScheduler.class);
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/testutil/TestResponse.java
=====================================================
package com.capitalone.dashboard.testutil;

import org.springframework.http.HttpStatus;

public class TestResponse<T> {
    private T body;
    private HttpStatus status;

    public TestResponse(T body, HttpStatus status) {
        this.body = body;
        this.status = status;
    }

    public T getBody() {
        return body;
    }

    public void setBody(T body) {
        this.body = body;
    }

    public HttpStatus getStatus() {
        return status;
    }

    public void setStatus(HttpStatus status) {
        this.status = status;
    }
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/client/RestAuthType.java
=====================================================
package com.capitalone.dashboard.client;

public enum RestAuthType {
    BASIC,
    TOKEN;
}

=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/client/RestUserInfo.java
=====================================================
package com.capitalone.dashboard.client;

public class RestUserInfo {
    private String userId;
    private String passCode;

    public RestUserInfo(String userId, String passCode) {
        this.userId = userId;
        this.passCode = passCode;
    }

    public String getFormattedString() {
        return userId.trim() + ":" + passCode.trim();
    }
}


=====================================================
== File: site-content/src/main/java/com/capitalone/dashboard/client/RestClient.java
=====================================================
package com.capitalone.dashboard.client;

import com.capitalone.dashboard.util.Encryption;
import com.capitalone.dashboard.util.EncryptionException;
import com.capitalone.dashboard.util.Supplier;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestOperations;
import java.nio.charset.StandardCharsets;
import java.util.Map;

@Component
public class RestClient {
    private static final Log LOG = LogFactory.getLog(RestClient.class);
    private final RestOperations restOperations;

    @Autowired
    public RestClient(Supplier<RestOperations> restOperationsSupplier) {
        this.restOperations = restOperationsSupplier.get();
    }

    public ResponseEntity<String> makeRestCallPost(String url, JSONObject body) {
        if (restOperations == null) { return null; }

        long start = System.currentTimeMillis();

        ResponseEntity<String> response
                = restOperations.exchange(url, HttpMethod.POST, new HttpEntity<Object>(body, null), String.class);

        long end = System.currentTimeMillis();

        LOG.info("Time taken to make a post call to "+url+" = "+(end-start));

        return response;
    }


=====================================================
== File: create_collector.md
=====================================================
Create New Collector
==================================================

Copy skeleton collector project
--------------------------------------
Copy the sample collector project into a new directory in the collectors folder and give it a name to match the collector
you are building (eg pivotalTracker). In the pom.xml file, change the artifactId, name and optionally the groupId elements, like so:

    <project>
        <groupId>com.capitalone.dashboard</groupId>
        <artifactId>pivotal-tracker-collector</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <name>Pivotal Tracker Collector</name>

        ...
    </project>

The pom file includes all of the dependencies you will need to interact with the Dashboard Application MongoDB instance,
such as Model classes and Repositories.

Extending Collector
--------------------------------------

If you need to store extra configuration for your collector, you can create a class that extends Collector and add new
fields to store configuration information that is specific to your collector.

    package com.capitalone.dashboard.collector;

    import com.capitalone.dashboard.model.Collector;

    /**
     * Collect Features from PivotalTracker
     */
    public class PivotalTrackerCollector extends Collector {
        private String apiToken;

        public String getApiToken() {
            return apiToken;
        }

        public void setApiToken(String apiToken) {
            this.apiToken = apiToken;
        }
    }

If you decide to take this approach, you will also need to create a Spring Data repository interface that extends from
BaseCollectorRepository.

    package com.capitalone.dashboard.repository;


=====================================================
== File: .travis.yml
=====================================================
language: java
jdk:
  - openjdk8

branches:
  only:
    - master
    - gerrit-integration
    - "/^v[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+.*$/"

cache:
  directories:
    - "$TRAVIS_BUILD_DIR/UI/node_modules"

install: true

before_script:
  - sudo chown -R $USER:$GROUP $TRAVIS_BUILD_DIR

script:
  - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mvn clean install -q; fi
  - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then cp ./src/devops/deploy-snapshot.sh . && ./deploy-snapshot.sh; fi
  - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [[ "$TRAVIS_BRANCH" =~ ^v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then cp ./src/devops/release.sh . && ./release.sh; fi

notifications:
  webhooks:
    urls: https://webhooks.gitter.im/e/48597b0f75dd571734bc
    on_success: always
    on_failure: always
    on_start: always
  email:
    recipients:
      - tapabrata.pal@capitalone.com
      - nireesh.thiruveedula@capitalone.com
      - Stephen.Hughes@capitalone.com
      - Prashant.Parekh@capitalone.com
      - Matthew.Beasley@capitalone.com
      - Subodh.Battina@capitalone.com
      - Ragha.Vema@capitalone.com
    on_success: always
    on_failure: always

=====================================================
== File: src/devops/pmd.xml
=====================================================
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
    xmlns="http://pmd.sf.net/ruleset/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
  <description>
  Exclude noisy rules.
  </description>

  <rule ref="rulesets/internal/all-java.xml">
    <exclude name="AddEmptyString"/>
    <exclude name="AppendCharacterWithChar"/>
    <exclude name="ArrayIsStoredDirectly"/>
    <exclude name="AssignmentInOperand"/>
    <exclude name="AtLeastOneConstructor"/>
    <exclude name="AvoidCatchingGenericException"/>
    <exclude name="AvoidDuplicateLiterals"/>
    <exclude name="AvoidFieldNameMatchingMethodName"/>
    <exclude name="AvoidFinalLocalVariable"/>
    <exclude name="AvoidInstantiatingObjectsInLoops"/>
    <exclude name="AvoidLiteralsInIfCondition"/>
    <exclude name="AvoidSynchronizedAtMethodLevel"/>
    <exclude name="AvoidThrowingNullPointerException"/>
    <exclude name="AvoidThrowingRawExceptionTypes"/>
    <exclude name="AvoidUsingShortType"/>
    <exclude name="BeanMembersShouldSerialize"/>
    <exclude name="CallSuperInConstructor"/>
    <exclude name="CommentRequired"/>
    <exclude name="CommentSize"/>
    <exclude name="CompareObjectsWithEquals"/>
    <exclude name="ConfusingTernary"/>
    <exclude name="CyclomaticComplexity"/>
    <exclude name="DataflowAnomalyAnalysis"/>
    <exclude name="DefaultPackage"/>
    <exclude name="DoNotUseThreads"/>
    <exclude name="DuplicateImports"/>
    <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
    <exclude name="ExcessiveImports"/>
    <exclude name="ExcessivePublicCount"/>
    <exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
    <exclude name="GodClass"/>
    <exclude name="GuardDebugLogging"/>
    <exclude name="GuardLogStatement"/>
    <exclude name="GuardLogStatementJavaUtil"/>
    <exclude name="ImmutableField"/>
    <exclude name="LawOfDemeter"/>
    <exclude name="LocalVariableCouldBeFinal"/>
    <exclude name="LoggerIsNotStaticFinal"/>
    <exclude name="LongVariable"/>

=====================================================
== File: src/devops/release.sh
=====================================================
#!/bin/bash

cp src/devops/.travis.settings.xml $HOME/.m2/settings.xml

openssl aes-256-cbc -K $encrypted_00b218189f3e_key -iv $encrypted_00b218189f3e_iv -in src/devops/keys.gpg.enc -out keys.gpg -d

gpg --fast-import keys.gpg

shred keys.gpg

sed -i 's|-SNAPSHOT||g' pom.xml

mvn deploy -q -P release

=====================================================
== File: src/devops/deploy-snapshot.sh
=====================================================
#!/bin/bash

cp src/devops/.travis.settings.xml $HOME/.m2/settings.xml

mvn deploy -q

=====================================================
== File: src/devops/.travis.settings.xml
=====================================================
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <servers>
    <server>
      <id>ossrh</id>
      <username>${env.OSSRH_USERNAME}</username>
      <password>${env.OSSRH_PASSWORD}</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>release</id>
      <properties>
        <gpg.keyname>${env.GPG_KEYNAME}</gpg.keyname>
        <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
      </properties>
    </profile>
  </profiles>
</settings>

=====================================================
== File: src/test/resources/artifacts/artifacts.json
=====================================================
[{
    "id": "56ccb7a57fab7c3eac031aac",
    "_class": "com.capitalone.dashboard.model.BinaryArtifact",
    "timestamp": 1456256819843,
    "artifactName": "api.jar",
    "canonicalName": "api-1.0.0.0.jar",
    "artifactGroupId": "com.lightningcd.api",
    "artifactVersion": "1.0.0.0",
    "buildInfo":  {
      "id": "5ba51c320be2d3f98f795044",
      "_class": "com.capitalone.dashboard.model.Build",
      "collectorItemId": "5ba136220be2d32568777fa5",
      "timestamp": 1537547314372,
      "number": "148",
      "buildUrl": "http://localhost:8082/job/c1usercheck/148/",
      "startTime": 1537547300387,
      "endTime": 1537547314338,
      "duration": 13951,
      "buildStatus": "Success",
      "codeRepos": [
        {
          "url": "https://mygithub.com/myOrg/myRepo",
          "branch": "refs/remotes/origin/master",
          "type": "GIT"
        }
      ],
      "sourceChangeSet": []
    }
  }
]

=====================================================
== File: src/test/resources/collectors/coll.json
=====================================================
[
{
  "id" : "5ba136220be2d32568777fa4",
  "_class" : "com.capitalone.dashboard.model.Collector",
  "name" : "Hudson",
  "collectorType" : "Build",
  "enabled" : true,
  "online" : true,
  "errors" : [],
  "uniqueFields" : {
    "jobName" : "",
    "jobUrl" : ""
  },
  "allFields" : {
    "jobName" : "",
    "jobUrl" : "",
    "instanceUrl" : ""
  },
  "lastExecuted" : 1537838340823,
  "searchFields" : [
    "options.jobName",
    "niceName"
  ]
},
{
  "id" : "5ba136290be2d32568777fa8",
  "_class" : "com.capitalone.dashboard.model.Collector",
  "name" : "Sonar",
  "collectorType" : "CodeQuality",
  "enabled" : true,
  "online" : true,
  "errors" : [],
  "uniqueFields" : {},
  "allFields" : {},
  "lastExecuted" : 1537838341109,
  "searchFields" : [
    "description"
  ]
},
{
  "id" : "5ba155280be2d339d2f2461e",
  "_class" : "com.capitalone.dashboard.model.Collector",
  "name" : "Product",
  "collectorType" : "Product",
  "enabled" : true,
  "online" : true,
  "errors" : [],
  "uniqueFields" : {},
  "allFields" : {},
  "lastExecuted" : 0,

=====================================================
== File: src/test/resources/component/component.json
=====================================================
[
  {
    "id": "5ba155820be2d339d2f24626",
    "_class": "com.capitalone.dashboard.model.Component",
    "name": "Testing",
    "collectorItems": {
      "SCM": [
        {
          "id": "5ba16a200be2d349ddf7fc80",
          "enabled": true,
          "errors": [],
          "pushed": false,
          "collectorId": "5ba16a0b0be2d34a64291205",
          "lastUpdated": 0,
          "options": {
            "password": "",
            "personalAccessToken": "",
            "branch": "master",
            "userID": "",
            "url": "https://mygithub.com/myOrg/myRepo"
          }
        }
      ],
      "Build": [
        {
          "id": "5ba136220be2d32568777fa5",
          "description": "job/c1usercheck/",
          "niceName": "TopoJenkins",
          "enabled": false,
          "errors": [],
          "pushed": true,
          "collectorId": "5ba136220be2d32568777fa4",
          "lastUpdated": 1537305331713,
          "options": {
            "jobName": "job/c1usercheck/",
            "jobUrl": "http://localhost:8082/job/c1usercheck/",
            "instanceUrl": "http://localhost:8082/"
          }
        }
      ],
      "CodeQuality": [
        {
          "id": "5ba136290be2d32568777fa9",
          "description": "C1 Custom Env Var Inject",
          "niceName": "TopoJenkins",
          "enabled": false,
          "errors": [],
          "pushed": true,
          "collectorId": "5ba136290be2d32568777fa8",
          "lastUpdated": 1537305335290,

=====================================================
== File: src/test/resources/builds/builds.json
=====================================================
[
  {
    "id": "5ba51c320be2d3f98f795044",
    "_class": "com.capitalone.dashboard.model.Build",
    "collectorItemId": "5ba136220be2d32568777fa5",
    "timestamp": 1537547314372,
    "number": "148",
    "buildUrl": "http://localhost:8082/job/c1usercheck/148/",
    "startTime": 1537547300387,
    "endTime": 1537547314338,
    "duration": 13951,
    "buildStatus": "Success",
    "codeRepos": [
      {
        "url": "https://mygithub.com/myOrg/myRepo",
        "branch": "refs/remotes/origin/master",
        "type": "GIT"
      }
    ],
    "sourceChangeSet": []
  },
  {
    "id": "5ba51d120be2d3f98f79504c",
    "_class": "com.capitalone.dashboard.model.Build",
    "collectorItemId": "5ba136220be2d32568777fa5",
    "timestamp": 1537547538123,
    "number": "149",
    "buildUrl": "http://localhost:8082/job/c1usercheck/149/",
    "startTime": 1537547525358,
    "endTime": 1537547538098,
    "duration": 12740,
    "buildStatus": "Success",
    "codeRepos": [
      {
        "url": "https://mygithub.com/myOrg/myRepo",
        "branch": "refs/remotes/origin/master",
        "type": "GIT"
      }
    ],
    "sourceChangeSet": []
  },
  {
    "id": "5ba520c40be2d3f98f795054",
    "_class": "com.capitalone.dashboard.model.Build",
    "collectorItemId": "5ba136220be2d32568777fa5",
    "timestamp": 1537548484349,
    "number": "150",
    "buildUrl": "http://localhost:8082/job/c1usercheck/150/",
    "startTime": 1537548473383,
    "endTime": 1537548484312,

=====================================================
== File: src/test/resources/librarypolicy/librarypolicy.json
=====================================================
[{
  "id": "5ad626cfc23b392c8f61ea1b",
  "_class": "com.capitalone.dashboard.model.LibraryPolicyResult",
  "collectorItemId": "5ad5f605c23b391cfa1c01a4",
  "timestamp": 1523984079768,
  "evaluationTimestamp": 1522879797193,
  "threats": {
    "License": [
      {
        "level": "Medium",
        "components": [
          "com.amazonaws:aws-java-sdk-sqs-1.11.28.jar",
          "ch.qos.logback:logback-classic-1.1.11.jar",
          "ch.qos.logback:logback-core-1.1.11.jar",
          "junit:junit-4.11.jar",
          "highcharts:highcharts-3d-4.2.1.js",
          "highcharts:highcharts-4.2.1.js",
          "net.masterthought:cucumber-reporting-2.0.0.jar"
        ],
        "count": 7
      },
      {
        "level": "None",
        "components": [
          "org.springframework:spring-test-4.3.10.RELEASE.jar",
          "org.jsoup:jsoup-1.8.3.jar",
          "com.amazonaws:jmespath-java-1.0.jar",
          "org.springframework.retry:spring-retry-1.2.1.RELEASE.jar",
          "com.amazonaws:aws-java-sdk-kms-1.11.28.jar",
          "com.fasterxml.jackson.core:jackson-core-2.8.9.jar",
          "org.springframework.batch:spring-batch-infrastructure-3.0.8.RELEASE.jar",
          "com.fasterxml.jackson.core:jackson-annotations-2.8.0.jar",
          "com.google.code.gson:gson-2.8.1.jar",
          "org.slf4j:slf4j-api-1.7.25.jar",
          "org.springframework.boot:spring-boot-test-autoconfigure-1.5.6.RELEASE.jar",
          "com.vaadin.external.google:android-json-0.0.20131108.vaadin1.jar",
          "com.jayway.jsonpath:json-path-2.2.0.jar",
          "org.springframework.batch:spring-batch-core-3.0.8.RELEASE.jar",
          "org.apache.logging.log4j:log4j-api-2.7.jar",
          "org.apache.httpcomponents:httpclient-4.5.3.jar",
          "org.springframework.boot:spring-boot-starter-logging-1.5.6.RELEASE.jar",
          "org.assertj:assertj-core-2.6.0.jar",
          "org.slf4j:jul-to-slf4j-1.7.25.jar",
          "jquery:jquery-1.12.1.min.js",
          ":aws-temporary-credentials-provider-2.1.3.jar",
          "com.fasterxml.jackson.core:jackson-databind-2.8.9.jar",
          "org.springframework:spring-beans-4.3.10.RELEASE.jar",
          "org.apache.velocity:velocity-1.7.jar",
          "org.springframework.boot:spring-boot-starter-test-1.5.6.RELEASE.jar",
          "commons-logging:commons-logging-1.1.3.jar",

=====================================================
== File: src/test/resources/dashboard/dashboard.json
=====================================================
[
  {
    "id": "5ba155820be2d339d2f24627",
    "_class": "com.capitalone.dashboard.model.Dashboard",
    "template": "widgets",
    "title": "TestPlugin",
    "widgets": [
      {
        "id": "5ba16a200be2d349ddf7fc82",
        "name": "repo",
        "componentId": "5ba155820be2d339d2f24626",
        "options": {
          "password": "",
          "id": "repo0",
          "personalAccessToken": "",
          "branch": "master",
          "userID": "",
          "url": "https://mygithub.com/myOrg/myRepo"
        }
      },
      {
        "id": "5ba16af70be2d34a77757045",
        "name": "build",
        "componentId": "5ba155820be2d339d2f24626",
        "options": {
          "buildDurationThreshold": 3,
          "id": "build0",
          "consecutiveFailureThreshold": 5
        }
      },
      {
        "id": "5ba16b060be2d34a77757048",
        "name": "codeanalysis",
        "componentId": "5ba155820be2d339d2f24626",
        "options": {
          "id": "codeanalysis0"
        }
      }
    ],
    "owners": [
      {
        "username": "topo",
        "authType": "STANDARD"
      }
    ],
    "type": "Team",
    "application": {
      "name": "Testing",
      "components": [
        {

=====================================================
== File: src/test/resources/codequality/codequality.json
=====================================================
[
  {
    "id": "5ba950da0be2d3128858d322",
    "_class": "com.capitalone.dashboard.model.CodeQuality",
    "collectorItemId": "5ba136290be2d32568777fa9",
    "timestamp": 1537822938615,
    "name": "C1 Custom Env Var Inject",
    "url": "http://localhost:9000/dashboard/index/org.jenkins-ci.plugins:CustomC1EnvVarInject",
    "type": "StaticAnalysis",
    "version": "1.0.0-SNAPSHOT",
    "buildId": "5ba51c320be2d3f98f795044",
    "metrics": [
      {
        "name": "coverage",
        "value": "0.0",
        "formattedValue": "0.0%"
      },
      {
        "name": "new_vulnerabilities",
        "value": "",
        "formattedValue": ""
      },
      {
        "name": "violations",
        "value": "28",
        "formattedValue": "28"
      },
      {
        "name": "quality_gate_details",
        "value": "{\"level\":\"ERROR\",\"conditions\":[{\"metric\":\"new_security_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"new_reliability_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"new_maintainability_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"coverage\",\"op\":\"LT\",\"warning\":\"\",\"error\":\"80\",\"actual\":\"0.0\",\"level\":\"ERROR\"}]}",
        "formattedValue": "{\"level\":\"ERROR\",\"conditions\":[{\"metric\":\"new_security_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"new_reliability_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"new_maintainability_rating\",\"op\":\"GT\",\"period\":1,\"error\":\"1\",\"actual\":\"1\",\"level\":\"OK\"},{\"metric\":\"coverage\",\"op\":\"LT\",\"warning\":\"\",\"error\":\"80\",\"actual\":\"0.0\",\"level\":\"ERROR\"}]}%"
      },
      {
        "name": "sqale_index",
        "value": "203",
        "formattedValue": "3h 23min"
      },
      {
        "name": "critical_violations",
        "value": "1",
        "formattedValue": "1"
      },
      {
        "name": "blocker_violations",
        "value": "0",
        "formattedValue": "0"
      },
      {
        "name": "new_major_violations",
        "value": "",

=====================================================
== File: src/test/resources/test_results/test_results.json
=====================================================
[

  {
    "id" : "5803cd02edb9650aa33d205a",
    "collectorItemId" : "57f2a0193b55670a9e06d63a",
    "timestamp" : 1476644087024,
    "executionId" : "94",
    "buildId" : "5803cd02edb9650aa33d2059",
    "description" : " TEST-UI",
    "url" : "https://myjenkins.com/myjenkins/job/TEST-UI/",
    "startTime" : 1476643852954,
    "endTime" : 1476644086910,
    "duration" : 233956,
    "failureCount" : 0,
    "successCount" : 1,
    "skippedCount" : 0,
    "totalCount" : 1,
    "unknownStatusCount" : 0,
    "type" : "Functional",
    "targetAppName" : " -UI-SLATE",
    "targetEnvName" : "QAMB",
    "testCapabilities" : [
      {
        "timestamp" : 0,
        "executionId" : "94",
        "description" : "/json",
        "startTime" : 0,
        "endTime" : 0,
        "duration" : 161998,
        "failedTestSuiteCount" : 0,
        "successTestSuiteCount" : 1,
        "skippedTestSuiteCount" : 0,
        "totalTestSuiteCount" : 1,
        "unknownStatusTestSuiteCount" : 0,
        "status" : "Success",
        "type" : "Functional",
        "testSuites" : [
          {
            "id" : "validate-auto-loan-account-details",
            "description" : "Feature:Validate Auto Loan Account Details",
            "type" : "Functional",
            "startTime" : 0,
            "endTime" : 0,
            "duration" : 161998,
            "totalTestCaseCount" : 2,
            "failedTestCaseCount" : 0,
            "successTestCaseCount" : 2,
            "skippedTestCaseCount" : 0,
            "unknownStatusCount" : 0,
            "status" : "Success",

=====================================================
== File: src/test/resources/collector_items/items.json
=====================================================
[
  {
    "id": "5ba136220be2d32568777fa5",
    "_class": "com.capitalone.dashboard.model.CollectorItem",
    "description": "job/c1usercheck/",
    "niceName": "TopoJenkins",
    "enabled": false,
    "errors": [],
    "pushed": true,
    "collectorId": "5ba136220be2d32568777fa4",
    "lastUpdated": 1537548484342,
    "options": {
      "jobName": "job/c1usercheck/",
      "jobUrl": "http://localhost:8082/job/c1usercheck/",
      "instanceUrl": "http://localhost:8082/"
    }
  },
  {
    "id": "5ba136220be2d32568777fa6",
    "_class": "com.capitalone.dashboard.model.CollectorItem",
    "description": "job/c1usercheck2/",
    "niceName": "TopoJenkins",
    "enabled": false,
    "errors": [],
    "pushed": true,
    "collectorId": "5ba136220be2d32568777fa4",
    "lastUpdated": 1537548484342,
    "options": {
      "jobName": "job/c1usercheck2/",
      "jobUrl": "http://localhost:8082/job/c1usercheck2/",
      "instanceUrl": "http://localhost:8082/"
    }
  },
  {
    "id": "5ba136290be2d32568777fa9",
    "_class": "com.capitalone.dashboard.model.CollectorItem",
    "description": "C1 Custom Env Var Inject",
    "niceName": "TopoJenkins",
    "enabled": false,
    "errors": [],
    "pushed": true,
    "collectorId": "5ba136290be2d32568777fa8",
    "lastUpdated": 1537548487364,
    "options": {
      "projectName": "C1 Custom Env Var Inject",
      "projectId": "AWUfseU7tTiUsfWMVoi8",
      "instanceUrl": "http://localhost:9000"
    }
  },
  {

=====================================================
== File: src/test/resources/securityscan/securityscan.json
=====================================================
[
  {
    "_id": "5ac4f4e95470fb75445daaf6",
    "collectorItemId": "5b4e524333ec296b81c3935f",
    "timestamp": 1522855896054,
    "type": "SecurityAnalysis",
    "metrics": [
      {
        "name": "Score",
        "value": "89",
        "formattedValue": "89"
      },
      {
        "name": "Low",
        "value": "1",
        "formattedValue": "1",
        "status": "Ok"
      },
      {
        "name": "Medium",
        "value": "4",
        "formattedValue": "4",
        "status": "Warning"
      },
      {
        "name": "Critical",
        "value": "3",
        "formattedValue": "3",
        "status": "Alert"
      },
      {
        "name": "High",
        "value": "21",
        "formattedValue": "21",
        "status": "Alert"
      }
    ]
  }
]

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/FongoBaseRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import org.junit.Rule;
import org.junit.runner.RunWith;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.github.fakemongo.junit.FongoRule;

@ContextConfiguration(classes = { FongoConfig.class })
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public abstract class FongoBaseRepositoryTest {

    @Rule
    public FongoRule fongoRule = new FongoRule();
}

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/CollectorTaskTests.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.collector.CollectorTask;
import com.capitalone.dashboard.model.Collector;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.support.CronTrigger;

import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class CollectorTaskTests {

    @Mock private TaskScheduler taskScheduler;
    @Mock private BaseCollectorRepository<Collector> baseCollectorRepository;

    private CollectorTask<Collector> task;

    private static final String COLLECTOR_NAME = "Test Collector";

    @Before
    public void init() {
        task = new TestCollectorTask();
    }

    @Test
    public void run_collectorNotRegistered_savesNewCollector() {
        Collector c = new Collector();
        when(baseCollectorRepository.findByName(COLLECTOR_NAME)).thenReturn(null);
        when(baseCollectorRepository.save(any(Collector.class))).thenReturn(c);
        task.run();
        verify(baseCollectorRepository).save(any(Collector.class));
    }

    @Test
    public void run_enabled() {
    	Collector c = new Collector();
        c.setEnabled(true);
        long prevLastExecuted = c.getLastExecuted();

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/CollectorItemRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.testutil.FongoConfig;
import com.capitalone.dashboard.util.LoadTestData;
import com.github.fakemongo.junit.FongoRule;
import com.google.common.collect.Lists;
import org.bson.types.ObjectId;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static org.junit.Assert.assertEquals;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {FongoConfig.class})
@DirtiesContext
public class CollectorItemRepositoryTest {

    @Rule
    public FongoRule fongoRule = new FongoRule();

    @Autowired
    private CollectorItemRepository collectorItemRepository;

    @Test
    public void findAllByOptionNameValueAndCollectorIdsInReturns0() throws IOException {
        collectorItemRepository.deleteAll();
        LoadTestData.loadCollectorItems(collectorItemRepository);
        Iterable<CollectorItem> items = collectorItemRepository.findAllByOptionNameValueAndCollectorIdsIn("jobName", "job/", Collections.singletonList(new ObjectId("5ba136220be2d32568777fa4")));
        List<CollectorItem> itemList = Lists.newArrayList(items);
        assertEquals(itemList.size(),0);
    }

    @Test
    public void findAllByOptionNameValueAndCollectorIdsInReturns1() throws IOException {
        collectorItemRepository.deleteAll();
        LoadTestData.loadCollectorItems(collectorItemRepository);
        Iterable<CollectorItem> items = collectorItemRepository.findAllByOptionNameValueAndCollectorIdsIn("jobName", "job/c1usercheck/", Collections.singletonList(new ObjectId("5ba136220be2d32568777fa4")));

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/FongoConfig.java
=====================================================
package com.capitalone.dashboard.repository;

import org.springframework.context.annotation.Bean;

import com.capitalone.dashboard.config.MongoConfig;
import com.github.fakemongo.Fongo;
import com.mongodb.MongoClient;

public class FongoConfig extends MongoConfig {

    @Override
    @Bean
    public MongoClient mongo() throws Exception {
        return new Fongo(getDatabaseName()).getMongo();
    }
    
    @Override
    protected String getDatabaseName() {
        return "test-db";
    }
}

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/TemplateRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Template;
import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

public class TemplateRepositoryTest extends FongoBaseRepositoryTest {

    private static Template mockTemplate;

    @Autowired
    private TemplateRepository templateRepository;

    @Before
    public void setUp() {
        mockTemplate = new Template("template1", getWidgetsAndOrder(), getWidgetsAndOrder());
    }

    @After
    public void tearDown() {
        mockTemplate = null;
        templateRepository.deleteAll();
    }

    @Test
    public void validate_save() {
        templateRepository.save(mockTemplate);
        assertTrue(
                "Happy-path MongoDB connectivity validation for the FeatureRepository has failed",
                templateRepository.findAll().iterator().hasNext());
    }

    @Test
    public void validate_get() {
        templateRepository.save(mockTemplate);
        Template actual = templateRepository.findByTemplate("template1");
        assertEquals(actual.getTemplate(), mockTemplate.getTemplate());
    }

    @Test

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/AuthenticationRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.lang.reflect.Field;

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;

import com.capitalone.dashboard.model.Authentication;

public class AuthenticationRepositoryTest extends FongoBaseRepositoryTest {

	private static int testNumber = 0;

	private static String username  ;

	@Before
	public void updateUsername(){
		username = "usernameTest" + testNumber;
		testNumber++;
	}

    @Autowired
    private AuthenticationRepository authenticationRepository;


    /*
     * This test checks that adding a duplicate username will create an exception
     */
    @Test(expected=DuplicateKeyException.class)
    public void createDuplicateUserTest() {

    	String username = "username";

    	Authentication user1 = new Authentication(username, "pass1");

    	authenticationRepository.save(user1);

    	Authentication user2 = new Authentication(username, "pass2");

    	// This line should throw a DuplicateKeyException
    	authenticationRepository.save(user2);
    }


=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/FeatureRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.capitalone.dashboard.model.Feature;

public class FeatureRepositoryTest extends FongoBaseRepositoryTest {
	private static Feature mockV1Feature;
	private static Feature mockJiraFeature;
	private static Feature mockJiraFeature2;
	private static Feature mockJiraFeature3;
	private static Feature mockJiraFeature4;
	private static final String generalUseDate = "2015-11-01T00:00:00Z";
	private static final String generalUseDate2 = "2015-12-01T00:00:00Z";
	private static final String generalUseDate3 = "2015-12-15T00:00:00Z";
	private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
	private static Calendar cal = Calendar.getInstance();
	private static final String maxDateWinner = df.format(new Date());
	private static String maxDateLoser = new String();
	private static String currentSprintEndDate = new String();
	private static final ObjectId jiraCollectorId = new ObjectId();
//	private static final ObjectId v1CollectorId = new ObjectId();

	@Autowired
	private FeatureRepository featureRepo;

	@Before
	public void setUp() {
		// Date-time modifications
		cal.setTime(new Date());
		cal.add(Calendar.DAY_OF_YEAR, -1);
		maxDateLoser = df.format(cal.getTime());
		cal.add(Calendar.DAY_OF_YEAR, +13);
		currentSprintEndDate = df.format(cal.getTime());

		// Helper mock data

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/ScopeOwnerRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.ScopeOwnerCollectorItem;

public class ScopeOwnerRepositoryTest extends FongoBaseRepositoryTest {
	private static ScopeOwnerCollectorItem mockV1ScopeOwner;
	private static ScopeOwnerCollectorItem mockJiraScopeOwner;
	private static ScopeOwnerCollectorItem mockJiraScopeOwner2;
	private static CollectorItem mockBadItem;
	private static final String generalUseDate = "2015-11-01T00:00:00Z";
	private static final String olderThanGeneralUseDate = "2015-10-30T00:00:00Z";
	private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
	private static Calendar cal = Calendar.getInstance();
	private static final String maxDateWinner = df.format(new Date());
	private static String maxDateLoser = new String();
	private static final ObjectId jiraCollectorId = new ObjectId();
	private static final ObjectId v1CollectorId = new ObjectId();

	@Autowired
	private ScopeOwnerRepository scopeOwnerRepo;
	@Autowired
	private CollectorItemRepository badItemRepo;

	@Before
	public void setUp() {
		// Date-time modifications
		cal.setTime(new Date());
		cal.add(Calendar.DAY_OF_YEAR, -1);
		maxDateLoser = df.format(cal.getTime());

		// VersionOne Mock Scope
		mockV1ScopeOwner = new ScopeOwnerCollectorItem();
		mockV1ScopeOwner.setCollectorId(v1CollectorId);

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.testutil.FongoConfig;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;
import java.util.Objects;

import static org.junit.Assert.*;


public class RelatedCollectorItemRepositoryTest extends FongoBaseRepositoryTest {

    @Autowired
    private RelatedCollectorItemRepository relatedCollectorItemRepository;

    @Test
    public void saveRelatedItems() {
        relatedCollectorItemRepository.deleteAll();
        ObjectId left = ObjectId.get();
        ObjectId right = ObjectId.get();
        relatedCollectorItemRepository.saveRelatedItems(left, right, "some source", "some reason");
        List<RelatedCollectorItem> relatedCollectorItemList = Lists.newArrayList(relatedCollectorItemRepository.findAll());
        assertFalse(CollectionUtils.isEmpty(relatedCollectorItemList));
        assertEquals(1, relatedCollectorItemList.size());
        assertEquals(relatedCollectorItemList.get(0).getLeft(), left);
        assertEquals(relatedCollectorItemList.get(0).getRight(), right);
        assertTrue(relatedCollectorItemList.get(0).getReason().equalsIgnoreCase("some reason"));
        assertTrue(relatedCollectorItemList.get(0).getSource().equalsIgnoreCase("some source"));

    }

    @Test
    public void saveRelatedItemsDuplicate() {
        relatedCollectorItemRepository.deleteAll();
        ObjectId left = ObjectId.get();
        ObjectId right = ObjectId.get();
        RelatedCollectorItem rc = new RelatedCollectorItem();
        rc.setLeft(left);
        rc.setRight(right);

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/DashboardCreateTests.java
=====================================================

package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.*;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;

public class DashboardCreateTests extends FongoBaseRepositoryTest {

    @Autowired
    private DashboardRepository dashboardRepository;

    @Autowired
    private ComponentRepository componentRepository;

    @Autowired
    private CmdbRepository cmdbRepository;

    @Test
    public void createTeamDashboardTest() {
        Component component = new Component("Jay's component");
        component.setOwner("Jay");

        component = componentRepository.save(component);
        System.out.println(component.getId());

        Cmdb configItemApp = new Cmdb();
        configItemApp.setConfigurationItem("ASVTEST");
        configItemApp = cmdbRepository.save(configItemApp);


        Cmdb configItemComp = new Cmdb();
        configItemComp.setConfigurationItem("BAPTEST");
        configItemComp = cmdbRepository.save(configItemComp);


        Application application = new Application("Jay's App", component);

        List<String> activeWidgets = new ArrayList<>();
        List<Owner> owners = new ArrayList<Owner>();
        owners.add(new Owner("owner", AuthType.STANDARD));
        Dashboard dashboard = new Dashboard("Topo", "Jays's Dashboard", application, owners, DashboardType.Team,  configItemApp.getConfigurationItem(), configItemComp.getConfigurationItem(), activeWidgets, false, ScoreDisplayType.HEADER);

        Widget build = new Widget();

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/TeamRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.Team;
import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class TeamRepositoryTest extends FongoBaseRepositoryTest {
    private static Team mockV1Team;
    private static Team mockJiraTeam;
    private static Team mockJiraTeam2;
    private static CollectorItem mockBadItem;
    private static final String generalUseDate = "2015-11-01T00:00:00Z";
    private static final String olderThanGeneralUseDate = "2015-10-30T00:00:00Z";
    private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    private static Calendar cal = Calendar.getInstance();
    private static final String maxDateWinner = df.format(new Date());
    private static String maxDateLoser = new String();
    private static final ObjectId jiraCollectorId = new ObjectId();
    private static final ObjectId v1CollectorId = new ObjectId();

    @Autowired
    private TeamRepository teamRepo;
    @Autowired
    private CollectorItemRepository badItemRepo;

    @Before
    public void setUp() {
        // Date-time modifications
        cal.setTime(new Date());
        cal.add(Calendar.DAY_OF_YEAR, -1);
        maxDateLoser = df.format(cal.getTime());

        // VersionOne Mock Scope
        mockV1Team = new Team("", "");
        mockV1Team.setCollectorId(v1CollectorId);

=====================================================
== File: src/test/java/com/capitalone/dashboard/repository/ScopeRepositoryTest.java
=====================================================
package com.capitalone.dashboard.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.capitalone.dashboard.model.Scope;

public class ScopeRepositoryTest extends FongoBaseRepositoryTest {
	private static Scope mockV1Scope;
	private static Scope mockJiraScope;
	private static Scope mockJiraScope2;
	private static final String generalUseDate = "2015-11-01T00:00:00Z";
	private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
	private static Calendar cal = Calendar.getInstance();
	private static final String maxDateWinner = df.format(new Date());
	private static String maxDateLoser = new String();
	private static String currentScopeEndDate = new String();
	private static final ObjectId jiraCollectorId = new ObjectId();
	private static final ObjectId v1CollectorId = new ObjectId();

	@Autowired
	private ScopeRepository scopeRepo;

	@Before
	public void setUp() {
		// Date-time modifications
		cal.setTime(new Date());
		cal.add(Calendar.DAY_OF_YEAR, -1);
		maxDateLoser = df.format(cal.getTime());
		cal.add(Calendar.DAY_OF_YEAR, +13);
		currentScopeEndDate = df.format(cal.getTime());

		// VersionOne Mock Scope
		mockV1Scope = new Scope();
		mockV1Scope.setCollectorId(v1CollectorId);
		mockV1Scope.setIsDeleted("False");
		mockV1Scope.setChangeDate(maxDateLoser);
		mockV1Scope.setAssetState("Active");
		mockV1Scope.setBeginDate(maxDateLoser);

=====================================================
== File: src/test/java/com/capitalone/dashboard/util/HygieiaUtilsTest.java
=====================================================
package com.capitalone.dashboard.util;

import org.junit.Assert;
import org.junit.Test;

public class HygieiaUtilsTest {
    @Test
    public void checkForEmptyStringValuesTest() {
        boolean result = HygieiaUtils.checkForEmptyStringValues("", "test1", "test2");
        Assert.assertTrue(result);

        result = HygieiaUtils.checkForEmptyStringValues("test0", "test1", "test2");
        Assert.assertFalse(result);
    }
}

=====================================================
== File: src/test/java/com/capitalone/dashboard/util/TestUtils.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.BinaryArtifact;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.BuildStatus;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.CommitType;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.RepoBranch;
import com.capitalone.dashboard.model.SCM;
import org.bson.types.ObjectId;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


/**
 * Created by syq410 on 2/23/17.
 */
@Ignore
public class TestUtils {

    private static final ObjectId DASHBOARD_ID = new ObjectId();

    public static Commit createCommit(String revisionNumber,String scmUrl) {
        Commit commit = new Commit();
        commit.setScmRevisionNumber(revisionNumber);
        commit.setCollectorItemId(ObjectId.get());
        commit.setType(CommitType.New);
        commit.setScmUrl(scmUrl);
        return commit;
    }

    public static Pipeline getPipeline(ObjectId collectorItemId) {
        Pipeline pipeline = new Pipeline();
        pipeline.addCommit(PipelineStage.COMMIT.getName(), createPipelineCommit("scmRev3"));
        EnvironmentStage environmentStage = new EnvironmentStage();
        environmentStage.setLastArtifact(getBinaryArtifact());
        pipeline.getEnvironmentStageMap().put("DEV",environmentStage);
        Set<Build> failedBuilds = new HashSet<>();
        Build failedBuild = createBuild();
        failedBuild.setCollectorItemId(collectorItemId);

=====================================================
== File: src/test/java/com/capitalone/dashboard/util/EncryptionTests.java
=====================================================
package com.capitalone.dashboard.util;

import org.junit.Test;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

public class EncryptionTests {

	private final String THING_TO_BE_ENCRYPTED = "AKIAJ24MI4VLOIR72NVA";
	private final String A_GOOD_STRING_KEY = "5XBoZ7li2W5wzhOULEqtQzdkufjsVFs4";
	private final String A_LONG_KEY = "0ED1C7B771C9BBAB2583C364AFE8FB0C2F23A6FC8157EE3601ABB53D9CEA9893";
	private final String A_SHORT_KEY = "F55CC56E8DB6056EB4085263";
	private final String A_BAD_STRING_KEY = "c/t/nuBFwTgvB+lwzS/q5W0ZkQhhxCB1";
	private static final String ALGO = "DESede";
	private static final SecretKey GOOD_KEY = getKey();
	private static final SecretKey BAD_KEY = getKey();

	private static SecretKey getKey() {
		SecretKey key = null;
		try {
			key = KeyGenerator.getInstance(ALGO).generateKey();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
//		String stringKey = Base64.encodeBase64String(key.getEncoded());
		return key;
	}


	@Test
	public void testGetStringKey() {
		String key = null;
		try {
			key = Encryption.getStringKey();
		} catch (EncryptionException e) {
			e.printStackTrace();
		}
		assertNotEquals(null, key);
		assertNotEquals("", key);
	}

	@Test
	public void testGetSecretKey() {
		SecretKey key = null;
		try {

=====================================================
== File: src/test/java/com/capitalone/dashboard/util/PipelineUtilsTest.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.*;
import com.capitalone.dashboard.repository.CommitRepository;
import org.bson.types.ObjectId;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.capitalone.dashboard.util.TestUtils.createBuild;
import static com.capitalone.dashboard.util.TestUtils.createCommit;
import static com.capitalone.dashboard.util.TestUtils.getPipeline;
import static com.capitalone.dashboard.util.TestUtils.getScm;
import static org.junit.Assert.assertEquals;

/**
 * Created by syq410 on 2/23/17.
 */
@RunWith(MockitoJUnitRunner.class)
public class PipelineUtilsTest {

    private static final ObjectId DASHBOARD_ID = new ObjectId();
    @Mock
    private CommitRepository commitRepository;

    @Test
    public void testOrderForStages() {
        Map<String, String> ordermap = PipelineUtils.getOrderForStages(setupDashboard());
        assertEquals(ordermap.get("0"), "Commit");
        assertEquals(ordermap.get("1"), "Build");
        assertEquals(ordermap.get("2"), "dev");
        assertEquals(ordermap.get("3"), "qa");
        assertEquals(ordermap.get("4"), "int");

    }

    private Dashboard setupDashboard() {
        ObjectId configItemAppId = new ObjectId();
        ObjectId configItemComponetId = new ObjectId();
        List<String> activeWidgets = new ArrayList<>();
        List<Owner> owners = new ArrayList<Owner>();
        owners.add(new Owner("owner", AuthType.STANDARD));

=====================================================
== File: src/test/java/com/capitalone/dashboard/util/DashboardUtilsTest.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.FongoBaseRepositoryTest;
import org.bson.types.ObjectId;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Arrays;
import java.util.Set;

import static org.junit.Assert.*;

public class DashboardUtilsTest extends FongoBaseRepositoryTest{

    @Autowired
    private ComponentRepository componentRepository;

    @Autowired
    private CollectorRepository collectorRepository;

    @Autowired
    private CollectorItemRepository collectorItemRepository;


    @Test
    public void getUniqueCollectorItemIDsFromAllComponents() throws Exception {
        Component component1 = getComponent("TestComponent1");
        Collector collector1 = getCollector("TestCollector1",CollectorType.Build);
        CollectorItem collectorItem1 = getCollectorItem("TestCollectorItem1",collector1);
        component1.addCollectorItem(collector1.getCollectorType(), collectorItem1);
        Collector collector11 = getCollector("TestCollector1",CollectorType.SCM);
        CollectorItem collectorItem11 = getCollectorItem("TestCollectorItem11",collector11);
        component1.addCollectorItem(collector11.getCollectorType(), collectorItem11);

        Component component2 = getComponent("TestComponent2");
        CollectorItem collectorItem2 = getCollectorItem("TestCollectorItem2",collector11);
        component2.addCollectorItem(collector11.getCollectorType(), collectorItem2);


        Component component3 = getComponent("TestComponent2");
        component3.addCollectorItem(collector11.getCollectorType(), collectorItem2);

        componentRepository.save(Arrays.asList(component1,component2,component3));

=====================================================
== File: src/test/java/com/capitalone/dashboard/util/LoadTestData.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.LibraryPolicyResult;
import com.capitalone.dashboard.model.TestResult;
import com.capitalone.dashboard.repository.BuildRepository;
import com.capitalone.dashboard.repository.CodeQualityRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.LibraryPolicyResultsRepository;
import com.capitalone.dashboard.repository.TestResultRepository;
import com.capitalone.dashboard.testutil.GsonUtil;
import com.google.common.io.Resources;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.util.List;

public class LoadTestData {

    public static void loadDashBoard(DashboardRepository dashboardRepository) throws IOException {
        Gson gson = GsonUtil.getGson();
        String json = IOUtils.toString(Resources.getResource("./dashboard/dashboard.json"));
        List<Dashboard> dashboards = gson.fromJson(json, new TypeToken<List<Dashboard>>(){}.getType());
        dashboardRepository.save(dashboards);
    }

    public static void loadCollector (CollectorRepository collectorRepository) throws IOException {
        Gson gson = GsonUtil.getGson();
        String json = IOUtils.toString(Resources.getResource("./collectors/coll.json"));
        List<Collector> collector = gson.fromJson(json, new TypeToken<List<Collector>>(){}.getType());
        collectorRepository.save(collector);
    }

    public static void loadComponent(ComponentRepository componentRepository) throws IOException {
        Gson gson = GsonUtil.getGson();
        String json = IOUtils.toString(Resources.getResource("./component/component.json"));
        List<Component> components = gson.fromJson(json, new TypeToken<List<Component>>(){}.getType());
        componentRepository.save(components);
    }


=====================================================
== File: src/test/java/com/capitalone/dashboard/util/GitBranchSpecTest.java
=====================================================
package com.capitalone.dashboard.util;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;



public class GitBranchSpecTest {
    @Test
    public void testMatch() {

        GitBranchSpec l = new GitBranchSpec("master");
        assertTrue(l.matches("origin/master"));
        assertFalse(l.matches("origin/something/master"));
        assertTrue(l.matches("master"));
        assertFalse(l.matches("dev"));
        
        
        GitBranchSpec est = new GitBranchSpec("origin/*/dev");
        
        assertFalse(est.matches("origintestdev"));
        assertTrue(est.matches("origin/test/dev"));
        assertFalse(est.matches("origin/test/release"));
        assertFalse(est.matches("origin/test/somthing/release"));
        
        GitBranchSpec s = new GitBranchSpec("origin/*");
        
        assertTrue(s.matches("origin/master"));
      
        GitBranchSpec m = new GitBranchSpec("**/magnayn/*");
        
        assertTrue(m.matches("origin/magnayn/b1"));
        assertTrue(m.matches("remote/origin/magnayn/b1"));
        assertTrue(m.matches("remotes/origin/magnayn/b1"));
      
        GitBranchSpec n = new GitBranchSpec("*/my.branch/*");
        
        assertTrue(n.matches("origin/my.branch/b1"));
        assertFalse(n.matches("origin/my-branch/b1"));
        assertFalse(n.matches("remote/origin/my.branch/b1"));
        assertTrue(n.matches("remotes/origin/my.branch/b1"));
      
        GitBranchSpec o = new GitBranchSpec("**");
        
        assertTrue(o.matches("origin/my.branch/b1"));
        assertTrue(o.matches("origin/my-branch/b1"));
        assertTrue(o.matches("remote/origin/my.branch/b1"));

=====================================================
== File: src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskTwoWithGenericItem.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.GenericCollectorItem;
import com.capitalone.dashboard.repository.BaseCollectorRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.GenericCollectorItemRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class TestCollectorTaskTwoWithGenericItem extends CollectorTaskWithGenericItem<Collector> {

    private final CollectorRepository collectorRepository;

    @Autowired
    public TestCollectorTaskTwoWithGenericItem(TaskScheduler taskScheduler, CollectorItemRepository collectorItemRepository, GenericCollectorItemRepository genericCollectorItemRepository, RelatedCollectorItemRepository relatedCollectorItemRepository,
                                               CollectorRepository collectorRepository) {
        super(taskScheduler, "MyTool", collectorItemRepository, genericCollectorItemRepository, relatedCollectorItemRepository);
        this.collectorRepository = collectorRepository;
    }

    @Override
    public Map<String, Object> getGenericCollectorItemOptions(String serverUrl, GenericCollectorItem genericCollectorItem) {
        Map<String, Object> options = new HashMap<>();
        options.put("projectName", "C1 Custom Env Var Inject");
        options.put("instanceUrl", "http://localhost:9000");
        return options;
    }

    @Override
    public Collector getCollector() {
        Collector collector = new Collector();
        collector.setId(new ObjectId("5ba136290be2d32568777fa8"));
        collector.setName("MyTool");
        return collector;
    }

    @Override
    public BaseCollectorRepository<Collector> getCollectorRepository() {
        return collectorRepository;
    }


=====================================================
== File: src/test/java/com/capitalone/dashboard/collector/CollectorTaskTest.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.repository.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.scheduling.TaskScheduler;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;


@RunWith(MockitoJUnitRunner.class)
public class CollectorTaskTest {
    @Mock private TaskScheduler taskScheduler;

    private static final String COLLECTOR_NAME = "Test Collector";
    private CollectorTask<Collector> collector;

    @Before
    public void init() {
        collector = new CollectorTaskTest.TestCollectorTask();
    }

    @Test
    public void throttleRequestsTest_ratelimit_exceeded() {
        long startTime = System.currentTimeMillis() - 500;
        int requestCount = 5;
        long waitTime = 500;
        int requestRateLimit = 3;
        long requestRateLimitTimeWindow = 1000;

        CollectorTask<Collector> collectorSpy = Mockito.spy(collector);
        boolean result = collectorSpy.throttleRequests(startTime, requestCount,
                                                waitTime, requestRateLimit,
                                                requestRateLimitTimeWindow);
        assertEquals(true, result);
        verify(collectorSpy, times(1)).sleep(Mockito.anyLong());
    }

    @Test
    public void throttleRequestsTest_ratelimit_not_exceeded() {
        long startTime = System.currentTimeMillis() - 500;
        int requestCount = 2;
        long waitTime = 500;

=====================================================
== File: src/test/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItemTest.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.GenericCollectorItem;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.GenericCollectorItemRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import com.capitalone.dashboard.testutil.BaseCollectorTestConfig;
import com.capitalone.dashboard.testutil.FongoConfig;
import com.capitalone.dashboard.util.LoadTestData;
import com.github.fakemongo.junit.FongoRule;
import com.google.common.collect.Lists;
import org.bson.types.ObjectId;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {FongoConfig.class, BaseCollectorTestConfig.class})
public class CollectorTaskWithGenericItemTest {

    @Rule
    public FongoRule fongoRule = new FongoRule();

    @Autowired
    private CollectorItemRepository collectorItemRepository;

    @Autowired
    private GenericCollectorItemRepository genericCollectorItemRepository;

    @Autowired
    RelatedCollectorItemRepository relatedCollectorItemRepository;

    @Autowired
    TestCollectorTaskWithGenericItem testCollectorTaskWithGenericItem;


=====================================================
== File: src/test/java/com/capitalone/dashboard/collector/TestCollectorTaskWithGenericItem.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.GenericCollectorItem;
import com.capitalone.dashboard.repository.BaseCollectorRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.GenericCollectorItemRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class TestCollectorTaskWithGenericItem extends CollectorTaskWithGenericItem<Collector> {

    private final CollectorRepository collectorRepository;

    @Autowired
    public TestCollectorTaskWithGenericItem(TaskScheduler taskScheduler, CollectorItemRepository collectorItemRepository, GenericCollectorItemRepository genericCollectorItemRepository, RelatedCollectorItemRepository relatedCollectorItemRepository,
                                            CollectorRepository collectorRepository) {
        super(taskScheduler, "Sonar", collectorItemRepository, genericCollectorItemRepository, relatedCollectorItemRepository);
        this.collectorRepository = collectorRepository;
    }

    @Override
    public Map<String, Object> getGenericCollectorItemOptions(String serverUrl, GenericCollectorItem genericCollectorItem) {
        Map<String, Object> options = new HashMap<>();
        options.put("projectName", "C1 Custom Env Var Inject");
        options.put("instanceUrl", "http://localhost:9000");
        return options;
    }

    @Override
    public Collector getCollector() {
        Collector collector = new Collector();
        collector.setId(new ObjectId("5ba136290be2d32568777fa8"));
        collector.setName("Sonar");
        return collector;
    }

    @Override
    public BaseCollectorRepository<Collector> getCollectorRepository() {
        return collectorRepository;
    }


=====================================================
== File: src/test/java/com/capitalone/dashboard/model/DashboardTest.java
=====================================================
package com.capitalone.dashboard.model;

import com.capitalone.dashboard.util.PipelineUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertEquals;

@RunWith(MockitoJUnitRunner.class)
public class DashboardTest {

    @Test
    public void findEnvironmentMappings(){
        Dashboard dashboard = makeTeamDashboard("template", "title", "appName","" ,"ASVTEST","BAPTEST", "comp1", "comp2");
        dashboard.getWidgets().add(makePipelineWidget("DEV", "QA", null, null, "PROD"));
        Widget buildWidget = new Widget();
        buildWidget.setName("build");
        dashboard.getWidgets().add(buildWidget);

        Widget commitWidget = new Widget();
        commitWidget.setName("repo");
        dashboard.getWidgets().add(commitWidget);

        Map<PipelineStage, String> expected = new HashMap<>();
        expected.put(PipelineStage.valueOf("COMMIT"), "Commit");
        expected.put(PipelineStage.valueOf("BUILD"), "Build");
        expected.put(PipelineStage.valueOf("DEV"), "DEV");
        expected.put(PipelineStage.valueOf("QA"), "QA");
        expected.put(PipelineStage.valueOf("PROD"), "PROD");

        Map<PipelineStage, String> actual = PipelineUtils.getStageToEnvironmentNameMap(dashboard);
        assertEquals(expected, actual);
    }

    @Test
    public void findEnvironmentMappings_no_mappings_configured(){
        Dashboard dashboard = makeTeamDashboard("template", "title", "appName","","ASVTEST", "BAPTEST","comp1", "comp2");
        Map<PipelineStage, String> expected = new HashMap<>();

        Map<PipelineStage, String> actual = PipelineUtils.getStageToEnvironmentNameMap(dashboard);
        assertEquals(expected, actual);
    }

    private Dashboard makeTeamDashboard(String template, String title, String appName, String owner, String configItemAppName, String configItemComponentName, String... compNames) {

=====================================================
== File: src/test/java/com/capitalone/dashboard/model/LibraryPolicyResultTest.java
=====================================================
package com.capitalone.dashboard.model;

import org.junit.Test;

import java.util.Objects;
import java.util.Set;

import static org.junit.Assert.*;

public class LibraryPolicyResultTest {

    @Test
    public void addThreat() {
        LibraryPolicyResult result = new LibraryPolicyResult();
        result.addThreat(LibraryPolicyType.License, LibraryPolicyThreatLevel.Critical, LibraryPolicyThreatDisposition.Open, "component1");

        assertEquals(result.getThreats().size(), 1);
        assertEquals(result.getThreats().keySet().size(), 1);
        assertEquals(result.getThreats().values().size(), 1);
        assertEquals(result.getThreats().keySet().iterator().next(), LibraryPolicyType.License);
        Set<LibraryPolicyResult.Threat> threats = result.getThreats().get(LibraryPolicyType.License);
        LibraryPolicyResult.Threat threat = threats.iterator().next();
        assertEquals(threat.getCount(), 1);
        assertEquals(threat.getLevel(), LibraryPolicyThreatLevel.Critical);
        assertEquals(threat.getComponents().iterator().next(), "component1##Open");
        assertEquals(threat.getDispositionCounts().size(), 1);
        assertEquals(threat.getDispositionCounts().get(LibraryPolicyThreatDisposition.Open).intValue(), 1);


        result.addThreat(LibraryPolicyType.License, LibraryPolicyThreatLevel.Critical, LibraryPolicyThreatDisposition.Open, "component2");
        assertEquals(result.getThreats().size(), 1);
        assertEquals(result.getThreats().keySet().size(), 1);
        assertEquals(result.getThreats().values().size(), 1);
        assertEquals(result.getThreats().keySet().iterator().next(), LibraryPolicyType.License);
        threats = result.getThreats().get(LibraryPolicyType.License);
        assertEquals(threats.size(), 1);
        threat = threats.iterator().next();
        assertEquals(threat.getCount(), 2);
        assertEquals(threat.getLevel(), LibraryPolicyThreatLevel.Critical);
        assertTrue(threat.getComponents().contains( "component1##Open"));
        assertTrue(threat.getComponents().contains( "component2##Open"));
        assertEquals(threat.getDispositionCounts().size(), 1);
        assertEquals(threat.getDispositionCounts().get(LibraryPolicyThreatDisposition.Open).intValue(), 2);


        result.addThreat(LibraryPolicyType.License, LibraryPolicyThreatLevel.Critical, LibraryPolicyThreatDisposition.Closed, "component3");
        assertEquals(result.getThreats().size(), 1);
        assertEquals(result.getThreats().keySet().size(), 1);
        assertEquals(result.getThreats().values().size(), 1);
        assertEquals(result.getThreats().keySet().iterator().next(), LibraryPolicyType.License);

=====================================================
== File: src/test/java/com/capitalone/dashboard/model/StandardWidgetTest.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.junit.Test;

import java.util.Objects;

import static org.junit.Assert.*;

public class StandardWidgetTest {

    @Test
    public void getOptions() {
    }

    @Test
    public void testStandardwidget() {
        StandardWidget sw = new StandardWidget(CollectorType.Build, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("build"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "build0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("build"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "build0"));

        sw = new StandardWidget(CollectorType.SCM, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("repo"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "repo0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("repo"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "repo0"));

        sw = new StandardWidget(CollectorType.CodeQuality, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "codeanalysis0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "codeanalysis0"));

        sw = new StandardWidget(CollectorType.Test, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "codeanalysis0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "codeanalysis0"));

        sw = new StandardWidget(CollectorType.StaticSecurityScan, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getOptions().get("id"), "codeanalysis0"));
        assertTrue(sw.getWidget().getName().equalsIgnoreCase("codeanalysis"));
        assertTrue(Objects.equals(sw.getWidget().getOptions().get("id"), "codeanalysis0"));


        sw = new StandardWidget(CollectorType.LibraryPolicy, ObjectId.get());
        assertTrue(sw.getName().equalsIgnoreCase("codeanalysis"));

=====================================================
== File: src/test/java/com/capitalone/dashboard/model/ComponentTest.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.junit.Assert;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class ComponentTest {

    @Test
    public void testGetLastUpdatedCollectorItemForType() {
        Component component = new Component();
        List<CollectorItem> cItems = new ArrayList<>();
        cItems.add(makeCollectorItem(1537476665987L));
        cItems.add(makeCollectorItem(0));
        cItems.add(makeCollectorItem(1537471111111L));
        cItems.add(makeCollectorItem(1537472222222L));
        cItems.add(makeCollectorItem(1537473333333L));
        component.getCollectorItems().put(CollectorType.SCM, cItems);
        CollectorItem c = component.getLastUpdatedCollectorItemForType(CollectorType.SCM);
        Assert.assertArrayEquals(new long[]{1537476665987L}, new long[]{c.getLastUpdated()});

    }

    @Test
    public void testGetLastUpdatedCollectorItemForTypeForOneItem() {
        Component component = new Component();
        List<CollectorItem> cItems = new ArrayList<>();
        cItems.add(makeCollectorItem(1537473333333L));
        component.getCollectorItems().put(CollectorType.SCM, cItems);
        CollectorItem c = component.getLastUpdatedCollectorItemForType(CollectorType.SCM);
        Assert.assertArrayEquals(new long[]{1537473333333L}, new long[]{c.getLastUpdated()});

    }

    @Test
    public void testGetLastUpdatedCollectorItemForTypeForZero() {
        Component component = new Component();
        List<CollectorItem> cItems = new ArrayList<>();
        cItems.add(makeCollectorItem(1537473333333L));
        cItems.add(makeCollectorItem(0));
        component.getCollectorItems().put(CollectorType.SCM, cItems);
        CollectorItem c = component.getLastUpdatedCollectorItemForType(CollectorType.SCM);
        Assert.assertArrayEquals(new long[]{1537473333333L}, new long[]{c.getLastUpdated()});

    }

=====================================================
== File: src/test/java/com/capitalone/dashboard/event/EnvironmentComponentEventListenerTest.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.Application;
import com.capitalone.dashboard.model.AuthType;
import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.BinaryArtifact;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.model.EnvironmentComponent;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Owner;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.ScoreDisplayType;
import com.capitalone.dashboard.repository.BinaryArtifactRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.CommitRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.capitalone.dashboard.util.TestUtils.createBuild;
import static com.capitalone.dashboard.util.TestUtils.createCommit;
import static com.capitalone.dashboard.util.TestUtils.createPipelineCommit;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class EnvironmentComponentEventListenerTest {

=====================================================
== File: src/test/java/com/capitalone/dashboard/event/TestResultEventListenerTest.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.TestResult;
import com.capitalone.dashboard.model.TestCapability;
import com.capitalone.dashboard.model.TestSuiteType;
import com.capitalone.dashboard.model.TestCase;
import com.capitalone.dashboard.model.TestCaseStatus;
import com.capitalone.dashboard.model.TestCaseStep;
import com.capitalone.dashboard.model.TestSuite;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Performance;
import com.capitalone.dashboard.model.PerformanceType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PerformanceRepository;
import org.bson.types.ObjectId;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;

import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class TestResultEventListenerTest {

    @Mock
    private CollectorRepository collectorRepository;
    @Mock
    private CollectorItemRepository collectorItemRepository;
    @Mock
    private PerformanceRepository performanceRepository;
    @InjectMocks
    private TestResultEventListener testResultEventListener;
    private static final String COLLECTOR_NAME = "PerfTools";

=====================================================
== File: src/test/java/com/capitalone/dashboard/event/CommitEventListenerTest.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.Application;
import com.capitalone.dashboard.model.AuthType;
import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.CommitType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.model.Owner;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.ScoreDisplayType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class CommitEventListenerTest {

    @Mock
    private ComponentRepository componentRepository;

    @Mock
    private DashboardRepository dashboardRepository;

=====================================================
== File: src/test/java/com/capitalone/dashboard/event/BuildEventListenerTest.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.event.sync.SyncDashboard;
import com.capitalone.dashboard.model.Application;
import com.capitalone.dashboard.model.AuthType;
import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Owner;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.ScoreDisplayType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.CommitRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.capitalone.dashboard.util.TestUtils.createBuild;
import static com.capitalone.dashboard.util.TestUtils.createCommit;
import static com.capitalone.dashboard.util.TestUtils.createPipelineCommit;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;


@RunWith(MockitoJUnitRunner.class)
public class BuildEventListenerTest {


=====================================================
== File: src/test/java/com/capitalone/dashboard/event/sync/SyncDashboardTest.java
=====================================================
package com.capitalone.dashboard.event.sync;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.Widget;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.BuildRepository;
import com.capitalone.dashboard.repository.CodeQualityRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.LibraryPolicyResultsRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import com.capitalone.dashboard.repository.TestResultRepository;
import com.capitalone.dashboard.testutil.FongoConfig;
import com.capitalone.dashboard.util.LoadTestData;
import com.github.fakemongo.junit.FongoRule;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {FongoConfig.class})
@DirtiesContext

public class SyncDashboardTest {

=====================================================
== File: src/test/java/com/capitalone/dashboard/MarkdownTest.java
=====================================================
package com.capitalone.dashboard;

import com.google.common.base.Predicate;
import com.google.common.io.Files;
import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;

import javax.annotation.Nullable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.util.Locale;
import java.util.regex.Pattern;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class MarkdownTest {

    private Pattern absoluteLinkPattern = Pattern.compile(".*github.com/capitalone/Hygieia.*", Pattern.DOTALL);
    private File root;

    @Before
    public void before(){
        root = getProjectRoot();
    }

    @Test
    public void licenseInRoot(){
        File license = new File(root, "LICENSE");
        assertTrue(license.exists());
        license = null;
    }

    private static final Predicate<File> MARK_DOWN_PREDICATE = new Predicate<File>() {
        @Override
        public boolean apply(@Nullable File file) {
            return file != null && file.getName().endsWith(".md");
        }
    };

    //TODO: Review: disabled so we can explain how to setup a test example pointing to the Hygieia github, not sure this is really necessary.
    @Ignore
    @Test
    public void noAbsoluteLinksInMarkdown() throws Exception {

=====================================================
== File: src/main/resources/logback.xml
=====================================================
<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
      <pattern>%d %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>
  <root level="INFO">
      <appender-ref ref="STDOUT" />
  </root>

  <logger name="com.mongodb.FongoDBCollection" level="INFO"/>
  <logger name="com.github.fakemongo.impl.ExpressionParser" level="INFO"/>
</configuration>

=====================================================
== File: src/main/java/com/capitalone/dashboard/misc/HygieiaException.java
=====================================================
package com.capitalone.dashboard.misc;

public class HygieiaException extends Exception {
	private static final long serialVersionUID = 4596406816345733781L;
	public static final int NOTHING_TO_UPDATE = 0;
    public static final int JSON_FORMAT_ERROR = -1;
    public static final int COLLECTOR_CREATE_ERROR = -10;
    public static final int COLLECTOR_ITEM_CREATE_ERROR = -11;
    public static final int ERROR_INSERTING_DATA = -12;
    public static final int DUPLICATE_DATA = -13;
    public static final int BAD_DATA = -14;
    public static final int API_RATE_LIMIT_ERROR = -15;
    
    public static final int INVALID_CONFIGURATION = -999;
    
    private int errorCode = 0;

    public HygieiaException(String message, int errorCode) {
        super(message);
        this.errorCode = errorCode;
    }

    public HygieiaException(String message, Throwable cause, int errorCode) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public HygieiaException(Throwable cause) {
        super(cause);
    }

    public HygieiaException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public int getErrorCode() {
        return errorCode;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/AuditResultRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.AuditResult;
import com.capitalone.dashboard.model.AuditType;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;

public interface AuditResultRepository extends PagingAndSortingRepository<AuditResult, ObjectId> {

    AuditResult findById(ObjectId id);
    Page<AuditResult> findByAuditType(AuditType auditType, Pageable pageable);
    Iterable<AuditResult> findByDashboardTitle(String dashboardTitle);
    Iterable<AuditResult> findByDashboardTitleAndAuditType(String dashboardTitle, AuditType auditType);
    Iterable<AuditResult> findByConfigItemBusServNameAndConfigItemBusAppName(String configItemBusServName, String configItemBusAppName);
    Iterable<AuditResult> findByConfigItemBusServNameAndConfigItemBusAppNameAndAuditType(String configItemBusServName, String configItemBusAppName, AuditType auditType);
    Page<AuditResult> findByLineOfBusiness(String lineOfBusiness, Pageable pageable);
    Page<AuditResult> findByLineOfBusinessAndAuditType(String lineOfBusiness, AuditType auditType, Pageable pageable);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorItem;
import com.mysema.query.BooleanBuilder;
import com.mysema.query.types.path.PathBuilder;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * A {@link CollectorItem} repository
 */
public interface CollectorItemRepository extends BaseCollectorItemRepository<CollectorItem>, QueryDslPredicateExecutor<CollectorItem> {

    //// FIXME: 1/20/16 I really hate this dashboard specific method in the collectoritem repository, should we move the dashboardcollectoritem repository into core?
    @Query(value="{'options.dashboardId': ?1, 'collectorId': ?0 }")
    CollectorItem findTeamDashboardCollectorItemsByCollectorIdAndDashboardId(ObjectId collectorId, String dashboardId);
    @Query(value="{'options.applicationName' : ?1, 'collectorId' : ?0}")
    List<CollectorItem> findByOptionsAndDeployedApplicationName(ObjectId collectorId, String applicationName);

    // FIXME: 3/1/16 Really need to refactor this. Do not want collector specific lookups here.
    @Query(value="{'options.jobName' : ?2, 'niceName' : ?1, 'collectorId' : ?0}")
    CollectorItem findByCollectorIdNiceNameAndJobName(ObjectId collectorId, String niceName, String jobName);
    @Query(value="{'options.projectId' : ?2, 'niceName' : ?1, 'collectorId' : ?0}")
    CollectorItem findByCollectorIdNiceNameAndProjectId(ObjectId collectorId, String niceName, String projectId);

    @Query(value="{ 'collectorId' : ?0, options.url : {$regex : '^?1$', $options: 'i'}, options.branch : {$regex : '^?2$', $options: 'i'}, enabled : ?3}")
    CollectorItem findRepoByUrlAndBranch(ObjectId collectorId, String url, String branch, boolean enabled);

    @Query(value="{ 'collectorId': { $in: ?0 }, ?1 : {$regex : '.*?2.*', $options: 'i'}}")
    Page<CollectorItem> findByCollectorIdAndSearchField(List<ObjectId> collectorId, String searchField, String searchFieldValue, Pageable pageable);

    @Query(value="{ 'collectorId': { $in: ?0 }, ?1 : {$regex : '.*?2.*', $options: 'i'} ,  ?3 : {$regex : '.*?4.*', $options: 'i'}}")
    Page<CollectorItem> findByCollectorIdAndSearchFields(List<ObjectId> collectorId,String searchField1, String searchFieldValue1, String searchField2,String searchFieldValue2,  Pageable pageable);

    @Query(value="{'options.teamId' : ?0}")
    CollectorItem findByJiraTeamId(String teamId);

    @Query(value="{'options.projectId' : ?0}")
    CollectorItem findByJiraProjectId(String projectId);

    List<CollectorItem> findByDescription(String description);

    default Iterable<CollectorItem> findAllByOptionNameValue(String optionName, String optionValue) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ChangeOrderRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.ChangeOrder;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

/**
 * Repository for {@link ChangeOrder} data.
 */
public interface ChangeOrderRepository extends CrudRepository<ChangeOrder, ObjectId> {
    ChangeOrder findByChangeID(String changeItem);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/RequestLogRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.RequestLog;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

public interface RequestLogRepository extends CrudRepository<RequestLog, ObjectId> {
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryCustom.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.Map;

import com.capitalone.dashboard.model.BinaryArtifact;

public interface BinaryArtifactRepositoryCustom {
	String CANONICAL_NAME = "canonicalName";
	String ARTIFACT_GROUP_ID = "artifactGroupId";
	String ARTIFACT_MODULE = "artifactModule";
	String ARTIFACT_VERSION = "artifactVersion";
	String ARTIFACT_NAME = "artifactName";
	String ARTIFACT_CLASSIFIER = "artifactClassifier";
	String ARTIFACT_EXTENSION = "artifactExtension";
	String BUILD_INFO_ID = "buildInfo.id";
			
	Iterable<BinaryArtifact> findByAttributes(Map<String, Object> attributes);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/EnvironmentComponentRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.EnvironmentComponent;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * {@link EnvironmentComponent} repository.
 */
public interface EnvironmentComponentRepository extends CrudRepository<EnvironmentComponent, ObjectId> {

    /**
     * Finds the {@link EnvironmentComponent} collector item id, environment name and component name.
     *
     * @param collectorItemId collector item id
     * @param environmentName environment name
     * @param componentName component name
     * @return a {@link EnvironmentComponent}
     */
    @Query(value="{ collectorItemId : ?0, environmentName : ?1, componentName : ?2}")
    EnvironmentComponent findComponent(ObjectId collectorItemId, String environmentName, String componentName);

    /**
     * Finds all {@link EnvironmentComponent}s for a given {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @return list of {@link EnvironmentComponent}
     */
    List<EnvironmentComponent> findByCollectorItemId(ObjectId collectorItemId);

    @Query(value="{ 'collectorItemId': {$in: ?0 }, 'deployed': true}")
    List<EnvironmentComponent> findDeployedByCollectorItemIds(List<ObjectId> collectorItemIds);

    @Query(value="{ 'collectorItemId': ?0, 'componentName': ?1, 'componentVersion': ?2, 'deployed':true}")
    List<EnvironmentComponent> findDeployedByCollectorItemIdAndComponentNameAndComponentVersion(ObjectId dashboardCollectorItemId, String componentName, String componentVersion);

    @Query(value="{ 'collectorItemId': ?0, 'componentName': ?1, 'componentVersion': ?2, 'deployTime':?3}")
    EnvironmentComponent findByUniqueKey(ObjectId collectorItemId, String componentName, String componentVersion, long deployTime);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/GitHubRepoRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.webhook.github.GitHubRepo;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;

import java.util.List;

public interface GitHubRepoRepository extends BaseCollectorItemRepository<GitHubRepo>, QueryDslPredicateExecutor<GitHubRepo> {
    @Query(value="{ 'collectorId' : ?0, options.url : ?1, options.branch : ?2}")
    GitHubRepo findGitHubRepo(ObjectId collectorId, String url, String branch);

    @Query(value="{ 'collectorId' : ?0, enabled: true}")
    List<GitHubRepo> findEnabledGitHubRepos(ObjectId collectorId);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/AuthenticationRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import org.bson.types.ObjectId;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.capitalone.dashboard.model.Authentication;

public interface AuthenticationRepository extends PagingAndSortingRepository<Authentication, ObjectId>{
	
	
	 Authentication findByUsername(String username);


}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/GenericCollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.GenericCollectorItem;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Build} data.
 */
public interface GenericCollectorItemRepository extends CrudRepository<GenericCollectorItem, ObjectId>, QueryDslPredicateExecutor<GenericCollectorItem> {
    List<GenericCollectorItem> findAllByToolName(String toolName);
    List<GenericCollectorItem> findAllByRelatedCollectorItem (ObjectId relatedCollectorItemId);
    GenericCollectorItem findByToolNameAndRawDataAndRelatedCollectorItem(String toolName, String rawData, ObjectId relatedCollectorItem);
    List<GenericCollectorItem> findAllByToolNameAndProcessTimeEquals(String toolName, long processTime);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/RallyBurnDownRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.RallyBurnDownData;

public interface RallyBurnDownRepository extends CrudRepository<RallyBurnDownData, ObjectId>{
	
	RallyBurnDownData findByIterationIdAndProjectId(String iterationId, String projectId);
	
}
	

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CloudVolumeRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudVolumeStorage;
import com.capitalone.dashboard.model.NameValue;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;
import java.util.List;

public interface CloudVolumeRepository extends
        CrudRepository<CloudVolumeStorage, ObjectId>,
        QueryDslPredicateExecutor<CloudVolumeStorage> {

    @Query(value = "{ collectorItemId:  ?0 }")
    Collection<CloudVolumeStorage> findByCollectorItemId(ObjectId collectorItemId);

    @Query(value = "{volumeId : ?0}")
    CloudVolumeStorage findByVolumeId(String volumeId);

    @Query(value = "{ tags: ?0 }")
    Collection<CloudVolumeStorage> findByTags(List<NameValue> tags);

    @Query(value = "{ 'tags.name' : ?0, 'tags.value' : ?1 }")
    Collection<CloudVolumeStorage> findByTagNameAndValue(String name, String value);

    Collection<CloudVolumeStorage> findByVolumeIdIn(List<String> volumeId);

    Collection<CloudVolumeStorage> findByAttachInstancesIn(List<String> attachInstances);

    @Query(value = "{accountNumber : ?0}")
    Collection<CloudVolumeStorage> findByAccountNumber(String accountNumber);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/BuildRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.BuildStatus;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Build} data.
 */
public interface BuildRepository extends CrudRepository<Build, ObjectId>, QueryDslPredicateExecutor<Build> {

    /**
     * Finds the {@link Build} with the given number for a specific {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param number buld number
     * @return a {@link Build}
     */
    Build findByCollectorItemIdAndNumber(ObjectId collectorItemId, String number);

    @Query(value="{'sourceChangeSet.scmRevisionNumber' : {$exists: true, $in: ?0}, 'collectorItemId': { $in: ?1 }}")
    List<Build> findBuildsForRevisionNumbersAndBuildCollectorItemIds(List<String> scmRevisionNumbers, List<ObjectId> buildCollectorItemId);

    Build findTop1ByCollectorItemIdOrderByTimestampDesc(ObjectId collectorItemId);

    Build findTop1ByCollectorItemIdAndBuildStatusOrderByTimestampDesc(ObjectId collectorItemId, BuildStatus buildStatus);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ApiTokenRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.ApiToken;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface ApiTokenRepository extends CrudRepository<ApiToken, ObjectId> {
    ApiToken findByApiUserAndExpirationDt(String apiUser, Long expirationDt);
    ApiToken findByApiUserAndApiKey(String apiUser, String apiKey);
    List<ApiToken> findByApiUser(String apiUser);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQuery.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import org.bson.types.ObjectId;

import java.util.List;
import java.util.Map;


public interface CustomRepositoryQuery {
    List<CollectorItem> findCollectorItemsBySubsetOptions(ObjectId id, Map<String, Object> allOptions, Map<String, Object> uniqueOptions,Map<String,Object> uniqueOptionsFromCollector);
    List<Component> findComponents(Collector collector);
    List<Component> findComponents(CollectorType collectorType);
    List<Component> findComponents(Collector collector, CollectorItem collectorItem);
    List<Component> findComponents(ObjectId collectorId, CollectorType collectorType, CollectorItem collectorItem);
    List<Component> findComponents(ObjectId collectorId, CollectorType collectorType, ObjectId collectorItemId);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CloudInstanceHistoryRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudInstanceHistory;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;

public interface CloudInstanceHistoryRepository extends
        CrudRepository<CloudInstanceHistory, ObjectId> {

    Collection<CloudInstanceHistory> findByAccountNumber(String accountNumber);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/FortifyScanRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.FortifyScanReport;

public interface FortifyScanRepository extends CrudRepository<FortifyScanReport, ObjectId>{
	
	FortifyScanReport findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);

	List<FortifyScanReport> findByCollectorItemId(ObjectId id);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/IncidentRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Incident;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

/**
 * Repository for {@link Incident} data.
 */

public interface IncidentRepository extends MongoRepository<Incident, ObjectId> {
    Incident findByIncidentID(String incidentID);

    @Query("{ 'severity' : {$in : ?0} }")
    List<Incident> findBySeverity(String[] severityValues);

    @Query(value = "{'severity' : {$in : ?0}, 'openTime' : {$gt : ?1, $lt : ?2}}")
    Page<Incident> findIncidentsBySeverityAndOpenTimeBetween (String[] severityValues, long startDate, long endDate, Pageable pageable);

    @Query(value = "{'severity' : {$in : ?0}, 'openTime' : {$gt : ?1, $lt : ?2}}", count = true)
    long countIncidentsBySeverityAndOpenTimeBetween (String[] severityValues, long startDate, long endDate);

    @Query("{ 'collectorItemId' : {$in : ?0} }")
    List<Incident> findByCollectorItemId(List<ObjectId> collectorItemIds);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/JobRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;

import com.capitalone.dashboard.model.JobCollectorItem;

public interface JobRepository<T extends JobCollectorItem> extends BaseCollectorItemRepository<T> {
    @Query(value="{ 'collectorId' : ?0, options.instanceUrl : ?1, options.jobName : ?2}")
    T findJob(ObjectId collectorId, String instanceUrl, String jobName);

    @Query(value="{ 'collectorId' : ?0, options.jobUrl : ?1, options.jobName : ?2}")
    T findJobByJobUrl(ObjectId collectorId, String jobUrl, String jobName);

    @Query(value="{ 'collectorId' : ?0, options.instanceUrl : ?1, enabled: true}")
    List<T> findEnabledJobs(ObjectId collectorId, String instanceUrl);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.BinaryArtifact;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface BinaryArtifactRepository extends CrudRepository<BinaryArtifact, ObjectId>, BinaryArtifactRepositoryCustom {

    Iterable<BinaryArtifact> findByCollectorItemId(ObjectId collectorItemId);
    
    @Query("{ 'collectorItemId': ?0, 'artifactGroupId' : ?1, 'artifactModule' : ?2, 'artifactVersion' : ?3, 'artifactName' : ?4, 'artifactClassifier' : ?5, 'artifactExtension' : ?6 }")
    Iterable<BinaryArtifact> findByAttributes(Object collectorItemId, String artifactGroupId, String artifactModule, String artifactVersion, String artifactName, String artifactClassifier, String artifactExtension);
    
    @Query("{ 'artifactGroupId' : ?0, 'artifactModule' : ?1, 'artifactVersion' : ?2, 'artifactName' : ?3, 'artifactClassifier' : ?4, 'artifactExtension' : ?5 }")
    Iterable<BinaryArtifact> findByAttributes(String artifactGroupId, String artifactModule, String artifactVersion, String artifactName, String artifactClassifier, String artifactExtension);

    Iterable<BinaryArtifact> findByBuildInfoId (ObjectId artifactBuildId);

    Iterable<BinaryArtifact> findByArtifactNameAndTimestampGreaterThan(String artifactName, Long timestamp);
    Iterable<BinaryArtifact> findByArtifactNameAndArtifactExtensionAndTimestampGreaterThan(String artifactName, String artifactExtension, Long timestamp);

    @Query(value="{'metadata.buildUrl' : ?0}")
    Iterable<BinaryArtifact> findByMetadataBuildUrl(String buildUrl);

    List<BinaryArtifact> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/LibraryPolicyResultsRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.LibraryPolicyResult;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link CodeQuality} data.
 */
public interface LibraryPolicyResultsRepository extends CrudRepository<LibraryPolicyResult, ObjectId>, QueryDslPredicateExecutor<LibraryPolicyResult> {


    LibraryPolicyResult findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
    LibraryPolicyResult findByCollectorItemId(ObjectId collectorItemId);
    List<LibraryPolicyResult> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);
    List<LibraryPolicyResult> findByCollectorItemIdAndEvaluationTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/BinaryArtifactRepositoryImpl.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

import com.capitalone.dashboard.model.BinaryArtifact;

public class BinaryArtifactRepositoryImpl implements BinaryArtifactRepositoryCustom {	
	@Autowired
	MongoTemplate template;
	
	@Override
	public Iterable<BinaryArtifact> findByAttributes(Map<String, Object> attributes) {
		Criteria c = null;
		
		boolean first = true;
		for (Map.Entry<String, Object> e : attributes.entrySet()) {
			if (first) {
				c = Criteria.where(e.getKey()).is(e.getValue());
			} else {
				c = c.and(e.getKey()).is(e.getValue());
			}
			
			first = false;
		}
		
		return template.find(new Query(c), BinaryArtifact.class);
	}
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ServiceAccountRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.ServiceAccount;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

public interface ServiceAccountRepository extends CrudRepository<ServiceAccount, ObjectId> {

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ScopeRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.Scope;

/**
 * Repository for {@link Scope}.
 */
public interface ScopeRepository extends CrudRepository<Scope, ObjectId>,
		QueryDslPredicateExecutor<Scope> {
	/**
	 * This essentially returns the max change date from the collection, based
	 * on the last change date (or default delta change date property) available
	 * 
	 * @param collectorId
	 *            Collector ID of source system collector
	 * @param changeDate
	 *            Last available change date or delta begin date property
	 * @return A single Change Date value that is the maximum value of the
	 *         existing collection
	 */
	@Query
	List<Scope> findTopByCollectorIdAndChangeDateGreaterThanOrderByChangeDateDesc(
			ObjectId collectorId, String changeDate);

	@Query(value = "{'pId' : ?0}", fields="{'pId' : 1}")
	List<Scope> getScopeIdById(String pId);

	@Query
	List<Scope> findByOrderByProjectPathDesc();

	@Query(value = "{'pId' : ?0 }")
	List<Scope> getScopeById(String pId);

	@Query(value = "{ 'collectorId' : ?0 }")
	List<Scope> findByCollectorId(ObjectId collectorId);

	Page<Scope> findAllByCollectorIdAndNameContainingIgnoreCase(ObjectId collectorId, String name, Pageable pageable);

	Scope findByCollectorIdAndPId(ObjectId collectorId, String pId);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ScoreCriteriaSettingsRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.score.ScoreMetric;
import com.capitalone.dashboard.model.score.ScoreValueType;
import com.capitalone.dashboard.model.score.settings.ScoreCriteriaSettings;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

/**
 * Repository for {@link ScoreCriteriaSettings} data.
 */
public interface ScoreCriteriaSettingsRepository extends CrudRepository<ScoreCriteriaSettings, ObjectId>, QueryDslPredicateExecutor<ScoreMetric> {

    /**
     * Finds {@link ScoreCriteriaSettings}s for a given type {@link com.capitalone.dashboard.model.score.ScoreValueType}.
     *
     * @param type Score Value Type
     * @return a {@link ScoreCriteriaSettings}
     */
    ScoreCriteriaSettings findByType(ScoreValueType type);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CloudSubNetworkRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudInstance;
import com.capitalone.dashboard.model.CloudSubNetwork;
import com.capitalone.dashboard.model.NameValue;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;
import java.util.List;

public interface CloudSubNetworkRepository extends
        CrudRepository<CloudSubNetwork, ObjectId>,
        QueryDslPredicateExecutor<CloudInstance> {

    @Query(value = "{ collectorItemId:  ?0 }")
    CloudSubNetwork findByCollectorItemId(ObjectId collectorItemId);

    @Query(value= "{ tags: ?0 }")
    Collection<CloudSubNetwork> findByTags(List<NameValue> tags);


    @Query(value = "{subnetId : ?0}")
    CloudSubNetwork findBySubnetId(String subnetId);

    @Query(value = "{ 'tags.name' : ?0, 'tags.value' : ?1 }")
    Collection<CloudSubNetwork> findByTagNameAndValue(String name, String value);

    Collection<CloudSubNetwork> findBySubnetIdIn(List<String> subnetId);

    Collection<CloudSubNetwork> findByAccountNumber(String accountNumber);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CollItemConfigHistoryRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorItemConfigHistory;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface CollItemConfigHistoryRepository extends CrudRepository<CollectorItemConfigHistory, ObjectId>  {
	List<CollectorItemConfigHistory> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);
	CollectorItemConfigHistory findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/BaseCollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.capitalone.dashboard.model.CollectorItem;

/**
 * Base {@link CollectorItem} repository that provides methods useful for any {@link CollectorItem}
 * implementation.
 *
 * @param <T> Class that extends {@link CollectorItem}
 */
public interface BaseCollectorItemRepository<T extends CollectorItem> extends PagingAndSortingRepository<T, ObjectId> {

    /**
     * Finds all {@link CollectorItem}s that are enabled.
     *
     * @return list of {@link CollectorItem}s
     */
    List<T> findByEnabledIsTrue();

    /**
     * Finds all {@link CollectorItem}s that match the provided id's.
     *
     * @param ids {@link Collection} of ids
     * @return list of {@link CollectorItem}s
     */
    List<T> findByCollectorIdIn(Collection<ObjectId> ids);
    
    /**
     * Finds paged results of {@link CollectorItem}s that match the provided id's.
     *
     * @param ids {@link Collection} of ids
     * @param {@link org.springframework.data.domain.Pageable} object to determine which page to return
     * @return page of {@link CollectorItem}s
     */
    Page<T> findByCollectorIdInAndDescriptionContainingIgnoreCase(Collection<ObjectId> ids, String description, Pageable pageable);

    /**
     * Finds the {@link CollectorItem} for a given collector and options. This should represent a unique
     * instance of a {@link CollectorItem} for a given {@link com.capitalone.dashboard.model.Collector}.
     *

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/TeamRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Team;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Team}.
 */
public interface TeamRepository extends CrudRepository<Team, ObjectId>,
        QueryDslPredicateExecutor<Team> {

    Team findByTeamId(String teamId);

    Team findByName(String name);

    /**
     * This essentially returns the max change date from the collection, based
     * on the last change date (or default delta change date property) available
     *
     * @param collectorId
     *            Collector ID of source system collector
     * @param changeDate
     *            Last available change date or delta begin date property
     * @return A single Change Date value that is the maximum value of the
     *         existing collection
     */
    @Query(value = "{ 'collectorId' : ?0, 'changeDate' : {$gt: ?1}, '_class' : 'com.capitalone.dashboard.model.Team', 'assetState': 'Active'}")
    List<Team> findTopByChangeDateDesc(ObjectId collectorId, String changeDate);

    @Query(value = "{ 'collectorId' : ?0 }")
    List<Team> findByCollectorId(ObjectId collectorId);

    Page<Team> findAllByCollectorIdAndNameContainingIgnoreCase(ObjectId collectorId, String name, Pageable pageable);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CodeQualityRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CodeQuality;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link CodeQuality} data.
 */
public interface CodeQualityRepository extends CrudRepository<CodeQuality, ObjectId>, QueryDslPredicateExecutor<CodeQuality> {

    /**
     * Finds the {@link CodeQuality} data point at the given timestamp for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param timestamp timestamp
     * @return a {@link CodeQuality}
     */
    CodeQuality findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
    
    List<CodeQuality> findByCollectorItemIdAndVersionOrderByTimestampDesc (ObjectId collectorItemId,String version);

    List<CodeQuality> findByCollectorItemIdAndNameAndVersionOrderByTimestampDesc (ObjectId collectorItemId,String name,String version);
    
    List<CodeQuality> findByCollectorItemIdOrderByTimestampDesc (ObjectId collectorItemId);
    
    List<CodeQuality> findByNameAndVersion(String name,String version);

    List<CodeQuality> findByNameAndVersionOrderByTimestampDesc(String name,String version);

    List<CodeQuality> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);

    CodeQuality findTop1ByCollectorItemIdOrderByTimestampDesc(ObjectId collectorItemId);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryImpl.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import javax.xml.bind.DatatypeConverter;

import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.util.StringUtils;

import com.capitalone.dashboard.model.Feature;
import com.capitalone.dashboard.util.FeatureCollectorConstants;

/**
 * Repository for {@link Feature} with custom methods implementation.
 */
public class FeatureRepositoryImpl implements FeatureRepositoryCustom {

    @Autowired
    private MongoOperations operations;
    
    @Override
    @SuppressWarnings("PMD.NPathComplexity")
    public List<Feature> findByActiveEndingSprints(String sTeamId, String sProjectId, ObjectId collectorId, String currentISODateTime, boolean minimal) {
        boolean dateTimeValid = true;
        try {
            DatatypeConverter.parseDateTime(currentISODateTime);
        } catch (IllegalArgumentException e) {
            // invalid datetime string
            dateTimeValid = false;
        }
        String queryStr = dateTimeValid 
                ? "{'isDeleted' : 'False', $and : [{'sSprintID' : {$ne : null}}, {'sSprintID' : {$ne : ''}}, {'sSprintAssetState': { $regex: '^active$', $options: 'i' }}, {'sSprintEndDate' : {$gte : '" + currentISODateTime + "'}}, {'sSprintEndDate' : {$lt : '9999-12-31T59:59:59.999999'}}] }, $orderby: { 'sStatus' :-1 }" 
                : "{'isDeleted' : 'False', $and : [{'sSprintID' : {$ne : null}}, {'sSprintID' : {$ne : ''}}, {'sSprintAssetState': { $regex: '^active$', $options: 'i' }}, {'sSprintEndDate' : {$lt : '9999-12-31T59:59:59.999999'}}] }, $orderby: { 'sStatus' :-1 }";
        BasicQuery query = null;
        if (minimal) {
            query = new BasicQuery(queryStr,
                    "{'sStatus': 1, 'sNumber': 1, 'sName': 1, 'changeDate': 1, 'sUrl': 1, 'sSprintID': 1, 'sSprintName': 1, 'sSprintUrl': 1, 'sSprintBeginDate': 1, 'sSprintEndDate': 1, 'sEpicID' : 1,'sEpicNumber' : 1, 'sEpicName' : 1, 'sEpicUrl' : 1, 'sEstimate': 1, 'sEstimateTime': 1}");
        } else {
            query = new BasicQuery(queryStr);
        }
        if (collectorId != null) {
            query.addCriteria(Criteria.where("collectorId").is(collectorId));
        }
        if (!StringUtils.isEmpty(sTeamId) && !FeatureCollectorConstants.TEAM_ID_ANY.equalsIgnoreCase(sTeamId)) {
            query.addCriteria(Criteria.where("sTeamID").is(sTeamId));
        }

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/FeatureRepositoryCustom.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;

import com.capitalone.dashboard.model.Feature;

/**
 * Repository for {@link FeatureCollector} with custom methods.
 */
public interface FeatureRepositoryCustom {
    
    /**
     * Find all features with active sprints that are between the provided date and that have an end date < 9999-12-31 EOD
     * 
     * @param sTeamId
     * @param sProjectId
     * @param currentISODateTime
     * @param minimal
     * @return
     */
    List<Feature> findByActiveEndingSprints(String sTeamId, String sProjectId, ObjectId collectorId, String currentISODateTime, boolean minimal);

    /**
     * Find all features that have sprints set but without an end date (or an end date >= 9999-12-31 EOD)
     * 
     * @param sTeamId
     * @param sProjectId
     * @param minimal
     * @return
     */
    List<Feature> findByUnendingSprints(String sTeamId, String sProjectId, ObjectId collectorId, boolean minimal);
    
    /**
     * Find all features without sprints set
     * 
     * @param sTeamId
     * @param sProjectId
     * @param minimal
     * @return
     */
    List<Feature> findByNullSprints(String sTeamId, String sProjectId, ObjectId collectorId, boolean minimal);
    
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/DashboardRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.model.Owner;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.Collection;
import java.util.List;

/**
 * {@link Dashboard} repository.
 */
public interface DashboardRepository extends PagingAndSortingRepository<Dashboard, ObjectId> {
	
	List<Dashboard> findByOwner(String owner);

	List<Dashboard> findByOwners(Owner owner);
	List<Dashboard> findByOwnersAndTypeContainingIgnoreCase(Owner owner, String type);

	List<Dashboard> findByTitle(String title);
	Dashboard findByTitleAndType(String title, DashboardType type);

    List<Dashboard> findByApplicationComponentsIn(Collection<Component> components);

    @Query(value="{'application.components.$id': {$in : ?0 }}")
    List<Dashboard> findByApplicationComponentIdsIn(Collection<ObjectId> componentIds);

	@Query(value="{'type': {$in : [null, 'Team']}}")
	List<Dashboard> findTeamDashboards();

	@Query(value="{'widgets.options.teams.collectorItemId': ?0 }")
	List<Dashboard> findProductDashboardsByTeamDashboardCollectorItemId(String teamDashboardCollectorItemId);

	Iterable<Dashboard> findAllByConfigurationItemBusServName(String configurationItem);

	Iterable<Dashboard> findAllByConfigurationItemBusAppName(String configurationItem);

	Iterable<Dashboard> findAllByConfigurationItemBusServNameIn(List<String> configurationItemList);

	Iterable<Dashboard> findAllByConfigurationItemBusServNameAndConfigurationItemBusAppName(String appName, String compName);

	Dashboard findByConfigurationItemBusServNameIgnoreCaseAndConfigurationItemBusAppNameIgnoreCase(String appName, String compName);
	List<Dashboard> findAllByTypeAndConfigurationItemBusServNameContainingIgnoreCase(DashboardType type, String appName);
	List<Dashboard> findAllByConfigurationItemBusServNameContainingIgnoreCaseAndConfigurationItemBusAppNameContainingIgnoreCase(String appName, String compName);

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/TemplateRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Template;
import org.bson.types.ObjectId;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * {@link Template} repository.
 */
public interface TemplateRepository extends PagingAndSortingRepository<Template, ObjectId> {

    Template findByTemplate(String template);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ScoreRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.score.ScoreMetric;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.CodeQuality;

/**
 * Repository for {@link CodeQuality} data.
 */
public interface ScoreRepository extends CrudRepository<ScoreMetric, ObjectId>, QueryDslPredicateExecutor<ScoreMetric> {

    /**
     * Finds the {@link ScoreMetric} data point at the given timestamp for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param timestamp timstamp
     * @return a {@link CodeQuality}
     */
    ScoreMetric findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);

    /**
     * Finds all {@link ScoreMetric}s for a given {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @return list of {@link ScoreMetric}
     */
    ScoreMetric findByCollectorItemId(ObjectId collectorItemId);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CloudInstanceRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudInstance;
import com.capitalone.dashboard.model.NameValue;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;
import java.util.List;

public interface CloudInstanceRepository extends
        CrudRepository<CloudInstance, ObjectId>,
        QueryDslPredicateExecutor<CloudInstance> {

    @Query(value = "{instanceId : ?0}")
    CloudInstance findByInstanceId(String instanceId);

    @Query(value = "{ tags: ?0 }")
    Collection<CloudInstance> findByTags(List<NameValue> tags);

    @Query(value = "{ 'tags.name' : ?0, 'tags.value' : ?1 }")
    Collection<CloudInstance> findByTagNameAndValue(String name, String value);

    Collection<CloudInstance> findByInstanceIdIn(List<String> instanceId);

    @Query(value = "{accountNumber : ?0}")
    Collection<CloudInstance> findByAccountNumber(String accountNumber);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CmdbRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Cmdb;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
/**
 * Repository for {@link Cmdb} data.
 */
public interface CmdbRepository extends CrudRepository<Cmdb, ObjectId>  {

    Cmdb findByConfigurationItem(String configurationItem);

    List<Cmdb> findAllByConfigurationItemContainingOrCommonNameContainingAllIgnoreCase(String configItemFilter, String commonNameFilter);

    Page<Cmdb> findAllByItemTypeAndValidConfigItemAndIdIn(String itemType, boolean valid, List<ObjectId> idList, Pageable pageable);

    Page<Cmdb> findAllByItemTypeAndConfigurationItemContainingIgnoreCaseAndValidConfigItem(String itemType, String configurationItem, Pageable pageable, boolean valid);

    Cmdb findByConfigurationItemIgnoreCase(String configurationItem);

    List<Cmdb> findAllByItemType(String type);

    List<Cmdb> findAllByItemTypeAndValidConfigItem(String type, boolean valid);

    Cmdb findByConfigurationItemAndItemType(String confiugrationItem, String itemType);

    Iterable<Cmdb> findAllByValidConfigItem(boolean validFlag);

    Cmdb findByConfigurationItemIgnoreCaseOrCommonNameIgnoreCase(String configurationItem, String commonName);

    Cmdb findByItemTypeAndCommonNameContainingIgnoreCase(String itemType, String commonName);

    Cmdb findByItemTypeAndConfigurationItemIgnoreCase(String itemType, String configurationItem);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CloudVirtualNetworkRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CloudInstance;
import com.capitalone.dashboard.model.CloudVirtualNetwork;
import com.capitalone.dashboard.model.NameValue;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.Collection;
import java.util.List;

public interface CloudVirtualNetworkRepository extends
        CrudRepository<CloudVirtualNetwork, ObjectId>,
        QueryDslPredicateExecutor<CloudInstance> {

    @Query(value = "{ collectorItemId:  ?0 }")
    CloudVirtualNetwork findByCollectorItemId(ObjectId collectorItemId);

    @Query(value= "{ tags: ?0 }")
    Collection<CloudVirtualNetwork> findByTags(List<NameValue> tags);


    @Query(value = "{virtualNetorkId : ?0}")
    CloudVirtualNetwork findByVirtualNetworkId(String virtualNetworkId);

    @Query(value = "{ 'tags.name' : ?0, 'tags.value' : ?1 }")
    Collection<CloudVirtualNetwork> findByTagNameAndValue(String name, String value);

    Collection<CloudVirtualNetwork> findByvirtualNetworkIdIn(List<String> virtualNetworkId);

    @Query(value = "{accountNumber : ?0}")
    Collection<CloudVirtualNetwork> findByAccountNumber(String accountNumber);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ScoreCollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;

import com.capitalone.dashboard.model.score.ScoreCollectorItem;

/**
 * Repository for {@link ScoreCollectorItem}s.
 */
public interface ScoreCollectorItemRepository extends BaseCollectorItemRepository<ScoreCollectorItem> {

  /**
   * Finds all enabled {@link ScoreCollectorItem}s
   *
   * @param collectorId ID
   * @return list of {@link ScoreCollectorItem}s
   */
  @Query(value = "{ 'collectorId' : ?0, enabled: true}")
  List<ScoreCollectorItem> findEnabledScores(ObjectId collectorId);

  @Query(value="{'collectorId': ?0, 'options.dashboardId': ?1}")
  ScoreCollectorItem findCollectorItemByCollectorIdAndDashboardId(ObjectId collectorId, ObjectId dashboardId);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/UserInfoRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.Collection;

import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.AuthType;
import com.capitalone.dashboard.model.UserInfo;
import com.capitalone.dashboard.model.UserRole;

public interface UserInfoRepository extends CrudRepository<UserInfo, ObjectId>{

	UserInfo findByUsernameAndAuthType(String username, AuthType authType);

    Collection<UserInfo> findByAuthoritiesIn(UserRole roleAdmin);

    Iterable<UserInfo> findByOrderByUsernameAsc();

    UserInfo findByUsername(String userName);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ScopeOwnerRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;

import com.capitalone.dashboard.model.ScopeOwnerCollectorItem;

/**
 * CollectorItem repository for {@link ScopeOwnerCollectorItem}.
 */
public interface ScopeOwnerRepository extends BaseCollectorItemRepository<ScopeOwnerCollectorItem> {
	@Query(value = "{ 'collectorId' : ?0, 'options.teamId' : ?1, 'options.assetState': 'Active'}")
	ScopeOwnerCollectorItem findTeamCollector(ObjectId collectorId, String teamId);
	
	@Query(value = "{ 'collectorId' : ?0, 'options.teamId' : ?1, options.name : ?2, 'options.assetState': 'Active'}")
	ScopeOwnerCollectorItem findTeamCollector(ObjectId collectorId, String teamId, String name);

	@Query(value = "{ 'collectorId' : ?0, 'options.teamId' : ?1, enabled: true, 'options.assetState': 'Active'}")
	List<ScopeOwnerCollectorItem> findEnabledTeamCollectors(ObjectId collectorId, String teamId);

	/**
	 * This essentially returns the max change date from the collection, based
	 * on the last change date (or default delta change date property) available
	 * 
	 * @param collectorId
	 *            Collector ID of source system collector
	 * @param changeDate
	 *            Last available change date or delta begin date property
	 * @return A single Change Date value that is the maximum value of the
	 *         existing collection
	 */
	@Query(value = "{ 'collectorId' : ?0, 'options.changeDate' : {$gt: ?1}, '_class' : 'com.capitalone.dashboard.model.ScopeOwnerCollectorItem', 'options.assetState': 'Active'}")
	List<ScopeOwnerCollectorItem> findTopByChangeDateDesc(ObjectId collectorId, String changeDate);

	@Query(value = "{'options.teamId' : ?0}", fields = "{'options.teamId' : 1}")
	List<ScopeOwnerCollectorItem> getTeamIdById(String teamId);

	@Query(value = "{'options.assetState' : ?0}", delete = true)
	List<ScopeOwnerCollectorItem> delete(String assetState);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.mysema.query.BooleanBuilder;
import com.mysema.query.types.path.PathBuilder;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
import java.util.Map;

/**
 * {@link Component} repository.
 */
public interface ComponentRepository extends CrudRepository<Component, ObjectId>,QueryDslPredicateExecutor<Component> {


    @Query(value = "{'collectorItems.SCM._id': ?0}")
    List<Component> findBySCMCollectorItemId(ObjectId scmCollectorItemId);

    @Query(value="{'collectorItems.Build._id': ?0}")
    List<Component> findByBuildCollectorItemId(ObjectId buildCollectorItemId);

    @Query(value="{'collectorItems.Deployment._id': ?0}")
    List<Component> findByDeployCollectorItemId(ObjectId deployCollectorItemId);

    @Query(value="{'collectorItems.Incident.enabled' : ?0}")
    List<Component> findByIncidentCollectorItems(boolean enabled);


    default List<Component> findByCollectorTypeAndItemIdIn(CollectorType collectorType, List<ObjectId> collectorItemIds) {
        BooleanBuilder builder = new BooleanBuilder();
        PathBuilder<Component> path = new PathBuilder<>(Component.class, "components");
        builder.and(path.get("collectorItems", Map.class).get(collectorType.toString(),List.class).get("id", ObjectId.class).in(collectorItemIds));
        return (List<Component>) findAll(builder.getValue());
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/Monitor2Repository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Monitor2;
import org.bson.types.ObjectId;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface Monitor2Repository extends PagingAndSortingRepository<Monitor2, ObjectId> {

    /**
     * Find all {@link Monitor2}s for a given {@link com.capitalone.dashboard.model.Dashboard}.
     *
     * @param dashboardId dashboard id
     * @return list of {@link Monitor2}s
     */
    List<Monitor2> findByDashboardId(ObjectId dashboardId);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/RelatedCollectorItemRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Build} data.
 */
public interface RelatedCollectorItemRepository extends CrudRepository<RelatedCollectorItem, ObjectId>, QueryDslPredicateExecutor<RelatedCollectorItem> {
    List<RelatedCollectorItem> findRelatedCollectorItemByLeft(ObjectId left);
    List<RelatedCollectorItem> findRelatedCollectorItemByRight(ObjectId right);
    List<RelatedCollectorItem> findAllByLeftAndRight(ObjectId left, ObjectId right);

    default RelatedCollectorItem saveRelatedItems(ObjectId left, ObjectId right, String source, String reason) {
        List<RelatedCollectorItem> items = findAllByLeftAndRight(left, right);
        if (!CollectionUtils.isEmpty(items)) {
            this.delete(items);
        }
        RelatedCollectorItem related = new RelatedCollectorItem();
        related.setLeft(left);
        related.setRight(right);
        related.setCreationTime(System.currentTimeMillis());
        related.setSource(source);
        related.setReason(reason);
        return save(related);
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/PipelineRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Pipeline;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface PipelineRepository extends CrudRepository<Pipeline, ObjectId>, QueryDslPredicateExecutor<Pipeline> {

    Pipeline findByCollectorItemId(ObjectId collectorItemId);

    List<Pipeline> findByCollectorItemIdIn(List<ObjectId> collectorItemIds);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ConfigurationRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.Configuration;


public interface ConfigurationRepository extends CrudRepository<Configuration, ObjectId> , QueryDslPredicateExecutor<Configuration>{

	Configuration findByCollectorName(String collectorNiceName);
	
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/RallyFeatureRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.RallyFeature;

/**
 * Repository for {@link CodeQuality} data.
 */
public interface RallyFeatureRepository extends CrudRepository<RallyFeature, ObjectId>, QueryDslPredicateExecutor<RallyFeature> {

    /**
     * Finds the {@link Rallyfeature} data point at the given timestamp for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param timestamp timstamp
     * @return a {@link RallyFeature}
     */
    RallyFeature findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
    
    
    @Query(value="{'projectId' : ?0}")
    List<RallyFeature> findByIterationLists(String projectId);
  
    @Query(value="{'projectId' : ?0, options.iterationId : ?1}")
    RallyFeature findByRallyWidgetDetails(String projectId,String iterationId);
    
    @Query(value="{'collectorItemId' :?0}")
    List<RallyFeature> findByProjectIterationId(Object collectorItemId);
    
    List<RallyFeature> findByCollectorItemIdAndRemainingDaysNot(Object collectorItemId, int remainginDays);
    

	List<RallyFeature> findByProjectId(String projectId);
    
}


=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CommitRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Commit;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Commit} data.
 */
public interface CommitRepository extends CrudRepository<Commit, ObjectId>, QueryDslPredicateExecutor<Commit> {

    /**
     * Finds the {@link Commit} with the given revision number for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @param revisionNumber revision number
     * @return a {@link Commit}
     */
    Commit findByCollectorItemIdAndScmRevisionNumber(ObjectId collectorItemId, String revisionNumber);

    Long countCommitsByCollectorItemId(ObjectId collectorItemId);

    Commit findByScmUrlIgnoreCaseAndScmBranchIgnoreCaseAndScmRevisionNumber (String scmUrl, String scmBranch, String scmRevisionNumber);

    List<Commit> findByScmRevisionNumber (String scmUrl);

    List<Commit> findByScmUrlIgnoreCaseAndScmBranch (String scmUrl, String scmBranch);

    Commit findByScmRevisionNumberAndScmUrlIgnoreCaseAndScmBranchIgnoreCase(String scmRevisionNumber, String scmUrl, String branch);

    List<Commit> findAllByScmRevisionNumberAndScmUrlIgnoreCaseAndScmBranchIgnoreCaseOrderByTimestampAsc (String scmRevisionNumber, String scmUrl, String branch);

    @Query(value="{ 'collectorItemId': ?0, 'scmCommitTimestamp': { $gt: ?1 }}")
    List<Commit> findByCollectorItemIdAndScmCommitTimestamp(ObjectId collectorItemid, Long scmCommitTimestampThreshold);

    List<Commit> findByScmUrlIgnoreCaseAndScmBranchIgnoreCaseAndScmCommitTimestampIsBetween(String scmUrl, String scmBranch, long beginDate, long endDate);

    List<Commit> findByCollectorItemIdAndScmCommitTimestampIsBetween(ObjectId collectorItemId, long beginDate, long endDate);

    List<Commit> findCommitsByCollectorItemIdAndTimestampAfterAndPullNumberIsNull(ObjectId collectorItemId, long beginDate);

    Commit findByScmRevisionNumberAndScmAuthorIgnoreCaseAndScmCommitLogAndScmCommitTimestamp(String scmRevisionNumber, String scmAuthor, String scmCommitLog, long scmCommitTimestamp);

    List<Commit> findAllByScmRevisionNumberAndScmAuthorIgnoreCaseAndScmCommitLogAndScmCommitTimestamp(String scmRevisionNumber, String scmAuthor, String scmCommitLog, long scmCommitTimestamp);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CodeReposBuildsRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.CodeReposBuilds;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

/**
 * Repository for {@link CodeReposBuilds} data.
 */
public interface CodeReposBuildsRepository extends CrudRepository<CodeReposBuilds, ObjectId>, QueryDslPredicateExecutor<CodeReposBuilds> {

    CodeReposBuilds findByCodeRepo(String codeRepo);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/MaturityModelRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.MaturityModel;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface MaturityModelRepository extends CrudRepository<MaturityModel, ObjectId>, QueryDslPredicateExecutor<MaturityModel> {
    MaturityModel findByProfile(String profile);

    @Query(value="{}", fields="{ profile : 1 }")
    List<String> getAllProfiles();
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/RepositoryPackage.java
=====================================================
package com.capitalone.dashboard.repository;

/**
 * Marker interface for repository scanning
 */
public interface RepositoryPackage {
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/EnvironmentStatusRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.EnvironmentStatus;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * {@link EnvironmentStatus} repository.
 */
public interface EnvironmentStatusRepository extends CrudRepository<EnvironmentStatus, ObjectId> {

    /**
     * Finds all {@link EnvironmentStatus}es for a given {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item id
     * @return list of {@link EnvironmentStatus}es.
     */
    List<EnvironmentStatus> findByCollectorItemId(ObjectId collectorItemId);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/TeamInventoryRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Scope;
import com.capitalone.dashboard.model.TeamInventory;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link Scope}.
 */
public interface TeamInventoryRepository extends CrudRepository<TeamInventory, ObjectId>,
		QueryDslPredicateExecutor<TeamInventory> {

	@Query(value = "{ 'collectorId' : ?0 }")
	List<TeamInventory> findByCollectorId(ObjectId collectorId);

	TeamInventory findByNameAndTeamId(String name, String teamId);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/PerformanceRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Performance;
import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface PerformanceRepository extends CrudRepository<Performance, ObjectId>, QueryDslPredicateExecutor<Performance> {

    Performance findByCollectorItemIdAndTimestamp(ObjectId collectorItemId, long timestamp);
    List<Performance> findByCollectorItemId (ObjectId collectorItemId);


}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CollectorRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorType;
import org.bson.types.ObjectId;

import java.util.List;

/**
 * A {@link Collector} repository
 */
public interface CollectorRepository extends BaseCollectorRepository<Collector> {

    List<Collector> findById(ObjectId id);
    List<Collector> findAllByCollectorType(CollectorType collectorType);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/ServiceRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Service;
import org.bson.types.ObjectId;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * A {@link Service} repository
 */
public interface ServiceRepository extends PagingAndSortingRepository<Service, ObjectId> {

    /**
     * Find all {@link Service}s for a given {@link com.capitalone.dashboard.model.Dashboard}.
     *
     * @param dashboardId dashboard id
     * @return list of {@link Service}s
     */
    List<Service> findByDashboardId(ObjectId dashboardId);

    /**
     * Find all dependent {@link Service}s for a given {@link com.capitalone.dashboard.model.Dashboard}.
     *
     * @param dashboardId dashboard id
     * @return list of {@link Service}s
     */
    List<Service> findByDependedBy(ObjectId dashboardId);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/GitRequestRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.GitRequest;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Repository for {@link GitRequest} data.
 */
public interface GitRequestRepository  extends CrudRepository<GitRequest, ObjectId>, QueryDslPredicateExecutor<GitRequest> {


    List<GitRequest> findByCollectorItemIdAndRequestType(ObjectId collectorItemId, String requestType);

    @Query(value="{ 'collectorItemId' : ?0, 'requestType' : ?1}", fields="{ 'number' : 2, 'updatedAt' : 3 }")
    List<GitRequest> findRequestNumberAndLastUpdated(ObjectId collectorItemId, String requestType);

    @Query(value="{ 'collectorItemId' : ?0, 'state' : { $ne : 'merged' }}", fields="{ 'requestType' : 1, 'number' : 2, 'updatedAt' : 3, 'id' : 4}")
    List<GitRequest> findNonMergedRequestNumberAndLastUpdated(ObjectId collectorItemId);

    @Query(value="{ 'collectorItemId' : ?0}", fields="{ 'requestType' : 1, 'number' : 2, 'updatedAt' : 3, 'id' : 4}")
    List<GitRequest> findRequestNumberAndLastUpdated(ObjectId collectorItemId);

    GitRequest findByCollectorItemIdAndScmRevisionNumber(ObjectId collectorItemId, String revisionNumber);

    GitRequest findByCollectorItemIdAndNumberAndRequestType(ObjectId collectorItemId, String number, String requestType);

    @Query(value="{ 'collectorItemId': ?0, 'scmCommitTimestamp': { $gt: ?1 }}")
    List<GitRequest> findByCollectorItemIdAndScmCommitTimestamp(ObjectId collectorItemid,
                                                          Long scmCommitTimestampThreshold);

    GitRequest findByCollectorItemIdAndNumber(ObjectId collectorItemId, String number);

    List<GitRequest> findByScmUrlIgnoreCaseAndScmBranchIgnoreCaseAndCreatedAtGreaterThanEqualAndMergedAtLessThanEqual(String scmUrl, String scmBranch, long beginDt, long endDt);

    List<GitRequest> findByScmUrlIgnoreCaseAndScmBranchIgnoreCase(String scmUrl, String scmBranch);

    List<GitRequest> findByScmRevisionNumber(String revisionNumber);

    List<GitRequest> findByCollectorItemIdAndMergedAtIsBetween(ObjectId collectorItemId, long beginDate, long endDate);

    GitRequest findByScmUrlIgnoreCaseAndScmBranchIgnoreCaseAndNumberAndRequestTypeIgnoreCase(String scmUrl, String scmBranch, String number, String requestType);

    @Query(value="{'$or':[{'scmRevisionNumber' : ?0}, {'scmMergeEventRevisionNumber' : ?0}]}")
    GitRequest findByScmRevisionNumberOrScmMergeEventRevisionNumber(String revisionNumber);


=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/BaseCollectorRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorType;
import org.bson.types.ObjectId;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Generic Collector repository that contains methods common to any model that extends from
 * Collector.
 *
 * @param <T> Class that extends {@link Collector}
 */
public interface BaseCollectorRepository<T extends Collector> extends CrudRepository<T, ObjectId> {

    /**
     * Finds a {@link Collector} by its name.
     *
     * @param name name
     * @return a {@link Collector}
     */
    T findByName(String name);

    /**
     * Finds all {@link Collector}s of a given {@link CollectorType}.
     *
     * @param collectorType a {@link CollectorType}
     * @return list of {@link Collector}s of a given {@link CollectorType}
     */
    List<T> findByCollectorType(CollectorType collectorType);

    /**
     * Finds all {@link Collector}s of a given {@link CollectorType}.
     *
     * @param collectorType a {@link CollectorType}
     * @param  name
     * @return list of {@link Collector}s of a given {@link CollectorType}
     */

    List<T> findByCollectorTypeAndName(CollectorType collectorType, String name);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/CustomRepositoryQueryImpl.java
=====================================================
package com.capitalone.dashboard.repository;


import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.util.GitHubParsedUrl;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

@Component
public class CustomRepositoryQueryImpl implements CustomRepositoryQuery {

    private final MongoTemplate template;
    private static final String REGEX_ANY_STRING_INCLUDING_EMPTY = "^$|^.*";

    @Autowired
    public CustomRepositoryQueryImpl(MongoTemplate template) {
        this.template = template;
    }


    @Override
    public List<CollectorItem> findCollectorItemsBySubsetOptions(ObjectId id, Map<String, Object> allOptions, Map<String, Object> uniqueOptions,Map<String, Object> uniqueOptionsFromCollector) {
        Criteria c = Criteria.where("collectorId").is(id);
        uniqueOptions.values().removeIf(d-> d.equals(null) || ((d instanceof String) && StringUtils.isEmpty((String) d)));
        for (Map.Entry<String, Object> e : allOptions.entrySet()) {
            if (uniqueOptionsFromCollector.containsKey(e.getKey())) {
                c = getCriteria(uniqueOptions, c, e);
            }
        }
        List<CollectorItem> items =  template.find(new Query(c), CollectorItem.class);
        return items;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/repository/TestResultRepository.java
=====================================================
package com.capitalone.dashboard.repository;

import com.capitalone.dashboard.model.TestResult;

import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;

/**
 * Repository for {@link TestResult} data.
 */
public interface TestResultRepository extends CrudRepository<TestResult, ObjectId>, QueryDslPredicateExecutor<TestResult> {

    /**
     * Finds the {@link TestResult} with the given execution ID for a specific
     * {@link com.capitalone.dashboard.model.CollectorItem}.
     *
     * @param collectorItemId collector item ID
     * @param executionId execution ID
     * @return a TestSuite
     */
    TestResult findByCollectorItemIdAndExecutionId(ObjectId collectorItemId, String executionId);

    TestResult findByCollectorItemId(ObjectId collectorItemId);
    
    List<TestResult> findByUrlAndTimestampGreaterThanEqualAndTimestampLessThanEqual(String jobUrl,long beginDt,long endDt);
    List<TestResult> findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(ObjectId collectorItemId, long beginDate, long endDate);

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/response/BuildDataCreateResponse.java
=====================================================
package com.capitalone.dashboard.response;

import com.capitalone.dashboard.model.BuildStatus;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.bson.types.ObjectId;

public class BuildDataCreateResponse {
    private ObjectId id;
    private ObjectId collectorItemId;
    private ObjectId dashboardId;
    private long timestamp;
    private String number;
    private String buildUrl;
    private long startTime;
    private long endTime;
    private long duration;
    private BuildStatus buildStatus;
    private String startedBy;
    private String log;

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public ObjectId getDashboardId() {
        return dashboardId;
    }

    public void setDashboardId(ObjectId dashboardId) {
        this.dashboardId = dashboardId;
    }

    public long getTimestamp() {
        return timestamp;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/response/CloudVolumeAggregatedResponse.java
=====================================================
package com.capitalone.dashboard.response;

public class CloudVolumeAggregatedResponse {
    private int nonEncryptedCount;
    private int noAttachmentCount;
    private int noAccountCount;
    private int nonTaggedCount;
    private int totalCount;
    private long lastUpdated;

    public int getNonEncryptedCount() {
        return nonEncryptedCount;
    }

    public void setNonEncryptedCount(int nonEncryptedCount) {
        this.nonEncryptedCount = nonEncryptedCount;
    }

    public int getNoAttachmentCount() {
        return noAttachmentCount;
    }

    public void setNoAttachmentCount(int noAttachmentCount) {
        this.noAttachmentCount = noAttachmentCount;
    }

    public int getNoAccountCount() {
        return noAccountCount;
    }

    public void setNoAccountCount(int noAccountCount) {
        this.noAccountCount = noAccountCount;
    }

    public int getNonTaggedCount() {
        return nonTaggedCount;
    }

    public void setNonTaggedCount(int nonTaggedCount) {
        this.nonTaggedCount = nonTaggedCount;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/response/CloudVirtualNetworkAggregatedResponse.java
=====================================================
package com.capitalone.dashboard.response;

public class CloudVirtualNetworkAggregatedResponse {

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/response/RallyBurnDownResponse.java
=====================================================
package com.capitalone.dashboard.response;

import java.util.List;

public class RallyBurnDownResponse {
	private List<String> iterationDates;
	private List<String> toDoHours;
	private List<Double> acceptedPoints;
	private List<Double> totalTaskEstimate;
	
	public List<Double> getTotalTaskEstimate() {
		return totalTaskEstimate;
	}
	public void setTotalTaskEstimate(List<Double> totalTaskEstimate) {
		this.totalTaskEstimate = totalTaskEstimate;
	}
	public List<String> getIterationDates() {
		return iterationDates;
	}
	public void setIterationDates(List<String> iterationDates) {
		this.iterationDates = iterationDates;
	}
	public List<String> getToDoHours() {
		return toDoHours;
	}
	public void setToDoHours(List<String> toDoHours) {
		this.toDoHours = toDoHours;
	}
	public List<Double> getAcceptedPoints() {
		return acceptedPoints;
	}
	@Override
	public String toString() {
		return "RallyBurnDownResponse [iterationDates=" + iterationDates + ", toDoHours=" + toDoHours
				+ ", acceptedPoints=" + acceptedPoints + "]";
	}
	public void setAcceptedPoints(List<Double> acceptedPoints) {
		this.acceptedPoints = acceptedPoints;
	}
	
	

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/response/CloudSubNetworkAggregatedResponse.java
=====================================================
package com.capitalone.dashboard.response;

public class CloudSubNetworkAggregatedResponse {
    
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/PipelineUtils.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.RepoBranch;
import com.capitalone.dashboard.model.SCM;
import com.capitalone.dashboard.model.Widget;
import com.capitalone.dashboard.repository.CommitRepository;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public final class PipelineUtils {

    private PipelineUtils(){

    }

    public static Map<String, PipelineCommit> commitSetToMap(Set<PipelineCommit> set){
        Map<String, PipelineCommit> returnMap = new HashMap<>();
        for(PipelineCommit commit : set){
            returnMap.put(commit.getScmRevisionNumber(), commit);
        }
        return returnMap;
    }

    public static Map<PipelineStage, String> getStageToEnvironmentNameMap(Dashboard dashboard) {
        Map<PipelineStage, String> rt = new LinkedHashMap<>();

        for(Widget widget : dashboard.getWidgets()) {
            if(widget.getName().equalsIgnoreCase("build")){
                rt.put(PipelineStage.valueOf("Build"), "Build");
            }if(widget.getName().equalsIgnoreCase("repo")){
                rt.put(PipelineStage.valueOf("Commit"), "Commit");
            }
            if (widget.getName().equalsIgnoreCase("pipeline")) {
                Map<?,?> gh = (Map<?,?>) widget.getOptions().get("mappings");
                for (Map.Entry<?, ?> entry : gh.entrySet()) {
                    rt.put(PipelineStage.valueOf((String) entry.getKey()), (String) entry.getValue());

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/EncryptionException.java
=====================================================
package com.capitalone.dashboard.util;

public class EncryptionException extends Exception {
	private static final long serialVersionUID = -4472911532254883259L;

	/**
     * Constructs a {@code EncrytionException} with no detail message.
     */
    public EncryptionException() {
        super();
    }

    /**
     * Constructs a {@code EncrytionException} with the specified
     * detail message.
     *
     * @param   s   the detail message.
     */
    public EncryptionException(String s) {
        super(s);
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/FeatureCollectorConstants.java
=====================================================

package com.capitalone.dashboard.util;

/**
 * This class is established to house any globally-referenced constant values.
 * Most values that can or should be modifiable at deploy-time should be kept in
 * a properties file, but valid use cases for constant values should be added
 * here.
 *
 * @author kfk884
 *
 */
public final class FeatureCollectorConstants {
    public static final String JIRA = "Jira";
    public static final String JIRA_XRAY = "Jira XRay";

    public static final String VERSIONONE = "VersionOne";
    public static final String GITLAB = "GitlabFeature";
    @SuppressWarnings("PMD.AvoidUsingHardCodedIP")
    // not an IP
    public static final String AGENT_VER = "01.00.00.01";
    public static final String AGENT_NAME = "Hygieia Dashboard - VersionOne Feature Collector";

    public static final String STORY_HOURS_ESTIMATE = "hours";
    public static final String STORY_POINTS_ESTIMATE = "storypoints";
    public static final String STORY_COUNT_ESTIMATE = "count";

    public static final String SPRINT_SCRUM = "scrum";
    public static final String SPRINT_KANBAN = "kanban";

    public static final String TEAM_ID_ANY = "any";
    public static final String PROJECT_ID_ANY = "any";

    public static final String TOOL_TYPE = "featureTool";
    public static final String PROJECT_NAME = "projectName";
    public static final String PROJECT_ID = "projectId";
    public static final String TEAM_NAME = "teamName";
    public static final String TEAM_ID = "teamId";
    public static final String ESTIMATE_METRIC_TYPE = "estimateMetricType";
    public static final String SPRINT_TYPE = "sprintType";
    public static final String LIST_TYPE = "listType";
    public static final String SHOW_STATUS = "showStatus";

    private FeatureCollectorConstants() {
        // This class should not be instantiable
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/CoreFeatureSettings.java
=====================================================
package com.capitalone.dashboard.util;

import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "feature")
public class CoreFeatureSettings {
	private List<String> todoStatuses;
	private List<String> doingStatuses;
	private List<String> doneStatuses;

	public List<String> getTodoStatuses() {
		return todoStatuses;
	}

	public void setTodoStatuses(List<String> todoStatuses) {
		this.todoStatuses = todoStatuses;
	}

	public List<String> getDoingStatuses() {
		return doingStatuses;
	}

	public void setDoingStatuses(List<String> doingStatuses) {
		this.doingStatuses = doingStatuses;
	}

	public List<String> getDoneStatuses() {
		return doneStatuses;
	}

	public void setDoneStatuses(List<String> doneStatuses) {
		this.doneStatuses = doneStatuses;
	}
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/Supplier.java
=====================================================
package com.capitalone.dashboard.util;

/**
 * A class that can supply objects of a single type.  Semantically, this could
 * be a factory, generator, builder, closure, or something else entirely. No
 * guarantees are implied by this interface.
 *
 */
public interface Supplier<T> {

    /**
     * Retrieves an instance of the appropriate type. The returned object may or
     * may not be a new instance, depending on the implementation.
     *
     * @return an instance of the appropriate type
     */
    T get();
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/HygieiaUtils.java
=====================================================
package com.capitalone.dashboard.util;


import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.lang3.StringUtils;
import org.jboss.logging.Logger;

import java.lang.reflect.InvocationTargetException;
import java.net.URI;

public class HygieiaUtils {
	private static final Logger LOGGER = Logger.getLogger(HygieiaUtils.class);

    public static void mergeObjects(Object dest, Object source) throws IllegalAccessException, InvocationTargetException {
        new BeanUtilsBean() {
            @Override
            public void copyProperty(Object dest, String name, Object value)
                    throws IllegalAccessException, InvocationTargetException {
                if (value != null) {
                    super.copyProperty(dest, name, value);
                }
            }
        }.copyProperties(dest, source);
    }
    
    /**
     * Determines if two urls are equal accounting for load balancers and variations in schemes.
     * <p>
     * Two urls are equal if:
     * <ul>
     * <li>the root domain is the same</li>
     * <li>the path is the same (ignoring .git at the end)</li>
     * <li>the query is the same</li>
     * </ul>
     * <p>
     * It is assumed that load balancers use a distinct subdomain in a url.
     * 
     * @param url1
     * @param url2
     * @return		if the two urls are equal ignoring load balancers, url schemes, and path endings.
     */
    @SuppressWarnings("PMD.NPathComplexity")
    public static boolean smartUrlEquals(String url1, String url2) {
    	String u1 = nullSafe(url1);
    	String u2 = nullSafe(url2);
    	
    	String u1Host = null;
    	String u1Path = null;
    	String u1Query = null;
    	

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/SuperFeatureComparator.java
=====================================================
package com.capitalone.dashboard.util;

import java.util.Comparator;

import com.capitalone.dashboard.model.Feature;

/**
 * Comparator utility class for handling comparisons of Super Features (epics)
 * to other Super Features. This is used when manipulating results of MongoDB
 * repository responses and sorting them in an efficient manner within memory.
 * 
 * @author kfk884
 * 
 */
public class SuperFeatureComparator implements Comparator<Feature> {

	public SuperFeatureComparator() {
		// No instantiation requirements
	}

	/**
	 * Compares two feature object models and sorts based on their subsequent
	 * epic IDs, as a string comparator
	 * 
	 * @return A list of Features sorted by EpicID, descending
	 */
	@Override
	public int compare(Feature f, Feature ff) {
		if (f.getsEpicID().compareToIgnoreCase(ff.getsEpicID()) <= -1) {
			return -1;
		} else if (f.getsEpicID().compareToIgnoreCase(ff.getsEpicID()) >= 1) {
			return 1;
		} else {
			return 0;
		}
	}

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/Encryption.java
=====================================================
package com.capitalone.dashboard.util;

import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

@SuppressWarnings("PMD.AvoidCatchingNPE") // TODO: Avoid catching NullPointerException; consider removing the cause of the NPE
public final class Encryption {

    private static final String ALGO = "DESede";
    private static final Logger LOGGER = LoggerFactory.getLogger(Encryption.class);

    private Encryption() {
        // util class.
    }

    public static String getStringKey() throws EncryptionException {
        SecretKey key = null;
        try {
            key = KeyGenerator.getInstance(ALGO).generateKey();
        } catch (NoSuchAlgorithmException e) {
            throw new EncryptionException("Cannot generate a secret key" + '\n' + e.getMessage());
        }
        return Base64.encodeBase64String(key.getEncoded());
    }

    public static SecretKey getSecretKey() throws EncryptionException {
        SecretKey key = null;
        try {
            key = KeyGenerator.getInstance(ALGO).generateKey();
        } catch (NoSuchAlgorithmException e) {
            throw new EncryptionException("Cannot generate a secret key" + '\n' + e.getMessage());
        }
        return key;
    }

    public static String encryptString(String message, SecretKey key)
            throws EncryptionException {
        String encryptedMessage = "";
        try {
            Cipher cipher = Cipher.getInstance(ALGO);
            cipher.init(Cipher.ENCRYPT_MODE, key);
            byte[] encryptedBytes = cipher.doFinal(message.getBytes());
            encryptedMessage = Base64.encodeBase64String(encryptedBytes);


=====================================================
== File: src/main/java/com/capitalone/dashboard/util/DashboardUtils.java
=====================================================
package com.capitalone.dashboard.util;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.repository.ComponentRepository;
import org.bson.types.ObjectId;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

public final class DashboardUtils {


    /**
     * Gets a unique set of collector item ids for a given collector from all components in the Hygieia instance.
     * @param componentRepository component repo
     * @param collector collector
     * @return unique set of collector item ids
     */
    public static Set<ObjectId> getUniqueCollectorItemIDsFromAllComponents(ComponentRepository componentRepository, Collector collector) {
        Set<ObjectId> uniqueIDs = new HashSet<>();
        for (com.capitalone.dashboard.model.Component comp : componentRepository.findAll()) {
            if (comp.getCollectorItems() == null || comp.getCollectorItems().isEmpty()) continue;
            List<CollectorItem> itemList = comp.getCollectorItems().get(collector.getCollectorType());
            if (itemList == null) continue;
            for (CollectorItem ci : itemList) {
                if (ci != null && ci.getCollectorId().equals(collector.getId())) {
                    uniqueIDs.add(ci.getId());
                }
            }
        }
        return uniqueIDs;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/GitHubParsedUrl.java
=====================================================
package com.capitalone.dashboard.util;

public class GitHubParsedUrl {
    private String url;
    private String host;
    private String apiUrl;
    private String orgName;
    private String repoName;


    public GitHubParsedUrl(String url){
        this.url = url;
        parse();
    }

    private void parse(){
        if (url.endsWith(".git")) {
            url = url.substring(0, url.lastIndexOf(".git"));
        }
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getApiUrl() {
        return apiUrl;
    }

    public void setApiUrl(String apiUrl) {
        this.apiUrl = apiUrl;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/GitBranchSpec.java
=====================================================
package com.capitalone.dashboard.util;


import java.util.StringTokenizer;
import java.util.regex.Pattern;


public class GitBranchSpec {
    private String name;

    public String getName() {
        return name;
    }

    private void setName(String name) {
        if (name == null) {
            throw new IllegalArgumentException();
        } else if (name.length() == 0) {
            this.name = "**";
        } else {
            this.name = name.trim();
        }
    }


    public GitBranchSpec(String name) {
        setName(name);
    }

    public String toString() {
        return name;
    }

    public boolean matches(String item) {
        return getPattern().matcher(item).matches();
    }


    private Pattern getPattern() {
        String expandedName = name;
        // use regex syntax directly if name starts with colon
        if ((expandedName.charAt(0) == ':') && (expandedName.length() > 1)) {
            String regexSubstring = expandedName.substring(1, expandedName.length());
            return Pattern.compile(regexSubstring);
        }
        // build a pattern into this builder
        StringBuilder builder = new StringBuilder(100);

        // for legacy reasons (sic) we do support various branch spec format to declare remotes / branches
        builder.append("(refs/heads/");

=====================================================
== File: src/main/java/com/capitalone/dashboard/util/UnsafeDeleteException.java
=====================================================
package com.capitalone.dashboard.util;

/**
 * Created by jkc on 1/20/16.
 */
public class UnsafeDeleteException extends RuntimeException {
	private static final long serialVersionUID = -664077740219817001L;
	public UnsafeDeleteException() {
        super();
    }
    public UnsafeDeleteException(String s) {
        super(s);
    }
    public UnsafeDeleteException(String s, Throwable throwable) {
        super(s, throwable);
    }
    public UnsafeDeleteException(Throwable throwable) {
        super(throwable);
    }

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/config/CollectorConfig.java
=====================================================
package com.capitalone.dashboard.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * Configuration class that creates Beans common to any Collector implementation
 */
@Configuration
public class CollectorConfig {

    @Bean
    public TaskScheduler taskScheduler() {
        return new ThreadPoolTaskScheduler();
    }

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/config/collector/CloudConfig.java
=====================================================
package com.capitalone.dashboard.config.collector;

import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.NameValue;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class CloudConfig extends CollectorItem {
    private static final String CLOUD_PROVIDER = "provider";
    private static final List<NameValue> TAGS = new ArrayList<>();

    private static final int AGE_ERROR_THRESHOLD_DEFAULT = 60;
    private static final int AGE_ALERT_THRESHOLD_DEFAULT = 45;

    private static final double CPU_ERROR_THRESHOLD_DEFAULT = 80.0;
    private static final double CPU_ALERT_THRESHOLD_DEFAULT = 50.0;

    private static final double MEMORY_ERROR_THRESHOLD_DEFAULT = 80.0;
    private static final double MEMORY_ALERT_THRESHOLD_DEFAULT = 50.0;

    private static final int DISK_IO_ERROR_THRESHOLD_DEFAULT = 80;
    private static final int DISK_IO_ALERT_THRESHOLD_DEFAULT = 50;

    private static final int NETWORK_IO_ERROR_THRESHOLD_DEFAULT = 80;
    private static final int NETWORK_IO_ALERT_THRESHOLD_DEFAULT = 50;

//    private static final int SUBNET_IP_ERROR_THRESHOLD_DEFAULT = 80;
//    private static final int SUBNET_IP_ALERT_THRESHOLD_DEFAULT = 50;

    private static final String AGE_ERROR = "ageError";
    private static final String AGE_ALERT = "ageAlert";
    private static final String CPU_ERROR = "cpuError";
    private static final String CPU_ALERT = "cpuAlert";
    private static final String MEMORY_ERROR = "memoryError";
    private static final String MEMORY_ALERT = "memoryAlert";
    private static final String DISKIO_ERROR = "diskIOError";
    private static final String DISKIO_ALERT = "diskIOAlert";
    private static final String NETWORKIO_ERROR = "networkIOError";
    private static final String NETWORKIO_ALERT = "networkIOAlert";

    public String getCloudProvider() {
        return (String) getOptions().get(CLOUD_PROVIDER);
    }

    public void setCloudProvider(String cloudProvider) {
        getOptions().put(CLOUD_PROVIDER, cloudProvider);
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/config/MongoConfig.java
=====================================================
package com.capitalone.dashboard.config;

import com.capitalone.dashboard.repository.RepositoryPackage;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Component
@EnableMongoRepositories(basePackageClasses = RepositoryPackage.class)
public class MongoConfig extends AbstractMongoConfiguration {
    private static final Logger LOGGER = LoggerFactory.getLogger(MongoConfig.class);

    @Value("${dbname:dashboard}")
    private String databaseName;
    @Value("${dbhost:localhost}")
    private String host;
    @Value("${dbport:27017}")
    private int port;
    @Value("${dbreplicaset:false}")
    private String dbreplicaset;
    @Value("#{'${dbhostport:localhost:27017}'.split(',')}")
    private List<String> hostport;
    @Value("${dbusername:}")
    private String userName;
    @Value("${dbpassword:}")
    private String password;



    @Override
    protected String getDatabaseName() {
        return databaseName;
    }

    @Override

=====================================================
== File: src/main/java/com/capitalone/dashboard/collector/CollectorTask.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.repository.BaseCollectorRepository;
import com.google.common.base.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * Base class for Collector task implementation which provides subclasses with
 * the following:
 * <p>
 * <ol>
 * <li>Creates a Collector instance the first time the collector runs.</li>
 * <li>Uses TaskScheduler to schedule the job based on the provided cron when the process starts.</li>
 * <li>Saves the last execution time on the collector when the collection run finishes.</li>
 * <li>Sets the collector online/offline when the collector process starts/stops</li>
 * </ol>
 *
 * @param <T> Class that extends Collector
 */
@Component
public abstract class CollectorTask<T extends Collector> implements Runnable {
    private static final Logger LOGGER = LoggerFactory.getLogger(CollectorTask.class);

    private final TaskScheduler taskScheduler;
    private final String collectorName;

    @Autowired
    protected CollectorTask(TaskScheduler taskScheduler, String collectorName) {
        this.taskScheduler = taskScheduler;
        this.collectorName = collectorName;
    }

    @Override
    public final void run() {
        LOGGER.info("Running Collector: {}", collectorName);
        T collector = getCollectorRepository().findByName(collectorName);
        if (collector == null) {
            // Register new collector
            collector = getCollectorRepository().save(getCollector());
        } else {
            // In case the collector options changed via collectors properties setup.

=====================================================
== File: src/main/java/com/capitalone/dashboard/collector/CollectorTaskWithGenericItem.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.GenericCollectorItem;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.GenericCollectorItemRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Component
public abstract class CollectorTaskWithGenericItem<T extends Collector> extends CollectorTask<T> {

    private final CollectorItemRepository collectorItemRepository;
    private final GenericCollectorItemRepository genericCollectorItemRepository;
    private final RelatedCollectorItemRepository relatedCollectorItemRepository;

    @Autowired
    public CollectorTaskWithGenericItem(TaskScheduler taskScheduler, String collectorName, CollectorItemRepository collectorItemRepository, GenericCollectorItemRepository genericCollectorItemRepository, RelatedCollectorItemRepository relatedCollectorItemRepository) {
        super(taskScheduler, collectorName);
        this.collectorItemRepository = collectorItemRepository;
        this.genericCollectorItemRepository = genericCollectorItemRepository;
        this.relatedCollectorItemRepository = relatedCollectorItemRepository;
    }


    public Map<ObjectId, Set<ObjectId>> processGenericItems(List<String> toolServers) {
        List<GenericCollectorItem> genericCollectorItems = genericCollectorItemRepository.findAllByToolNameAndProcessTimeEquals(getCollector().getName(), 0L);
        if (CollectionUtils.isEmpty(genericCollectorItems)) {
            return Collections.emptyMap();
        }
        Map<ObjectId, Set<ObjectId>> collectorItemBuildIds = new HashMap<>();
        genericCollectorItems.forEach(gci -> {
            toolServers.stream()
                    .map(server -> Lists.newArrayList(collectorItemRepository.findAllByOptionMapAndCollectorIdsIn(getGenericCollectorItemOptions(server, gci), Lists.newArrayList(getCollector().getId()))))
                    .forEach(collectorItems -> collectorItems.forEach(item -> {
                        //Save as related item. Related Item event listener will process it.
                        if (!collectorItemBuildIds.containsKey(item.getId())) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/collector/RestOperationsSupplier.java
=====================================================
package com.capitalone.dashboard.collector;

import com.capitalone.dashboard.util.Supplier;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;

/**
 * Supplier that returns an instance of RestOperations
 */
@Component
public class RestOperationsSupplier implements Supplier<RestOperations> {
    @Override
    public RestOperations get() {
        return new RestTemplate();
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/status/LibraryPolicyAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum LibraryPolicyAuditStatus {
    LIBRARY_POLICY_AUDIT_FAIL,
    LIBRARY_POLICY_SCAN_FAIL,
    LIBRARY_POLICY_AUDIT_MISSING,
    LIBRARY_POLICY_AUDIT_DETAIL_MISSING,
    LIBRARY_POLICY_AUDIT_OK,
    LIBRARY_POLICY_FOUND_HIGH_SECURITY,
    LIBRARY_POLICY_FOUND_HIGH_LICENSE,
    LIBRARY_POLICY_FOUND_CRITICAL_SECURITY,
    LIBRARY_POLICY_FOUND_CRITICAL_LICENSE
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/status/CodeReviewAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum CodeReviewAuditStatus {
    //peer review type LGTM, GH REVIEW, COMMENTS ONLY
    PEER_REVIEW_LGTM_SELF_APPROVAL,
    PEER_REVIEW_LGTM_ERROR,
    PEER_REVIEW_LGTM_PENDING,
    PEER_REVIEW_LGTM_UNKNOWN,
    PEER_REVIEW_LGTM_SUCCESS,
    PEER_REVIEW_BY_SERVICEACCOUNT,

    PEER_REVIEW_GHR,
    PEER_REVIEW_GHR_SELF_APPROVAL,
    PEER_REVIEW_REG_COMMENTS,
    PEER_REVIEW_REV_COMMENTS,
    //no pull requests for queried date range
    NO_PULL_REQ_FOR_DATE_RANGE,
    //direct commits to master
    DIRECT_COMMITS_TO_BASE,
    DIRECT_COMMITS_TO_BASE_FIRST_COMMIT,
    COMMIT_AUTHOR_EQ_SYSTEM_USER,
    DIRECT_COMMIT_NONCODE_CHANGE,
    DIRECT_COMMIT_NONCODE_CHANGE_SERVICE_ACCOUNT,
    DIRECT_COMMIT_NONCODE_CHANGE_USER_ACCOUNT,
    //commit author v/s who merged the pr
    COMMITAUTHOR_NE_MERGECOMMITER,
    COMMITAUTHOR_EQ_MERGECOMMITER,
    MERGECOMMITER_NOT_FOUND,
    COMMITAUTHOR_EQ_SERVICEACCOUNT,
    MERGECOMMITER_EQ_SERVICEACCOUNT,

    //peer review of a pull request
    PULLREQ_REVIEWED_BY_PEER,
    PULLREQ_NOT_PEER_REVIEWED,
    BASE_FIRST_COMMIT,

    //type of git workflow
    GIT_FORK_STRATEGY,
    GIT_BRANCH_STRATEGY,
    GIT_NO_WORKFLOW,

    REPO_NOT_CONFIGURED,
    PENDING_DATA_COLLECTION,

    NO_COMMIT_FOR_DATE_RANGE, //Removew this later when we can remove legacy peer review
    COMMIT_AFTER_PR_MERGE, COLLECTOR_ITEM_ERROR,
    SCM_AUTHOR_LOGIN_INVALID, //passed when SCM AUTHOR is unavailable
    DIRECT_COMMIT_CHANGE_WHITELISTED_ACCOUNT
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/status/CodeQualityAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum CodeQualityAuditStatus {
    CODE_QUALITY_AUDIT_FAIL,
    STATIC_SECURITY_SCAN_FAIL,
    CODE_QUALITY_AUDIT_GATE_MISSING,
    QUALITY_PROFILE_VALIDATION_AUDIT_OK,
    QUALITY_PROFILE_VALIDATION_AUDIT_FAIL,
    QUALITY_PROFILE_VALIDATION_AUDIT_NO_CHANGE,
    CODE_QUALITY_AUDIT_OK,
    CODE_QUALITY_DETAIL_MISSING,
    STATIC_SECURITY_SCAN_AUDIT_NO_CHANGE,
    STATIC_SECURITY_SCAN_MISSING,
    STATIC_SECURITY_SCAN_OK,
    STATIC_SECURITY_SCAN_NO_CLOSED_FINDINGS,
    STATIC_SECURITY_SCAN_FOUND_CRITICAL,
    STATIC_SECURITY_SCAN_FOUND_HIGH,
    COLLECTOR_ITEM_ERROR,
    CODE_QUALITY_NOT_CONFIGURED,
    CODE_QUALITY_GATES_FOUND,
    CODE_QUALITY_CHECK_IS_CURRENT,
    CODE_QUALITY_THRESHOLD_BLOCKER_MET,
    CODE_QUALITY_THRESHOLD_CRITICAL_MET,
    CODE_QUALITY_THRESHOLD_UNIT_TEST_MET,
    CODE_QUALITY_THRESHOLD_CODE_COVERAGE_MET,
    CODE_QUALITY_THRESHOLD_BLOCKER_FOUND,
    CODE_QUALITY_THRESHOLD_CRITICAL_FOUND,
    CODE_QUALITY_THRESHOLD_UNIT_TEST_FOUND,
    CODE_QUALITY_THRESHOLD_CODE_COVERAGE_FOUND


}

=====================================================
== File: src/main/java/com/capitalone/dashboard/status/ArtifactAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum ArtifactAuditStatus {
    ART_SYS_ACCT_BUILD_AUTO,
    ART_SYS_ACCT_BUILD_USER,
    ART_DOCK_IMG_FOUND,
    ART_SYS_ACCT_BUILD_THIRD_PARTY,
    COLLECTOR_ITEM_ERROR,
    NO_ACTIVITY,
    UNAVAILABLE,
    ART_PROD_DEPLOY_OK,
    ART_PROD_DEPLOY_FAIL,
    ART_TEST_FOUND,
    ART_TEST_NOT_FOUND,
    ARTIFACT_NOT_CONFIGURED
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/status/TestResultAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum TestResultAuditStatus {
    TEST_RESULT_AUDIT_FAIL,
    TEST_RESULT_AUDIT_MISSING,
    TEST_RESULT_MISSING,
    TEST_RESULT_AUDIT_OK,
    TEST_RESULT_SKIPPED,
    TEST_RESULTS_TRACEABILITY_NOT_FOUND,
    TEST_RESULTS_TRACEABILITY_STORY_NOT_FOUND,
    TEST_RESULTS_TRACEABILITY_STORY_MATCH,
    TEST_RESULTS_TRACEABILITY_THRESHOLD_DEFAULT,
    TEST_RESULTS_TRACEABILITY_STORY_STATUS_INVALID,
    TEST_RESULTS_TRACEABILITY_NOT_FOUND_IN_GIVEN_DATE_RANGE
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/status/PerformanceTestAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum PerformanceTestAuditStatus {
    PERF_RESULT_AUDIT_FAIL,
    PERF_RESULT_AUDIT_MISSING,
    PERF_RESULT_AUDIT_OK,
    PERFORMANCE_THRESHOLD_RESPONSE_TIME_MET,
    PERFORMANCE_THRESHOLD_TRANSACTIONS_PER_SECOND_MET,
    PERFORMANCE_THRESHOLD_ERROR_RATE_MET,
    PERFORMANCE_COMMIT_IS_CURRENT,
    PERFORMANCE_THRESHOLDS_ERROR_RATE_FOUND,
    PERFORMANCE_THRESHOLDS_TRANSACTIONS_PER_SECOND_FOUND,
    PERFORMANCE_THRESHOLDS_RESPONSE_TIME_FOUND,
    PERFORMANCE_MET,
    PERFORMANCE_CHANGE_UNAUTHORIZED,
    COLLECTOR_ITEM_ERROR
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/status/BuildAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum BuildAuditStatus{
    BUILD_JOB_IS_NON_PROD,
    BUILD_JOB_CONFIGURATION_REVIEW_FAIL,
    BUILD_JOB_CONFIGURATION_REVIEW_PASS,
    BUILD_JOB_CONFIGURATION_NO_CHANGE,
    COLLECTOR_ITEM_ERROR, BUILD_MATCHES_REPO, BUILD_REPO_MISMATCH, BUILD_AUTHOR_EQ_REPO_AUTHOR, BUILD_AUTHOR_NE_REPO_AUTHOR, NO_BUILD_FOUND, BUILD_JOB_IS_PROD
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/status/DashboardAuditStatus.java
=====================================================
package com.capitalone.dashboard.status;

public enum DashboardAuditStatus {
    DASHBOARD_BAD_LOOKUP_DATA,
    DASHBOARD_REPO_NOT_CONFIGURED,
    DASHBOARD_BUILD_CONFIGURED,
    DASHBOARD_BUILD_NOT_CONFIGURED,
    DASHBOARD_CODEQUALITY_CONFIGURED,
    DASHBOARD_CODEQUALITY_NOT_CONFIGURED,
    DASHBOARD_STATIC_SECURITY_ANALYSIS_CONFIGURED,
    DASHBOARD_STATIC_SECURITY_ANALYSIS_NOT_CONFIGURED,
    DASHBOARD_LIBRARY_POLICY_ANALYSIS_CONFIGURED,
    DASHBOARD_LIBRARY_POLICY_ANALYSIS_NOT_CONFIGURED,
    DASHBOARD_NOT_REGISTERED,
    DASHBOARD_TEST_CONFIGURED,
    DASHBOARD_TEST_NOT_CONFIGURED,
    DASHBOARD_REPO_BUILD_VALID,
    DASHBOARD_REPO_BUILD_INVALID,
    DASHBOARD_REPO_PR_AUTHOR_EQ_BUILD_AUTHOR,
    DASHBOARD_REPO_PR_AUTHOR_NE_BUILD_AUTHOR,
    // Error collecting from repo
    COLLECTOR_ITEM_ERROR, // Git repo not configured
    DASHBOARD_PERFORMANCE_TEST_CONFIGURED, DASHBOARD_PERFORMANCE_TEST_NOT_CONFIGURED, DASHBOARD_REPO_CONFIGURED,
    DASHBOARD_ARTIFACT_CONFIGURED,DASHBOARD_ARTIFACT_NOT_CONFIGURED
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/JobCollectorItem.java
=====================================================
package com.capitalone.dashboard.model;

public class JobCollectorItem extends CollectorItem {
    protected static final String INSTANCE_URL = "instanceUrl";
    protected static final String JOB_NAME = "jobName";
    protected static final String JOB_URL = "jobUrl";

    public String getInstanceUrl() {
        return (String) getOptions().get(INSTANCE_URL);
    }

    public void setInstanceUrl(String instanceUrl) {
        getOptions().put(INSTANCE_URL, instanceUrl);
    }

    public String getJobName() {
        return (String) getOptions().get(JOB_NAME);
    }

    public void setJobName(String jobName) {
        getOptions().put(JOB_NAME, jobName);
    }

    public String getJobUrl() {
        return (String) getOptions().get(JOB_URL);
    }

    public void setJobUrl(String jobUrl) {
        getOptions().put(JOB_URL, jobUrl);
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubRepo.java
=====================================================
package com.capitalone.dashboard.model.webhook.github;

import com.capitalone.dashboard.model.CollectorItem;

/**
 * CollectorItem extension to store the github repo url and branch.
 */
public class GitHubRepo extends CollectorItem {
    public static final String REPO_URL = "url"; // http://github.company.com/jack/somejavacode
    public static final String BRANCH = "branch"; // master, development etc.
    public static final String USER_ID = "userID";
    public static final String PASSWORD = "password";
    public static final String PERSONAL_ACCESS_TOKEN = "personalAccessToken";

    public String getUserId() {
        return (String) getOptions().get(USER_ID);
    }

    public String getPassword() {
        return (String) getOptions().get(PASSWORD);
    }


    public String getRepoUrl() {
        return (String) getOptions().get(REPO_URL);
    }

    public void setRepoUrl(String instanceUrl) {
        getOptions().put(REPO_URL, instanceUrl);
    }
    
    public String getBranch() {
        return (String) getOptions().get(BRANCH);
    }

    public void setBranch(String branch) {
        getOptions().put(BRANCH, branch);
    }

    public String getPersonalAccessToken() {
        return String.valueOf(getOptions().get(PERSONAL_ACCESS_TOKEN));
    }

    public void setPersonalAccessToken(String personalAccessToken) {
        getOptions().put(PERSONAL_ACCESS_TOKEN, personalAccessToken);
    }


    @Override
    public boolean equals(Object o) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/webhook/github/GitHubParsed.java
=====================================================
package com.capitalone.dashboard.model.webhook.github;

import com.capitalone.dashboard.misc.HygieiaException;

import java.net.MalformedURLException;
import java.net.URL;

public class GitHubParsed {
    private String url;
    private String apiUrl;
    private String baseApiUrl;
    private String graphQLUrl;
    private String orgName;
    private String repoName;

    private static final String SEGMENT_API = "/api/v3/repos";
    private static final String BASE_API = "/api/v3/";
    private static final String PUBLIC_GITHUB_BASE_API = "api.github.com/";
    private static final String PUBLIC_GITHUB_REPO_HOST = "api.github.com/repos";
    private static final String PUBLIC_GITHUB_HOST_NAME = "github.com";

    private static final String SEGMENT_GRAPHQL = "/api/graphql";
    private static final String PUBLIC_GITHUB_GRAPHQL = "api.github.com/graphql";



    public GitHubParsed(String url) throws MalformedURLException, HygieiaException {
        this.url = url;
        parse();
    }

    private void parse() throws MalformedURLException, HygieiaException {
        if (url.endsWith(".git")) {
            url = url.substring(0, url.lastIndexOf(".git"));
        }
        URL u = new URL(url);
        String host = u.getHost();
        String protocol = u.getProtocol();
        String path = u.getPath();
        String[] parts = path.split("/");
        if (parts.length < 3) {
            throw new HygieiaException("Bad github repo URL: " + url, HygieiaException.BAD_DATA);
        }
        orgName = parts[1];
        repoName = parts[2];
        if (host.startsWith(PUBLIC_GITHUB_HOST_NAME)) {
            baseApiUrl = protocol + "://" + PUBLIC_GITHUB_BASE_API;
            apiUrl = protocol + "://" + PUBLIC_GITHUB_REPO_HOST + path;
            graphQLUrl = protocol + "://" + PUBLIC_GITHUB_GRAPHQL;
        } else {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/webhook/github/MergeEvent.java
=====================================================
package com.capitalone.dashboard.model.webhook.github;

import java.util.Objects;

public class MergeEvent {
    private String mergeSha;
    private String gitRequestNumber;
    private String mergeRef;
    private String mergeAuthor;
    private String mergeAuthorLDAPDN;
    private long mergedAt;

    public String getMergeSha() {
        return mergeSha;
    }

    public void setMergeSha(String mergeSha) {
        this.mergeSha = mergeSha;
    }

    public String getGitRequestNumber() {
        return gitRequestNumber;
    }

    public void setGitRequestNumber(String gitRequestNumber) {
        this.gitRequestNumber = gitRequestNumber;
    }

    public String getMergeRef() {
        return mergeRef;
    }

    public void setMergeRef(String mergeRef) {
        this.mergeRef = mergeRef;
    }

    public String getMergeAuthor() {
        return mergeAuthor;
    }

    public void setMergeAuthor(String mergeAuthor) {
        this.mergeAuthor = mergeAuthor;
    }

    public String getMergeAuthorLDAPDN() {
        return mergeAuthorLDAPDN;
    }

    public void setMergeAuthorLDAPDN(String mergeAuthorLDAPDN) {
        this.mergeAuthorLDAPDN = mergeAuthorLDAPDN;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/RallyFeatureType.java
=====================================================
package com.capitalone.dashboard.model;

public enum RallyFeatureType {
	Feature(CollectorType.Feature);
	private final CollectorType collectorType;
	
	RallyFeatureType(CollectorType collectorType) {
        this.collectorType = collectorType;
    }
    public static RallyFeatureType fromString(String value) {
        for (RallyFeatureType rallyFeatureType : values()) {
            if (rallyFeatureType.toString().equalsIgnoreCase(value)) {
                return rallyFeatureType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid RallyFeatureType.");
    }
    
    public CollectorType collectorType() {
        return collectorType;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/BaseModel.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;

/**
 * Base class for all Mongo model classes that has an id property.
 */
public class BaseModel {
    @Id
    private ObjectId id;

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    /*
     * Note:
     * 
     * Having hashcode + equals is more complicated than simply comparing ObjectIds since
     * it does not provide a way to properly compare models that have not been saved yet.
     */
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Build.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

/**
 * The result of a Continuous Integration build execution. Typically produces binary artifacts.
 * Often triggered by one or more SCM commits.
 *
 * Possible collectors:
 *  Hudson (in scope)
 *  Team City
 *  TFS
 *  Go
 *  Bamboo
 *  TravisCI
 *
 */
@Document(collection="builds")
public class Build extends BaseModel {
    private ObjectId collectorItemId;
    private long timestamp;

    private String number;
    private String buildUrl;
    private long startTime;
    private long endTime;
    private long duration;
    private BuildStatus buildStatus;
    private String startedBy;
    private String log;
    private List<RepoBranch> codeRepos = new ArrayList<>();
    private List<SCM> sourceChangeSet = new ArrayList<>();

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public void setSourceChangeSet(List<SCM> sourceChangeSet) {
        this.sourceChangeSet = sourceChangeSet;
    }

    public long getTimestamp() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestCaseStep.java
=====================================================
package com.capitalone.dashboard.model;


public class TestCaseStep {

    /**
     * Identifies this test case step in the source system
     */
    private String id;

    /**
     * Description of the test case step that might make sense to a human
     */
    private String description;

    /**
     * Test case duration in milliseconds
     */
    private long duration;

    /**
     * Status of the test case step
     */
    private TestCaseStatus status;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/GitRequest.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;


@Document(collection="gitrequests")
public class GitRequest  {

    // fields added from SCM class that we are not extending anymore
    private String scmUrl;
    private String scmBranch;
    private String scmRevisionNumber;
    //squash merge commit may be different from pr commit
    private String scmMergeEventRevisionNumber;
    private String scmCommitLog;
    private long scmCommitTimestamp;
    private String scmAuthor;
    private long numberOfChanges;
    // fields added above are from SCM class that we are not extending anymore

    @Id
    private ObjectId id;
    private String orgName;
    private String repoName;
    private String sourceRepo;
    private String sourceBranch;
    private String targetRepo;
    private String targetBranch;
    private String number;
    @Indexed
    private ObjectId collectorItemId;
    private long updatedAt;
    private long createdAt;
    private long closedAt;
    private String state;
    private long mergedAt;
    private String mergeAuthor;
    private String mergeAuthorLDAPDN;
    private long timestamp;
    private long resolutiontime;
    private String userId = null;
    private String commentsUrl;
    private String reviewCommentsUrl;
    private List<Comment> comments;
    private List<Review> reviews;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/DashboardType.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Defines the type of {@link Dashboard}.
 */
public enum DashboardType {
    Product,
    Team;

    public static DashboardType fromString(String value){
        for(DashboardType dashboardType : values()){
            if(dashboardType.toString().equalsIgnoreCase(value)){
                return dashboardType;
            }
        }
        throw new IllegalArgumentException(value+" is not a valid DashboardType");
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Pipeline.java
=====================================================
package com.capitalone.dashboard.model;

import com.capitalone.dashboard.util.PipelineUtils;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.*;

/**
 * Document containing the details of a Pipeline for a TeamDashboardCollectorItem
 */
@Document(collection="pipelines")
public class Pipeline extends BaseModel{
    /**
     * {@link CollectorItem} teamdashboard collector item id
     * */
    private ObjectId collectorItemId;

    /**
     * Map of environment names to EnvironmentStage objects. "Build" and "Commit" are
     * treated as environments.
     * */
    @Field("stages") 
    private Map<String, EnvironmentStage> environmentStageMap = new HashMap<>();

    /**
     * not including this in the map above because the enum allows us to
     * use ordinals to iterate through pipeline progression
     * */
    private Set<Build> failedBuilds = new HashSet<>();

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public Map<String, EnvironmentStage> getEnvironmentStageMap() {
        return environmentStageMap;
    }

    public void setEnvironmentStageMap(Map<String, EnvironmentStage> environmentStageMap) {
        this.environmentStageMap = environmentStageMap;
    }

    /**
     * Adds a commit to a given environment.  Will create a new stage if it doesn't exist.

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/GenericCollectorItem.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;

/**
 * A generic structure to hold a generic collector item info for a given tool that only that tool collector can
 * decipher. This will be used in creating collector item via API for non-standard tools.
 */
@Document(collection = "generic_collector_items")
public class GenericCollectorItem extends BaseModel {
    @NotNull
    private String toolName;
    @NotNull
    private ObjectId collectorId;
    @NotNull
    private String rawData;
    @NotNull
    private long creationTime;
    private long processTime;
    @NotNull
    private String source;
    private ObjectId relatedCollectorItem; //To build relations if needed
    private ObjectId buildId; //if started  off by some build - connects to build collection



    public ObjectId getBuildId() {
        return buildId;
    }

    public void setBuildId(ObjectId buildId) {
        this.buildId = buildId;
    }

    public ObjectId getRelatedCollectorItem() {
        return relatedCollectorItem;
    }

    public void setRelatedCollectorItem(ObjectId relatedCollectorItem) {
        this.relatedCollectorItem = relatedCollectorItem;
    }

    public long getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(long creationTime) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/UserRole.java
=====================================================
package com.capitalone.dashboard.model;

public enum UserRole {

	ROLE_USER,
	ROLE_ADMIN,
	ROLE_API;
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Stage.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.HashSet;
import java.util.Set;


public class Stage {
	
    public Stage(){

    }

    public Stage(Set<PipelineCommit> commits){
        this.commits = commits;
    }
    /** A collection that includes all commits ever to come into the stage */
    private Set<PipelineCommit> commits = new HashSet<>();

    public Set<PipelineCommit> getCommits() {
        return commits;
    }

    public void setCommits(Set<PipelineCommit> commits) {
        this.commits = commits;
    }

    public void addCommit(PipelineCommit commit){
        this.commits.add(commit);
    }

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Team.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents a Tempo Team in JIRA.
 */
@Document(collection="team")
public class Team extends BaseModel {
    private ObjectId collectorId;
    @Indexed
    private String teamId;
    @Indexed
    private String name;
    private String changeDate;
    private String assetState;
    private String isDeleted;
    private boolean enabled;
    private String teamType;

    private long lastCollected;

    @Transient
    private Collector collector;

    public Collector getCollector() {
        return collector;
    }

    public void setCollector(Collector collector) {
        this.collector = collector;
    }

    public Team(String teamId, String name) {
        this.teamId = (teamId != null ? teamId.trim() : "");
        this.name = (name != null ? name.trim() : "");
    }

    public ObjectId getCollectorId() {
        return collectorId;
    }

    public void setCollectorId(ObjectId collectorId) {
        this.collectorId = collectorId;
    }

    public String getTeamId() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestCaseStatus.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Denotes the status of a given {@link TestCase}.
 */
public enum TestCaseStatus {
    Success, Failure, Skipped, Unknown
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/relation/RelatedCollectorItem.java
=====================================================
package com.capitalone.dashboard.model.relation;

import com.capitalone.dashboard.model.BaseModel;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;

@Document(collection = "related_items")
public class RelatedCollectorItem extends BaseModel{
    @NotNull
    private ObjectId left;
    @NotNull
    private ObjectId right;
    @NotNull
    private String source;
    @NotNull
    private String reason;
    @NotNull
    private long creationTime;

    public ObjectId getLeft() {
        return left;
    }

    public void setLeft(ObjectId left) {
        this.left = left;
    }

    public ObjectId getRight() {
        return right;
    }

    public void setRight(ObjectId right) {
        this.right = right;
    }

    public long getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(long creationTime) {
        this.creationTime = creationTime;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ChangeOrder.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Objects;

@Document(collection="changeorder")
public class ChangeOrder extends BaseModel{

    private ObjectId collectorItemId;
    private Long timestamp;
    private String changeOrderItem;

    private String changeID;
    private String category;
    private String status;
    private String approvalStatus;
    private String initiatedBy;
    private String assignedTo;
    private String assignmentGroup;
    private String changeCoordinator;
    private String coordinatorPhone;
    private Long plannedStart;
    private Long plannedEnd;
    private String reason;
    private String phase;
    private String riskAssessment;
    private String priority;
    private Long dateEntered;
    private boolean open;
    private String backoutDuration;
    private Long closeTime;
    private String extProjectRef;
    private String rFCType2;
    private String company;
    private String title;
    private String subcategory;
    private String sLAAgreementID;
    private String changeModel;
    private String service;

    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ");

    public ObjectId getCollectorItemId() { return collectorItemId; }

    public void setCollectorItemId(ObjectId collectorItemId) { this.collectorItemId = collectorItemId; }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/FeatureIssueLink.java
=====================================================

package com.capitalone.dashboard.model;

/**
 * Represents an issue link of a jira story.
 */
public class FeatureIssueLink {

	private String targetIssueKey;
	private String targetIssueUri;
	private String issueLinkName;
	private String issueLinkType;
	private String issueLinkDirection;

	public String getTargetIssueKey() {
		return targetIssueKey;
	}

	public void setTargetIssueKey(String targetIssueKey) {
		this.targetIssueKey = targetIssueKey;
	}

	public String getTargetIssueUri() {
		return targetIssueUri;
	}

	public void setTargetIssueUri(String targetIssueUri) {
		this.targetIssueUri = targetIssueUri;
	}

	public String getIssueLinkName() {
		return issueLinkName;
	}

	public void setIssueLinkName(String issueLinkName) {
		this.issueLinkName = issueLinkName;
	}

	public String getIssueLinkType() {
		return issueLinkType;
	}

	public void setIssueLinkType(String issueLinkType) {
		this.issueLinkType = issueLinkType;
	}

	public String getIssueLinkDirection() {
		return issueLinkDirection;
	}


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/PipelineStageType.java
=====================================================
package com.capitalone.dashboard.model;

public enum PipelineStageType {
	BUILD, COMMIT, DEPLOY
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestCaseConditionResult.java
=====================================================
package com.capitalone.dashboard.model;

public class TestCaseConditionResult {
    private TestCaseStatus status;
    private long duration;

    public TestCaseStatus getStatus() {
        return status;
    }

    public void setStatus(TestCaseStatus status) {
        this.status = status;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Review.java
=====================================================
package com.capitalone.dashboard.model;

public class Review {
    private String body;
    private String state;
    private String author;
    private String authorLDAPDN;
    private long createdAt;
    private long updatedAt;

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getAuthorLDAPDN() {
        return authorLDAPDN;
    }

    public void setAuthorLDAPDN(String authorLDAPDN) {
        this.authorLDAPDN = authorLDAPDN;
    }

    public long getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(long createdAt) {
        this.createdAt = createdAt;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Application.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.DBRef;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * The software application the team is developing and/or operating. Consists of one or more software
 * components and may exist in one or more environments.
 */
public class Application {
    private String name;
    private String owner;
    private String lineOfBusiness;
    @DBRef
    private List<Component> components = new ArrayList<>();

    Application() {
    }

    public Application(String name, Component... componentsArray) {
        this.name = name;
        Collections.addAll(components, componentsArray);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getLineOfBusiness() {
        return lineOfBusiness;
    }

    public void setLineOfBusiness(String lineOfBusiness) {
        this.lineOfBusiness = lineOfBusiness;
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ScopeOwner.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents a team in a content management system that works with features.
 *
 * Possible collectors: VersionOne PivotalTracker Rally Trello Jira
 *
 * @author kfk884
 *
 */
@Document(collection = "scope-owner")
public class ScopeOwner extends CollectorItem {
	private ObjectId collectorItemId;
	@Indexed
	private String teamId;
	@Indexed
	private String name;
	private String changeDate;
	private String assetState;
	private String isDeleted;

	public ObjectId getCollectorItemId() {
		return collectorItemId;
	}

	public void setCollectorItemId(ObjectId collectorItemId) {
		this.collectorItemId = collectorItemId;
	}

	public String getTeamId() {
		return this.teamId;
	}

	public void setTeamId(String teamId) {
		this.teamId = teamId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getChangeDate() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/PerformanceMetric.java
=====================================================
package com.capitalone.dashboard.model;

public class PerformanceMetric {
    private String name;
    private Object value;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatLevel.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumerates the possible statuses.
 */
public enum LibraryPolicyThreatLevel {
    Critical, High, Medium, Low, None;

    public static LibraryPolicyThreatLevel fromString(String value){
        for(LibraryPolicyThreatLevel threatLevel : values()){
            if(threatLevel.toString().equalsIgnoreCase(value)){
                return threatLevel;
            }
        }
        throw new IllegalArgumentException(value+" is not a valid LibraryPolicyThreatLevel");
    }

    public static LibraryPolicyThreatLevel fromDouble(double value){
        if ((value == 10)) return LibraryPolicyThreatLevel.Critical;
        if ((value < 10.0) && (value >= 7.0)) return LibraryPolicyThreatLevel.High;
        if ((value < 7.0) && (value >= 4.0)) return LibraryPolicyThreatLevel.Medium;
        if ((value < 4.0) && (value > 0.0)) return LibraryPolicyThreatLevel.Low;
        if (value == 0.0) return LibraryPolicyThreatLevel.None;

        throw new IllegalArgumentException(value+" is not a valid LibraryPolicyThreatLevel");
    }

    public static LibraryPolicyThreatLevel fromInt(int value){
        double dv = (double) value;
        return fromDouble(dv);
    }

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CodeReposBuilds.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

@Document(collection = "code_repos_builds")
public class CodeReposBuilds extends BaseModel {

    @Indexed(unique = true)
    private String codeRepo;

    private Set<ObjectId> buildCollectorItems = new HashSet<>();

    @Indexed
    private long timestamp;

    public String getCodeRepo() {
        return codeRepo.toLowerCase(Locale.US);
    }

    public void setCodeRepo(String codeRepo) {
        this.codeRepo = codeRepo.toLowerCase(Locale.US);
    }

    public Set<ObjectId> getBuildCollectorItems() {
        return buildCollectorItems;
    }

    public void setBuildCollectorItems(Set<ObjectId> buildCollectorItems) {
        this.buildCollectorItems = buildCollectorItems;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/RepoBranch.java
=====================================================
package com.capitalone.dashboard.model;


import javax.validation.constraints.NotNull;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;

public class RepoBranch {
    private String url = "";
    private String branch = "";
    private RepoType type = RepoType.Unknown;

    public enum RepoType {
        SVN,
        GIT,
        Unknown;

        public static com.capitalone.dashboard.model.RepoBranch.RepoType fromString(String value) {
            if (value ==  null) return RepoType.Unknown;
            for (com.capitalone.dashboard.model.RepoBranch.RepoType repoType : values()) {
                if (repoType.toString().equalsIgnoreCase(value)) {
                    return repoType;
                }
            }
            throw new IllegalArgumentException(value + " is not a valid RepoType.");
        }
    }

    public RepoBranch(String url, String branch, RepoType repoType) {
        this.url = url;
        this.branch = branch;
        this.type = repoType;
    }

    public RepoBranch() {
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url.toLowerCase(Locale.US);
    }

    public String getBranch() {
        switch (this.getType()) {
            case GIT: return getGITNormalizedBranch(branch);
            case SVN: return branch;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/quality/FindBugsXmlReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import java.util.List;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "BugCollection")
public class FindBugsXmlReport implements CodeQualityVisitee {
    @Override
    public void accept(CodeQualityVisitor visitor) {
        visitor.visit(this);
    }

    @XmlElement(name = "file")
    private List<BugFile> files;

    public List<BugFile> getFiles() {
        return files;
    }

    public void setFiles(List<BugFile> files) {
        this.files = files;
    }


    @XmlAccessorType(XmlAccessType.FIELD)
    public static class BugFile {
        @XmlElement(name = "BugInstance")
        private List<BugInstance> bugCollection;

        public List<BugInstance> getBugCollection() {
            return bugCollection;
        }

        public void setBugCollection(List<BugInstance> bugCollection) {
            this.bugCollection = bugCollection;
        }
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class BugInstance {

        @XmlAttribute
        private String type;

        @XmlAttribute
        private BugPriority priority;

        @XmlAttribute
        private BugCategory category;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/quality/PmdReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import java.util.List;

@XmlRootElement(name="pmd")
@XmlAccessorType(XmlAccessType.FIELD)
public class PmdReport implements CodeQualityVisitee {

    @XmlElement(name="file")
    private List<PmdFile> files;

    @Override
    public void accept(CodeQualityVisitor visitor) {
        visitor.visit(this);
    }

    public List<PmdFile> getFiles() {
        return files;
    }

    public void setFiles(List<PmdFile> files) {
        this.files = files;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class PmdFile{

        @XmlElement(name="violation")
        private List<PmdViolation> violations;

        public List<PmdViolation> getViolations() {
            return violations;
        }

        public void setViolations(List<PmdViolation> violations) {
            this.violations = violations;
        }
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class PmdViolation {

        @XmlAttribute(name="priority")
        private int priority;

        public int getPriority() {
            return priority;
        }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/quality/JacocoXmlReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import java.util.List;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "report")
public class JacocoXmlReport implements CodeQualityVisitee{

    @XmlElement(name="counter")
    private List<Counter> counters;


    @Override
    public void accept(CodeQualityVisitor visitor) {
        visitor.visit(this);
    }

    public List<Counter> getCounters() {
        return counters;
    }

    public void setCounters(List<Counter> counters) {
        this.counters = counters;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Counter {
        @XmlAttribute(name="type")
        private CounterType type;

        @XmlAttribute(name="missed")
        private int missed;

        @XmlAttribute(name="covered")
        private int covered;

        public int getMissed() {
            return missed;
        }

        public void setMissed(int missed) {
            this.missed = missed;
        }

        public int getCovered() {
            return covered;
        }

        public void setCovered(int covered) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/quality/ArtifactType.java
=====================================================
package com.capitalone.dashboard.model.quality;

public enum ArtifactType {
    junit, findbugs, jacoco, pmd, checkstyle;
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitor.java
=====================================================
package com.capitalone.dashboard.model.quality;

import com.capitalone.dashboard.model.CodeQuality;

public interface CodeQualityVisitor {

    CodeQuality produceResult();

    void visit(JunitXmlReport junitXmlReport);

    void visit(FindBugsXmlReport findBugsXmlReport);

    void visit(JacocoXmlReport jacocoXmlReport);

    void visit(PmdReport pmdReport);

    void visit(CheckstyleReport checkstyleReport);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/quality/CodeQualityVisitee.java
=====================================================
package com.capitalone.dashboard.model.quality;

public interface CodeQualityVisitee {

    void accept(CodeQualityVisitor visitor);
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/quality/JunitXmlReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.XMLGregorianCalendar;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * Contains the results of exexuting a testsuite
 * <p>
 * <p>Java class for testsuite complex type.
 * <p>
 * <p>The following schema fragment specifies the expected content contained within this class.
 * <p>
 * <pre>
 * &lt;complexType name="testsuite">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="properties">
 *           &lt;complexType>
 *             &lt;complexContent>
 *               &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 &lt;sequence>
 *                   &lt;element name="property" maxOccurs="unbounded" minOccurs="0">
 *                     &lt;complexType>
 *                       &lt;complexContent>
 *                         &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                           &lt;attribute name="name" use="required">
 *                             &lt;simpleType>
 *                               &lt;restriction base="{http://www.w3.org/2001/XMLSchema}token">
 *                                 &lt;minLength value="1"/>
 *                               &lt;/restriction>
 *                             &lt;/simpleType>
 *                           &lt;/attribute>
 *                           &lt;attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *                         &lt;/restriction>
 *                       &lt;/complexContent>
 *                     &lt;/complexType>
 *                   &lt;/element>
 *                 &lt;/sequence>
 *               &lt;/restriction>
 *             &lt;/complexContent>
 *           &lt;/complexType>
 *         &lt;/element>
 *         &lt;element name="testcase" maxOccurs="unbounded" minOccurs="0">
 *           &lt;complexType>

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/quality/CheckstyleReport.java
=====================================================
package com.capitalone.dashboard.model.quality;

import javax.xml.bind.annotation.*;
import java.util.List;

@XmlRootElement(name="checkstyle")
@XmlAccessorType(XmlAccessType.FIELD)
public class CheckstyleReport implements CodeQualityVisitee {

    @XmlElement(name="file")
    private List<CheckstyleFile> files;

    @Override
    public void accept(CodeQualityVisitor visitor) {
        visitor.visit(this);
    }

    public List<CheckstyleFile> getFiles() {
        return files;
    }

    public void setFiles(List<CheckstyleFile> files) {
        this.files = files;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class CheckstyleFile {

        @XmlElement(name="error")
        private List<CheckstyleError> errors;

        public List<CheckstyleError> getErrors() {
            return errors;
        }

        public void setErrors(List<CheckstyleError> errors) {
            this.errors = errors;
        }
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class CheckstyleError {

        @XmlAttribute(name="severity")
        private CheckstyleSeverity severity;


        public CheckstyleSeverity getSeverity() {
            return severity;
        }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/UserStory.java
=====================================================
package com.capitalone.dashboard.model;

public class UserStory {
	
	private String storyId;
	private String storyName;
	private String ownerName;
	private String storyUrl;
	private long lastUpdateDate;
	private String state;
	
	
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public long getLastUpdateDate() {
		return lastUpdateDate;
	}
	public void setLastUpdateDate(long lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}
	public String getStoryUrl() {
		return storyUrl;
	}
	public void setStoryUrl(String storyUrl) {
		this.storyUrl = storyUrl;
	}
	public String getStoryId() {
		return storyId;
	}
	public void setStoryId(String storyId) {
		this.storyId = storyId;
	}
	public String getStoryName() {
		return storyName;
	}
	public void setStoryName(String storyName) {
		this.storyName = storyName;
	}
	public String getOwnerName() {
		return ownerName;
	}
	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}
	
	

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/StandardWidget.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.collections.MapUtils;
import org.bson.types.ObjectId;

import java.util.HashMap;
import java.util.Map;

public class StandardWidget {
    private CollectorType collectorType;
    private static final String REPO = "repo";
    private static final String BUILD = "build";
    private static final String CODEQUALITY = "codeanalysis";
    private static final String FEATURE = "feature";
    private static final String DEPLOY = "deploy";

    private static final String REPO_ID = "repo0";
    private static final String BUILD_ID = "build0";
    private static final String CODEQUALITY_ID = "codeanalysis0";
    private static final String FEATURE_ID = "feature0";
    private static final String DEPLOY_ID = "deploy0";

    private Map<String, Object> options = new HashMap<>();
    private String name;
    private ObjectId componentId;

    public StandardWidget(CollectorType collectorType, ObjectId componentId) {
        this.collectorType = collectorType;
        this.componentId = componentId;
        setNameAndId();
    }

    /**
     * Setup the standard name, id etc for the widget
     */

    private void setNameAndId() {
        switch (collectorType) {
            case SCM:
                name = REPO;
                options.put("id", REPO_ID);
                break;

            case Build:
                name = BUILD;
                options.put("id", BUILD_ID);
                options.put("buildDurationThreshold", 3);
                options.put("consecutiveFailureThreshold", 5);
                break;


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/BuildStatus.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumeration of valid build statuses.
 */
public enum BuildStatus {
    Success,
    Failure,
    Unstable,
    Aborted,
    InProgress,
    Unknown;

    public static BuildStatus fromString(String value) {
        for (BuildStatus buildStatus : values()) {
            if (buildStatus.toString().equalsIgnoreCase(value)) {
                return buildStatus;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid BuildStatus.");
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CloudVirtualNetwork.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;


@Document(collection = "cloud_virtual_network")
public class CloudVirtualNetwork extends BaseModel{
    @Indexed
    @NotNull
    @NotBlank
    private String virtualNetworkId;
    @NotNull
    @NotBlank
    private String accountNumber;
    private ObjectId collectorItemId;
    private String cidrBlock;
    private boolean defaultNetwork;
    private String state; //pending, available etc.
    private Map<String, String> tags = new HashMap<>();
    private long creationDate;
    private long lastUpdateDate;

    public String getVirtualNetworkId() {
        return virtualNetworkId;
    }

    public void setVirtualNetworkId(String virtualNetworkId) {
        this.virtualNetworkId = virtualNetworkId;
    }

    public String getCidrBlock() {
        return cidrBlock;
    }

    public void setCidrBlock(String cidrBlock) {
        this.cidrBlock = cidrBlock;
    }

    public boolean isDefaultNetwork() {
        return defaultNetwork;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/EnvironmentStage.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Class representing any stage of a {@link Pipeline}
 */
public class EnvironmentStage extends Stage{
    /** {@link BinaryArtifact} The last artifact to be processed */
    private BinaryArtifact lastArtifact;

    public BinaryArtifact getLastArtifact() {
        return lastArtifact;
    }

    public void setLastArtifact(BinaryArtifact lastArtifact) {
        this.lastArtifact = lastArtifact;
    }


}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/RallyBurnDownData.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection="rally_burndown")

public class RallyBurnDownData extends BaseModel{
	
	public static final String ITERATION_TO_DO_HOURS = "iterationToDoHours";
	public static final String ACCEPTED_POINTS = "acceptedPoints";
	public static final String ITERATION_DATE = "iterationDate";
	
	private List<Map<String,String>> burnDownData; 
	private String iterationId;
	private String projectName;
	private String iterationName;
	private String projectId;
	private Double totalEstimate;
	private long lastUpdated;
	
	
	public long getLastUpdated() {
		return lastUpdated;
	}
	public void setLastUpdated(long timestamp) {
		this.lastUpdated = timestamp;
	}
	
	public List<Map<String, String>> getBurnDownData() {
		if(burnDownData==null){
			burnDownData = new ArrayList<>();
		}
		return burnDownData;
	}
	public void setBurnDownData(List<Map<String, String>> burnDownData) {
		this.burnDownData = burnDownData;
	}
	public String getIterationId() {
		return iterationId;
	}
	public void setIterationId(String iterationId) {
		this.iterationId = iterationId;
	}
	public String getProjectName() {
		return projectName;
	}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/PerformanceMetricStatus.java
=====================================================
package com.capitalone.dashboard.model;

public enum PerformanceMetricStatus {
    OK, WARNING, CRITICAL
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/LibraryPolicyType.java
=====================================================
package com.capitalone.dashboard.model;


public enum LibraryPolicyType {
    Security,
    License,
    Other;

    public static LibraryPolicyType fromString(String value) {
        for (LibraryPolicyType policyType : values()) {
            if (policyType.toString().equalsIgnoreCase(value)) {
                return policyType;
            }
        }
        return Other;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ScoreDisplayType.java
=====================================================
package com.capitalone.dashboard.model;

public enum ScoreDisplayType {
    HEADER,
    WIDGET;

    public static ScoreDisplayType fromString(String value){
        for(ScoreDisplayType scoreDisplay : values()){
            if(scoreDisplay.toString().equalsIgnoreCase(value)){
                return scoreDisplay;
            }
        }
        return ScoreDisplayType.HEADER;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/RequestLog.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.Document;


@Document(collection = "requests")
public class RequestLog extends BaseModel {
    private String client;
    private String endpoint;
    private String method;
    private String parameter;
    private long requestSize;
    private String requestContentType;
    private Object requestBody;
    private long responseSize;
    private String responseContentType;
    private Object responseBody;
    private int responseCode;
    private long timestamp;
    private long responseTime;

    public String getClient() {
        return client;
    }

    public void setClient(String client) {
        this.client = client;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getParameter() {
        return parameter;
    }

    public void setParameter(String parameter) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Configuration.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.Base64;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "configuration")
public class Configuration extends BaseModel {

	private final static String PREFIX = "BASE64:";

	public Configuration(String collectorName, Set<Map<String, String>> info) {
		super();
		this.collectorName = collectorName;
		this.info = info;
	}

	public Set<Map<String, String>> decryptOrEncrptInfo() {
		for (Map<String, String> info : info) {
			if (!info.isEmpty()) {
				String password = info.get("password").toString();
				if(password.contains(PREFIX)){
					Base64.Decoder decoder = Base64.getDecoder();
					password = new String(decoder.decode(password.replaceFirst(PREFIX, "").trim()));
				} else {
					Base64.Encoder encoder = Base64.getEncoder();
					password = PREFIX + encoder.encodeToString(password.getBytes());
				}
				info.replace("password", password);
			}
		}
		return info;
	}

	public Configuration() {
	}

	private String collectorName;
	private Set<Map<String, String>> info = new HashSet<>();

	public String getCollectorName() {
		return collectorName;
	}

	public void setCollectorName(String collectorName) {
		this.collectorName = collectorName;
	}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Collector.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The collectors that have been registered in the given Dashboard app instance.
 */
@Document(collection = "collectors")
public class Collector extends BaseModel {
    private String name;
    private CollectorType collectorType;
    private boolean enabled;
    private boolean online;
    private List<CollectionError> errors = new ArrayList<>();
    //Every collector will have its own set of required and all fields depending upon the specific tool.
    private Map<String, Object> uniqueFields = new HashMap<>();
    private Map<String, Object> allFields = new HashMap<>();

    private long lastExecuted;
    private List<String> searchFields = Arrays.asList("description");
    private Map<String, Object> properties = new HashMap<>(); //general purpose name-value properties

    public Collector() {
    }

    public Collector(String name, CollectorType collectorType) {
        this.name = name;
        this.collectorType = collectorType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public CollectorType getCollectorType() {
        return collectorType;
    }

    public void setCollectorType(CollectorType collectorType) {
        this.collectorType = collectorType;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/NameValue.java
=====================================================
package com.capitalone.dashboard.model;


public class NameValue {

    private String name;
    private String value;

    public NameValue () {
    }

    public NameValue(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NameValue nameValue = (NameValue) o;

        if (!name.equals(nameValue.name)) return false;
        return value.equals(nameValue.value);

    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + value.hashCode();
        return result;
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CodeQuality.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashSet;
import java.util.Set;

/**
 * Represents code quality at a specific point in time. This could include
 * a unit test run, a security scan, static analysis, functional tests,
 * manual acceptance tests or bug reports.
 *
 * Possible Collectors:
 *  Sonar (in scope)
 *  Fortify
 *  ALM
 *  Various build system test results
 *
 */
@Document(collection="code_quality")
public class CodeQuality extends BaseModel {
    private ObjectId collectorItemId;
    private long timestamp;

    private String name;
    private String url;
    private CodeQualityType type;
    private String version;
    private  ObjectId buildId;

    private Set<CodeQualityMetric> metrics = new HashSet<>();

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getName() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CodeQualityMetricStatus.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumerates the possible {@link CodeQualityMetric} statuses.
 */
public enum CodeQualityMetricStatus {
    Ok, Warning, Alert, Error
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/RallyStoryStages.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.List;

public class RallyStoryStages {
	
	private String backlog;
	private String defined;
	private String inProgress;
	private String completed;
	private String accepted;
	private String defects;
	private List<UserStory> userStories;
	
	
	public List<UserStory> getUserStories() {
		return userStories;
	}
	public void setUserStories(List<UserStory> userStories) {
		this.userStories = userStories;
	}
	public String getDefects() {
		return defects;
	}
	public void setDefects(String defects) {
		this.defects = defects;
	}
	public String getBacklog() {
		return backlog;
	}
	public void setBacklog(String backlog) {
		this.backlog = backlog;
	}
	public String getDefined() {
		return defined;
	}
	public void setDefined(String defined) {
		this.defined = defined;
	}
	public String getInProgress() {
		return inProgress;
	}
	public void setInProgress(String inProgress) {
		this.inProgress = inProgress;
	}
	public String getCompleted() {
		return completed;
	}
	public void setCompleted(String completed) {
		this.completed = completed;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TeamMember.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.List;

/**
 * Class representing any team members of a {@link TeamInventory}
 */
public class TeamMember {

    private String orgId;
    private String allocation;
    private String teamId;
    private String name;
    private List<TeamLevelDetails> teams;


    private String regOrTemp ;

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public String getAllocation() {
        return allocation;
    }

    public void setAllocation(String allocation) {
        this.allocation = allocation;
    }

    public String getTeamId() {
        return teamId;
    }

    public void setTeamId(String teamId) {
        this.teamId = teamId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CollectorItem.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.collections.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * <p>
 *      Represents a unique collection in an external tool. For example, for a CI tool
 *      the collector item would be a Job. For a project management tool, the collector item
 *      might be a Scope.
 * </p>
 * <p>
 *      Each {@link Collector} is responsible for specifying how it's {@link CollectorItem}s are
 *      uniquely identified by storing key/value pairs in the options Map. The description field will
 *      be visible to users in the UI to aid in selecting the correct {@link CollectorItem} for their dashboard.
 *      Ideally, the description will be unique for a given {@link Collector}.
 * </p>
 */
@Document(collection="collector_items")
public class CollectorItem extends BaseModel {

    private String description;
    private String niceName;
    private String environment;
    private boolean enabled;
    private List<CollectionError> errors = new ArrayList<>();
    private boolean pushed;
    private ObjectId collectorId;
    private long lastUpdated;
    private Map<String,Object> options = new HashMap<>();

    @Transient
    private Collector collector;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TeamLevelDetails.java
=====================================================
package com.capitalone.dashboard.model;

public class TeamLevelDetails extends CollectorItem {


    public String getInstanceUrl() {
        return (String) getOptions().get("instanceUrl");
    }

    public void setInstanceUrl(String url) {
        getOptions().put("instanceUrl", url);
    }

    public String getTeamId() {
        return (String) getOptions().get("teamId");
    }

    public void setTeamId(String teamId) {
        getOptions().put("teamId", teamId);
    }

    public String getTeamName() {
        return (String) getOptions().get("teamName");
    }

    public void setTeamName(String teamName) {
        getOptions().put("teamName", teamName);
    }

    public String getUrl() {
        return (String) getOptions().get("url");
    }

    public void setUrl(String url) {
        getOptions().put("url", url);
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TeamLevelDetails that = (TeamLevelDetails) o;
        return getTeamId().equals(that.getTeamId()) && getTeamName().equals(that.getTeamName());
    }

    @Override
    public int hashCode() {
        int result = getTeamId().hashCode();

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/LibraryPolicyResult.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.collections.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;


@Document(collection = "library_policy")
public class LibraryPolicyResult extends BaseModel {
    private ObjectId collectorItemId;
    private long timestamp;
    private long evaluationTimestamp;
    private Map<LibraryPolicyType, Set<Threat>> threats = new HashMap<>();
    private String reportUrl;
    private Integer totalComponentCount;
    private Integer knownComponentCount;
    private List<PolicyScanMetric> policyAlert = new ArrayList<>();
    private ObjectId buildId;

    public static class Threat {
        LibraryPolicyThreatLevel level;
        List<String> components = new ArrayList<>();
        int count;
        private Map<LibraryPolicyThreatDisposition, Integer> dispositionCounts = new HashMap<>();

        public Threat(LibraryPolicyThreatLevel level, int count) {
            this.level = level;
            this.count = count;
        }

        public LibraryPolicyThreatLevel getLevel() {
            return level;
        }

        public void setLevel(LibraryPolicyThreatLevel level) {
            this.level = level;
        }

        public int getCount() {
            return count;
        }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Performance.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;

@Document(collection="performance")
public class Performance extends BaseModel{

    private ObjectId collectorItemId;
    private long timestamp;
    private String url;
    private PerformanceType type;
    private String version;
    private  ObjectId executionId;
    private String targetAppName;
    private String targetEnvName;
    private Map<String,Object> metrics = new HashMap<>();

    public Map<String,Object> getMetrics() {
        return metrics;
    }

    public void setMetrics(Map<String,Object> metrics) {
        this.metrics = metrics;
    }

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Component.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * A self-contained, independently deployable piece of the larger application. Each component of an application
 * has a different source repo, build job, deploy job, etc.
 *
 */
@Document(collection="components")
public class Component extends BaseModel {
    private String name; // must be unique to the application
    private String owner;
    private Map<CollectorType, List<CollectorItem>> collectorItems = new HashMap<>();

    public Component() {
    }

    public Component(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public Map<CollectorType, List<CollectorItem>> getCollectorItems() {
        return collectorItems;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/StoryIndicator.java
=====================================================
package com.capitalone.dashboard.model;
public class StoryIndicator {
    private String storyId;
    private String storyNumber;
    private String storyName;
    private String storyStatus;
    private String storyState;
    private String storyType;
    private String epicNumber;
    private String epicName;
    private String projectName;
    private String teamName;
    private String sprintName;
    public String getStoryId() {
        return storyId;
    }
    public void setStoryId(String storyId) {
        this.storyId = storyId;
    }
    public String getStoryNumber() {
        return storyNumber;
    }
    public void setStoryNumber(String storyNumber) {
        this.storyNumber = storyNumber;
    }
    public String getStoryName() {
        return storyName;
    }
    public void setStoryName(String storyName) {
        this.storyName = storyName;
    }
    public String getStoryStatus() {
        return storyStatus;
    }
    public void setStoryStatus(String storyStatus) {
        this.storyStatus = storyStatus;
    }
    public String getStoryState() {
        return storyState;
    }
    public void setStoryState(String storyState) {
        this.storyState = storyState;
    }
    public String getStoryType() {
        return storyType;
    }
    public void setStoryType(String storyType) {
        this.storyType = storyType;
    }
    public String getEpicNumber() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/PipelineStage.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.Locale;

public final class PipelineStage {

	public static final PipelineStage COMMIT = new PipelineStage("Commit", PipelineStageType.COMMIT);
	public static final PipelineStage BUILD = new PipelineStage("Build", PipelineStageType.BUILD);

	private final String name;
	private final PipelineStageType type;
	
	private PipelineStage(String name, PipelineStageType type) { 
		this.name = name;
		this.type = type;
	}
	
	public String getName() {
		return name;
	}
	
	public PipelineStageType getType() {
		return type;
	}
	
	public static PipelineStage valueOf(String name) {
		if (name == null) {
			throw new IllegalArgumentException();
		}
		
		if (COMMIT.name.equalsIgnoreCase(name)) {
			return COMMIT;
		} else if (BUILD.name.equalsIgnoreCase(name)) {
			return BUILD;
		} else {
			return new PipelineStage(name, PipelineStageType.DEPLOY);
		}
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.toLowerCase(Locale.getDefault()).hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@SuppressWarnings("PMD.SimplifyBooleanReturns")
	@Override

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Dashboard.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

/**
 * A collection of widgets, collectors and application components that represent a software
 * project under development and/or in production use.
 *
 */
@Document(collection="dashboards")
public class Dashboard extends BaseModel {

    private String template;

    //NOTE Mongodb treats strings as different if they have different case
    @Indexed(unique=true)
    private String title;

    private List<Widget> widgets = new ArrayList<>();

    // multiple owner references for backwards compatibility
    // TODO: remove once impacts of breaking change are assessed
    private String owner;
    private List<Owner> owners = new ArrayList<Owner>();
    
    private DashboardType type;

    private Application application;

    private String configurationItemBusServName;

    private String configurationItemBusAppName;

    private boolean validServiceName;

    private boolean validAppName;

    private boolean remoteCreated;

    //Enable/Disable scoring for the dashboard
    private boolean scoreEnabled;

    //Display position for score.
    //Default to HEADER
    private ScoreDisplayType scoreDisplay = ScoreDisplayType.HEADER;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ServiceAccount.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection="service_accounts")
public class ServiceAccount extends BaseModel {

    private String serviceAccountName;
    private String fileNames;

    public ServiceAccount(String serviceAccountName, String fileNames) {
       this.serviceAccountName = serviceAccountName;
       this.fileNames = fileNames;
    }

    public String getServiceAccountName() {
        return serviceAccountName;
    }

    public void setServiceAccountName(String serviceAccountName) {
        this.serviceAccountName = serviceAccountName;
    }

    public String getFileNames() {
        return fileNames;
    }

    public void setFileNames(String fileNames) {
        this.fileNames = fileNames;
    }

    @Override
    public String toString() {
        return "ServiceAccount [serviceAccount=" + serviceAccountName + ", fileNames=" + fileNames + "]";
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Commit.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * A specific commit in a version control repository.
 *
 * Possible collectors:
 *  Subversion (in scope)
 *  Git (in scope)
 *  GitHub
 *  TFS
 *  BitBucket
 *  Unfuddle
 *
 */
@Document(collection="commits")
@CompoundIndexes({
        @CompoundIndex(name = "unique_scm_key", def = "{'collectorItemId' : 1, 'scmRevisionNumber': 1}")
})
public class Commit extends SCM {
    @Id
    private ObjectId id;
    @Indexed
    private ObjectId collectorItemId;
    private long timestamp;

    private boolean firstEverCommit;

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/PipelineCommit.java
=====================================================
package com.capitalone.dashboard.model;

public class PipelineCommit extends SCM{
	
    public PipelineCommit() {
    }

    public PipelineCommit(long timestamp) {
        this.timestamp = timestamp;
    }

    public PipelineCommit(SCM scm, long timestamp){
        super(scm);
        this.timestamp = timestamp;
    }
    private long timestamp;

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((scmRevisionNumber == null) ? 0 : scmRevisionNumber.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PipelineCommit other = (PipelineCommit) obj;
		if (scmRevisionNumber == null) {
			if (other.scmRevisionNumber != null)
				return false;
		} else if (!scmRevisionNumber.equals(other.scmRevisionNumber))
			return false;
		return true;
	}
    

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestSuiteType.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Denotes the type of tests in a given {@link TestSuite}.
 */
public enum TestSuiteType {
    Unit, Functional, Regression, Performance, Integration, Security, Manual;

    public static TestSuiteType fromString(String value) {
        for (TestSuiteType type : values()) {
            if (type.toString().equalsIgnoreCase(value)) {
                return type;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid TestSuiteType.");
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/AuditResult.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;

@Document(collection = "audit_results")
public class AuditResult extends BaseModel {

    private ObjectId dashboardId;
    private String dashboardTitle;
    private String lineOfBusiness;
    private String configItemBusServName;
    private String configItemBusAppName;
    private String configItemBusServOwner;
    private String configItemBusAppOwner;
    private AuditType auditType;
    private String auditTypeStatus;
    private String auditStatus;
    private String url;
    private String auditDetails;
    private Map traceability;
    private long timestamp;
    private Map<String, Object> options = new HashMap<>();

    public AuditResult() { }

    @SuppressWarnings("PMD.ExcessiveParameterList")
    public AuditResult(ObjectId dashboardId, String dashboardTitle, String lineOfBusiness, String configItemBusServName,
                       String configItemBusAppName, String configItemBusServOwner, String configItemBusAppOwner, AuditType auditType,
                       String auditTypeStatus, String auditStatus, String auditDetails, String url, Map traceability, long timestamp) {
        this.dashboardId = dashboardId;
        this.dashboardTitle = dashboardTitle;
        this.lineOfBusiness = lineOfBusiness;
        this.configItemBusServName = configItemBusServName;
        this.configItemBusAppName = configItemBusAppName;
        this.configItemBusServOwner = configItemBusServOwner;
        this.configItemBusAppOwner = configItemBusAppOwner;
        this.auditType = auditType;
        this.auditTypeStatus = auditTypeStatus;
        this.auditStatus = auditStatus;
        this.url = url;
        this.auditDetails = auditDetails;
        this.traceability = traceability;
        this.timestamp = timestamp;
    }

    @SuppressWarnings("PMD.ExcessiveParameterList")

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CollectorItemConfigHistory.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;

@Document(collection="collitem_cfghist")
public class CollectorItemConfigHistory extends BaseModel {

    private ObjectId collectorItemId;
    private long timestamp;
    private ConfigHistOperationType operation;
    private String userName;
    private String userID;
    private Map<String, Object> changeMap = new HashMap<>();

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public ConfigHistOperationType getOperation() {
        return operation;
    }

    public void setOperation(ConfigHistOperationType operation) {
        this.operation = operation;
    }

    public Map<String, Object> getChangeMap() {
        return changeMap;
    }

    public void setChangeMap(Map<String, Object> changeMap) {
        this.changeMap = changeMap;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/PerformanceType.java
=====================================================
package com.capitalone.dashboard.model;


public enum PerformanceType {
    ApplicationPerformance(CollectorType.AppPerformance),
    InfrastructurePerformance(CollectorType.InfraPerformance);

    private final CollectorType collectorType;
    PerformanceType(CollectorType collectorType) {
        this.collectorType = collectorType;
    }

    public static PerformanceType fromString(String value) {
        for (PerformanceType performanceType : values()) {
            if (performanceType.toString().equalsIgnoreCase(value)) {
                return performanceType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid PerformanceType.");
    }

    public CollectorType collectorType() {
        return collectorType;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Authentication.java
=====================================================
package com.capitalone.dashboard.model;

import com.google.common.hash.Hashing;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.nio.charset.StandardCharsets;

/**
 * This class serves as the model for storing credential used for login & Signup.
 */


@Document(collection = "authentication")
public class Authentication extends BaseModel {
    static final String HASH_PREFIX = "sha512:";

    @Indexed(unique = true)
    private String username;

    private String password;


    public Authentication(String username, String password) {
        this.username = username;
        this.password = hash(password);
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = hash(password);
    }


    static String hash(String password) {
        if (!password.startsWith(HASH_PREFIX)) {
            return HASH_PREFIX + Hashing.sha512().hashString(password, StandardCharsets.UTF_8).toString();
        }
        return password;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CodeQualityType.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumerates the possible {@link CodeQuality} types.
 */
public enum CodeQualityType {
    StaticAnalysis(CollectorType.CodeQuality),
    SecurityAnalysis(CollectorType.StaticSecurityScan);

    private final CollectorType collectorType;
    CodeQualityType(CollectorType collectorType) {
        this.collectorType = collectorType;
    }

    public static CodeQualityType fromString(String value) {
        for (CodeQualityType qualityType : values()) {
            if (qualityType.toString().equalsIgnoreCase(value)) {
                return qualityType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid CodeQualityType.");
    }

    public CollectorType collectorType() {
        return collectorType;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CloudInstance.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * Represents an EC2 instance from AWS
 */
@Document(collection = "cloud_instance")
public class CloudInstance extends BaseModel{
    @Indexed
    private String instanceId;

    @Indexed
    private String accountNumber;
    private String instanceType;
    private String imageId;
    private long imageExpirationDate;
    private boolean imageApproved;
    private String instanceOwner;
    private boolean isMonitored;
    private String privateDns;
    private String privateIp;
    private String publicDns;
    private String publicIp;
    private String subnetId;
    private String virtualNetworkId;
    private int age;
    private String status;
    private boolean isStopped;
    private boolean isTagged;
    private double cpuUtilization;
    private long lastUpdatedDate;
    private List<String> securityGroups = new ArrayList<>();
    private List<NameValue> tags = new ArrayList<>();
    private double networkIn;
    private double networkOut;
    private double diskRead;
    private double diskWrite;
    private String rootDeviceName;
    private String autoScaleName;
    private String lastAction;


    public String getInstanceId() {
        return instanceId;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/MaturityModel.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "maturity_model")
public class MaturityModel {
    @Indexed
    private String profile;
    private String rules;

    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    public String getRules() {
        return rules;
    }

    public void setRules(String rules) {
        this.rules = rules;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/ScoreTypeValue.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Score Value with Type Details
 */
public class ScoreTypeValue {

  private ScoreType scoreType = ScoreType.value_percent;

  private Double scoreValue;

  //Propagate the score
  private PropagateType propagate = PropagateType.no;

  public ScoreTypeValue() {}

  public static ScoreTypeValue noScore() {
    ScoreTypeValue scoreTypeValue = new ScoreTypeValue();
    scoreTypeValue.setScoreType(ScoreType.no_score);
    return scoreTypeValue;
  }

  public static ScoreTypeValue zeroScore() {
    ScoreTypeValue scoreTypeValue = new ScoreTypeValue();
    scoreTypeValue.setScoreType(ScoreType.zero_score);
    return scoreTypeValue;
  }

  public ScoreTypeValue(Double scoreValue) {
    this.scoreValue = scoreValue;
  }

  public static ScoreTypeValue cloneScoreTypeValue(ScoreTypeValue scoreTypeValue) {
    if (null == scoreTypeValue) {
      return null;
    }
    ScoreTypeValue scoreTypeValueClone = new ScoreTypeValue();
    scoreTypeValueClone.setScoreType(scoreTypeValue.getScoreType());
    scoreTypeValueClone.setScoreValue(scoreTypeValue.getScoreValue());
    scoreTypeValueClone.setPropagate(scoreTypeValue.getPropagate());
    return scoreTypeValueClone;
  }

  public ScoreType getScoreType() {
    return scoreType;
  }

  public boolean isNoScore() {
    return scoreType == ScoreType.no_score;
  }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/ScoreComponentSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Score Settings for a Component
 */
public class ScoreComponentSettings {

  //If component is disabled, this can be set true
  private boolean disabled = false;

  //Weight for component in score (0-100)
  private int weight = 0;

  //Score Criterias for component
  private ScoreCriteria criteria;

  public static ScoreComponentSettings cloneScoreComponentSettings(ScoreComponentSettings scoreComponentSettings) {
    if (null == scoreComponentSettings) {
      return null;
    }
    ScoreComponentSettings scoreComponentSettingsClone = new ScoreComponentSettings();
    copyScoreComponentSettings(scoreComponentSettings, scoreComponentSettingsClone);
    return scoreComponentSettingsClone;
  }

  public static void copyScoreComponentSettings(ScoreComponentSettings from, ScoreComponentSettings to) {
    if (null == from || null == to) {
      return;
    }
    to.setDisabled(from.isDisabled());
    to.setWeight(from.getWeight());
    ScoreCriteria criteria = from.getCriteria();
    if (null == criteria) {
      return;
    }
    to.setCriteria(
      ScoreCriteria.cloneScoreCriteria(criteria)
    );
  }

  public boolean isDisabled() {
    return disabled;
  }

  public void setDisabled(boolean disabled) {
    this.disabled = disabled;
  }

  public int getWeight() {
    return weight;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/ScoreType.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Score Type
 */
public enum ScoreType {
  //When Type is no_score component is not considered for scoring
  no_score,
  //When Type is zero_score component component score is `0`
  zero_score,
  //When Type is value_percent component score is a defined value
  value_percent
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/ScoreThresholdSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Score Threshold Settings
 */
public class ScoreThresholdSettings {

  //Compare with these operators
  public enum ComparatorType {
    equals,
    less,
    greater,
    less_or_equal,
    greater_or_equal
  }

  //The value can be of type percent for percent of days, Or days for number of days
  public enum ValueType {
    percent,
    days
  }

  private ComparatorType comparator = ComparatorType.less_or_equal;

  private ValueType type = ValueType.percent;

  //If the threshold is met set the score
  private ScoreTypeValue score;

  //Number of days to check for while applying threshold
  private Integer numDaysToCheck;

  //Value to compare
  private Double value;

  public static ScoreThresholdSettings cloneScoreThresholdSettings(ScoreThresholdSettings scoreThresholdSettings) {
    if (null == scoreThresholdSettings) {
      return scoreThresholdSettings;
    }

    ScoreThresholdSettings scoreThresholdSettingsClone = new ScoreThresholdSettings();
    scoreThresholdSettingsClone.setComparator(scoreThresholdSettings.getComparator());
    scoreThresholdSettingsClone.setType(scoreThresholdSettings.getType());
    scoreThresholdSettingsClone.setValue(scoreThresholdSettings.getValue());
    scoreThresholdSettingsClone.setNumDaysToCheck(scoreThresholdSettings.getNumDaysToCheck());
    scoreThresholdSettingsClone.setScore(
      ScoreTypeValue.cloneScoreTypeValue(scoreThresholdSettings.getScore())
      );
    return scoreThresholdSettingsClone;
  }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteriaSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.score.ScoreValueType;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "score_criteria_settings")
public class ScoreCriteriaSettings extends BaseModel {

  //Max Score
  private int maxScore;

  //Build Score Settings
  private BuildScoreSettings build;

  //Quality Score Settings
  private QualityScoreSettings quality;

  //Deploy Score Settings
  private DeployScoreSettings deploy;

  //SCM Score Settings
  private ScmScoreSettings scm;

  //Alert Score Component Settings
  private ComponentAlert componentAlert;

  //Score can be calculated for types defined in ScoreValueType
  private ScoreValueType type = ScoreValueType.DASHBOARD;

  //Time when score was calculated
  private long timestamp;

  public int getMaxScore() {
    return maxScore;
  }

  public void setMaxScore(int maxScore) {
    this.maxScore = maxScore;
  }

  public BuildScoreSettings getBuild() {
    return build;
  }

  public void setBuild(BuildScoreSettings build) {
    this.build = build;
  }

  public QualityScoreSettings getQuality() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/ScmScoreSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Bean to hold score settings specific to scm
 */
public class ScmScoreSettings extends ScoreComponentSettings {

  public static final int SCM_NUM_OF_DAYS = 14;

  private ScoreComponentSettings commitsPerDay;

  private int numberOfDays = SCM_NUM_OF_DAYS;

  public static ScmScoreSettings cloneScmScoreSettings(ScmScoreSettings scmScoreSettings) {
    if (null == scmScoreSettings) {
      return null;
    }

    ScmScoreSettings scmScoreSettingsClone = new ScmScoreSettings();
    ScoreComponentSettings.copyScoreComponentSettings(scmScoreSettings, scmScoreSettingsClone);
    scmScoreSettingsClone.setNumberOfDays(
      scmScoreSettings.getNumberOfDays()
    );
    scmScoreSettingsClone.setCommitsPerDay(
      ScoreComponentSettings.cloneScoreComponentSettings(scmScoreSettings.getCommitsPerDay())
    );

    return scmScoreSettingsClone;
  }

  public int getNumberOfDays() {
    return numberOfDays;
  }

  public void setNumberOfDays(int numberOfDays) {
    this.numberOfDays = numberOfDays;
  }

  public ScoreComponentSettings getCommitsPerDay() {
    return commitsPerDay;
  }

  public void setCommitsPerDay(ScoreComponentSettings commitsPerDay) {
    this.commitsPerDay = commitsPerDay;
  }

  @Override public String toString() {
    return "ScmScoreSettings{" +
      "commitsPerDay=" + commitsPerDay +
      ", numberOfDays=" + numberOfDays +

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/QualityScoreSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Bean to hold score settings specific to quality
 */
public class QualityScoreSettings extends ScoreComponentSettings {

  //Settings for Code Coverage
  private ScoreComponentSettings codeCoverage;

  //Settings for Unit Tests
  private ScoreComponentSettings unitTests;

  //Settings for Violations
  private ViolationsScoreSettings violations;

  public static QualityScoreSettings cloneQualityScoreSettings(QualityScoreSettings qualityScoreSettings) {
    if (null == qualityScoreSettings) {
      return null;
    }

    QualityScoreSettings qualityScoreSettingsClone = new QualityScoreSettings();
    ScoreComponentSettings.copyScoreComponentSettings(qualityScoreSettings, qualityScoreSettingsClone);
    qualityScoreSettingsClone.setCodeCoverage(
      ScoreComponentSettings.cloneScoreComponentSettings(qualityScoreSettings.getCodeCoverage())
    );
    qualityScoreSettingsClone.setUnitTests(
      ScoreComponentSettings.cloneScoreComponentSettings(qualityScoreSettings.getUnitTests())
    );
    qualityScoreSettingsClone.setViolations(
      ViolationsScoreSettings.cloneViolationsScoreSettings(qualityScoreSettings.getViolations())
    );

    return qualityScoreSettingsClone;
  }


  public ScoreComponentSettings getCodeCoverage() {
    return codeCoverage;
  }

  public void setCodeCoverage(ScoreComponentSettings codeCoverage) {
    this.codeCoverage = codeCoverage;
  }

  public ScoreComponentSettings getUnitTests() {
    return unitTests;
  }

  public void setUnitTests(ScoreComponentSettings unitTests) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/BuildScoreSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Bean to hold score settings specific to build
 */
public class BuildScoreSettings extends ScoreComponentSettings {

  public static final long BUILD_DURATION_THRESHOLD_MILLIS = 300000;

  public static final int BUILD_STATUS_NUM_OF_DAYS = 14;

  //Settings for Build Threshold Duration
  private BuildDurationScoreSettings duration;

  //Settings for Build Status
  private ScoreComponentSettings status;

  //Number Of Days to calculate build score
  private int numberOfDays = BUILD_STATUS_NUM_OF_DAYS;

  public static BuildScoreSettings cloneBuildScoreSettings(BuildScoreSettings buildScoreSettings) {
    if (null == buildScoreSettings) {
      return null;
    }
    BuildScoreSettings buildScoreSettingsClone = new BuildScoreSettings();
    ScoreComponentSettings.copyScoreComponentSettings(buildScoreSettings, buildScoreSettingsClone);
    buildScoreSettingsClone.setNumberOfDays(buildScoreSettings.getNumberOfDays());
    buildScoreSettingsClone.setStatus(
      ScoreComponentSettings.cloneScoreComponentSettings(buildScoreSettings.getStatus())
    );

    buildScoreSettingsClone.setDuration(
      BuildDurationScoreSettings.cloneBuildDurationScoreSettings(buildScoreSettings.getDuration())
    );

    return buildScoreSettingsClone;
  }


  public int getNumberOfDays() {
    return numberOfDays;
  }

  public void setNumberOfDays(int numberOfDays) {
    this.numberOfDays = numberOfDays;
  }

  public BuildDurationScoreSettings getDuration() {
    return duration;
  }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/PropagateType.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

public enum PropagateType {
  no(1),
  widget(2),
  dashboard(3);

  private final int value;

  private PropagateType(int value) {
    this.value = value;
  }

  public int getValue() {
    return value;
  }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/DeployScoreSettings.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Bean to hold score settings specific to deploy
 */
public class DeployScoreSettings extends ScoreComponentSettings {

  //Settings for Deploy Success Instances
  private ScoreComponentSettings deploySuccess;

  //Settings for Instances Online
  private ScoreComponentSettings intancesOnline;

  public static DeployScoreSettings cloneDeployScoreSettings(DeployScoreSettings deployScoreSettings) {
    if (null == deployScoreSettings) {
      return null;
    }
    DeployScoreSettings deployScoreSettingsClone = new DeployScoreSettings();
    ScoreComponentSettings.copyScoreComponentSettings(deployScoreSettings, deployScoreSettingsClone);
    deployScoreSettingsClone.setDeploySuccess(
      ScoreComponentSettings.cloneScoreComponentSettings(deployScoreSettings.getDeploySuccess())
    );
    deployScoreSettingsClone.setIntancesOnline(
      ScoreComponentSettings.cloneScoreComponentSettings(deployScoreSettings.getIntancesOnline())
    );
    return deployScoreSettingsClone;
  }

  public ScoreComponentSettings getDeploySuccess() {
    return deploySuccess;
  }

  public void setDeploySuccess(ScoreComponentSettings deploySuccess) {
    this.deploySuccess = deploySuccess;
  }

  public ScoreComponentSettings getIntancesOnline() {
    return intancesOnline;
  }

  public void setIntancesOnline(ScoreComponentSettings intancesOnline) {
    this.intancesOnline = intancesOnline;
  }

  @Override public String toString() {
    return "DeployScoreSettings{" +
      "deploySuccess=" + deploySuccess +
      ", intancesOnline=" + intancesOnline +
      ", disabled=" + isDisabled() +
      ", weight=" + getWeight() +

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/ComponentAlert.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

/**
 * Alert Settings for Scoring component
 */
public class ComponentAlert {

  private ScoreThresholdSettings.ComparatorType comparator = ScoreThresholdSettings.ComparatorType.less_or_equal;

  //Value to compare
  private Double value;

  public static ComponentAlert cloneComponentAlert(ComponentAlert componentAlert) {
    if (null == componentAlert) {
      return null;
    }

    ComponentAlert componentAlertClone = new ComponentAlert();
    componentAlertClone.setComparator(componentAlert.getComparator());
    componentAlertClone.setValue(componentAlert.getValue());
    return componentAlertClone;
  }

  public ScoreThresholdSettings.ComparatorType getComparator() {
    return comparator;
  }

  public void setComparator(ScoreThresholdSettings.ComparatorType comparator) {
    this.comparator = comparator;
  }

  public Double getValue() {
    return value;
  }

  public void setValue(Double value) {
    this.value = value;
  }

  @Override public String toString() {
    return "WidgetAlert{" +
      "comparator=" + comparator +
      ", value=" + value +
      '}';
  }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/settings/ScoreCriteria.java
=====================================================
package com.capitalone.dashboard.model.score.settings;

import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Score Criteria
 * Criteria Conditions
 * - No Widget Found
 * - No Data Found in Widget
 * Threshold Settings for data
 */
public class ScoreCriteria {

  //Score when no widget is found
  private ScoreTypeValue noWidgetFound;

  //Score when no data is found in widget
  private ScoreTypeValue noDataFound;

  //List of threshold conditions
  private List<ScoreThresholdSettings> dataRangeThresholds;

  public static ScoreCriteria cloneScoreCriteria(ScoreCriteria scoreCriteria) {
    if (null == scoreCriteria) {
      return null;
    }

    ScoreCriteria scoreCriteriaClone = new ScoreCriteria();

    scoreCriteriaClone.setNoDataFound(
      ScoreTypeValue.cloneScoreTypeValue(scoreCriteria.getNoDataFound())
    );
    scoreCriteriaClone.setNoWidgetFound(
      ScoreTypeValue.cloneScoreTypeValue(scoreCriteria.getNoWidgetFound())
    );

    List<ScoreThresholdSettings> dataRangeThresholds = scoreCriteria.getDataRangeThresholds();
    if (CollectionUtils.isEmpty(dataRangeThresholds)) {
      return scoreCriteriaClone;
    }

    List<ScoreThresholdSettings> dataRangeThresholdsClone = new ArrayList<>();
    for (ScoreThresholdSettings dataRangeThreshold : dataRangeThresholds) {
      dataRangeThresholdsClone.add(
        ScoreThresholdSettings.cloneScoreThresholdSettings(dataRangeThreshold)
      );
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/ScoreCollectorItem.java
=====================================================
package com.capitalone.dashboard.model.score;

import com.capitalone.dashboard.model.CollectorItem;
import org.bson.types.ObjectId;

public class ScoreCollectorItem extends CollectorItem {

  private static final String DASHBOARD_ID = "dashboardId";

  public ObjectId getDashboardId() {
    return (ObjectId) getOptions().get(DASHBOARD_ID);
  }

  public void setDashboardId(ObjectId dashboardId) {
    getOptions().put(DASHBOARD_ID, dashboardId);
  }

  @Override
  public boolean equals(Object o) {
    if (this == o)
      return true;
    if (o == null || getClass() != o.getClass())
      return false;
    ScoreCollectorItem that = (ScoreCollectorItem) o;
    return getDashboardId().equals(that.getDashboardId());
  }

  @Override
  public int hashCode() {
    int result = getDashboardId().hashCode();
    return result;
  }


}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/ScoreValueType.java
=====================================================
package com.capitalone.dashboard.model.score;

/*
  Score Type for calculating scores
 */
public enum ScoreValueType {
  DASHBOARD;

  public static ScoreValueType fromString(String value) {
    for (ScoreValueType scoreValueType : values()) {
      if (scoreValueType.toString().equalsIgnoreCase(value)) {
        return scoreValueType;
      }
    }
    throw new IllegalArgumentException(value + " is not a valid ScoreValueType.");
  }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetric.java
=====================================================
package com.capitalone.dashboard.model.score;

import java.util.List;

/*
  Score for a component like widget
 */
public class ScoreComponentMetric extends ScoreComponentMetricBase {
  //Individual components within a component, with scores for them
  private List<ScoreComponentMetricBase> children;

  public List<ScoreComponentMetricBase> getChildren() {
    return children;
  }

  public void setChildren(List<ScoreComponentMetricBase> children) {
    this.children = children;
  }

  @Override public String toString() {
    return "ScoreComponentMetric{" +
      "score='" + getScore() + '\'' +
      ", total='" + getTotal() + '\'' +
      ", weight='" + getWeight() + '\'' +
      ", refId='" + getRefId() + '\'' +
      ", displayId='" + getDisplayId() + '\'' +
      ", displayName='" + getDisplayName() + '\'' +
      ", message='" + getMessage() + '\'' +
      ", propagate='" + getPropagate() + '\'' +
      ", state='" + getState() + '\'' +
      ", noScore=" + isNoScore() +
      ", children=" + children + '\'' +
      ", options=" + getOptions() + '\'' +
      ", alert='" + isAlert() +
      '}';
  }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/ScoreComponentMetricBase.java
=====================================================
package com.capitalone.dashboard.model.score;

import com.google.common.collect.Maps;
import org.bson.types.ObjectId;

import java.util.Map;

public class ScoreComponentMetricBase {
  //Score for the widget/component
  private String score;

  //Score total
  private String total;

  //Weight in percent for a widget/component
  private String weight;

  //Reference Id. When score is for type Dashboard, value is Widget Id
  private ObjectId refId;

  //Unique display id for widget/component
  private String displayId;

  //Display name for the widget/component
  private String displayName;

  //Propagate type value for widget/component
  private String propagate;

  //Status of score calculation
  private String state;

  //If widget/component has no score, flag is true
  private boolean noScore;

  //Alert is true if there is message to alert
  private boolean alert = false;

  //Message to display
  private String message;

  //Additional options to save data
  public Map<String, Object> options = Maps.newHashMap();

  public Map<String, Object> getOptions() {
    return options;
  }

  public String getScore() {
    return score;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/score/ScoreMetric.java
=====================================================
package com.capitalone.dashboard.model.score;

import com.capitalone.dashboard.model.BaseModel;
import com.google.common.collect.Maps;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Collection;
import java.util.Map;

/*
  Collection for scores based on type dashboard/team
 */
@Document(collection = "score_metric")
public class ScoreMetric extends BaseModel {
  //Collector Item Id for score
  private ObjectId collectorItemId;

  //Id for score type as Dashboard/Team
  //If type is DASHBOARD, value should be id of dashboard
  private ObjectId scoreTypeId;

  //Score can be calculated for types defined in ScoreValueType
  private ScoreValueType type = ScoreValueType.DASHBOARD;

  //Time when score was calculated
  private long timestamp;

  //Score value
  private String score;

  //Score total
  private String total;

  //Failure message
  private String failureMssg;

  //If the dashboard has no score, the flag is set as true
  private boolean noScore;

  //Options to save additional properties
  public Map<String, String> options = Maps.newHashMap();

  //Collection of scores for individual components (widgets for dashboard score)
  private Collection<ScoreComponentMetric> componentMetrics;

  public Map<String, String> getOptions() {
    return options;
  }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/UserInfo.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.Collection;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import com.google.common.collect.Sets;

@Document(collection="user_info")
@CompoundIndexes({
    @CompoundIndex(name = "username_authType", def = "{'username' : 1, 'authType': 1}")
})
public class UserInfo {
	
	@Id
	private ObjectId id;
	private String username;
	private Collection<UserRole> authorities;
	private AuthType authType;
	private String firstName;
	private String middleName;
	private String lastName;
	private String displayName;
	private String emailAddress;
	
	public UserInfo() {
	    authorities = Sets.newHashSet();
	}
	
	public ObjectId getId() {
		return id;
	}
	
	public void setId(ObjectId id) {
		this.id = id;
	}
	
	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	
	public Collection<UserRole> getAuthorities() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/PolicyScanMetric.java
=====================================================
package com.capitalone.dashboard.model;

public class PolicyScanMetric {
	
	private Integer policycriticalCount;
    private Integer policysevereCount;
	private Integer polimoderateCount;
	private Integer policyAffectedCount;
	
	public Integer getPolicyAffectedCount() {
		return policyAffectedCount;
	}
	public void setPolicyAffectedCount(Integer policyAffectedCount) {
		this.policyAffectedCount = policyAffectedCount;
	}
	public Integer getPolicycriticalCount() {
		return policycriticalCount;
	}
	public void setPolicycriticalCount(Integer policycriticalCount) {
		this.policycriticalCount = policycriticalCount;
	}
	public Integer getPolicysevereCount() {
		return policysevereCount;
	}
	public void setPolicysevereCount(Integer policysevereCount) {
		this.policysevereCount = policysevereCount;
	}
	public Integer getPolimoderateCount() {
		return polimoderateCount;
	}
	public void setPolimoderateCount(Integer polimoderateCount) {
		this.polimoderateCount = polimoderateCount;
	}

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Cmdb.java
=====================================================
package com.capitalone.dashboard.model;


import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;

@Document(collection="cmdb")
public class Cmdb extends BaseModel{

    private ObjectId collectorItemId;
    private long timestamp;

    /**
     * configurationItem unique system generated id
     */
    @NotNull
    private String configurationItem;
    /**
     * configurationItemSubType SubType of the CI
     */
    private String configurationItemSubType;
    /**
     * configurationItemType Type of the CI
     */
    private String configurationItemType;
    private String assignmentGroup;
    /**
     * A owner assigned to the CI usually the id associated with the owner when provided
     */
    private String appServiceOwner;
    /**
     * A owner assigned to the CI usually the id associated with the owner when provided
     */
    private String businessOwner;
    /**
     * A owner assigned to the CI usually the id associated with the owner when provided
     */
    private String supportOwner;
    /**
     * A owner assigned to the CI usually the id associated with the owner when provided
     */
    private String developmentOwner;
    /**
     * A owner assigned to the CI usually the fullName of the owner when provided
     */
    private String appServiceOwnerUserName;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Comment.java
=====================================================
package com.capitalone.dashboard.model;

public class Comment {
    private String user;
    private String userLDAPDN;
    private long createdAt;
    private long updatedAt;
    private String body;
    private String status;

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getUserLDAPDN() {
        return userLDAPDN;
    }

    public void setUserLDAPDN(String userLDAPDN) {
        this.userLDAPDN = userLDAPDN;
    }

    public long getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(long createdAt) {
        this.createdAt = createdAt;
    }

    public long getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(long updatedAt) {
        this.updatedAt = updatedAt;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/EnvironmentComponent.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents deployable units (components) deployed to an environment.
 */
@Document(collection = "environment_components")
public class EnvironmentComponent extends BaseModel {
    /**
     * Deploy collectorItemId
     */
    private ObjectId collectorItemId;
    private String environmentID;
    private String environmentName;
    private String environmentUrl;
    private String componentID;
	private String componentName;
    private String componentVersion;
    private String jobUrl;
    private boolean deployed;
    private long deployTime;
    private long asOfDate;


	
    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }
    
    public String getEnvironmentID() {
    	return environmentID;
    }
    
    public void setEnvironmentID(String environmentID) {
    	this.environmentID = environmentID;
    }

    public String getEnvironmentName() {
        return environmentName;
    }

    public void setEnvironmentName(String environmentName) {
        this.environmentName = environmentName;
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Service.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashSet;
import java.util.Set;

/**
 * A product or service offered by an Application.
 */
@Document(collection="services")
public class Service extends BaseModel {
    private String name;
    private String url;
    private String applicationName;
    private ObjectId dashboardId;
    private ServiceStatus status;
    private String message;
    private long lastUpdated;
    private Set<ObjectId> dependedBy = new HashSet<>();

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public ObjectId getDashboardId() {
        return dashboardId;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CloudInstanceHistory.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents an EC2 instance from AWS
 */
@Document(collection = "cloud_instance_history")
public class CloudInstanceHistory extends BaseModel{
    @Indexed
    private String accountNumber;
    @Indexed
    private long time;
    private int total;
    private int nonTagged;
    private int stopped;
    private int expiredImage;
    private double estimatedCharge;
    private double cpu;
    private double diskRead;
    private double diskWrite;
    private double networkIn;
    private double networkOut;
    private String currency = "USD";

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Monitor2.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

/*
Represents the getters and setters for the Aws Server Status object.
 */
@Document(collection = "monitor2")
public class Monitor2 extends BaseModel {
    private String name;
    private String url;
    private int status;
    private ObjectId dashboardId;
    private long lastUpdated;
    private String applicationName;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() { return this.url; }

    public void setUrl(String url) { this.url = url; }

    public int getStatus() { return this.status; }

    public void setStatus(int status) { this.status = status; }

    public ObjectId getDashboardId() {
        return dashboardId;
    }

    public void setDashboardId(ObjectId dashboardId) {
        this.dashboardId = dashboardId;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public long getLastUpdated() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ConfigHistOperationType.java
=====================================================
package com.capitalone.dashboard.model;

public enum ConfigHistOperationType {
    CREATED,
    CHANGED,
    RENAMED,
    DELETED;

    public static ConfigHistOperationType fromString(String value) {
        for (ConfigHistOperationType opType : values()) {
            if (opType.toString().equalsIgnoreCase(value)) {
                return opType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid operation Type");
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/SprintEstimate.java
=====================================================
package com.capitalone.dashboard.model;

public class SprintEstimate {
	private int openEstimate;
	private int inProgressEstimate;
	private int completeEstimate;
	private int totalEstimate;
	/**
	 * @return the openEstimate
	 */
	public int getOpenEstimate() {
		return openEstimate;
	}
	/**
	 * @param openEstimate the openEstimate to set
	 */
	public void setOpenEstimate(int openEstimate) {
		this.openEstimate = openEstimate;
	}
	/**
	 * @return the inProgressEstimate
	 */
	public int getInProgressEstimate() {
		return inProgressEstimate;
	}
	/**
	 * @param inProgressEstimate the inProgressEstimate to set
	 */
	public void setInProgressEstimate(int inProgressEstimate) {
		this.inProgressEstimate = inProgressEstimate;
	}
	/**
	 * @return the completeEstimate
	 */
	public int getCompleteEstimate() {
		return completeEstimate;
	}
	/**
	 * @param completeEstimate the completeEstimate to set
	 */
	public void setCompleteEstimate(int completeEstimate) {
		this.completeEstimate = completeEstimate;
	}
	/**
	 * @return the totalEstimate
	 */
	public int getTotalEstimate() {
		return totalEstimate;
	}
	/**

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CommitStatus.java
=====================================================
package com.capitalone.dashboard.model;

public class CommitStatus {
    private String state;
    private String context;
    private String author;
    private String authorLDAPDN;
    private String description;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getAuthorLDAPDN() {
        return authorLDAPDN;
    }

    public void setAuthorLDAPDN(String authorLDAPDN) {
        this.authorLDAPDN = authorLDAPDN;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ServiceStatus.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Denotes the status of a product or service
 */
public enum ServiceStatus {
    Ok(200, 200),
    Warning(300, 400),
    Unauth(401, 401),
    Alert(0, 999);

	private int low;
	private int high;
	
	private ServiceStatus(int low, int high) {
		this.low = low;
		this.high = high;
	}
	
	public static ServiceStatus fromString(String value) {
        for(ServiceStatus status : ServiceStatus.values()) {
            if (status.toString().equalsIgnoreCase(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid ServiceStatus.");
    }
	
	public static ServiceStatus getServiceStatus(int statusCode) {
		for(ServiceStatus status : ServiceStatus.values()) {
			if(status.low <= statusCode && status.high >= statusCode) {
				return status;
			}
		}
		
		return Alert;
	}

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CloudSubNetwork.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@Document(collection = "cloud_subnetwork")
public class CloudSubNetwork extends BaseModel{
    @Indexed
    private String subnetId;
    private String accountNumber;
    private String virtualNetworkId;
    private String cidrBlock;
    private int cidrCount;
    private String zone;
    private int availableIPCount;
    private int subscribedIPCount;
    private int usedIPCount;
    private boolean defaultForZone;
    private String state;
    private long creationDate;
    private long lastUpdateDate;
    private List<NameValue> tags = new ArrayList<>();
    private Map<String, Integer> ipUsage;
    private Map<String, Integer> subscribedIPUsage;


    public Map<String, Integer> getIpUsage() {
        return ipUsage;
    }

    public void setIpUsage(Map<String, Integer> ipUsage) {
        this.ipUsage = ipUsage;
    }

    public String getSubnetId() {
        return subnetId;
    }

    public void setSubnetId(String subnetId) {
        this.subnetId = subnetId;
    }

    public String getVirtualNetworkId() {
        return virtualNetworkId;
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CloudVolumeStorage.java
=====================================================
package com.capitalone.dashboard.model;


import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

@Document(collection = "cloud_volume")
public class CloudVolumeStorage extends BaseModel{
    @Indexed
    private String volumeId;

    @Indexed
    private String accountNumber;
    private String status;
    private long creationDate;
    private int size;
    private List<NameValue> tags = new ArrayList<>();
    private boolean encrypted;
    private String type;
    private String zone;
    private List<String> attachInstances = new ArrayList<>();


    public String getVolumeId() {
        return volumeId;
    }

    public void setVolumeId(String volumeId) {
        this.volumeId = volumeId;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Owner.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class Owner {

	private String username;
	private AuthType authType;
	
	public Owner() {}
	
	public Owner(String username, AuthType authType) {
		this.username = username;
		this.authType = authType;
	}

	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	
	public AuthType getAuthType() {
		return authType;
	}
	
	public void setAuthType(AuthType authType) {
		this.authType = authType;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj == this) {
			return true;
		}
		if (obj.getClass() != getClass()) {
			return false;
		}
		
		Owner rhs = (Owner) obj;
		
		return new EqualsBuilder().append(username, rhs.username).append(authType, rhs.authType).isEquals();
	}


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/AuditType.java
=====================================================
package com.capitalone.dashboard.model;

public enum AuditType {

    ALL,
    CODE_REVIEW,
    BUILD_REVIEW,
    CODE_QUALITY,
    STATIC_SECURITY_ANALYSIS,
    LIBRARY_POLICY,
    TEST_RESULT,
    PERF_TEST,
    ARTIFACT;


    public static AuditType fromString(String value) {
        for (AuditType auditType : values()) {
            if (auditType.toString().equalsIgnoreCase(value)) {
                return auditType;
            }
        }
        throw new IllegalArgumentException(value + " is not a Audit Type");
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/EnvironmentStatus.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents the status (online/offline) of a server for a given component and environment.
 */
@Document(collection = "environment_status")
public class EnvironmentStatus extends BaseModel {
    private ObjectId collectorItemId;
    private String componentID;
	private String environmentName;
    private String componentName;
    private String resourceName;
    private String parentAgentName;
    private boolean online;

    public ObjectId getCollectorItemId() {
        return collectorItemId;
    }

    public void setCollectorItemId(ObjectId collectorItemId) {
        this.collectorItemId = collectorItemId;
    }

    public String getComponentID() {
		return componentID;
	}

	public void setComponentID(String componentID) {
		this.componentID = componentID;
	}
	
    public String getEnvironmentName() {
        return environmentName;
    }

    public void setEnvironmentName(String environmentName) {
        this.environmentName = environmentName;
    }

    public String getComponentName() {
        return componentName;
    }

    public void setComponentName(String componentName) {
        this.componentName = componentName;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestCaseCondition.java
=====================================================
package com.capitalone.dashboard.model;

public class TestCaseCondition {
    private String condition;
    private TestCaseConditionResult result;


    public String getCondition() {
        return condition;
    }

    public void setCondition(String condition) {
        this.condition = condition;
    }

    public TestCaseConditionResult getResult() {
        return result;
    }

    public void setResult(TestCaseStatus status, long duration) {
        TestCaseConditionResult result = new TestCaseConditionResult();
        result.setDuration(duration);
        result.setStatus(status);
        this.result = result;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CollectorType.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Enumerates the possible {@link Collector} types.
 */
public enum CollectorType {
    SCM,
    CMDB,
    Incident,
    Build,
    Artifact,
    Deployment,
    AgileTool,
    @Deprecated
    Feature,
    TestResult,
    @Deprecated
    ScopeOwner,
    @Deprecated
    Scope,
    CodeQuality,
    Test,
    StaticSecurityScan,
    LibraryPolicy,
    ChatOps,
    Cloud,
    Product,
    AppPerformance,
    InfraPerformance,
    Score,
    TEAM,
    Audit;

    public static CollectorType fromString(String value) {
        for (CollectorType collectorType : values()) {
            if (collectorType.toString().equalsIgnoreCase(value)) {
                return collectorType;
            }
        }
        throw new IllegalArgumentException(value + " is not a CollectorType");
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ApiToken.java
=====================================================
package com.capitalone.dashboard.model;

import com.google.common.hash.Hashing;
import org.springframework.data.mongodb.core.mapping.Document;

import java.nio.charset.StandardCharsets;

@Document(collection="apitoken")
public class ApiToken extends BaseModel {

    static final String HASH_PREFIX = "sha512:";
    private String apiUser;
    private String apiKey;
    private Long expirationDt;

    public ApiToken(String apiUser, String apiKey, Long expirationDt) {
        this.apiUser = apiUser;
        this.apiKey = hash(apiKey);
        this.expirationDt = expirationDt;
    }

    public String getApiUser() {
        return apiUser;
    }

    public void setApiUser(String apiUser) {
        this.apiUser = apiUser;
    }

    public String getApiKey() {
        return apiKey;
    }

    public void setApiKey(String apiKey) {
        this.apiKey = hash(apiKey);
    }

    public Long getExpirationDt() {
        return expirationDt;
    }

    public void setExpirationDt(Long expirationDt) {
        this.expirationDt = expirationDt;
    }

    static String hash(String apiKey) {
        if (!apiKey.startsWith(HASH_PREFIX)) {
            return HASH_PREFIX + Hashing.sha512().hashString(apiKey, StandardCharsets.UTF_8).toString();
        }
        return apiKey;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/AuthType.java
=====================================================
package com.capitalone.dashboard.model;

public enum AuthType {

	STANDARD,
	LDAP,
	APIKEY;
	
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Template.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

/**
 * A collection of templates represent a software
 * project under development and/or in production use.
 */
@Document(collection = "templates")
public class Template extends BaseModel {
    @Indexed(unique = true)
    private String template;

    private List<String> widgets = new ArrayList<>();

    private List<String> order = new ArrayList<>();

    public Template(String template, List<String> widgets, List<String> order) {
        this.template = template;
        this.widgets = widgets;
        this.order = order;
    }

    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    public List<String> getWidgets() {
        return widgets;
    }

    public void setWidgets(List<String> widgets) {
        this.widgets = widgets;
    }

    public List<String> getOrder() {
        return order;
    }

    public void setOrder(List<String> order) {
        this.order = order;
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CommitType.java
=====================================================
package com.capitalone.dashboard.model;

public enum CommitType {
    NotBuilt, //maven release commits that are not built
    Merge, //github merge commits that dont show up in build change set
    New;

    public static CommitType fromString(String value) {
        for (CommitType commitType : values()) {
            if (commitType.toString().equalsIgnoreCase(value)) {
                return commitType;
            }
        }
        throw new IllegalArgumentException(value + " is not a valid Commit Type");
    }
}



=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Incident.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Objects;

@Document(collection="incident")
public class Incident extends BaseModel {

    private ObjectId collectorItemId;
    private Long timestamp;
    private String incidentItem;
    private String incidentID;
    private String category;
    private Long openTime;
    private String openedBy;
    private String severity;
    private Long updatedTime;
    private String primaryAssignmentGroup;
    private String status;
    private Long closedTime;
    private String closedBy;
    private String closureCode;
    private String affectedItem;
    private String incidentDescription;
    private String incidentSysID;
    private String affectedItemType;
    private String affectedItemSysId;
    private String affectedBusinessServiceItem;
    private String affectedBusinessServiceItemType;
    private String affectedBusinessServiceItemSysId;
    private boolean attachedToBusinessServiceOrEnvironmentOnly;

    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ");

    public ObjectId getCollectorItemId() { return collectorItemId; }

    public void setCollectorItemId(ObjectId collectorItemId) { this.collectorItemId = collectorItemId; }

    public long getTimestamp() { return timestamp; }

    public void setTimestamp(long timestamp) { this.timestamp = timestamp; }

    public void setTimestamp(String timestamp) { this.timestamp = DATE_FORMATTER.parseMillis(timestamp); }

    public String getIncidentItem() { return incidentItem; }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/BinaryArtifact.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Binary artifacts produced by build jobs and stored in an artifact repository.
 *
 * Possible collectors:
 *  Nexus (in scope)
 *  Artifactory
 *  npm
 *  nuget
 *  rubygems
 *
 */
@Document(collection = "artifacts")
public class BinaryArtifact extends BaseModel {
	
	// list of known metadata properties
	// Note: these may be hard coded in other modules and external tools
	private static final String METADATA_BUILD_URL = "buildUrl";
	private static final String METADATA_BUILD_NUMBER = "buildNumber";
	private static final String METADATA_JOB_URL = "jobUrl";
	private static final String METADATA_JOB_NAME = "jobName";
	private static final String METADATA_INSTANCE_URL = "instanceUrl";
	
	private static final String METADATA_SCM_URL = "scmUrl";
	private static final String METADATA_SCM_BRANCH = "scmBranch";
	private static final String METADATA_SCM_REVISION_NUMBER = "scmRevisionNumber";
	
    /**
     * CollectorItemId for the {@link Build} that produced the artifact
     */
    private ObjectId collectorItemId;
    private long timestamp;

    private String canonicalName;
    private String artifactGroupId;
    private String artifactModule;
    private String artifactVersion;
    private String artifactName;
    private String artifactClassifier;
    private String artifactExtension;
    private String type;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/SCM.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.List;
import java.util.Objects;

/**
 * Base class to represent the details of a change in a source code management
 * system.
 */
public class SCM {
    protected String scmUrl;
    protected String scmBranch; // For SCM that don't have branch in the url
	protected String scmRevisionNumber;
    protected String scmCommitLog;
    protected String scmAuthor;
    protected String scmAuthorLogin;
    protected String scmAuthorLDAPDN;
    protected String scmCommitter;
    protected String scmCommitterLogin;
    protected List<String> scmParentRevisionNumbers;
    protected long scmCommitTimestamp;
    protected long numberOfChanges;
    protected CommitType type;
    protected String pullNumber;
    protected List<String> filesAdded;
    protected List<String> filesRemoved;
    protected List<String> filesModified;

    public SCM(){

    }
    
    public SCM(SCM scm) {
        this.scmUrl = scm.scmUrl;
        this.scmBranch = scm.scmBranch;
        this.scmRevisionNumber = scm.scmRevisionNumber;
        this.scmCommitLog = scm.scmCommitLog;
        this.scmAuthor = scm.scmAuthor;
        this.scmAuthorLogin = scm.scmAuthorLogin;
        this.scmParentRevisionNumbers = scm.scmParentRevisionNumbers;
        this.scmCommitTimestamp = scm.scmCommitTimestamp;
        this.numberOfChanges = scm.numberOfChanges;
        this.type = scm.type;
        this.filesAdded = scm.filesAdded;
        this.filesRemoved = scm.filesRemoved;
        this.filesModified = scm.filesModified;
    }

    @SuppressWarnings({"PMD.ExcessiveParameterList"})
    public SCM(String scmUrl, String scmBranch, String scmRevisionNumber, String scmCommitLog, String scmAuthor, String scmAuthorLogin, List<String> scmParentRevisionNumbers, long scmCommitTimestamp, long numberOfChanges, CommitType type) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestCapability.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.Collection;

public class TestCapability {

    /**
     * Creation timestamp
     */
    private long timestamp;

    /**
     * Identifies this test result in the source system
     */
    private String executionId;

    /**
     * Description of the test result that might make sense to a human
     */
    private String description;

    /**
     * Optional URL to test results
     */
    private String url;

    /**
     * Start test execution time {@link java.util.Date#getTime()}
     */
    private long startTime;

    /**
     * End test execution time {@link java.util.Date#getTime()}
     */
    private long endTime;

    /**
     * Test duration in milliseconds
     */
    private long duration;

    /**
     * Count of test cases that failed in all test suites
     */
    private int failedTestSuiteCount;

    /**
     * Count of test cases that generated an error in all test suites
     */

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/KeyValueLog.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

public class KeyValueLog {
    
    private static final char SEPERATOR = ' ';
    private static final char EQUALS = '=';
    private static final char QUOTE = '"';
    
    private StringBuilder builder = new StringBuilder();
    
    private Map<String, Object> attributes = new LinkedHashMap<>();
    
    public KeyValueLog with(String key, Object value) {
        attributes.put(key, value);
        return this;
    }
    
    @Override
    public String toString() {
        
        Set<String> keySet = attributes.keySet();
        for(String key : keySet) {
            builder.append(key).append(EQUALS).append(QUOTE).append(attributes.get(key)).append(QUOTE).append(SEPERATOR);
        }
        
        return builder.toString().trim();
    }

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CollectionError.java
=====================================================
package com.capitalone.dashboard.model;


public class CollectionError {

    private String errorCode;
    private String errorMessage;
    private long timestamp;

    public static final String UNKNOWN_HOST = "Unreachable";

    public CollectionError(String errorCode, String errorMessage) {
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
        this.timestamp = System.currentTimeMillis();
    }

    public String getErrorCode() {
        return errorCode;
    }


    public String getErrorMessage() {
        return errorMessage;
    }


    public long getTimestamp() {
        return timestamp;
    }

}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/RallyFeature.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents the rally metrics data for a particular iteration with remaining days calculated 
 * by start date and end date.
 */
@Document(collection = "rally_feature")
public class RallyFeature extends BaseModel {
	private long timestamp;
	private Object endDate;
	private int remainingDays;
	private Object startDate;
	private long lastUpdated;

	private ObjectId collectorItemId;
	private String plannedVelocity;
	private String state;
	private String taskActualTotal;
	private String taskEstimateTotal;
	private String taskRemainingTotal;
	private String projectId;
	private String projectName;
	private String planEstimate;
	private static final String INSTANCE_URL = "instanceUrl";
	private static final String ITERATION_NAME = "iterationName";
	private static final String ITERATION_ID = "iterationId";
	private String userListCount;
	private String lastExecuted;
	private Map<String, Object> options = new HashMap<>();

	private Set<RallyStoryStages> storyStages = new HashSet<>();
	
	public Object getStartDate() {
		return startDate;
	}

	public void setStartDate(Object startDate) {
		this.startDate = startDate;
	}

	public int getRemainingDays() {
		return remainingDays;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/Widget.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;

import java.util.HashMap;
import java.util.Map;

/**
 * Represents a widget on the dashboard. Each widget is associated with a specific component. The id, name and options
 * should be provided by the UI.
 */
public class Widget {
    private ObjectId id;
    private String name;
    private ObjectId componentId;
    private Map<String,Object> options = new HashMap<>();

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ObjectId getComponentId() {
        return componentId;
    }

    public void setComponentId(ObjectId componentId) {
        this.componentId = componentId;
    }

    public Map<String, Object> getOptions() {
        return options;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestResult.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Collection;

/**
 * Represents a collection of test suites that have been executed. This may include
 * a unit test run, a security scan, static analysis, functional tests,
 * manual acceptance tests or bug reports.
 *
 * Possible Collectors:
 *  Hudson (in scope)
 *  ALM
 *  Various build system test results
 *
 */
@Document(collection="test_results")
@CompoundIndexes({
        @CompoundIndex(name = "test_results_collItemId_ts_idx", def = "{'collectorItemId' : 1, 'timestamp': -1}")
})
public class TestResult extends BaseModel {
    /**
     * ID of {@link CollectorItem}
     */
    private ObjectId collectorItemId;

    /**
     * Creation timestamp
     */
    private long timestamp;

    /**
     * Identifies this test result in the source system
     */
    private String executionId;

    //Object ID of the build event - if say build happens via Jenkins
    private ObjectId buildId;
    /**
     * Description of the test result that might make sense to a human
     */
    private String description;

    /**
     * Optional URL to test results

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TeamInventory.java
=====================================================
package com.capitalone.dashboard.model;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;


@Document(collection="teamInventory")
public class TeamInventory extends BaseModel {
    private ObjectId collectorId;
    private ObjectId collectorItemId;
    @Indexed
    private String teamId;
    private String name;
     private String lob;
    private List<TeamMember> teamMembers;
     private long timestamp;

    @Transient
    private Collector collector;

    public Collector getCollector() {
        return collector;
    }

    public void setCollector(Collector collector) {
        this.collector = collector;
    }

    public TeamInventory(String teamId, String name) {
        this.teamId = (teamId != null ? teamId.trim() : "");
        this.name = (name != null ? name.trim() : "");
    }

    public ObjectId getCollectorId() {
        return collectorId;
    }

    public void setCollectorId(ObjectId collectorId) {
        this.collectorId = collectorId;
    }

    public String getTeamId() {
        return teamId;
    }

    public void setTeamId(String teamId) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/CodeQualityMetric.java
=====================================================
package com.capitalone.dashboard.model;

/**
 * Represents a {@link CodeQuality} metric. Each metric should have a unique name property.
 */
public class CodeQualityMetric {
    private String name;
    private String value;
    private String formattedValue;
    private CodeQualityMetricStatus status;
    private String statusMessage;

    public CodeQualityMetric(String name) {
        this.name = name;
    }

    public CodeQualityMetric() {}

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String getValue() { return value; }

    public void setValue(String value) { this.value = value; }

    public String getFormattedValue() {
        return formattedValue;
    }

    public void setFormattedValue(String formattedValue) {
        this.formattedValue = formattedValue;
    }

    public CodeQualityMetricStatus getStatus() {
        return status;
    }

    public void setStatus(CodeQualityMetricStatus status) {
        this.status = status;
    }

    public String getStatusMessage() {
        return statusMessage;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ScopeOwnerCollectorItem.java
=====================================================
package com.capitalone.dashboard.model;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.data.mongodb.core.index.Indexed;

/**
 * Collector implementation for Feature that stores system configuration
 * settings required for source system data connection (e.g., API tokens, etc.)
 *
 * @author KFK884
 */
public class ScopeOwnerCollectorItem extends CollectorItem {
	@Indexed
	private static final String TEAM_ID = "teamId";
	@Indexed
	private static final String PROJECT_ID = "projectId";
	private static final String CHANGE_DATE = "changeDate";
	private static final String ASSET_STATE = "assetState";
	private static final String IS_DELETED = "isDeleted";

	public String getTeamId() {
		return (String) getOptions().get(TEAM_ID);
	}

	public void setTeamId(String teamId) {
		getOptions().put(TEAM_ID, teamId);
	}

	public String getProjectId() {
		return (String) getOptions().get(PROJECT_ID);
	}

	public void setProjectId(String projectId) {
		getOptions().put(PROJECT_ID, projectId);
	}

	public String getName() {
		return getDescription();
	}

	public void setName(String name) {
		setDescription(name);
	}

	public String getChangeDate() {
		return (String) getOptions().get(CHANGE_DATE);
	}

	public void setChangeDate(String changeDate) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestCase.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
 * An individual test case in a {@link TestSuite}.
 */
public class TestCase {
    /**
     * Identifies this test case in the source system
     */
    private String id;

    /**
     * Description of the test case that might make sense to a human
     */
    private String description;

    private long duration;

    private int totalTestStepCount;
    /**
     * Count of test cases that failed
     */
    private int failedTestStepCount;

    /**
     * Count of test cases that generated an error
     */
    private int successTestStepCount;

    /**
     * Count of test cases that were skipped
     */
    private int skippedTestStepCount;

    private int unknownStatusTestStepCount;
    /**
     * Status of the test case
     */
    private TestCaseStatus status = TestCaseStatus.Unknown;

    private Collection<TestCaseStep> testSteps = new ArrayList<>();

    private Set<String> tags = new HashSet<>();

    /**

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/LibraryPolicyThreatDisposition.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.Arrays;

public enum LibraryPolicyThreatDisposition {
    Open,
    Closed,
    FalsePositive,
    WillNotFix,
    NotUsed,
    Challenged,
    ReviewRequested,
    Unknown;

    public static LibraryPolicyThreatDisposition fromString(String value) {
        return Arrays.stream(values())
                .filter(disposition -> disposition.toString()
                        .equalsIgnoreCase(value))
                .findFirst().orElse(Unknown);
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/ArtifactIdentifier.java
=====================================================
package com.capitalone.dashboard.model;

@SuppressWarnings("PMD.NPathComplexity")
public class ArtifactIdentifier {
	private final String group;
	private final String name;
	private final String version;
	private final String classifier;
	private final String extension;
	
	public ArtifactIdentifier(String group, String name, String version, String classifier, String extension) {
		super();
		this.group = group;
		this.name = name;
		this.version = version;
		this.classifier = classifier;
		this.extension = extension;
	}

	/**
	 * @return the group
	 */
	public String getGroup() {
		return group;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the version
	 */
	public String getVersion() {
		return version;
	}

	/**
	 * @return the classifier
	 */
	public String getClassifier() {
		return classifier;
	}

	/**
	 * @return the extension
	 */

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/FeatureStatus.java
=====================================================
package com.capitalone.dashboard.model;

public enum FeatureStatus {
	BACKLOG("Backlog"), GROOMING("Grooming"), WAITING("Waiting"), IN_PROGRESS("In Progress"), IMPEDED(
			"Impeded"), DONE("Done"), ACCEPTED("Accepted");

	private String status;

	FeatureStatus(String status) {
		this.status = status;
	}

	public String getStatus() {
		return this.status;
	}

	@Override
	public String toString() {
		return this.status;
	}
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/package-info.java
=====================================================
package com.capitalone.dashboard.model;

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/NameValueCount.java
=====================================================
package com.capitalone.dashboard.model;

public class NameValueCount {
    private NameValue keyValue;
    private int count;

    public NameValueCount(NameValue keyValue, int count) {
        this.keyValue = keyValue;
        this.count = count;
    }

    public NameValue getKeyValue() {
        return keyValue;
    }

    public void setKeyValue(NameValue keyValue) {
        this.keyValue = keyValue;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/FeatureHistory.java
=====================================================
package com.capitalone.dashboard.model;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * Represents a trending history of features (story/requirement) from a content management system.
 *
 * Possible collectors: VersionOne PivotalTracker Rally Trello Jira
 *
 * @author kfk884
 *
 */
@Document(collection = "feature-history")
public class FeatureHistory extends BaseModel {
	/*
	 * Sprint data
	 */
	@Indexed
	private String sprintID;
	private String sprintBeginDate;
	private String sprintEndDate;
	/*
	 * Scope data
	 */
	@Indexed
	private String projectID;
	/*
	 * ScopeOwner data
	 */
	@Indexed
	private String teamID;
	/*
	 * Story data
	 */
	private String sStatus;
	private String sEstimate;
	private String sToDo;
	private String sAssetState;
	private String sSoftwareTesting;
	private String isDeleted;
	@Indexed
	private String changeDate;
	private String reportedDate;
	@Indexed
	private String storyID;

	public String getStoryID() {
		return storyID;
	}

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/TestSuite.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.Collection;

/**
 * A collection of {@link TestCase}s of a particular {@link TestSuiteType}.
 */
public class TestSuite {

    private String id;
    /**
     * Description of the test suite that might make sense to a human
     */
    private String description;

    /**
     * Type of test
     */
    private TestSuiteType type;

    /**
     * Start test suite execution time {@link java.util.Date#getTime()}
     */
    private long startTime;

    /**
     * End test suite execution time {@link java.util.Date#getTime()}
     */
    private long endTime;

    /**
     * Test suite duration in milliseconds
     */
    private long duration;

    private int totalTestCaseCount;
    /**
     * Count of test cases that failed
     */
    private int failedTestCaseCount;

    /**
     * Count of test cases that generated an error
     */
    private int successTestCaseCount;

    /**
     * Count of test cases that were skipped
     */

=====================================================
== File: src/main/java/com/capitalone/dashboard/model/FortifyScanReport.java
=====================================================
package com.capitalone.dashboard.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "fortify_report")
@CompoundIndexes(value = { @CompoundIndex(name = "project_id", def = "{'projectId' : 1, 'collectorItemId': 1}") })
public class FortifyScanReport extends BaseModel {

	private ObjectId collectorItemId;
	private long timestamp;
	private String name;
	private String url;
	private long projectId;
	private String version;
	private Map<String, Threat> threats = new HashMap<>();

	public static class Threat {
		List<String> components = new ArrayList<>();
		int count;

		public Threat(int count) {
			this.count = count;
		}

		public Threat() {
			// TODO Auto-generated constructor stub
		}

		public int getCount() {
			return count;
		}

		public void setCount(int count) {
			this.count = count;
		}

		public List<String> getComponents() {
			return components;
		}

		public void setComponents(List<String> components) {
			this.components = components;

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CloudVirtualNetworkListRefreshRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;


public class CloudVirtualNetworkListRefreshRequest {

    @NotNull
    private String accountNumber;
    @NotNull
    private List<String> virtualNetworkIds;
    private Date refreshDate;

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public List<String> getVirtualNetworkIds() {
        return virtualNetworkIds;
    }

    public void setVirtualNetworkIds(List<String> virtualNetworkIds) {
        this.virtualNetworkIds = virtualNetworkIds;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CodeQualityCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.CodeQualityMetric;
import com.capitalone.dashboard.model.CodeQualityType;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

public class CodeQualityCreateRequest {
    private String hygieiaId;
    @NotNull
    private long timestamp;
    @NotNull
    private String projectName;
    @NotNull
    private String projectId;
    @NotNull
    private String projectUrl;
    @NotNull
    private String serverUrl;
    @NotNull
    private CodeQualityType type;
    @NotNull
    private String projectVersion;

    private String toolName;

    private String niceName;

    private List<CodeQualityMetric> metrics = new ArrayList<>();



    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }


    public CodeQualityType getType() {
        return type;
    }

    public void setType(CodeQualityType type) {
        this.type = type;
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/GitRequestCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.SCM;

public class GitRequestCreateRequest extends SCM {
    private String hygieiaId;

    private long timestamp;

    public String getHygieiaId() {
        return hygieiaId;
    }

    public void setHygieiaId(String hygieiaId) {
        this.hygieiaId = hygieiaId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/DeployDataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;

public class DeployDataCreateRequest {
    @NotNull
    private String executionId;
    @NotNull
    private String jobUrl;
    @NotNull
    private String appName;
    @NotNull
    private String envName;
    @NotNull
    private String artifactName;
    @NotNull
    private String artifactVersion;
    @NotNull
    private String jobName;
    @NotNull
    private String instanceUrl;
    @NotNull
    private String deployStatus;
    @NotNull
    private long startTime;

    private String artifactGroup;
    private String hygieiaId;
    private long endTime;
    private long duration;
    private String startedBy;
    private String collectorName;
    private String niceName;


    public String getExecutionId() {
        return executionId;
    }

    public void setExecutionId(String executionId) {
        this.executionId = executionId;
    }

    public String getJobUrl() {
        return jobUrl;
    }

    public void setJobUrl(String jobUrl) {
        this.jobUrl = jobUrl;
    }

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/TestDataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.TestCapability;
import com.capitalone.dashboard.model.TestSuite;
import com.capitalone.dashboard.model.TestSuiteType;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collection;


public class TestDataCreateRequest {

    /**
     * ID of job
     */
    @NotNull
    private String testJobId;

    @NotNull
    private String testJobName;

    @NotNull
    private String serverUrl;
    /**
     * Optional URL to test results
     */
    @NotNull
    private String testJobUrl;

    /**
     * Identifies this test result in the source system
     */
    @NotNull
    private String executionId;

    private String niceName;

    /**
     * Creation timestamp
     */
    private long timestamp;

    /**
     * Description of the test result that might make sense to a human
     */
    private String description;

    /**
     * Start test execution time {@link java.util.Date#getTime()}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/PerformanceCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.PerformanceType;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;

public class PerformanceCreateRequest {
    private String hygieiaId;
    @NotNull
    private long timestamp;
    @NotNull
    private String projectName;
    @NotNull
    private String projectId;
    @NotNull
    private String projectUrl;
    @NotNull
    private String serverUrl;
    @NotNull
    private PerformanceType type;
    @NotNull
    private String projectVersion;
    @NotNull
    private String collectorName;

    private String niceName;

    private String targetAppName;

    private String targetEnvName;

    private Map<String,Object> metrics = new HashMap<>();



    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }


    public PerformanceType getType() {
        return type;
    }


=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CloudInstanceCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;


import com.capitalone.dashboard.model.NameValue;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

public class CloudInstanceCreateRequest {
    @NotNull
    private String instanceId;
    @NotNull
    private String accountNumber;
    private String instanceType;
    private String imageId;
    private String imageExpirationDate;
    private String imageApproved;
    private String instanceOwner;
    private String isMonitored;
    private String privateDns;
    private String privateIp;
    private String publicDns;
    private String publicIp;
    private String subnetId;
    private String virtualNetworkId;
    private String age;
    private String isEncrypted;
    private String status;
    private String isStopped;
    private String isTagged;
    private String cpuUtilization;
    private String lastUpdatedDate;
    private List<String> securityGroups = new ArrayList<>();
    private List<NameValue> tags = new ArrayList<>();
    private String networkIn;
    private String networkOut;
    private String diskRead;
    private String diskWrite;
    private String rootDeviceName;
    private String lastAction;
    private String autoScaleName;


    public String getInstanceId() {
        return instanceId;
    }

    public void setInstanceId(String instanceId) {
        this.instanceId = instanceId;

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CloudSubnetListRefreshRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;


public class CloudSubnetListRefreshRequest {

    @NotNull
    private String accountNumber;
    @NotNull
    private List<String> subnetIds;
    private Date refreshDate;

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public List<String> getSubnetIds() {
        return subnetIds;
    }

    public void setSubnetIds(List<String> subnetIds) {
        this.subnetIds = subnetIds;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CloudVolumeCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;


import com.capitalone.dashboard.model.NameValue;
import org.springframework.data.mongodb.core.index.Indexed;

import java.util.ArrayList;
import java.util.List;

public class CloudVolumeCreateRequest {
    @Indexed
    private String volumeId;

    @Indexed
    private String accountNumber;
    private String status;
    private long creationDate;
    private int size;
    private List<NameValue> tags = new ArrayList<>();
    private boolean encrypted;
    private String type;
    private String zone;
    private List<String> attchInstances = new ArrayList<>();


    public String getVolumeId() {
        return volumeId;
    }

    public void setVolumeId(String volumeId) {
        this.volumeId = volumeId;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public long getCreationDate() {

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/GenericCollectorItemCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;

/**
 * A request to create a Generic Collector Item.
 *
 */
public class GenericCollectorItemCreateRequest {
    private String buildId;
    @NotNull
    private String relatedCollectorItemId;
    @NotNull
    private String toolName;
    @NotNull
    private String rawData;
    @NotNull
    private String source;


    public String getBuildId() {
        return buildId;
    }

    public void setBuildId(String buildId) {
        this.buildId = buildId;
    }

    public String getToolName() {
        return toolName;
    }

    public void setToolName(String toolName) {
        this.toolName = toolName;
    }

    public String getRawData() {
        return rawData;
    }

    public void setRawData(String rawData) {
        this.rawData = rawData;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CloudSubnetCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.NameValue;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class CloudSubnetCreateRequest {
    @NotNull
    private String subnetId;
    private String accountNumber;
    private String virtualNetworkId;
    private String cidrBlock;
    private String cidrCount;
    private String zone;
    private String availableIPCount;
    private String subscribedIPCount;
    private String usedIPCount;
    private String defaultForZone;
    private String state;
    private String creationDate;
    private String lastUpdateDate;
    private List<NameValue> tags = new ArrayList<>();
    private Map<String, Integer> ipUsage;
    private Map<String, Integer> subscribedIPUsage;


    public String getSubnetId() {
        return subnetId;
    }

    public void setSubnetId(String subnetId) {
        this.subnetId = subnetId;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getVirtualNetworkId() {
        return virtualNetworkId;
    }

    public void setVirtualNetworkId(String virtualNetworkId) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/PerfTestDataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;


import com.capitalone.dashboard.model.TestCapability;
import com.capitalone.dashboard.model.TestSuite;
import com.capitalone.dashboard.model.TestSuiteType;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collection;

public class PerfTestDataCreateRequest {



    /**
     * perf test runID should be unique for each execution.
     */
    @NotNull
    private String runId;

    /**
     * Provide a test name, a new testname will create a new collector Item
     */
    @NotNull
    private String testName;



    /**
     * Provide a  platform name, a new platformName will create a new collector Item. default should be Jmeter.
     */
    @NotNull
    private String perfTool;

    /**
     * Type of test should be performance
     */
    @NotNull
    private TestSuiteType type;

    /**
     * Provide the test result status
     */
    private String resultStatus;

    /**
     * Provide a report URL if available
     */
    private String reportUrl;

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/BinaryArtifactCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.SCM;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * A request to create a BinaryArtifact.
 *
 */
public class BinaryArtifactCreateRequest {

    @NotNull
    private String artifactName;
    @NotNull
    String canonicalName;
    @NotNull
    private String artifactGroup;
    @NotNull
    private String artifactVersion;
    private String artifactModule;
    private String artifactClassifier;
    private String artifactExtension;
    
    // May be null if comes in from rest call outside of jenkins
    private String buildId;
    
    private long timestamp;
    
    // Used by the jenkins plugin
	// May be null if comes in from rest call outside of jenkins
    private List<SCM> sourceChangeSet = new ArrayList<>();
    
    // See usage of metadata in BinaryArtifactServiceImpl for defined property names
    private Map<String, Object> metadata = new HashMap<>();


    public String getArtifactName() {
        return artifactName;
    }

    public String getCanonicalName() {
        return canonicalName;
    }

    public void setCanonicalName(String canonicalName) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/ConfigurationCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.capitalone.dashboard.model.Configuration;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class ConfigurationCreateRequest {
	
	private String collectorName;
	private Set<Map<String,String>> info = new HashSet<>();
	
	public String getCollectorName() {
		return collectorName;
	}
	public void setCollectorName(String collectorName) {
		this.collectorName = collectorName;
	}
	public Set<Map<String, String>> getInfo() {
		return info;
	}
	public void setInfo(Set<Map<String, String>> info) {
		this.info = info;
	}
	
	public Configuration toConfiguration() {
		return new Configuration(collectorName,info);
	}
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/Monitor2DataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;

public class Monitor2DataCreateRequest {
    @NotNull
    private String name;
    private String url;
    private int status;

    public String getName() { return this.name; }

    public void setName(String name) { this.name = name; }

    public String getUrl() { return this.url; }

    public void setUrl(String url) { this.url = url; }

    public int getStatus() { return this.status; }

    public void setStatus(int status) { this.status = status; }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CommitCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.SCM;

public class CommitCreateRequest extends SCM {
    private String hygieiaId;

    private long timestamp;

    public String getHygieiaId() {
        return hygieiaId;
    }

    public void setHygieiaId(String hygieiaId) {
        this.hygieiaId = hygieiaId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CloudInstanceListRefreshRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;


public class CloudInstanceListRefreshRequest {

    @NotNull
    private String accountNumber;
    @NotNull
    private List<String> instanceIds;
    private Date refreshDate;

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public List<String> getInstanceIds() {
        return instanceIds;
    }

    public void setInstanceIds(List<String> instanceIds) {
        this.instanceIds = instanceIds;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/CloudVolumeListRefreshRequest.java
=====================================================
package com.capitalone.dashboard.request;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;


public class CloudVolumeListRefreshRequest {

    @NotNull
    private String accountNumber;
    @NotNull
    private List<String> volumeIds;
    private Date refreshDate;

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public List<String> getVolumeIds() {
        return volumeIds;
    }

    public void setVolumeIds(List<String> volumeIds) {
        this.volumeIds = volumeIds;
    }

    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/request/BuildDataCreateRequest.java
=====================================================
package com.capitalone.dashboard.request;

import com.capitalone.dashboard.model.RepoBranch;
import com.capitalone.dashboard.model.SCM;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;


public class BuildDataCreateRequest {

    @NotNull
    private String number;
    @NotNull
    private String buildUrl;
    @NotNull
    private String jobName;
    @NotNull
    private String buildStatus;
    @NotNull
    private long startTime;
    @NotNull
    private String jobUrl;
    @NotNull
    private String instanceUrl;

    private String niceName;

    private long endTime;
    private long duration;
    private String startedBy;
    private String log;
    private List<RepoBranch> codeRepos = new ArrayList<>();
    private List<SCM> sourceChangeSet = new ArrayList<>();

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getBuildUrl() {
        return buildUrl;
    }

    public void setBuildUrl(String buildUrl) {
        this.buildUrl = buildUrl;

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/DashboardEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.DashboardType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.mongodb.DBObject;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
import org.springframework.data.mongodb.core.mapping.event.AfterDeleteEvent;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;
import org.springframework.stereotype.Component;

/**
 * Listens for Dashboard lifecycle events to create and delete Product collector CollectorItems
 * whenever a Team Dashboard is created or deleted.
 */
@Component
public class DashboardEventListener extends AbstractMongoEventListener<Dashboard> {

    private final CollectorRepository collectorRepository;
    private final CollectorItemRepository collectorItemRepository;

    @Autowired
    public DashboardEventListener(CollectorRepository collectorRepository,
                                  CollectorItemRepository collectorItemRepository) {
        this.collectorRepository = collectorRepository;
        this.collectorItemRepository = collectorItemRepository;
    }

    /**
     * Creates a collector item for new team dashboards
     * @param event
     */
    @Override
    public void onAfterSave(AfterSaveEvent<Dashboard> event) {
        Dashboard dashboard = event.getSource();
        // Ignore product dashboards
        if (DashboardType.Product.equals(dashboard.getType())) {
            return;
        }

        Collector productCollector = getProductCollector();
        CollectorItem item = getDashboardCollectorItem(dashboard.getId().toString(), productCollector.getId());

        if (item == null) {
            // Create a new Collector Item

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/HygieiaMongoEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;

import java.util.List;

public abstract class HygieiaMongoEventListener<T> extends AbstractMongoEventListener<T> {

    protected final CollectorItemRepository collectorItemRepository;
    protected final PipelineRepository pipelineRepository;
    protected final CollectorRepository collectorRepository;

    public HygieiaMongoEventListener(CollectorItemRepository collectorItemRepository,
                                     PipelineRepository pipelineRepository,
                                     CollectorRepository collectorRepository) {
        this.collectorItemRepository = collectorItemRepository;
        this.pipelineRepository = pipelineRepository;
        this.collectorRepository = collectorRepository;
    }

    private Collector getProductCollector(){
        List<Collector> productCollectors = collectorRepository.findByCollectorType(CollectorType.Product);
        if(productCollectors.isEmpty()){
            return null;
        }
        return productCollectors.get(0);
    }

    /**
     * Finds the team dashboard collectoritem by dashboard id and product collectorid
     * @param teamDashboard
     * @return
     */
    protected CollectorItem getTeamDashboardCollectorItem(Dashboard teamDashboard) {
        ObjectId productCollectorId = getProductCollector().getId();
        ObjectId dashboardId = teamDashboard.getId();
        return collectorItemRepository.findTeamDashboardCollectorItemsByCollectorIdAndDashboardId(productCollectorId, dashboardId.toString());
    }

    /**

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/CodeQualityEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.event.sync.SyncDashboard;
import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

@org.springframework.stereotype.Component
public class CodeQualityEventListener extends HygieiaMongoEventListener<CodeQuality> {
    private final SyncDashboard syncDashboard;


    @Autowired
    public CodeQualityEventListener(
            CollectorItemRepository collectorItemRepository,
            PipelineRepository pipelineRepository,
            CollectorRepository collectorRepository, SyncDashboard syncDashboard) {
        super(collectorItemRepository, pipelineRepository, collectorRepository);
        this.syncDashboard = syncDashboard;
    }

    @Override
    public void onAfterSave(AfterSaveEvent<CodeQuality> event) {
        CodeQuality codeQuality = event.getSource();
        syncDashboard.sync(codeQuality);
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/BuildEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.event.sync.SyncDashboard;
import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.BuildStatus;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.SCM;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.CommitRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.capitalone.dashboard.util.PipelineUtils.isMoveCommitToBuild;
import static com.capitalone.dashboard.util.PipelineUtils.processPreviousFailedBuilds;

@org.springframework.stereotype.Component
public class BuildEventListener extends HygieiaMongoEventListener<Build> {
    private final DashboardRepository dashboardRepository;
    private final ComponentRepository componentRepository;
    private final CommitRepository commitRepository;
    private final SyncDashboard syncDashboard;

    @Autowired
    public BuildEventListener(DashboardRepository dashboardRepository,
                              CollectorItemRepository collectorItemRepository,
                              ComponentRepository componentRepository,
                              PipelineRepository pipelineRepository,
                              CollectorRepository collectorRepository, CommitRepository commitRepository, SyncDashboard syncDashboard) {
        super(collectorItemRepository, pipelineRepository, collectorRepository);
        this.dashboardRepository = dashboardRepository;
        this.componentRepository = componentRepository;
        this.commitRepository = commitRepository;
        this.syncDashboard = syncDashboard;

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/RelatedCollectorItemEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.event.sync.SyncDashboard;
import com.capitalone.dashboard.event.sync.SyncException;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

@org.springframework.stereotype.Component
public class RelatedCollectorItemEventListener extends HygieiaMongoEventListener<RelatedCollectorItem> {
    private static final Log LOG = LogFactory.getLog(RelatedCollectorItemEventListener.class);
    private final SyncDashboard syncDashboard;


    @Autowired
    public RelatedCollectorItemEventListener(
            CollectorItemRepository collectorItemRepository,
            PipelineRepository pipelineRepository,
            CollectorRepository collectorRepository, SyncDashboard syncDashboard) {
        super(collectorItemRepository, pipelineRepository, collectorRepository);
        this.syncDashboard = syncDashboard;
    }

    @Override
    public void onAfterSave(AfterSaveEvent<RelatedCollectorItem> event) {
        RelatedCollectorItem relatedCollectorItem = event.getSource();
        try {
            syncDashboard.sync(relatedCollectorItem);
        } catch (SyncException e) {
            LOG.error("Error processing related collector item. ID = " + relatedCollectorItem.getId() + ". Reason " + e.getMessage());
        }
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/EnvironmentComponentEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.BinaryArtifact;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.EnvironmentComponent;
import com.capitalone.dashboard.model.EnvironmentStage;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.model.SCM;
import com.capitalone.dashboard.repository.BinaryArtifactRepository;
import com.capitalone.dashboard.repository.BuildRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.CommitRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.JobRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import com.capitalone.dashboard.util.PipelineUtils;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.bson.types.ObjectId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@org.springframework.stereotype.Component
public class EnvironmentComponentEventListener extends HygieiaMongoEventListener<EnvironmentComponent> {
    private static final Logger LOGGER = LoggerFactory.getLogger(EnvironmentComponentEventListener.class);

    private final DashboardRepository dashboardRepository;
    private final ComponentRepository componentRepository;
    private final BinaryArtifactRepository binaryArtifactRepository;
    private final BuildRepository buildRepository;

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/sync/SyncException.java
=====================================================
package com.capitalone.dashboard.event.sync;

public class SyncException extends Exception{
    public SyncException(String message) {
        super(message);
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/sync/SyncDashboard.java
=====================================================
package com.capitalone.dashboard.event.sync;

import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.CodeQuality;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.RepoBranch;
import com.capitalone.dashboard.model.StandardWidget;
import com.capitalone.dashboard.model.Widget;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import com.capitalone.dashboard.repository.BuildRepository;
import com.capitalone.dashboard.repository.CodeQualityRepository;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.RelatedCollectorItemRepository;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

@org.springframework.stereotype.Component
public class SyncDashboard {
    private final DashboardRepository dashboardRepository;
    private final ComponentRepository componentRepository;
    private final CollectorRepository collectorRepository;
    private final CollectorItemRepository collectorItemRepository;
    private final BuildRepository buildRepository;
    private final RelatedCollectorItemRepository relatedCollectorItemRepository;
    private final CodeQualityRepository codeQualityRepository;

    private static final String BUILD_REPO_REASON = "Code Repo build";
    private static final String CODEQUALITY_TRIGGERED_REASON = "Code scan triggered by build";

    @Autowired
    public SyncDashboard(DashboardRepository dashboardRepository, ComponentRepository componentRepository,
                         CollectorRepository collectorRepository, CollectorItemRepository collectorItemRepository,

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/TestResultEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.TestResult;
import com.capitalone.dashboard.model.TestCapability;
import com.capitalone.dashboard.model.TestSuiteType;
import com.capitalone.dashboard.model.TestCase;
import com.capitalone.dashboard.model.TestCaseStatus;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Performance;
import com.capitalone.dashboard.model.PerformanceType;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.PerformanceRepository;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.bson.types.ObjectId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;
import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.concurrent.TimeUnit;
import java.util.Map;
import java.util.Optional;

@Component
public class TestResultEventListener extends AbstractMongoEventListener<TestResult> {

    private static final Logger LOGGER = LoggerFactory.getLogger(TestResultEventListener.class);

    private static final String STR_RESP_TIME_THRESHOLD = "KPI : Avg response times";
    private static final String STR_ACTUAL_RESP_TIME = "Actual Response Time";
    private static final String STR_TARGET_RESP_TIME = "Target Response Time";
    private static final String STR_TXN_PER_SEC_THRESHOLD = "KPI : Transaction Per Second";
    private static final String STR_ACTUAL_TXN_PER_SEC = "Actual Transactions per sec";
    private static final String STR_TARGET_TXN_PER_SEC = "Target Transactions per sec";
    private static final String STR_ERROR_RATE_THRESHOLD = "KPI : Error Rate Threshold";
    private static final String STR_ACTUAL_ERROR_RATE = "Actual Error Rate";
    private static final String STR_TARGET_ERROR_RATE = "Target Error Rate";
    private static final String STR_CRITICAL = "CRITICAL";
    private static final String STR_OPEN = "OPEN";
    private static final String COLLECTOR_NAME = "PerfTools";

=====================================================
== File: src/main/java/com/capitalone/dashboard/event/CommitEventListener.java
=====================================================
package com.capitalone.dashboard.event;

import com.capitalone.dashboard.model.BaseModel;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.model.CollectorType;
import com.capitalone.dashboard.model.Commit;
import com.capitalone.dashboard.model.CommitType;
import com.capitalone.dashboard.model.Component;
import com.capitalone.dashboard.model.Dashboard;
import com.capitalone.dashboard.model.Pipeline;
import com.capitalone.dashboard.model.PipelineCommit;
import com.capitalone.dashboard.model.PipelineStage;
import com.capitalone.dashboard.repository.CollectorItemRepository;
import com.capitalone.dashboard.repository.CollectorRepository;
import com.capitalone.dashboard.repository.ComponentRepository;
import com.capitalone.dashboard.repository.DashboardRepository;
import com.capitalone.dashboard.repository.PipelineRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AfterSaveEvent;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@org.springframework.stereotype.Component
public class CommitEventListener extends HygieiaMongoEventListener<Commit> {

    private final ComponentRepository componentRepository;
    private final DashboardRepository dashboardRepository;

    @Autowired
    public CommitEventListener(ComponentRepository componentRepository,
                               DashboardRepository dashboardRepository,
                               CollectorRepository collectorRepository,
                               CollectorItemRepository collectorItemRepository,
                               PipelineRepository pipelineRepository) {
        super(collectorItemRepository, pipelineRepository, collectorRepository);
        this.componentRepository = componentRepository;
        this.dashboardRepository = dashboardRepository;
    }

    @Override
    public void onAfterSave(AfterSaveEvent<Commit> event) {
        Commit commit = event.getSource();

        // Add the commit to all pipelines associated with the team dashboards
        // this commit is part of. But only if there is a build collector item
        // configured on that dashboard. Otherwise, the commit will be orphaned
        // in the commit stage.

=====================================================
== File: src/main/java/com/capitalone/dashboard/testutil/FongoConfig.java
=====================================================
package com.capitalone.dashboard.testutil;

import com.capitalone.dashboard.config.MongoConfig;
import com.github.fakemongo.Fongo;
import com.mongodb.MongoClient;
import org.springframework.context.annotation.Bean;

public class FongoConfig extends MongoConfig {

    @Override
    @Bean
    public MongoClient mongo()  {
        return new Fongo(getDatabaseName()).getMongo();
    }
    
    @Override
    protected String getDatabaseName() {
        return "test-db";
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/testutil/TestRestOperations.java
=====================================================
package com.capitalone.dashboard.testutil;

import com.capitalone.dashboard.collector.RestOperationsSupplier;
import org.springframework.http.HttpStatus;
import org.springframework.web.client.RestOperations;

import java.util.HashMap;
import java.util.Map;

public class TestRestOperations<T> extends RestOperationsSupplier {
    TestRestTemplate<? extends T> template;

    private Map<String, TestResponse<T>> response;

    public TestRestOperations(Map<String, TestResponse<T>> response) {
        this.response = response;
    }

    public Map<String, TestResponse<T>> getResponse() {
        return response;
    }

    public void addResponse(String key, TestResponse testResponse) {
        if (response == null) {
            response = new HashMap<>();
        }
        this.response.put(key, testResponse);
    }

    public void addResponse(String key, T body, HttpStatus httpStatus) {
        if (response == null) {
            response = new HashMap<>();
        }
        this.response.put(key, new TestResponse<>(body, httpStatus));
        if (template != null) {
            template.addResponse(key, new TestResponse<>(body, httpStatus));
        }
    }

    public TestRestTemplate<? extends T> getTemplate() {
        return template;
    }

    public void setTemplate(TestRestTemplate<? extends T> template) {
        this.template = template;
    }

    @Override
    public RestOperations get() {
        if (template == null) {

=====================================================
== File: src/main/java/com/capitalone/dashboard/testutil/TestRestTemplate.java
=====================================================
package com.capitalone.dashboard.testutil;

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

public class TestRestTemplate<T> extends RestTemplate {

    private Map<String, TestResponse<T>> response;

    public TestRestTemplate(Map<String, TestResponse<T>> response) {
        this.response = response;
    }

    public Map<String, TestResponse<T>> getResponse() {
        return response;
    }


    public void addResponse(String key, TestResponse testResponse) {
        if (response == null) {
            response = new HashMap<>();
        }
        this.response.put(key, testResponse);
    }

    public void addResponse(String key, T body, HttpStatus httpStatus) {
        if (response == null) {
            response = new HashMap<>();
        }
        this.response.put(key, new TestResponse<>(body, httpStatus));
    }

    public void clearResponse() {
        if (response != null) {
            response.clear();
        }
    }
    @Override
    public <T> ResponseEntity<T> exchange(String var1, HttpMethod var2, HttpEntity<?> var3, Class<T> var4, Object... var5) throws RestClientException {

        if (response.containsKey(var1)) {
            return new ResponseEntity(response.get(var1).getBody(),response.get(var1).getStatus());
        } else {

=====================================================
== File: src/main/java/com/capitalone/dashboard/testutil/GsonUtil.java
=====================================================
package com.capitalone.dashboard.testutil;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializer;
import org.bson.types.ObjectId;

import java.lang.reflect.Type;

public class GsonUtil {
    private static final GsonBuilder gsonBuilder = new GsonBuilder()
            .registerTypeAdapter(ObjectId.class, (JsonSerializer<ObjectId>) (src, typeOfSrc, context) -> new JsonPrimitive(src.toHexString()))
            .registerTypeAdapter(ObjectId.class, (JsonDeserializer<ObjectId>) GsonUtil::deserialize);

    private static ObjectId deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
        if (json instanceof JsonObject) {
            JsonObject jo = (JsonObject) json;
            return new ObjectId(jo.get("timestamp").getAsInt(), jo.get("machineIdentifier").getAsInt(), jo.get("processIdentifier").getAsShort(), jo.get("counter").getAsInt());
        }
        return new ObjectId(json.getAsString());
    }


    public static Gson getGson() {
        return gsonBuilder.create();
    }
}


=====================================================
== File: src/main/java/com/capitalone/dashboard/testutil/BaseCollectorTestConfig.java
=====================================================
package com.capitalone.dashboard.testutil;

import com.capitalone.dashboard.collector.RestOperationsSupplier;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.scheduling.TaskScheduler;

import java.util.HashMap;
import java.util.Map;

@ComponentScan(basePackages ={ "com.capitalone.dashboard.collector", "com.capitalone.dashboard.model"}, includeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value=TaskScheduler.class),
        @ComponentScan.Filter(type = FilterType.REGEX, pattern="com.capitalone.dashboard.collector.*CollectorTask.class"), @ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.capitalone.dashboard.collector.*Settings.class")})
public class BaseCollectorTestConfig {


    @Bean
    public RestOperationsSupplier restOperationsSupplier()  {
        Map<String, TestResponse<String>> responseMap = new HashMap<>();
        return new TestRestOperations(responseMap);
    }


    @Bean
    public TaskScheduler taskScheduler() {
        return Mockito.mock(TaskScheduler.class);
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/testutil/TestResponse.java
=====================================================
package com.capitalone.dashboard.testutil;

import org.springframework.http.HttpStatus;

public class TestResponse<T> {
    private T body;
    private HttpStatus status;

    public TestResponse(T body, HttpStatus status) {
        this.body = body;
        this.status = status;
    }

    public T getBody() {
        return body;
    }

    public void setBody(T body) {
        this.body = body;
    }

    public HttpStatus getStatus() {
        return status;
    }

    public void setStatus(HttpStatus status) {
        this.status = status;
    }
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/client/RestAuthType.java
=====================================================
package com.capitalone.dashboard.client;

public enum RestAuthType {
    BASIC,
    TOKEN;
}

=====================================================
== File: src/main/java/com/capitalone/dashboard/client/RestUserInfo.java
=====================================================
package com.capitalone.dashboard.client;

public class RestUserInfo {
    private String userId;
    private String passCode;

    public RestUserInfo(String userId, String passCode) {
        this.userId = userId;
        this.passCode = passCode;
    }

    public String getFormattedString() {
        return userId.trim() + ":" + passCode.trim();
    }
}


=====================================================
== File: src/main/java/com/capitalone/dashboard/client/RestClient.java
=====================================================
package com.capitalone.dashboard.client;

import com.capitalone.dashboard.util.Encryption;
import com.capitalone.dashboard.util.EncryptionException;
import com.capitalone.dashboard.util.Supplier;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestOperations;
import java.nio.charset.StandardCharsets;
import java.util.Map;

@Component
public class RestClient {
    private static final Log LOG = LogFactory.getLog(RestClient.class);
    private final RestOperations restOperations;

    @Autowired
    public RestClient(Supplier<RestOperations> restOperationsSupplier) {
        this.restOperations = restOperationsSupplier.get();
    }

    public ResponseEntity<String> makeRestCallPost(String url, JSONObject body) {
        if (restOperations == null) { return null; }

        long start = System.currentTimeMillis();

        ResponseEntity<String> response
                = restOperations.exchange(url, HttpMethod.POST, new HttpEntity<Object>(body, null), String.class);

        long end = System.currentTimeMillis();

        LOG.info("Time taken to make a post call to "+url+" = "+(end-start));

        return response;
    }