Last active
March 14, 2016 01:23
-
-
Save zaynelt/3ecb7148cb69bad1851c to your computer and use it in GitHub Desktop.
RAD Q1 2016 - Final Project Hints
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
//Object Oriented Class that represents our Stock_Item__c Object and provides functionality | |
public with sharing class StockItem { | |
//class variables defined here | |
//Example: String name; | |
//default constructor should take in arguments that can be used to instatiate a new StockItem object | |
//Create methods to execute the functionality described in the requirements. | |
} |
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
//A Utility class to process Stock Item records from the Stock Item Handler | |
public with sharing class StockItemHandler { | |
//Default Constructor | |
public StockItemHandler() { | |
} | |
//Create methods here to handle the before insert, before delete and utility processes described in the requirements | |
//They should accept lists of Stock_Item__c records from the trigger | |
} |
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
@isTest | |
private class StockItemHandler_Test { | |
@isTest static void testBeforeInsertFunctionality() { | |
// Implement test code | |
} | |
@isTest static void testBeforeDeleteFunctionality() { | |
// Implement test code | |
} | |
@isTest static void testgetLowStockItems() { | |
// Implement test code | |
} | |
} |
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
trigger StockItemTrigger on Stock_Item__c (before insert, before delete) { | |
//Instantiate StockItemHandler | |
//Before Insert Handling | |
if(Trigger.isInsert && Trigger.isBefore) { | |
//call the class in your handler for before insert | |
} | |
//Before Delete Handling | |
if(Trigger.isDelete && Trigger.isBefore) { | |
//call the class in your handler for before delete | |
} | |
} |
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
/* | |
* NOTE: THIS IS JUST A COMPLETED VERSION OF THE .trigger FILE ABOVE. | |
*/ | |
trigger CompletedStockItemTrigger on Stock_Item__c (before insert, before delete) { | |
//Instantiate StockItemHandler | |
StockItemHandler handler = new StockItemHandler(); | |
//Before Insert Handling | |
if(Trigger.isInsert && Trigger.isBefore) { | |
handler.OnBeforeInsert(Trigger.new); | |
} | |
//Before Delete Handling | |
if(Trigger.isDelete && Trigger.isBefore) { | |
handler.OnBeforeDelete(Trigger.old); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment