Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

Legacy XNAT CodeXNAT 1.7 +
user.canRead(project)

...

Permissions.canReadProject(user, project)

...

$user.canRead($item)$data.getSession().getAttribute("userHelper").canRead($item)

...

...

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.

...

Legacy XNAT CodeXNAT 1.7 +

TurbineUtils.getUser(data)

XDAT.getUserDetails()

$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()

Legacy XNAT CodeXNAT 1.7 +
user.isSiteAdmin()

...

Roles.isSiteAdmin(user)

...

In Velocity: $turbineUtils.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.StatusMessage

...

org.nrg.framework.status.StatusMessage
org.nrg.status.

...

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

...

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

Code Block
languagejava
public void handleEvent(WorkflowStatusEvent e) {
        if (!(e.getWorkflow() instanceof WrkWorkflowdata)) { 
            return;
        }
        WrkWorkflowdata wrk = (WrkWorkflowdata)e.getWorkflow();


Anchor
Changes since XNAT 1.7.0
Changes since XNAT 1.7.0

Changes since XNAT 1.7.0

Between 1.7.2 and 1.7.3

...

:

  • org.nrg.dicom.mizer.service.MizerException → org.nrg.dicom.mizer.exceptions.MizerException

Between 1.7.2 and 1.7.3

...

:

  • RestFileUtils.isFileRepresentationOfDirectory(file) → RestFileUtils.isFileRepresentationOfDirectoryOrEmpty(file)
  • Between 1.7.2 and 1.7.3, XNAT.dom → XNAT.app
  • So XNAT.dom.addFormCSRF() → XNAT.app.addFormCSRF()