Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
Conflicts:
	lib/mm_response_handlers.py
	mavensmate.py
	mavensmate.sublime-settings
	messages.json
	packages.json
	util.py
  • Loading branch information
joeferraro committed Aug 13, 2015
2 parents a988526 + 0dc74ab commit 8f5d774
Show file tree
Hide file tree
Showing 38 changed files with 1,262 additions and 77 deletions.
Empty file modified lib/apex/metadata-templates/ApexClass/ApexClass.cls
100644 → 100755
Empty file.
Empty file.
23 changes: 0 additions & 23 deletions lib/apex/metadata-templates/ApexClass/ApexRest.cls

This file was deleted.

16 changes: 16 additions & 0 deletions lib/apex/metadata-templates/ApexClass/BDDUnitTestApexClass.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@isTest
private class {{ api_name }}
{
@isTest
static void itShould()
{
// Given


// When


// Then

}
}
Empty file modified lib/apex/metadata-templates/ApexClass/BatchApexClass.cls
100644 → 100755
Empty file.
Empty file modified lib/apex/metadata-templates/ApexClass/ControllerExtension.cls
100644 → 100755
Empty file.
57 changes: 57 additions & 0 deletions lib/apex/metadata-templates/ApexClass/DomainClass.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* See https://github.com/financialforcedev/fflib-apex-common for more info
*
* Install library via
* https://githubsfdeploy.herokuapp.com/app/githubdeploy/financialforcedev/fflib-apex-common
*/

/**
* Encapsulates all behaviour logic relating to the {{ object_name }} object
*
* For more guidelines and details see
* https://developer.salesforce.com/page/Apex_Enterprise_Patterns_-_Domain_Layer
*
**/
public class {{ api_name }} extends fflib_SObjectDomain
{
public {{ api_name }}(List<{{ object_name }}> records)
{
super(records);
}

public override void onValidate()
{
for({{ object_name }} record : (List<{{ object_name }}>) Records)
{
}
}

public override void onValidate(Map<Id,SObject> existingRecords)
{
for({{ object_name }} record : (List<{{ object_name }}>) Records)
{
}
}

public override void onBeforeInsert()
{
for({{ object_name }} record : (List<{{ object_name }}>) Records)
{
}
}

public void someMethod()
{
for({{ object_name }} record : (List<{{ object_name }}>) Records)
{
}
}

public class Constructor implements fflib_SObjectDomain.IConstructable
{
public fflib_SObjectDomain construct(List<SObject> sObjectList)
{
return new {{ api_name }}(sObjectList);
}
}
}
Empty file modified lib/apex/metadata-templates/ApexClass/EmailServiceApexClass.cls
100644 → 100755
Empty file.
Empty file modified lib/apex/metadata-templates/ApexClass/ExceptionApexClass.cls
100644 → 100755
Empty file.
28 changes: 28 additions & 0 deletions lib/apex/metadata-templates/ApexClass/HttpCalloutMock.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@isTest
public class {{ api_name }} implements HttpCalloutMock {

protected Integer code;
protected String status;
protected String body;
protected Map<String, String> responseHeaders;

public {{ api_name }}(Integer code, String status, String body, Map<String, String> responseHeaders) {
this.code = code;
this.status = status;
this.body = body;
this.responseHeaders = responseHeaders;
}

public HTTPResponse respond(HTTPRequest req) {
//System.assertEquals('http://api.salesforce.com/foo/bar', req.getEndpoint());
//System.assertEquals('GET', req.getMethod());

// Create a fake response
HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setBody('{"foo":"bar"}');
res.setStatusCode(200);
return res;
}

}
Empty file modified lib/apex/metadata-templates/ApexClass/SchedulableApexClass.cls
100644 → 100755
Empty file.
50 changes: 50 additions & 0 deletions lib/apex/metadata-templates/ApexClass/SelectorClass.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* See https://github.com/financialforcedev/fflib-apex-common for more info
*
* Install library via
* https://githubsfdeploy.herokuapp.com/app/githubdeploy/financialforcedev/fflib-apex-common
*/

/**
* Class encapsulates query logic for {{ object_name }}
*
* https://developer.salesforce.com/page/Apex_Enterprise_Patterns_-_Selector_Layer
**/
public class {{ api_name }} extends fflib_SObjectSelector
{
public List<Schema.SObjectField> getSObjectFieldList()
{
return new List<Schema.SObjectField> {
{{ object_name }}.Id
};
}

public Schema.SObjectType getSObjectType()
{
return {{ object_name }}.sObjectType;
}

public List<{{ object_name }}> selectById(Set<ID> idSet)
{
return (List<{{ object_name }}>) selectSObjectsById(idSet);
}

/*
* For more examples see https://github.com/financialforcedev/fflib-apex-common-samplecode
*
public List<{{ object_name }}> selectBySomethingElse(List<String> somethings)
{
assertIsAccessible();
return (List<{{ object_name }}>) Database.query(
String.format(
'select {0}, ' +
'from {1} ' +
'where Something__c in :somethings ' +
'order by {2}',
new List<String> {
getFieldListString(),
getSObjectName(),
getOrderBy() } ) );
}
*/
}
21 changes: 21 additions & 0 deletions lib/apex/metadata-templates/ApexClass/ServiceClass.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* See https://github.com/financialforcedev/fflib-apex-common for more info
*
* Install library via
* https://githubsfdeploy.herokuapp.com/app/githubdeploy/financialforcedev/fflib-apex-common
*/

