This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Author: Dhanik Lal Sahni | |
* Date: Oct 8, 2019 | |
* Descpription: Implementation class for IServiceRequest to creating Case. | |
*/ | |
public class CaseServiceRequest implements IServiceRequest{ | |
//validate information | |
private string validateServiceRequest(ServiceRequestData data){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Author: Dhanik Lal Sahni | |
* Date: Oct 8, 2019 | |
* Descpription: Implementation class for IServiceRequest to change account's address. | |
*/ | |
public class AddressChangeServiceRequest implements IServiceRequest{ | |
//validate information | |
private string validateServiceRequest(ServiceRequestData data){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Author: Dhanik Lal Sahni | |
* Date: Oct 8, 2019 | |
* Descpription: Base Exception for throwing error in code. | |
*/ | |
public class BaseException extends Exception { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Author: Dhanik Lal Sahni | |
* Date: Oct 8, 2019 | |
* Descpription: Factory Implementation for creating object. | |
*/ | |
public class ServiceRequestFactory { | |
public IServiceRequest getServiceRequest(string serviceRequestType){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Author: Dhanik Lal Sahni | |
* Date: Oct 8, 2019 | |
* Descpription: AWS Service for uploading file | |
*/ | |
public class AWSService { | |
public string awsKey {get;set;} | |
public string awsSecret {get;set;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class S3Controller { | |
@AuraEnabled | |
public static void UploadDocToS3Server(string recordId) | |
{ | |
UploadDocument(recordId); | |
} | |
@future(callout=true) | |
public static void UploadDocument(string recordId) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AWSS3Service { | |
public string awsKey {get;set;} | |
public string awsSecret {get;set;} | |
public string bucketName {get;set;} | |
public string methodName {get;set;} | |
public string hostName {get;set;} | |
public AWSS3Service(string key, string secret, string bucket, string method, string host) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class S3Controller { | |
@AuraEnabled | |
public static FileData GetS3FileUsingFileId(string recordId) | |
{ | |
String key = '**************'; | |
String secret = '*********************************'; | |
String bucket = 'salesforcecodex'; | |
String host = 's3-us-west-1.amazonaws.com'; | |
String method = 'GET'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component | |
controller="S3Controller" | |
implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" | |
access="global"> | |
<aura:attribute name="data" type="String" /> | |
<aura:attribute name="recordId" type="String" /> | |
<aura:attribute name="showFileLink" type="boolean" /> | |
<lightning:button variant="brand" label="View Files" onclick="{!c.getData}" /> | |
<aura:if isTrue="{!v.showFileLink}"> | |
<a href="{!v.data}">Download File</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class S3FileController { | |
@AuraEnabled | |
public static string getFileUrl(string record) | |
{ | |
try | |
{ | |
List<FileStore__c> files=[SELECT S3ServerUrl__c,FileExtension__c FROM FileStore__c | |
where Id=:record]; | |
FileStore__c file=files[0]; | |
return file.S3ServerUrl__c; |