diff --git a/source/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java b/source/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java index 15d41fe50c..c82b6b6c71 100644 --- a/source/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java +++ b/source/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java @@ -54,6 +54,9 @@ import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.transaction.TransactionService; import org.alfresco.util.ISO9075; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.Status; @@ -66,8 +69,18 @@ import org.springframework.extensions.webscripts.WebScriptRequest; * @author dcaruana * @author wabson */ -public class NodeBrowserScript extends DeclarativeWebScript +public class NodeBrowserScript extends DeclarativeWebScript implements Serializable, ApplicationContextAware { + private static final long serialVersionUID = 48743409337475896L; + + private transient ApplicationContext applicationContext = null; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException + { + this.applicationContext = applicationContext; + } + private Long searchElapsedTime = null; // stores and node @@ -144,6 +157,8 @@ public class NodeBrowserScript extends DeclarativeWebScript protected NamespaceService getNamespaceService() { + // used by serialised bean objects + if (namespaceService == null) namespaceService = (NamespaceService)applicationContext.getBean("NamespaceService"); return namespaceService; } @@ -563,8 +578,10 @@ public class NodeBrowserScript extends DeclarativeWebScript /** * Node wrapper class */ - public class Node + public class Node implements Serializable { + private static final long serialVersionUID = 12608347204513848L; + private String qnamePath; private String prefixedQNamePath; @@ -680,7 +697,7 @@ public class NodeBrowserScript extends DeclarativeWebScript /** * Aspect wrapper class */ - public class Aspect extends QNameBean + public class Aspect extends QNameBean implements Serializable { private static final long serialVersionUID = -6448182941386934326L; @@ -693,8 +710,10 @@ public class NodeBrowserScript extends DeclarativeWebScript /** * Association wrapper class */ - public class Association + public class Association implements Serializable { + private static final long serialVersionUID = 1078430803027004L; + protected QNameBean name; protected QNameBean typeName; @@ -720,9 +739,6 @@ public class NodeBrowserScript extends DeclarativeWebScript */ public class ChildAssociation extends Association implements Serializable { - /** - * - */ private static final long serialVersionUID = -52439282250891063L; protected NodeRef childRef; @@ -783,8 +799,10 @@ public class NodeBrowserScript extends DeclarativeWebScript /** * Peer assoc wrapper class */ - public class PeerAssociation extends Association + public class PeerAssociation extends Association implements Serializable { + private static final long serialVersionUID = 4833278311416507L; + protected NodeRef sourceRef; protected NodeRef targetRef; protected QNameBean sourceType; @@ -830,8 +848,10 @@ public class NodeBrowserScript extends DeclarativeWebScript /** * Property wrapper class */ - public class Property + public class Property implements Serializable { + private static final long serialVersionUID = 7755924782250077L; + private QNameBean name; private boolean isCollection = false; @@ -952,8 +972,10 @@ public class NodeBrowserScript extends DeclarativeWebScript /** * Value wrapper */ - public class Value + public class Value implements Serializable { + private static final long serialVersionUID = 47235536691732705L; + private Serializable value; /** @@ -1039,11 +1061,13 @@ public class NodeBrowserScript extends DeclarativeWebScript /** * Permission bean */ - public static class Permission + public static class Permission implements Serializable { - private String permission; - private String authority; - private String accessStatus; + private static final long serialVersionUID = 1235536691732705L; + + private final String permission; + private final String authority; + private final String accessStatus; public Permission(String permission, String authority, String accessStatus) { @@ -1057,45 +1081,34 @@ public class NodeBrowserScript extends DeclarativeWebScript return permission; } - public void setPermission(String permission) - { - this.permission = permission; - } - public String getAuthority() { return authority; } - public void setAuthority(String authority) - { - this.authority = authority; - } - public String getAccessStatus() { return accessStatus; } - - public void setAccessStatus(String accessStatus) - { - this.accessStatus = accessStatus; - } } /** * Permission representing the fact that "Read Permissions" has not been granted */ - public static class NoReadPermissionGranted extends Permission + public static class NoReadPermissionGranted extends Permission implements Serializable { + private static final long serialVersionUID = 1236786691732705L; + public NoReadPermissionGranted() { super(PermissionService.READ_PERMISSIONS, "[Current Authority]", "Not Granted"); } } - public static class NoStoreMask extends Permission + public static class NoStoreMask extends Permission implements Serializable { + private static final long serialVersionUID = 3125536691732705L; + public NoStoreMask() { super("All ", "All", "Allowed");