1. Rocky Assad
  2. sf-code-validation

Overview

HTTPS SSH

screen cast demo

http://www.screencast.com/t/ysjBamDeNQ

screen cast tests

http://www.screencast.com/t/GouF6GLE8

#gmail cloudspokes.2604@gmail.com CloudProud

salesforce

cloudspokes.2604@gmail.com CloudProud999

Created in Salesforce

ApexClass CodeCheckResponse The response sent back to the client that called the API.

    CodeCheckRest
        The REST API to vaidate codes for the user and profile.

    CodeCheckRestTest
        The REST API unit tests. This includes tests for record actions as well.

    CodeCheckWebservice
        The SOAP API to validate codes for the user and profile.

    CodeCheckWebserviceTest
        The SOAP API unit tests.

    CodesGateway
        The class to handle feteching data for the Codes__c objects.

    CodesHandler
        The class to handle trigger events and delegate work out to the gateway class.

    ITrigger
        Interface containing methods Trigger Handlers must implement to enforce best practice.
        and bulkification of triggers.

    TriggerException
        The exception class used within the Trigger Factory.

    TriggerFactory
        The class used to instantiate and execute Trigger Handlers associated with sObjects.

ApexTrigger CodesTrigger Pushes all logic into TriggerFactory to handle bulk and limits.

CustomObject Code_API_Call_Counterc This object stores the number of API calls (Hit_Countc) that the user (Userc) and profile (Profileid__c) have called so far.

    Codes_Log__c
        This object stores all code validation API calls ever attempted. The following fields are stored:
        API_Called__c 
            The URI of the API that was called along with parameters supplied.

        API_Type__c
            Stores 'REST' or 'SOAP' for quick auditing.

        Code__c
            The code that was being validated.

        Code_Type__c
            The code type that was being validated.

        Message__c
            The message ('Invalid Code', 'Limit Exceeded', 'Valid Code', 'Error') that is sent back to the client within the response object.

        Profile_Id__c
            The profile id fo the users profile that was attempting code validation.

        Success__c
            Stores 'true' or 'false' depending if the code, and profile was valid.

        Timestamp__c
            The timestamp when the client made the API call.

        User__c
            The user that made the API call.


    Codes_Profiles__c
        This object has a looked up to the Codes object, and a field field for the max (Max_Hit_Count__c) amount of API calls allowed for that code and profile.

        ** TODO ** The profile id field is missing here. Create Profile_Id__c TEXT(18) and store the profile id that this code is valid for.

    Codes__c
        This object stores the valid codes (Code__c) and code types (Code_Type__c) available. The Code_Length__c field is automatically populatd via trigger based on the code entered/updated.

TODO

The admin interface page needs to be created. This page will populate the Codes_Profilesc object. This really can be accomplished by creating a visualforce page that overides the edit/new action for this object. The page would have all of the object's fields on it but also a custom compenent to list all available profiles. A single profile can be selected and stored in the Profile_Idc field. This will handle multiple profiles being assigned to a single code al with different max API call limits.

I hope this is helpful and you guys can use it. I really wish I had the tim to finish this (daughters birthday party today =))

Happy Coding.