The nodes for the ApplicationsTree are no longer storing instances of com.arsdigita.web.ApplicationType or com.arsdigita.web.Application to avoid problems with PDLs transaction management and threads.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2282 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
722a74ce2f
commit
8bbcac1977
|
|
@ -39,7 +39,10 @@ public class ApplicationInstanceTreeNode implements TreeNode {
|
||||||
/**
|
/**
|
||||||
* The application instance represented by this {@code TreeNode}
|
* The application instance represented by this {@code TreeNode}
|
||||||
*/
|
*/
|
||||||
private final Application application;
|
//private final Application application;
|
||||||
|
private String path;
|
||||||
|
private String title;
|
||||||
|
private String appType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
@ -47,7 +50,22 @@ public class ApplicationInstanceTreeNode implements TreeNode {
|
||||||
* @param application The application instance to represent by this {@code TreeNode}
|
* @param application The application instance to represent by this {@code TreeNode}
|
||||||
*/
|
*/
|
||||||
public ApplicationInstanceTreeNode(final Application application) {
|
public ApplicationInstanceTreeNode(final Application application) {
|
||||||
this.application = application;
|
//this.application = application;
|
||||||
|
path = application.getPath();
|
||||||
|
title = application.getTitle();
|
||||||
|
appType = application.getApplicationType().getApplicationObjectType();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppType() {
|
||||||
|
return appType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -57,7 +75,8 @@ public class ApplicationInstanceTreeNode implements TreeNode {
|
||||||
* @see TreeNode#getKey()
|
* @see TreeNode#getKey()
|
||||||
*/
|
*/
|
||||||
public Object getKey() {
|
public Object getKey() {
|
||||||
return application.getPath();
|
//return application.getPath();
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,7 +86,8 @@ public class ApplicationInstanceTreeNode implements TreeNode {
|
||||||
* @see TreeNode#getElement()
|
* @see TreeNode#getElement()
|
||||||
*/
|
*/
|
||||||
public Object getElement() {
|
public Object getElement() {
|
||||||
return application.getTitle();
|
//return application.getTitle();
|
||||||
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,13 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
} else if (node instanceof ApplicationTypeTreeNode) {
|
} else if (node instanceof ApplicationTypeTreeNode) {
|
||||||
final ApplicationTypeTreeNode typeTreeNode = (ApplicationTypeTreeNode) node;
|
final ApplicationTypeTreeNode typeTreeNode = (ApplicationTypeTreeNode) node;
|
||||||
|
|
||||||
if (typeTreeNode.getApplicationType().isSingleton()) {
|
//if (typeTreeNode.getApplicationType().isSingleton()) {
|
||||||
|
if (typeTreeNode.isSingleton()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return !retrieveApplicationInstances(typeTreeNode.getApplicationType()).isEmpty();
|
//return !retrieveApplicationInstances(typeTreeNode.getApplicationType()).isEmpty();
|
||||||
|
//return !retrieveApplicationInstances(typeTreeNode.getApplicationType()).isEmpty();
|
||||||
|
return !retrieveApplicationInstances(typeTreeNode.getObjecType()).isEmpty();
|
||||||
}
|
}
|
||||||
} else if (node instanceof ApplicationInstanceTreeNode) {
|
} else if (node instanceof ApplicationInstanceTreeNode) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -73,10 +76,11 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
return new AppTypesIterator(appTypes);
|
return new AppTypesIterator(appTypes);
|
||||||
} else if (node instanceof ApplicationTypeTreeNode) {
|
} else if (node instanceof ApplicationTypeTreeNode) {
|
||||||
final ApplicationTypeTreeNode typeTreeNode = (ApplicationTypeTreeNode) node;
|
final ApplicationTypeTreeNode typeTreeNode = (ApplicationTypeTreeNode) node;
|
||||||
final ApplicationType appType = typeTreeNode.getApplicationType();
|
//final ApplicationType appType = typeTreeNode.getApplicationType();
|
||||||
|
|
||||||
final ApplicationCollection applications = Application.retrieveAllApplications(
|
//final ApplicationCollection applications = Application.retrieveAllApplications(
|
||||||
appType.getApplicationObjectType());
|
// appType.getApplicationObjectType());
|
||||||
|
final ApplicationCollection applications = Application.retrieveAllApplications(typeTreeNode.getObjecType());
|
||||||
applications.addOrder("title");
|
applications.addOrder("title");
|
||||||
|
|
||||||
return new AppIterator(applications);
|
return new AppIterator(applications);
|
||||||
|
|
@ -96,6 +100,13 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
return applications;
|
return applications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ApplicationCollection retrieveApplicationInstances(final String appObjectType) {
|
||||||
|
final ApplicationCollection applications = Application.retrieveAllApplications();
|
||||||
|
applications.addEqualsFilter("objectType", appObjectType);
|
||||||
|
|
||||||
|
return applications;
|
||||||
|
}
|
||||||
|
|
||||||
private class RootTreeNode implements TreeNode {
|
private class RootTreeNode implements TreeNode {
|
||||||
|
|
||||||
public RootTreeNode() {
|
public RootTreeNode() {
|
||||||
|
|
|
||||||
|
|
@ -20,32 +20,72 @@ package com.arsdigita.ui.admin.applications.tree;
|
||||||
|
|
||||||
import com.arsdigita.bebop.tree.TreeNode;
|
import com.arsdigita.bebop.tree.TreeNode;
|
||||||
import com.arsdigita.web.ApplicationType;
|
import com.arsdigita.web.ApplicationType;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tree Node implementation for the Application Tree in the Application
|
* Tree Node implementation for the Application Tree in the Application admin tab.
|
||||||
* admin tab.
|
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class ApplicationTypeTreeNode implements TreeNode {
|
public class ApplicationTypeTreeNode implements TreeNode {
|
||||||
|
|
||||||
private final ApplicationType applicationType;
|
//private final ApplicationType applicationType;
|
||||||
|
private final BigDecimal appTypeId;
|
||||||
|
private final String name;
|
||||||
|
private final String title;
|
||||||
|
private final String objectType;
|
||||||
|
private final boolean singleton;
|
||||||
|
private final String description;
|
||||||
|
// Needed:
|
||||||
|
// isSingleton
|
||||||
|
// getObjectType
|
||||||
|
|
||||||
public ApplicationTypeTreeNode(final ApplicationType applicationType) {
|
public ApplicationTypeTreeNode(final ApplicationType applicationType) {
|
||||||
this.applicationType = applicationType;
|
//this.applicationType = applicationType;
|
||||||
|
appTypeId = applicationType.getID();
|
||||||
|
name = applicationType.getName();
|
||||||
|
title = applicationType.getTitle();
|
||||||
|
objectType = applicationType.getApplicationObjectType();
|
||||||
|
singleton = applicationType.isSingleton();
|
||||||
|
description = applicationType.getDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationType getApplicationType() {
|
//public ApplicationType getApplicationType() {
|
||||||
return applicationType;
|
// return applicationType;
|
||||||
|
//}
|
||||||
|
|
||||||
|
public BigDecimal getAppTypeId() {
|
||||||
|
return appTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObjecType() {
|
||||||
|
return objectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSingleton() {
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getKey() {
|
public Object getKey() {
|
||||||
return applicationType.getApplicationObjectType();
|
//return applicationType.getApplicationObjectType();
|
||||||
|
return objectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getElement() {
|
public Object getElement() {
|
||||||
return applicationType.getTitle();
|
//return applicationType.getTitle();
|
||||||
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue