Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Larrimore committed Nov 5, 2020
1 parent e575dc5 commit d867512
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions force-app/main/default/classes/CpmComponentController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ public with sharing class CpmComponentController {

@AuraEnabled(cacheable=true)
public static list<Demo_Component__c> getDemoComponents(){
return [SELECT Id, Title__c, Name, Description__c, Package_Name__c, Installation_Type__c, Install_Date__c, Update_Available__c, Installed__c, POC_Email__c, POC_Name__c, Github_Repository_URL__c, Installed_Version__c, SFDX_Package_Enabled_Flag__c FROM Demo_Component__c];
return [SELECT Id, Title__c, Name, Description__c, Package_Name__c, Installation_Type__c, Install_Date__c, Update_Available__c, Installed__c, POC_Email__c, POC_Name__c, Github_Repository_URL__c, Installed_Version__c, Latest_Package_Version_Deprecated_Flag__c, SFDX_Package_Enabled_Flag__c FROM Demo_Component__c];
}

@AuraEnabled
public static list<Demo_Component__c> getInstalledComponents(){
return [SELECT Id, Title__c, Name, Description__c, Package_Name__c, Installation_Type__c, Install_Date__c, Update_Available__c, Installed__c, POC_Email__c, POC_Name__c, Github_Repository_URL__c, Installed_Version__c, SFDX_Package_Enabled_Flag__c FROM Demo_Component__c WHERE Installed__c = true];
return [SELECT Id, Title__c, Name, Description__c, Package_Name__c, Installation_Type__c, Install_Date__c, Update_Available__c, Installed__c, POC_Email__c, POC_Name__c, Github_Repository_URL__c, Installed_Version__c, Latest_Package_Version_Deprecated_Flag__c, SFDX_Package_Enabled_Flag__c FROM Demo_Component__c WHERE Installed__c = true];
}

@AuraEnabled
public static list<Demo_Component__c> getAvailableComponents(){
return [SELECT Id, Title__c, Name, Description__c, Package_Name__c, Installation_Type__c, Install_Date__c, Update_Available__c, Installed__c, POC_Email__c, POC_Name__c, Github_Repository_URL__c, SFDX_Package_Enabled_Flag__c FROM Demo_Component__c WHERE Installed__c = false];
return [SELECT Id, Title__c, Name, Description__c, Package_Name__c, Installation_Type__c, Install_Date__c, Update_Available__c, Installed__c, POC_Email__c, POC_Name__c, Github_Repository_URL__c, Latest_Package_Version_Deprecated_Flag__c, SFDX_Package_Enabled_Flag__c FROM Demo_Component__c WHERE Installed__c = false];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public with sharing class CpmComponentInstallCheckerControllerTest {
CpmComponentInstallCheckerController.runApex();
Test.stopTest();

Demo_Component__C demoComponentVM = [SELECT Id, Title__c, Installed__c, Installed_Version_Tracking_Method__c, Update_Available__c, Source_Installed_Commit_Hash__c FROM Demo_Component__c where Github_Repository_URL__c =:ApiCalloutMock.VM_GITHUB_REPO_URL LIMIT 1];
Demo_Component__C demoComponentVM = [SELECT Id, Title__c, Installed__c, Installed_Version_Tracking_Method__c, Update_Available__c, Latest_Package_Version_Deprecated_Flag__c, Source_Installed_Commit_Hash__c FROM Demo_Component__c where Github_Repository_URL__c =:ApiCalloutMock.VM_GITHUB_REPO_URL LIMIT 1];

System.assertEquals('gpbu visitor management', demoComponentVM.Title__c);
System.assertEquals('Github_Commit', demoComponentVM.Installed_Version_Tracking_Method__c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public with sharing class CpmComponentInstallerController {
for(Component_Dependency__c packageDependency:packageDependencies){
Ids.add(packageDependency.Dependent_Component__c);
}
List<Demo_Component__c> dependentPackages = new List<Demo_Component__c>([SELECT Id, Installed__c, Title__c, Source_Install_Type_Flag__c, Package_Install_Type_Flag__c, Github_Repository_URL__c, Latest_Subscriber_Package_Version_Id__c, Install_Key__c, Source_Install_Url__c, Subscriber_Package_Id__c, Package_Install_Url__c FROM Demo_Component__c WHERE Id in :Ids]);
List<Demo_Component__c> dependentPackages = new List<Demo_Component__c>([SELECT Id, Installed__c, Title__c, Source_Install_Type_Flag__c, Package_Install_Type_Flag__c, Github_Repository_URL__c, Latest_Subscriber_Package_Version_Id__c, Install_Key__c, Source_Install_Url__c, Subscriber_Package_Id__c, Latest_Package_Version_Deprecated_Flag__c, Package_Install_Url__c FROM Demo_Component__c WHERE Id in :Ids]);
system.debug('found the following packages');
system.debug(dependentPackages);
return dependentPackages;
Expand Down
19 changes: 9 additions & 10 deletions force-app/main/default/classes/QueueGetInstalledPackages.cls
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ private static void doLater(Map<String, String> jobInfo) {
existsFlag = true;
if(!demoComponent.Installed__c){
System.debug('Demo Component was not installed previously, marking as installed');
QueuePlatformAsyncEventHelper.publishPlatformEvent(jobInfo,new Map<String,String>{
QueuePlatformAsyncEventHelper.FIELD_EVENT_STATUS_TITLE => 'Job Update Notification',
QueuePlatformAsyncEventHelper.FIELD_EVENT_STATUS_MESSAGE => 'Newly Installed Demo Component Found...',
QueuePlatformAsyncEventHelper.FIELD_EVENT_LEVEL => QueuePlatformAsyncEventHelper.EVENT_LEVEL_SUCCESS});
/*
* QueuePlatformAsyncEventHelper.publishPlatformEvent(jobInfo,new Map<String,String>{
* QueuePlatformAsyncEventHelper.FIELD_EVENT_STATUS_TITLE => 'Job Update Notification',
* QueuePlatformAsyncEventHelper.FIELD_EVENT_STATUS_MESSAGE => 'Newly Installed Demo Component Found...',
* QueuePlatformAsyncEventHelper.FIELD_EVENT_LEVEL => QueuePlatformAsyncEventHelper.EVENT_LEVEL_SUCCESS});
*/

demoComponent.Installed__c = true;
demoComponent.Package_Installed_Subscriber_Version_Id__c = subscriberPackageVersion.id;
Expand Down Expand Up @@ -138,8 +140,8 @@ private static void doLater(Map<String, String> jobInfo) {
demoComponent.Package_Installed_Version_Name__c = subscriberPackageVersion.name;
demoComponent.Package_Installed_Version_Number__c = subscriberPackageVersion.getSubscriberPackageVersionNumberText();
demoComponent.Latest_Package_Version_Deprecated_Flag__c = metadataInstalledPackageResponseRecord.subscriberPackageVersion.IsDeprecated;

if(null != metadataInstalledPackageResponseRecord.packageInstallRequest.LastModifiedDate){
if(null != metadataInstalledPackageResponseRecord.packageInstallRequest){
demoComponent.Install_date__c = metadataInstalledPackageResponseRecord.packageInstallRequest.LastModifiedDate;
}

Expand All @@ -158,10 +160,7 @@ private static void doLater(Map<String, String> jobInfo) {
QueueComponentUpdateEventHelper.FIELD_DEMO_COMPONENT_ID => demoComponent.Id
});
}else{
System.debug('Everything matches up, we dont need to do anything');

jobInfo.put(QueuePlatformAsyncEventHelper.FIELD_CURRENT_JOB_STAGE, QueuePlatformAsyncEventHelper.STAGE_COMPLETED);
QueuePlatformAsyncEventHelper.publishPlatformEvent(jobInfo);
System.debug('Everything matches up, we dont need to do anything');
}

}else{
Expand Down

0 comments on commit d867512

Please sign in to comment.