XNAT 1.7 has made changes to some of the methods that were in XNAT 1.6 (and in most cases were also in even earlier versions of XNAT). These changes are particularly important to those with pre-1.7 versions of XNAT who want to upgrade to 1.7 while preserving whatever customizations they made. There are also a few changes that have been made since the very first version of 1.7, so if you are upgrading from an earlier version of XNAT 1.7 to a later one, you should take a look at these changes. If you are coming from a pre-1.7 version of XNAT, please consult the following sections to see what changes, if any, you will need to make to your custom code. If you see a snippet of code, followed by an arrow, followed by more code, that means that before XNAT 1.7, your syntax might have looked like what is on the left of the arrow, but it is now suggested that your code look more like the code to the right of the arrow (and in most cases your code will not work right unless you make the change).
There have been extensive changes to how user permissions should be checked. The methods of the Permissions class should now be used.
For example user.canRead(project) → Permissions.canReadProject(user, project)
Another example is that now XNATUtils.getAllProjectIds(template) → Permissions.getAllProjectIds(template)
For example: TurbineUtils.getUser(data) → XDAT.getUserDetails()
In earlier versions of XNAT, the user object returned was a XDATUser. It now returns a UserI object, so you should modify your code as needed.
In Velocity: $user.getDisplayManager() → $data.getSession().getAttribute("userHelper").getDisplayManager() (Or you can simply do $displayManager if page is a SecureScreen.)
You used to be able to access the user object directly in classes that extend SecureResource. So user → getUser()
user.isSiteAdmin() → Roles.isSiteAdmin(user
There have also been extensive changes to DICOM SCP classes, so any customizations related to this may need to be refactored. Classes that implement DicomProjectIdentifier should be modified. For example:
Legacy XNAT Code | XNAT 1.7 + |
---|---|
org.nrg.dcm.DicomSCPManager | org.nrg.dcm.scp.DicomSCPManager |
org.nrg.dcm.preferences.DicomSCPInstance | org.nrg.dcm.scp.DicomSCPInstance |
apply(XDATUser user, DicomObject o) | apply(UserI user, DicomObject o) |
Legacy XNAT Code | XNAT 1.7 + |
---|---|
XFT.GetSiteURL() | XDAT.getSiteConfigPreferences().getSiteUrl() |
XFT.SetSiteURL(url) | XDAT.getSiteConfigPreferences().setSiteUrl(url) |
XFT.GetSiteID() | XDAT.getSiteConfigPreferences().getSiteId() |
XFT.SetSiteID(id) | XDAT.getSiteConfigPreferences().setSiteId(id) |
XFT.GetSiteURL() | XDAT.getSiteConfigPreferences().getSiteUrl() |
XFT.SetSiteURL(url) | XDAT.getSiteConfigPreferences().setSiteUrl(url) |
XFT.GetAdminEmailHost() | XDAT.getNotificationsPreferences().getSmtpHostname() |
XFT.SetAdminEmailHost(host) | XDAT.getNotificationsPreferences().getSmtpHostname(host) |
XFT.GetArchiveRootPath() | XDAT.getSiteConfigPreferences().getArchivePath() |
XFT.SetArchiveRootPath(path) | XDAT.getSiteConfigPreferences().setArchivePath(path) |
XFT.GetPrearchivePath() | XDAT.getSiteConfigPreferences().getPrearchivePath() |
XFT.SetPrearchivePath(path) | XDAT.getSiteConfigPreferences().setPrearchivePath(path) |
XFT.GetCachePath() | XDAT.getSiteConfigPreferences().getCachePath() |
XFT.SetCachePath(path) | XDAT.getSiteConfigPreferences().setCachePath(path) |
XFT.GetPipelinePath() | XDAT.getSiteConfigPreferences().getPipelinePath() |
XFT.SetPipelinePath(path) | XDAT.getSiteConfigPreferences().setPipelinePath(path) |
XFT.GetRequireLogin() | XDAT.getSiteConfigPreferences().getRequireLogin() |
XFT.SetRequireLogin(isRequired) | XDAT.getSiteConfigPreferences().setRequireLogin(isRequired) |
XFT.GetEmailVerification() | XDAT.getSiteConfigPreferences().getEmailVerification() |
XFT.SetEmailVerification(verificationRequired) | XDAT.getSiteConfigPreferences().setEmailVerification(verificationRequired) |
XFT.GetUserRegistration() | XDAT.getSiteConfigPreferences().getUserRegistration() |
XFT.SetUserRegistration(autoApprove) | XDAT.getSiteConfigPreferences().setUserRegistration(autoApprove) |
XFT.GetEnableCsrfToken() | XDAT.getSiteConfigPreferences().getEnableCsrfToken() |
XFT.SetEnableCsrfToken(enable) | XDAT.getSiteConfigPreferences().setEnableCsrfToken(enable) |
Legacy XNAT Code | XNAT 1.7 + |
---|---|
org.nrg.xnat.workflow.PipelineEmailHandlerAbst | org.nrg.xnat.event.listeners.PipelineEmailHandlerAbst |
org.nrg.xft.event.Event | org.nrg.xft.event.entities.WorkflowStatusEvent |
org.nrg.status.StatusMessage | org.nrg.framework.status.StatusMessage |
org.nrg.status.StatusQueue | org.nrg.framework.status.StatusQueue |
org.nrg.status.ListenerUtils | org.nrg.xnat.status.ListenerUtils |
org.nrg.status.StatusProducer | org.nrg.framework.status.StatusPro |
org.nrg.status.StatusProducerI | org.nrg.framework.status.StatusProducerI |
Legacy XNAT Code | XNAT 1.7 + |
---|---|
GetArchiveRootPath() | getArchiveRootPath() |
setSecret(long secret) | setSecret(String secret) for AliasTokens getSecret() now returns a String instead of a long |
AdminUtils.getAdminEmailId() | XDAT.getSiteConfigPreferences().getAdminEmail() XDAT.getNotificationsPreferences().getHelpContactInfo() is also available |
AdminUtils.getMailServer() | XDAT.getNotificationsPreferences().getSmtpHostname() |
In your handler classes, you should change public void handleEvent(Event e, WrkWorkflowdata wrk){
to
public void handleEvent(WorkflowStatusEvent e) {
if (!(e.getWorkflow() instanceof WrkWorkflowdata)) {
return;
}
WrkWorkflowdata wrk = (WrkWorkflowdata)e.getWorkflow();
XNAT 1.7.0 - 1.7.2 | XNAT 1.7.3 + |
---|---|
org.nrg.dicom.mizer.service.MizerException | org.nrg.dicom.mizer.exceptions.MizerException |
RestFileUtils.isFileRepresentationOfDirectory(file) | RestFileUtils.isFileRepresentationOfDirectoryOrEmpty(file) |
XNAT.dom → XNAT.app | XNAT.app |
XNAT.dom.addFormCSRF() | XNAT.app.addFormCSRF() |