Skip to content

Commit

Permalink
unsynced changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zachelrath committed Sep 20, 2012
1 parent 71204df commit 5bac2de
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 41 deletions.
72 changes: 38 additions & 34 deletions src/classes/InstallScript.cls
@@ -1,29 +1,32 @@
global class InstallScript implements InstallHandler {

global void onInstall(InstallContext ctx) {
global void onInstall(InstallContext ctx) {

String username = UserInfo.getUserName();
String profileId = UserInfo.getProfileId();
String debugString =
'Username: ' + ((username != null) ? username : 'null')
+ 'ProfileId: ' + ((profileId != null) ? profileId : 'null')
+ ', Contact.Accessible: ' + Contact.SObjectType.getDescribe().isAccessible()
+ ', Contact.LastName.Accessible: ' + Contact.LastName.getDescribe().isAccessible()
+ ', Account.Accessible: ' + Account.SObjectType.getDescribe().isAccessible()
+ ', Account.Name.Accessible: ' + Account.Name.getDescribe().isAccessible()
+ ', relax__Job__c.Accessible: ' + relax__Job__c..SObjectType.getDescribe().isAccessible()
+ ', relax__Job__c.relax__Apex_Class__c.getDescribe().isAccessible(): ' + relax__Job__c.relax__Apex_Class__c.getDescribe().isAccessible();

JobScheduler.SendDebugEmail(
debugString,debugString,'Debug from Relax Install Script in org ' + ctx.organizationId(),'zach@skoodat.com'
);
}
/*
public void SendDebugEmail(String htmlBody, String textBody, String subject, String email) {
// Send an email to the specified email addresses with a report of how the batch job went
String username = UserInfo.getUserName();
String profileId = UserInfo.getProfileId();
String debugString =
'Username: ' + ((username != null) ? username : 'null')
+ 'ProfileId: ' + ((profileId != null) ? profileId : 'null')
+ ', Contact.Accessible: ' + Contact.SObjectType.getDescribe().isAccessible()
+ ', Contact.LastName.Accessible: ' + Contact.LastName.getDescribe().isAccessible()
+ ', Account.Accessible: ' + Account.SObjectType.getDescribe().isAccessible()
+ ', Account.Name.Accessible: ' + Account.Name.getDescribe().isAccessible()
+ ', relax__Job__c.Accessible: ' + relax__Job__c..SObjectType.getDescribe().isAccessible()
+ ', relax__Job__c.relax__Apex_Class__c.getDescribe().isAccessible(): ' + relax__Job__c.relax__Apex_Class__c.getDescribe().isAccessible();

SendDebugEmail(
debugString,
debugString,
'Debug from Relax Install Script in org ' + ctx.organizationId(),
new List<String>{'zach@skoodat.com','umittal@salesforce.com'}
);
}

public static void SendDebugEmail(String htmlBody, String textBody, String subject, List<String> toAddresses) {
// Send an email to the specified email addresses with a report of how the batch job went
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setToAddresses(new List<String>{email});
mail.setToAddresses(toAddresses);
mail.setReplyTo('noreply@skoodat.com');
mail.setSenderDisplayName('Skoodat Relax');
mail.setSubject(subject);
Expand All @@ -33,19 +36,20 @@ global class InstallScript implements InstallHandler {
Messaging.reserveSingleEmailCapacity(1);

List<Messaging.SendEmailResult> result = Messaging.sendEmail(
new List<Messaging.SingleEmailMessage>{mail}
new List<Messaging.SingleEmailMessage>{mail}
);
}
*/

/////////////////
// UNIT TESTS
/////////////////

private static testMethod void TestInstall() {
InstallScript is = new InstallScript();
Test.testInstall(is, null);
Boolean b = false;
System.assertEquals(false,b);
}

/////////////////
// UNIT TESTS
/////////////////

private static testMethod void TestInstall() {
InstallScript is = new InstallScript();
Test.testInstall(is, null);
Boolean b = false;
System.assertEquals(false,b);

SendDebugEmail('test','test','testsubject',new List<String>{'zach@skoodat.com'});
}
}
12 changes: 10 additions & 2 deletions src/labels/CustomLabels.labels
@@ -1,3 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata"/>

<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
<labels>
<fullName>Scheduler_Could_Not_Be_Run</fullName>
<categories>error, scheduler, run</categories>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Scheduler Could Not Be Run</shortDescription>
<value>The Relax Job Scheduler could not be run: {0}</value>
</labels>
</CustomLabels>
21 changes: 21 additions & 0 deletions src/objects/Config__c.object
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<customSettingsType>Hierarchy</customSettingsType>
<customSettingsVisibility>Public</customSettingsVisibility>
<description>Configuration settings for Skoodat Relax</description>
<enableFeeds>false</enableFeeds>
<fields>
<fullName>Scheduler_Run_Interval_Minutes__c</fullName>
<defaultValue>2</defaultValue>
<description>How often to run the Relax Job Scheduler, in Minutes (must be at least 1)</description>
<externalId>false</externalId>
<inlineHelpText>How often to run the Relax Job Scheduler, in Minutes (must be at least 1)</inlineHelpText>
<label>Scheduler Run Interval (Minutes)</label>
<precision>2</precision>
<required>true</required>
<scale>0</scale>
<type>Number</type>
<unique>false</unique>
</fields>
<label>Relax Settings</label>
</CustomObject>
3 changes: 1 addition & 2 deletions src/package.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
Expand All @@ -22,4 +22,3 @@
</types>
<version>25.0</version>
</Package>

6 changes: 3 additions & 3 deletions src/pages/EditJob.page
Expand Up @@ -66,16 +66,16 @@

</apex:form>

<apex:pageBlock title="Job Status" rendered="{!AND(Job__c.IsActive__c,NOT(ISBLANK(Job__c.NexusJobSchedulerId__c)))}" id="jobStatus">
<apex:pageBlock title="Job Status" rendered="{!AND(Job__c.IsActive__c,NOT(ISBLANK(Job__c.JobSchedulerId__c)))}" id="jobStatus">
<apex:pageBlockSection showHeader="false" columns="2" rendered="{!Job__c.Run_Individually__c}">
<apex:outputField value="{!Job__c.NexusJobSchedulerId__c}"/>
<apex:outputField value="{!Job__c.JobSchedulerId__c}"/>
<apex:outputField value="{!Job__c.Last_Run__c}"/>
<apex:outputField value="{!Job__c.CronTriggerId__c}"/>
<apex:outputField value="{!Job__c.Next_Run__c}"/>
<apex:outputField value="{!Job__c.AsyncApexJobId__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection showHeader="false" columns="2" rendered="{!NOT(Job__c.Run_Individually__c)}">
<apex:outputField value="{!Job__c.NexusJobSchedulerId__c}"/>
<apex:outputField value="{!Job__c.JobSchedulerId__c}"/>
<apex:outputField value="{!Job__c.Last_Run__c}"/>
<apex:outputField value="{!Job__c.AsyncApexJobId__c}"/>
<apex:outputField value="{!Job__c.Next_Run__c}"/>
Expand Down

0 comments on commit 5bac2de

Please sign in to comment.