sfLeadMatcher
index
/home/sfscript/src/py_sforce/sflib/sfLeadMatcher.py

Copyright 2004 Chip Vanek, Magma Design Automation
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 
Class and script to scour leads in the Customers and Prospects queue
    Chip Vanek (chip@upvia.com), Nov 1st, 2004

 
Modules
       
StringIO
ZSI
base64
cStringIO
copy
getopt
logging
os
pprint
re
sets
sfMail
SforceService_services
sys
time
traceback
types
urlparse

 
Classes
       
LeadNotificationCache
LeadMatcher
LeadNotification
sop.SFSOP(sop.LockAndLoadMixin)
LeadNotificationSOP

 
class LeadMatcher(LeadNotificationCache)
     Methods defined here:
__init__(self, contactTool=None)
collectLeadNotif(self, contact, action, accountCandidates)
dictList(self, map, key, value)
add a value to a dictionary of lists
fetchAllCPLeads(self, qid)
Gets all leads in the customers and prospects queue
getAccountListOwners(self, accountIdList)
Given a list of accounts, get back a list of owning user IDs
processLeads(self, qid)
sendNotifications(self)

Data and other attributes defined here:
user_obj = 'User'

Methods inherited from LeadNotificationCache:
getCache(self, key, data={}, reset=False)
main accessor for getting cache information
setCache(self, key, data={})
load the latest data for the key into a simple object
persitence dictionary

Data and other attributes inherited from LeadNotificationCache:
cache = {}
debug = 0

 
class LeadNotification(LeadNotificationCache)
     Methods defined here:
__init__(self, userId, priUpdList, priNewList, auxNewList, userTool=None, accountTool=None)
userId - ID of user owning the accounts all contacts belong to.
priUpdList - list of existing contacts in accounts owned by the user
             that we have annotated
priNewList - list of new contacts we created in accounts owned by
             the user.
auxNewList - list of new contacts created in a top level account that
             could belong to a sub account owned by the user.
buildAuxNewSection(self)
buildPriNewSection(self)
buildPriUpdSection(self)
formatContactLineItem(self, contactData)
general format for a line of the report.
formatSection(self, contactDataList, title, blurb)
generateBody(self)
Build the notification report
generateHeader(self)
send(self)

Methods inherited from LeadNotificationCache:
getCache(self, key, data={}, reset=False)
main accessor for getting cache information
setCache(self, key, data={})
load the latest data for the key into a simple object
persitence dictionary

Data and other attributes inherited from LeadNotificationCache:
cache = {}
debug = 0

 
class LeadNotificationCache
     Methods defined here:
getCache(self, key, data={}, reset=False)
main accessor for getting cache information
setCache(self, key, data={})
load the latest data for the key into a simple object
persitence dictionary

Data and other attributes defined here:
cache = {}
debug = 0

 
class LeadNotificationSOP(sop.SFSOP)
    
Method resolution order:
LeadNotificationSOP
sop.SFSOP
sop.LockAndLoadMixin

Methods defined here:
__init__(self)
filename(self)

Data and other attributes defined here:
lastEntity = ''
lastUpdate = 0
maxObjAge = 86400000
resetStale = False

Methods inherited from sop.SFSOP:
__len__(self)
__repr__(self)
__str__(self)
data(self)
delData(self, key)
delete value from the cache
getAge(self, key)
return age of sop info in secs
getData(self, key, default='')
isStale(self, key)
Should we load fresh data from remote server
reset(self, state=False)
rest age to refresh on next access
setAge(self, key)
return age of sop info in secs
setData(self, key, value)

Methods inherited from sop.LockAndLoadMixin:
__del__(self)
changed(self)
commit(self)
getPath(self)
get the configured path for cache
load(self, default=None, marshal=False)
Must be called from init of object

 
Functions
       
main()
usage(err='')
Prints the Usage() statement for the program

 
Data
        ACCOUNT_OBJ = 'Account'
ACCOUNT_SIG = '001'
BAD_INFO_LIST = [None, [], [{}], {}, '', 'fail', 'warn']
BRANCH_CR_LINK_OBJ = 'Branch_CR_Link__c'
CASE_OBJ = 'Case'
CASE_SIG = '500'
CONTACT_OBJ = 'Contact'
CONTACT_SIG = '003'
DEFAULT_USER_ID = ''
ISO_8601_DATETIME = '%Y-%m-%dT%H:%M:%S'
LEAD_OBJ = 'Lead'
LEAD_OWNER_SIG = ['005', '00G']
LEAD_SIG = '00Q'
NOTE_OBJ = 'Note'
NOTE_SIG = '002'
QUEUE_ID = ' '
QUEUE_OBJ = 'Queue'
QUEUE_SIG = '00G'
RECTYPE_CR = '01230000000001YAAQ'
RECTYPE_PVCR = '0123000000003qfAAA'
StringTypes = (<type 'str'>, <type 'unicode'>)
TASK_BRANCH_OBJ = 'Task_Branch__c'
TEAM_BRANCH_OBJ = 'Team_Branch__c'
USER_OBJ = 'User'
USER_SIG = '005'
badInfoList = [None, [], [{}], {}, '', 'fail', 'warn']
dictTypes = [<type 'dict'>, <type 'dict'>]
numTypes = (<type 'long'>, <type 'float'>)
seqTypes = [<type 'list'>, <type 'tuple'>]
sfCache = <sop.AccessFactory instance>
sfEntities = <sop.AccessFactory instance>
strTypes = [<type 'str'>, (<type 'str'>, <type 'unicode'>)]
version = 3.0