Add file templates for IntelliJ
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<code_scheme name="ApexStyleGuide" version="173">
|
||||
<ApexCodeStyleSettings>
|
||||
<option name="CLASS_BRACE_STYLE" value="2" />
|
||||
<option name="METHOD_BRACE_STYLE" value="2" />
|
||||
<option name="BRACE_STYLE" value="2" />
|
||||
<option name="QUERY_BRACKET_STYLE" value="2" />
|
||||
<option name="APEX_DOC_REFORMAT_APEX_DOC" value="true" />
|
||||
</ApexCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="VAR_DECLARATION_WRAP" value="2" />
|
||||
<option name="OBJECT_LITERAL_WRAP" value="2" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
<option name="USE_CHAINED_CALLS_GROUP_INDENTS" value="true" />
|
||||
</JSCodeStyleSettings>
|
||||
<MarkdownNavigatorCodeStyleSettings>
|
||||
<option name="RIGHT_MARGIN" value="72" />
|
||||
</MarkdownNavigatorCodeStyleSettings>
|
||||
<MultiMarkdownCodeStyleSettings>
|
||||
<option name="RIGHT_MARGIN" value="72" />
|
||||
</MultiMarkdownCodeStyleSettings>
|
||||
<codeStyleSettings language="Apex">
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" />
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="SMART_TABS" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="RIGHT_MARGIN" value="120" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="2" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
@@ -0,0 +1,32 @@
|
||||
public inherited sharing class ${NAME}
|
||||
extends SObjects
|
||||
implements I${NAME}
|
||||
{
|
||||
public static I${NAME} newInstance(List<${SObject_API_Name}> records)
|
||||
{
|
||||
return (I${NAME}) Application.Domain.newInstance(records);
|
||||
}
|
||||
|
||||
public static I${NAME} newInstance(Set<Id> ids)
|
||||
{
|
||||
return (I${NAME}) Application.Domain.newInstance(ids);
|
||||
}
|
||||
|
||||
public ${NAME}(List<${SObject_API_Name}> records)
|
||||
{
|
||||
super(records, Schema.${SObject_API_Name}.SObjectType);
|
||||
}
|
||||
|
||||
public List<${SObject_API_Name}> get${NAME}()
|
||||
{
|
||||
return (List<${SObject_API_Name}>) getRecords();
|
||||
}
|
||||
|
||||
public class Constructor implements fflib_IDomainConstructor
|
||||
{
|
||||
public fflib_SObjects construct(List<Object> records)
|
||||
{
|
||||
return new ${NAME}((List<SObject>) records);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AepApexClassMeta.xml")
|
||||
@@ -0,0 +1,5 @@
|
||||
public interface I${NAME}
|
||||
extends fflib_ISObjects
|
||||
{
|
||||
List<${SObject_API_Name}> get${NAME}();
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AepApexClassMeta.xml")
|
||||
@@ -0,0 +1,38 @@
|
||||
@IsTest
|
||||
private class ${NAME}Test
|
||||
{
|
||||
@IsTest
|
||||
static void testNewInstanceWithIds()
|
||||
{
|
||||
final Id id = fflib_IDGenerator.generate(Schema.${SObject_API_Name}.SObjectType);
|
||||
final Set<Id> ids = new Set<Id>{ id };
|
||||
final List<${SObject_API_Name}> records = new List<${SObject_API_Name}>{ new ${SObject_API_Name}(Id = id) };
|
||||
|
||||
fflib_ApexMocks mocks = new fflib_ApexMocks();
|
||||
I${NAME}Selector selectorMock = (I${NAME}Selector) mocks.mock(I${NAME}Selector.class);
|
||||
|
||||
mocks.startStubbing();
|
||||
mocks.when(selectorMock.selectSObjectsById(ids)).thenReturn(records);
|
||||
mocks.stopStubbing();
|
||||
|
||||
Application.Selector.setMock(Schema.${SObject_API_Name}.SObjectType, selectorMock);
|
||||
|
||||
System.Test.startTest();
|
||||
I${NAME} result = ${NAME}.newInstance(ids);
|
||||
System.Test.stopTest();
|
||||
|
||||
System.assertEquals(records, result.get${NAME}());
|
||||
}
|
||||
|
||||
@IsTest
|
||||
static void testNewInstanceWithRecords()
|
||||
{
|
||||
final List<${SObject_API_Name}> records = new List<${SObject_API_Name}>{ new ${SObject_API_Name}(Id = fflib_IDGenerator.generate(Schema.${SObject_API_Name}.SObjectType)) };
|
||||
|
||||
System.Test.startTest();
|
||||
I${NAME} result = ${NAME}.newInstance(records);
|
||||
System.Test.stopTest();
|
||||
|
||||
System.assertEquals(records, result.get${NAME}());
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AepApexClassMeta.xml")
|
||||
@@ -0,0 +1,75 @@
|
||||
public virtual inherited sharing class ${NAME}
|
||||
extends fflib_SObjectSelector
|
||||
implements I${NAME}
|
||||
{
|
||||
public static I${NAME} newInstance()
|
||||
{
|
||||
return (I${NAME}) Application.Selector.newInstance(Schema.${SObject_API_Name}.SObjectType);
|
||||
}
|
||||
|
||||
public static IContactsSelector newWithoutSharingInstance()
|
||||
{
|
||||
return (IContactsSelector) Application.ElevatedSelector.newInstance(Schema.${SObject_API_Name}.SObjectType);
|
||||
}
|
||||
|
||||
public static IContactsSelector newInheritedSharingInstance()
|
||||
{
|
||||
return (IContactsSelector) Application.NoSharingSelector.newInstance(Schema.${SObject_API_Name}.SObjectType);
|
||||
}
|
||||
|
||||
public ${NAME}()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public ${NAME}(Boolean includeFieldSetFields, Boolean enforceCRUD, Boolean enforceFLS)
|
||||
{
|
||||
super(includeFieldSetFields, enforceCRUD, enforceFLS);
|
||||
}
|
||||
|
||||
public List<Schema.SObjectField> getSObjectFieldList()
|
||||
{
|
||||
return new List<Schema.SObjectField>
|
||||
{
|
||||
${SObject_API_Name}.Id
|
||||
};
|
||||
}
|
||||
|
||||
public Schema.SObjectType getSObjectType()
|
||||
{
|
||||
return Schema.${SObject_API_Name}.SObjectType;
|
||||
}
|
||||
|
||||
public virtual List<${SObject_API_Name}> selectById(Set<Id> idSet)
|
||||
{
|
||||
return (List<${SObject_API_Name}>) selectSObjectsById(idSet);
|
||||
}
|
||||
|
||||
public with sharing class WithSharing extends ${NAME}
|
||||
{
|
||||
// Constructor that will enforce CRUD and FLS
|
||||
public WithSharing()
|
||||
{
|
||||
super(true, true, true);
|
||||
}
|
||||
|
||||
public override List<${SObject_API_Name}> selectById(Set<Id> idSet)
|
||||
{
|
||||
return super.selectById(idSet);
|
||||
}
|
||||
}
|
||||
|
||||
public without sharing class WithoutSharing extends ${NAME}
|
||||
{
|
||||
// Constructor that will enforce CRUD and FLS
|
||||
public WithoutSharing()
|
||||
{
|
||||
super(true, false, false);
|
||||
}
|
||||
|
||||
public override List<${SObject_API_Name}> selectById(Set<Id> idSet)
|
||||
{
|
||||
return super.selectById(idSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AepApexClassMeta.xml")
|
||||
@@ -0,0 +1,5 @@
|
||||
public interface I${NAME}
|
||||
extends fflib_ISObjectSelector
|
||||
{
|
||||
List<${SObject_API_Name}> selectById(Set<Id> idSet);
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AepApexClassMeta.xml")
|
||||
@@ -0,0 +1,14 @@
|
||||
public with sharing class ${NAME}
|
||||
{
|
||||
public static void doSomething()
|
||||
{
|
||||
service().doSomething();
|
||||
}
|
||||
|
||||
private static I${NAME} service()
|
||||
{
|
||||
return (I${NAME}) Application.Service.newInstance(I${NAME}.class);
|
||||
}
|
||||
|
||||
public class ${NAME}Exception extends Exception {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AEPE ApexClassMeta.xml")
|
||||
@@ -0,0 +1,11 @@
|
||||
public inherited sharing class ${NAME}Impl
|
||||
implements I${NAME}
|
||||
{
|
||||
/**
|
||||
* Method doSomething
|
||||
*/
|
||||
public void doSomething()
|
||||
{
|
||||
// doSomething
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AEPE ApexClassMeta.xml")
|
||||
@@ -0,0 +1,7 @@
|
||||
public interface I${NAME}
|
||||
{
|
||||
/**
|
||||
* Method doSomething
|
||||
*/
|
||||
void doSomething();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
@IsTest
|
||||
private class ${NAME}Test
|
||||
{
|
||||
@IsTest
|
||||
static void testBehavior()
|
||||
{
|
||||
|
||||
System.Test.startTest();
|
||||
${NAME}.doSomething();
|
||||
System.Test.stopTest();
|
||||
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AEPE ApexClassMeta.xml")
|
||||
+1
@@ -0,0 +1 @@
|
||||
#parse("AEPE ApexClassMeta.xml")
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
|
||||
<apiVersion>52.0</apiVersion>
|
||||
<status>Active</status>
|
||||
</ApexClass>
|
||||
Reference in New Issue
Block a user