diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml
index b7f6543b71..f36a592dbe 100644
--- a/config/alfresco/web-client-config.xml
+++ b/config/alfresco/web-client-config.xml
@@ -239,6 +239,7 @@
+
@@ -253,6 +254,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java b/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java
index 0549966b2c..71fd02ae7b 100644
--- a/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java
+++ b/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java
@@ -63,7 +63,10 @@ public abstract class BaseActionWizard extends BaseWizardBean
protected List actions;
protected List transformers;
protected List imageTransformers;
- protected List aspects;
+ protected List commonAspects;
+ protected List removableAspects;
+ protected List addableAspects;
+ protected List testableAspects;
protected List users;
protected List encodings;
protected List objectTypes;
@@ -209,70 +212,129 @@ public abstract class BaseActionWizard extends BaseWizardBean
}
/**
- * Returns the aspects that are available
+ * Returns a list of aspects that can be removed
*
- * @return List of SelectItem objects representing the available aspects
+ * @return List of SelectItem objects representing the aspects that can be removed
*/
- public List getAspects()
+ public List getRemovableAspects()
{
- if (this.aspects == null)
+ if (this.removableAspects == null)
{
+ // get the list of common aspects
+ this.removableAspects = new ArrayList();
+ this.removableAspects.addAll(getCommonAspects());
+
+ // get those aspects configured to appear only in the remove aspect action
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
- ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects");
+ ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects-remove");
if (aspectsCfg != null)
{
- FacesContext context = FacesContext.getCurrentInstance();
- this.aspects = new ArrayList();
- for (ConfigElement child : aspectsCfg.getChildren())
- {
- QName idQName = Repository.resolveToQName(child.getAttribute("name"));
-
- if (idQName != null)
- {
- // try and get the display label from config
- String label = Utils.getDisplayLabel(context, child);
-
- // if there wasn't a client based label try and get it from the dictionary
- if (label == null)
- {
- AspectDefinition aspectDef = this.dictionaryService.getAspect(idQName);
- if (aspectDef != null)
- {
- label = aspectDef.getTitle();
- }
- else
- {
- label = idQName.getLocalName();
- }
- }
-
- this.aspects.add(new SelectItem(idQName.toString(), label));
- }
- else
- {
- logger.warn("Failed to resolve aspect '" + child.getAttribute("name") + "'");
- }
- }
-
- // make sure the list is sorted by the label
- QuickSort sorter = new QuickSort(this.aspects, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
- sorter.sort();
+ List aspects = readAspectsConfig(FacesContext.getCurrentInstance(), aspectsCfg);
+ this.removableAspects.addAll(aspects);
}
else
{
- logger.warn("Could not find 'aspects' configuration element");
+ logger.warn("Could not find 'aspects-remove' configuration element");
}
}
else
{
logger.warn("Could not find 'Action Wizards' configuration section");
}
+
+ // make sure the list is sorted by the label
+ QuickSort sorter = new QuickSort(this.removableAspects, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
+ sorter.sort();
}
- return this.aspects;
+ return this.removableAspects;
+ }
+
+ /**
+ * Returns a list of aspects that can be added
+ *
+ * @return List of SelectItem objects representing the aspects that can be added
+ */
+ public List getAddableAspects()
+ {
+ if (this.addableAspects == null)
+ {
+ // get the list of common aspects
+ this.addableAspects = new ArrayList();
+ this.addableAspects.addAll(getCommonAspects());
+
+ // get those aspects configured to appear only in the remove aspect action
+ ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
+ Config wizardCfg = svc.getConfig("Action Wizards");
+ if (wizardCfg != null)
+ {
+ ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects-add");
+ if (aspectsCfg != null)
+ {
+ List aspects = readAspectsConfig(FacesContext.getCurrentInstance(), aspectsCfg);
+ this.addableAspects.addAll(aspects);
+ }
+ else
+ {
+ logger.warn("Could not find 'aspects-add' configuration element");
+ }
+ }
+ else
+ {
+ logger.warn("Could not find 'Action Wizards' configuration section");
+ }
+
+ // make sure the list is sorted by the label
+ QuickSort sorter = new QuickSort(this.addableAspects, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
+ sorter.sort();
+ }
+
+ return this.addableAspects;
+ }
+
+ /**
+ * Returns a list of aspects that can be tested i.e. hasAspect
+ *
+ * @return List of SelectItem objects representing the aspects that can be tested for
+ */
+ public List getTestableAspects()
+ {
+ if (this.testableAspects == null)
+ {
+ // get the list of common aspects
+ this.testableAspects = new ArrayList();
+ this.testableAspects.addAll(getCommonAspects());
+
+ // get those aspects configured to appear only in the remove aspect action
+ ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
+ Config wizardCfg = svc.getConfig("Action Wizards");
+ if (wizardCfg != null)
+ {
+ ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects-test");
+ if (aspectsCfg != null)
+ {
+ List aspects = readAspectsConfig(FacesContext.getCurrentInstance(), aspectsCfg);
+ this.testableAspects.addAll(aspects);
+ }
+ else
+ {
+ logger.warn("Could not find 'aspects-test' configuration element");
+ }
+ }
+ else
+ {
+ logger.warn("Could not find 'Action Wizards' configuration section");
+ }
+
+ // make sure the list is sorted by the label
+ QuickSort sorter = new QuickSort(this.testableAspects, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
+ sorter.sort();
+ }
+
+ return this.testableAspects;
}
/**
@@ -846,6 +908,77 @@ public abstract class BaseActionWizard extends BaseWizardBean
}
}
+ /**
+ * Returns the aspects that are available in all scenarios i.e. add, remove and test
+ *
+ * @return List of SelectItem objects representing the available aspects
+ */
+ protected List getCommonAspects()
+ {
+ if (this.commonAspects == null)
+ {
+ ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
+ Config wizardCfg = svc.getConfig("Action Wizards");
+ if (wizardCfg != null)
+ {
+ ConfigElement aspectsCfg = wizardCfg.getConfigElement("aspects");
+ if (aspectsCfg != null)
+ {
+ this.commonAspects = readAspectsConfig(FacesContext.getCurrentInstance(), aspectsCfg);
+ }
+ else
+ {
+ logger.warn("Could not find 'aspects' configuration element");
+ }
+ }
+ else
+ {
+ logger.warn("Could not find 'Action Wizards' configuration section");
+ }
+ }
+
+ return this.commonAspects;
+ }
+
+
+ protected List readAspectsConfig(FacesContext context, ConfigElement aspectsCfg)
+ {
+ List aspects = new ArrayList();
+
+ for (ConfigElement child : aspectsCfg.getChildren())
+ {
+ QName idQName = Repository.resolveToQName(child.getAttribute("name"));
+
+ if (idQName != null)
+ {
+ // try and get the display label from config
+ String label = Utils.getDisplayLabel(context, child);
+
+ // if there wasn't a client based label try and get it from the dictionary
+ if (label == null)
+ {
+ AspectDefinition aspectDef = this.dictionaryService.getAspect(idQName);
+ if (aspectDef != null)
+ {
+ label = aspectDef.getTitle();
+ }
+ else
+ {
+ label = idQName.getLocalName();
+ }
+ }
+
+ aspects.add(new SelectItem(idQName.toString(), label));
+ }
+ else
+ {
+ logger.warn("Failed to resolve aspect '" + child.getAttribute("name") + "'");
+ }
+ }
+
+ return aspects;
+ }
+
// ------------------------------------------------------------------------------
// Inner classes
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java
index baf02081b6..edd553e04e 100644
--- a/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java
+++ b/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java
@@ -49,7 +49,7 @@ public class AddFeaturesHandler extends BaseActionHandler
String aspect = (String)actionProps.get(PROP_ASPECT);
// find the label used by looking through the SelectItem list
- for (SelectItem item : ((BaseActionWizard)wizard).getAspects())
+ for (SelectItem item : ((BaseActionWizard)wizard).getAddableAspects())
{
if (item.getValue().equals(aspect))
{
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java
index ed0f329c37..9029000ced 100644
--- a/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java
+++ b/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java
@@ -49,7 +49,7 @@ public class RemoveFeaturesHandler extends BaseActionHandler
String aspect = (String)actionProps.get(PROP_ASPECT);
// find the label used by looking through the SelectItem list
- for (SelectItem item : ((BaseActionWizard)wizard).getAspects())
+ for (SelectItem item : ((BaseActionWizard)wizard).getRemovableAspects())
{
if (item.getValue().equals(aspect))
{
diff --git a/source/java/org/alfresco/web/bean/rules/handlers/HasAspectHandler.java b/source/java/org/alfresco/web/bean/rules/handlers/HasAspectHandler.java
index 5510ec6316..e04025845c 100644
--- a/source/java/org/alfresco/web/bean/rules/handlers/HasAspectHandler.java
+++ b/source/java/org/alfresco/web/bean/rules/handlers/HasAspectHandler.java
@@ -49,7 +49,7 @@ public class HasAspectHandler extends BaseConditionHandler
String label = null;
String aspectName = (String)conditionProps.get(PROP_ASPECT);
- for (SelectItem item : ((CreateRuleWizard)wizard).getAspects())
+ for (SelectItem item : ((CreateRuleWizard)wizard).getTestableAspects())
{
if (item.getValue().equals(aspectName))
{
diff --git a/source/web/jsp/actions/add-features.jsp b/source/web/jsp/actions/add-features.jsp
index 5e263a6675..7a0bd45826 100644
--- a/source/web/jsp/actions/add-features.jsp
+++ b/source/web/jsp/actions/add-features.jsp
@@ -106,7 +106,7 @@
|
-
+
|
diff --git a/source/web/jsp/actions/remove-features.jsp b/source/web/jsp/actions/remove-features.jsp
index e88f3ebfaa..ca53707df2 100644
--- a/source/web/jsp/actions/remove-features.jsp
+++ b/source/web/jsp/actions/remove-features.jsp
@@ -106,7 +106,7 @@
|
-
+
|
diff --git a/source/web/jsp/rules/has-aspect.jsp b/source/web/jsp/rules/has-aspect.jsp
index 9d6b76c2b7..91578d515c 100644
--- a/source/web/jsp/rules/has-aspect.jsp
+++ b/source/web/jsp/rules/has-aspect.jsp
@@ -106,7 +106,7 @@
: |
-
+
|