/**
* Encapsulates all service layer logic for a given function or module in the application
*
* For more guidelines and details see
* https://developer.salesforce.com/page/Apex_Enterprise_Patterns_-_Service_Layer
*
**/
public class {{ api_name }}
{
public static void doSomething()
{

}
}
84 changes: 84 additions & 0 deletions lib/apex/metadata-templates/ApexClass/TriggerHandler.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
public class {{ api_name }}
{
/**
* Enum representing each of before/after CRUD events on Sobjects
*/
public enum Evt
{
afterdelete, afterinsert, afterundelete,
afterupdate, beforedelete, beforeinsert, beforeupdate
}

/*
* Simplistic handler to implement on any of the event. It doesn't require or enforces any pattern except the
* method name to be "handle()".
*/
public interface HandlerInterface
{
void handle();
}

// Internal mapping of handlers
Map<String, List<HandlerInterface>> eventHandlerMapping = new Map<String, List<HandlerInterface>>();

/**
* Core API to bind handlers with events
*/
public {{ api_name }} bind(Evt event, HandlerInterface eh)
{
List<HandlerInterface> handlers = eventHandlerMapping.get(event.name());
if (handlers == null)
{
handlers = new List<HandlerInterface>();
eventHandlerMapping.put(event.name(), handlers);
}
handlers.add(eh);
return this;
}

/**
* Invokes correct handlers as per the context of Trigger and available registered handlers
*/
public void manage()
{
Evt ev = null;
if(Trigger.isInsert && Trigger.isBefore)
{
ev = Evt.beforeinsert;
}
else if(Trigger.isInsert && Trigger.isAfter)
{
ev = Evt.afterinsert;
}
else if(Trigger.isUpdate && Trigger.isBefore)
{
ev = Evt.beforeupdate;
}
else if(Trigger.isUpdate && Trigger.isAfter)
{
ev = Evt.afterupdate;
}
else if(Trigger.isDelete && Trigger.isBefore)
{
ev = Evt.beforedelete;
}
else if(Trigger.isDelete && Trigger.isAfter)
{
ev = Evt.afterdelete;
}
else if(Trigger.isundelete)
{
ev = Evt.afterundelete;
}

List<HandlerInterface> handlers = eventHandlerMapping.get(ev.name());

if (handlers != null && ! handlers.isEmpty())
{
for (HandlerInterface h : handlers)
{
h.handle();
}
}
}
}
Empty file modified lib/apex/metadata-templates/ApexClass/UnitTestApexClass.cls
100644 → 100755
Empty file.
Empty file modified lib/apex/metadata-templates/ApexClass/UrlRewriterApexClass.cls
100644 → 100755
Empty file.
19 changes: 19 additions & 0 deletions lib/apex/metadata-templates/ApexClass/WebServiceMock.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@isTest
public class {{ api_name }} implements WebServiceMock {
public void doInvoke(
Object stub,
Object request,
Map<String, Object> response,
String endpoint,
String soapAction,
String requestName,
String responseNS,
String responseName,
String responseType) {

// Create response element from the autogenerated class.
// Populate response element.
// Add response element to the response parameter, as follows:
//response.put('response_x', responseElement);
}
}
Empty file modified lib/apex/metadata-templates/ApexClass/WebserviceClass.cls
100644 → 100755
Empty file.
Empty file.
Empty file modified lib/apex/metadata-templates/ApexPage/ApexPage.page
100644 → 100755
Empty file.
11 changes: 11 additions & 0 deletions lib/apex/metadata-templates/ApexPage/HeaderPageBlock.page
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<apex:page showHeader="true" sidebar="true">
<apex:sectionHeader title="MyHeaderTitle" subtitle="MyHeaderSubTitle" />
<apex:pageBlock title="MyPageBlockTitle">
<apex:pageBlockButtons location="top">

</apex:pageBlockButtons>
<apex:pageBlockSection title="MyPageBlockSectionTitle">

</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Empty file modified lib/apex/metadata-templates/ApexTrigger/ApexTrigger.trigger
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
trigger {{ api_name }} on {{ object_name }} (
before insert,
before update,
before delete,
after insert,
after update,
after delete,
after undelete) {

if (Trigger.isBefore) {
//call your handler.before method

} else if (Trigger.isAfter) {
//call handler.after method

}
}
2 changes: 1 addition & 1 deletion lib/apex/metadata-templates/ApexTrigger/ApexTriggerBulk.trigger
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
trigger {{ api_name }} on {{ object_name }} (before insert, before update, before delete, after insert, after update, after delete, after undelete) {

for( {{ object_name }} so : Trigger.new) {
for ({{ object_name }} so : Trigger.new) {
//friends remind friends to bulkify
}

Expand Down
19 changes: 19 additions & 0 deletions lib/apex/metadata-templates/ApexTrigger/DomainTrigger.trigger
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* See https://github.com/financialforcedev/fflib-apex-common for more info
*
* Install library via
* https://githubsfdeploy.herokuapp.com/app/githubdeploy/financialforcedev/fflib-apex-common
*/

/**
* Boiler plate Apex Trigger to route events to the respective Domain class methods
*
* For more guidelines and details see
* https://developer.salesforce.com/page/Apex_Enterprise_Patterns_-_Domain_Layer
**/
trigger {{ api_name }} on {{ object_name }} (after delete, after insert, after update,
before delete, before insert, before update)
{
// Creates Domain class instance and calls appropriate methods
fflib_SObjectDomain.triggerHandler({{ api_name }}.class);
}
Loading

0 comments on commit 8f5d774

Please sign in to comment.