Page tree
Skip to end of metadata
Go to start of metadata

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).

User Object and Permissions Changes

  • 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)

      • Or $data.getSession().getAttribute("userHelper").canRead($item) to check permissions from a Velocity page
    • Another example is that now XNATUtils.getAllProjectIds(template) → Permissions.getAllProjectIds(template)

  • Some of the XNAT code was changed so it would work with UserI objects rather than XDATUser objects.
    • 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

DICOM Changes

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 CodeXNAT 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)

XFT Changes

Legacy XNAT CodeXNAT 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)


Package Changes

Legacy XNAT CodeXNAT 1.7 +
org.nrg.xnat.workflow.PipelineEmailHandlerAbstorg.nrg.xnat.event.listeners.PipelineEmailHandlerAbst
org.nrg.xft.event.Eventorg.nrg.xft.event.entities.WorkflowStatusEvent
org.nrg.status.StatusMessageorg.nrg.framework.status.StatusMessage
org.nrg.status.StatusQueueorg.nrg.framework.status.StatusQueue
org.nrg.status.ListenerUtilsorg.nrg.xnat.status.ListenerUtils
org.nrg.status.StatusProducerorg.nrg.framework.status.StatusPro
org.nrg.status.StatusProducerIorg.nrg.framework.status.StatusProducerI


Other Changes

Legacy XNAT CodeXNAT 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();

Changes since XNAT 1.7.0

XNAT 1.7.0 - 1.7.2XNAT 1.7.3 +
org.nrg.dicom.mizer.service.MizerExceptionorg.nrg.dicom.mizer.exceptions.MizerException
RestFileUtils.isFileRepresentationOfDirectory(file)RestFileUtils.isFileRepresentationOfDirectoryOrEmpty(file)
XNAT.dom → XNAT.appXNAT.app
XNAT.dom.addFormCSRF()XNAT.app.addFormCSRF()