Merged V3.1 to HEAD

12999: Fixed read-only bootstrap of SiteAVMBootstrap and removed incorrect use of 'assert'
   13000: Added log4j to Eclipse classpath (unexported)
   13001: Merged V2.1-A to V3.1
      9127: Performance improvement to folder copy
      9151: *RECORD-ONLY* Fix index back up failing with missing files
   13002: Merged V2.1-A to V3.1
      9174: Further fixes for ACT-2588 (Lucene backup read-write locks)
      9279: Fix ADB-84. PHP module is not restricted by the upper version
      10191: Fix for ADB-77: Need to have as the sender's email address the email address of the user triggering the rule
   13006: Merged V2.1-A to V3.1
      10893: Fixes for ADB-78 & ADB-98
             - Fixed service getter/setter pattern as well
      10903: Fix for ADB-115 ACT-4355
   13010: Made AVMLockingBootstrap resilient to read-only mode
   13011: Better message for InvalidStoreRefException
   13013: Merged V2.1-A to V3.1
      9189: Composite Conditions Support Part 1 of 2 (repo)
      9190: Composite Conditions Support Part 1a of 2 ( missed file from repo)
   13015: Port of Adobe CIFS/FTP configuration changes
   13017: Convert avoids folders given by '--svn-status' option
   13018: Merge V2.1A to V3.1
      7746: (record-only) Added ability to specify a custom CIFS authenticator class
      8533: (record-only) Added the <disableNativeCode/> configuration tag, disable use of JNI code on Windows
      8700: (record-only) Update to prevent any native calls via configuration code
      8705: (record-only) Filer out the '0.0.0.0' bind address
      8864: (record-only) Added the getBean() method for custom authenticators to get access to beans
      9054: (record-only) Added the 'AIX' platform type for use in the platforms="..." attribute
      8863: (record-only) Fix passthru socket connection timeout, added 'protocolOrder' and 'offlineCheckInterval' config values
      12144: (record-only) CIFS virtual circuit fixes
   13020: Merged V2.1-A to V3.1 (Composite Actions)
      9191: Composite Conditions Support Part 2 of 2 (client)
      9243: Composite Conditions Support Part 1 of 2 (client)
      9245: Composite Conditions Support Part 2 of 2 (repo)
   13021: Merged V3.0 to V3.1
      13008: Merged V2.2 to V3.0
         12824: (record only) Change admin access to the web project staging store to be read-only in the virtualization view - ETWOTWO-933
   13024: Ported CIFS configuration changes from Adobe V2.1A, missed checkin.
   ___________________________________________________________________
   Modified: svn:mergeinfo
      Merged /alfresco/BRANCHES/V2.1-A:r9127,9151,9174,9189-9191,9243,9245,9279,10191,10893,10903
      Merged /alfresco/BRANCHES/V3.1:r12999-13002,13006,13010-13011,13013,13015,13017-13018,13020-13021,13024


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13550 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-03-11 03:22:35 +00:00
parent e98e71fb6f
commit 6519945977
18 changed files with 2244 additions and 208 deletions

View File

