This file contains hidden or 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
global interface InstallHandler { | |
void onInstall(InstallContext context) | |
} |
This file contains hidden or 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
global class PostInstallScript implements InstallHandler { | |
global void onInstall (InstallContext context) { | |
InitializePackage(); | |
} | |
} |
This file contains hidden or 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
global class PostInstallScript implements InstallHandler { | |
global void onInstall (InstallContext context) { | |
// Only initialize package on a fresh install! | |
if (context.previousVersion == null) { | |
InitializePackage(); | |
} | |
} | |
} |
This file contains hidden or 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
global class PostInstallScript implements InstallHandler { | |
global void onInstall (InstallContext context) | |
{ | |
// Only initialize package on a fresh install! | |
if (context.previousVersion == null) | |
{ | |
InitializePackage(); | |
} | |
// Migrate data, but only for versions older than 1.2 | |
else if (context.previousVersion().CompareTo(new Version (1,2)) < 0) |
This file contains hidden or 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
global class PostInstallScript implements InstallHandler { | |
global void onInstall (InstallContext context) | |
{ | |
// Initialize package (and new feature) on fresh installs | |
if (context.previousVersion() == null) | |
{ | |
InitializePackage(); | |
InitializeFeature13(); | |
} |
This file contains hidden or 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
global class PostInstallScript implements InstallHandler { | |
global void onInstall (InstallContext context) | |
{ | |
new Feature10Installer().onInstall(context); | |
new Feature12Installer().onInstall(context); | |
new Feature13Installer().onInstall(context); | |
} | |
} |
This file contains hidden or 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 Feature10Installer implements InstallHandler { | |
global void OnInstall (InstallContext context) | |
{ | |
// Only initialize package on a fresh install! | |
if (context.previousVersion() == null) | |
{ | |
InitializePackage(); | |
} | |
} | |
} |
This file contains hidden or 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 Feature12Installer implements InstallHandler { | |
global void onInstall (InstallContext context) | |
{ | |
// Migrate data, but only for versions older than 1.2 | |
if (context.previousVersion != null && context.previousVersion().CompareTo(new Version (1,2)) < 0) | |
{ | |
UpgradeForFeature12(); | |
} | |
} |
This file contains hidden or 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 Feature13Installer implements InstallHandler { | |
global void onInstall (InstallContext context) | |
{ | |
if (context.previousVersion() == null) | |
{ | |
InitializePackage(); | |
} | |
else if (context.previousVersion().CompareTo(new Version (1,3)) < 0) | |
{ |
This file contains hidden or 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 abstract class InstallHandlerBase implements InstallHandler | |
{ | |
public abstract Version GetLastPackageVersionWithoutFeature (); | |
public void onInstall(InstallContext context) | |
{ | |
if (isFreshInstall (context)) | |
{ | |
OnFreshInstall (context); | |
} |
OlderNewer