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 XMLParser { | |
public Object parse(Dom.XMLNode root) { | |
return new XMLNodeProcessor(root).process(); | |
} | |
private class XMLNodeProcessor { | |
private final Dom.XMLNode root; | |
private final Map<Dom.XMLNode, Object> resultMap; | |
private final Map<Dom.XMLNode, Map<String, Object>> pendingNodes; | |
private final Map<Dom.XMLNode, Map<String, Integer>> nodeNameCountMap; |
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
/** | |
* Split a string of any size, while avoiding the dreaded 'Regex too complicated' | |
* error, which the String.split(String) method causes on some large inputs. | |
* | |
* Note that this method does not avoid other errors, such as those related to | |
* excess heap size or CPU time. | |
*/ | |
List<String> safeSplit(String inStr, String delim) | |
{ | |
Integer regexFindLimit = 100; |
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 static string generate18CharId(final string id){ | |
final String abecedair = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345'; | |
if (String.isBlank(id) || (id.length() != 15 && id.length() != 18)) { | |
return null; | |
} | |
if (id.length() == 18) { | |
return id; | |
} | |
string suffix = ''; | |
for (integer i = 0; i < 3; i++) { |
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 with sharing class RecordTypeHandler { | |
// Build a local cache so that we don't request this multiple times | |
private static Map<Schema.SObjectType,Map<String,Id>> rtypesCache; | |
static { | |
rtypesCache = new Map<Schema.SObjectType,Map<String,Id>>(); | |
} | |
// Returns a map of active, user-available RecordType IDs for a given SObjectType, |
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 UserRoleInserter{ | |
final private Map<String,String> roleNamePerParentRoleName; | |
public UserRoleInserter(){ | |
this.roleNamePerParentRoleName = new Map<String,String>(); | |
} | |
public void PutUserRoleHierarchy(final String aUserRole, final String aParentUserRole) { | |
this.roleNamePerParentRoleName.put(aUserRole,aParentUserRole); | |
} |