@@ -0,0 +1,428 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.bean.rules;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigService;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.IHandler;
import org.alfresco.web.bean.rules.handlers.BaseConditionHandler;
import org.alfresco.web.bean.rules.handlers.CompositeConditionHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class CreateCompositeRuleWizard extends CreateRuleWizard
{
private static final Log logger = LogFactory.getLog(CreateCompositeRuleWizard.class);
private List<SelectItem> compositeConditions;
// Right now the UI only supports one level of recursion, although the
// backend supports unlimited recursion for composites.
// This limitation is introduced by the fact that we are have two "current"
// conditions - either normal condition, or composite conditions
// basically, the UI will have to store conditions in a more native way
// (instead of DataModel) to get unlimited number of composite conditions
// recursing
protected DataModel currentCompositeConditionsDataModel;
protected List<Map<String, Serializable>> currentCompositeConditionPropertiesList;
private boolean addingCompositeCondition;
public CreateCompositeRuleWizard()
{
// TODO Auto-generated constructor stub
}
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
this.setAddingCompositeCondition(false);
this.currentCompositeConditionsDataModel = null;
this.currentCompositeConditionPropertiesList = null;
}
public void setupCompositeConditionsMode()
{
this.setAddingCompositeCondition(true);
this.currentCompositeConditionsDataModel = new ListDataModel();
this.currentCompositeConditionPropertiesList = new ArrayList<Map<String, Serializable>>();
}
private void clearCompositeConditionMode()
{
// reset the action drop down
this.selectedCondition = null;
// this.currentConditionProperties = null;
this.currentCompositeConditionsDataModel = null;
this.currentCompositeConditionPropertiesList = null;
this.setAddingCompositeCondition(false);
}
/**
* Returns the properties for all the conditions as a JSF DataModel
*
* @return JSF DataModel representing the condition properties
*/
public DataModel getAllCompositeConditionsDataModel()
{
if (this.currentCompositeConditionsDataModel == null)
{
this.currentCompositeConditionsDataModel = new ListDataModel();
}
this.currentCompositeConditionsDataModel.setWrappedData(this.currentCompositeConditionPropertiesList);
return this.currentCompositeConditionsDataModel;
}
/**
* Displays the settings page for the current condition being added (if
* required)
*/
@Override
public void promptForConditionValues()
{
if (CompositeConditionHandler.NAME.equals(this.selectedCondition))
{
setupCompositeConditionsMode();
}
super.promptForConditionValues();
}
public void finishAddingCompositeCondition()
{
if (logger.isDebugEnabled())
logger.debug("Finishing Adding Composite Condition.");
// reset the effective chosen condition to composite-condition
this.selectedCondition = CompositeConditionHandler.NAME;
FacesContext context = FacesContext.getCurrentInstance();
returnViewId = getWizardContainerViewId(context);
printConditionState();
if (logger.isDebugEnabled())
logger.debug("\tAdding Condition '" + selectedCondition + "'");
IHandler handler = this.conditionHandlers.get(this.selectedCondition);
// creating object temporarily so we can pass it to
// CompositeConditionHandler
// Map<String, Serializable> newCompositeCondition = new HashMap<String,
// Serializable>();
currentConditionProperties.put(CompositeConditionHandler.PROP_COMPOSITE_CONDITION,
(Serializable) this.currentCompositeConditionPropertiesList);
currentConditionProperties.put(PROP_CONDITION_NAME, this.selectedCondition);
// this is called from the actions page so there must be a handler
// present so there's no need to check for null
String summary = handler.generateSummary(context, this, currentConditionProperties);
if (summary != null)
{
currentConditionProperties.put(PROP_CONDITION_SUMMARY, summary);
}
if (logger.isDebugEnabled())
logger.debug("Generated Summary - [" + summary + "] + selectedCondition " + this.selectedCondition);
if (editingCondition == false)
{
this.allConditionsPropertiesList.add(currentConditionProperties);
}
clearCompositeConditionMode();
// refresh the wizard
goToPage(context, this.returnViewId);
}
private String getWizardContainerViewId(FacesContext context)
{
String viewId = null;
ConfigService configSvc = Application.getConfigService(context);
Config globalConfig = configSvc.getGlobalConfig();
if (globalConfig != null)
{
viewId = globalConfig.getConfigElement("wizard-container").getValue();
}
else
{
logger.error("plain-dialog-container configuraion setting is not found");
}
return viewId;
}
@Override
public void cancelAddCondition()
{
if (isAddingCompositeCondition())
{
//don't clear when editing, since we are looking at a REFERENCE to an existing condition
if (this.editingCondition == false) {
this.currentConditionProperties.clear();
}
// reset the action drop down
this.selectedCondition = null;
IHandler handler = this.conditionHandlers.get(CompositeConditionHandler.NAME);
goToPage(FacesContext.getCurrentInstance(), handler.getJSPPath());
}
else
{
super.cancelAddCondition();
return;
}
}
/**
* Adds the condition just setup by the user to the list of composite
* conditions This gathers the composite conditions in the
*/
@Override
public void addCondition()
{
if (!isAddingCompositeCondition())
{
super.addCondition();
printConditionState();
return;
}
if (logger.isDebugEnabled())
logger.debug("Adding Condition to Composite Condition. ");
FacesContext context = FacesContext.getCurrentInstance();
// this is called from the actions page so there must be a handler
// present so there's no need to check for null
IHandler handler = this.conditionHandlers.get(this.selectedCondition);
if (handler != null)
{
String summary = handler.generateSummary(context, this, this.currentConditionProperties);
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, summary);
}
else
{
if (logger.isWarnEnabled())
logger.warn("No Summary could be generated for rule condition " + this.selectedCondition);
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, "ERROR - No Summary for " + this.selectedCondition);
}
if (editingCondition == false)
{
//this check is needed to prevent an condition when you are editing a composite, to prevent it from adding twice
currentCompositeConditionPropertiesList.add(this.currentConditionProperties);
if (logger.isDebugEnabled())
logger.debug("\tAdded condition to Composite condition.");
}
else
{
if (logger.isDebugEnabled())
logger.debug("\tEdited composite condition. ");
//editingCondition = false;
}
this.currentConditionProperties = new HashMap<String, Serializable>(3);
// resetting it for composite condition
// TODO: this is not persistent currently, which causes a minor bug
this.currentConditionProperties.put(PROP_CONDITION_NAME, CompositeConditionHandler.NAME);
this.currentConditionProperties.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.FALSE);
// refresh the wizard
printConditionState();
goToPage(context, this.returnViewId);
}
/**
* Sets up the context for editing existing composite condition values
*/
@SuppressWarnings("unchecked")
public void editCondition()
{
this.editingCondition = true;
if (logger.isDebugEnabled())
logger.debug("Editing Conditions. isAddingCompositeConditions - " + isAddingCompositeCondition());
//if user is on main conditions screen, check if the condition to be edited is a composite condition
if (!isAddingCompositeCondition())
{
Map condition = (Map) this.allConditionsDataModel.getRowData();
if (condition.get(PROP_CONDITION_NAME).equals(CompositeConditionHandler.NAME))
{
logger.debug("Composite Condition selected, enabling CompositeCondition Mode");
currentCompositeConditionPropertiesList = (List<Map<String, Serializable>>) condition
.get(CompositeConditionHandler.PROP_COMPOSITE_CONDITION);
addingCompositeCondition = true;
}
super.editCondition(condition );
return;
}
else
{
Map subCondition = (Map) currentCompositeConditionsDataModel.getRowData();
super.editCondition(subCondition);
}
}
public List<SelectItem> getCompositeConditions()
{
if (this.compositeConditions == null)
{
this.compositeConditions = new ArrayList<SelectItem>();
List<SelectItem> tempConditions = this.getConditions(); // loads up the conditions
for (SelectItem item : tempConditions)
{
if (!((item.getValue().equals(CompositeConditionHandler.NAME)) || (item.getValue().equals("no-condition"))))
{
this.compositeConditions.add(item);
}
}
}
return this.compositeConditions;
}
protected boolean isAddingCompositeCondition()
{
return addingCompositeCondition;
}
protected void setAddingCompositeCondition(boolean addingCompositeCondition)
{
if (logger.isDebugEnabled())
logger.debug("Setting addingCompositeCondition to " + addingCompositeCondition);
this.addingCompositeCondition = addingCompositeCondition;
}
/**
* Removes the requested condition from the list
*/
public void removeCondition()
{
if (!isAddingCompositeCondition())
{
super.removeCondition();
return;
}
if (logger.isDebugEnabled())
logger.debug("Removing Composite Conditions");
// use the built in JSF support for retrieving the object for the
// row that was clicked by the user
Map conditionToRemove = (Map) this.currentCompositeConditionsDataModel.getRowData();
this.currentCompositeConditionPropertiesList.remove(conditionToRemove);
// reset the action drop down
this.selectedCondition = null;
// refresh the wizard
FacesContext context = FacesContext.getCurrentInstance();
goToPage(context, context.getViewRoot().getViewId());
}
protected void printConditionState()
{
if (logger.isDebugEnabled())
{
logger.debug("\t\t*** GLOBAL ***");
logger.debug("\t\tallConditionsProperties");
if (allConditionsPropertiesList == null)
{
logger.debug("\t\t\tempty");
}
else
{
for (Object obj : allConditionsPropertiesList)
{
logger.debug("\t\t\t" + obj.toString());
}
}
logger.debug("\t\t*** COMPOSITE ***");
logger.debug("\t\taddingCompositeCondition " + addingCompositeCondition);
logger.debug("\t\tcurrentCompositeConditionsProperties");
if (currentCompositeConditionPropertiesList == null)
{
logger.debug("\t\t\t EMPTY");
}
else
{
int i = 1;
for (Map<String, Serializable> cond : currentCompositeConditionPropertiesList)
{
logger.debug("\t\t\tCondition" + i++);
for (String key : cond.keySet())
{
logger.debug("\t\t\t\tkey - {" + key + "} value - {" + cond.get(key) + "}");
}
}
}
logger.debug("\t\t*** BOTH ***");
logger.debug("\t\tcurrentConditionsProperties");
if (currentConditionProperties == null)
{
logger.debug("\t\t\t EMPTY");
}
else
{
for (String key : this.currentConditionProperties.keySet())
{
logger.debug("\t\t\tkey - {" + key + "} value - {" + this.currentConditionProperties.get(key) + "}");
}
}
}
}
}