Daily merge.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2882 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-05-12 20:22:46 +00:00
parent 1250a0352c
commit 1dd2a7b72b
67 changed files with 1364 additions and 389 deletions

View File

@@ -522,6 +522,22 @@ public class AdvancedSearchBean
this.contentType = contentType;
}
/**
* @return Returns the folder type currenty selected
*/
public String getFolderType()
{
return this.folderType;
}
/**
* @param folderType Sets the currently selected folder type
*/
public void setFolderType(String folderType)
{
this.folderType = folderType;
}
/**
* @return Returns the contentFormat.
*/
@@ -571,16 +587,17 @@ public class AdvancedSearchBean
{
FacesContext context = FacesContext.getCurrentInstance();
DictionaryService dictionaryService = Repository.getServiceRegistry(context).getDictionaryService();
// add the well known cm:content object type by default
this.contentTypes = new ArrayList<SelectItem>(5);
this.contentTypes.add(new SelectItem(ContentModel.TYPE_CONTENT.toString(),
Application.getMessage(context, MSG_CONTENT)));
dictionaryService.getType(ContentModel.TYPE_CONTENT).getTitle()));
// add any configured content sub-types to the list
List<String> types = getSearchConfig().getContentTypes();
if (types != null)
{
DictionaryService dictionaryService = Repository.getServiceRegistry(context).getDictionaryService();
for (String type : types)
{
QName idQName = Repository.resolveToQName(type);
@@ -613,6 +630,58 @@ public class AdvancedSearchBean
return this.contentTypes;
}
/**
* @return Returns a list of folder object types to allow the user to select from
*/
public List<SelectItem> getFolderTypes()
{
if (this.folderTypes == null)
{
FacesContext context = FacesContext.getCurrentInstance();
DictionaryService dictionaryService = Repository.getServiceRegistry(context).getDictionaryService();
// add the well known cm:folder object type by default
this.folderTypes = new ArrayList<SelectItem>(5);
this.folderTypes.add(new SelectItem(ContentModel.TYPE_FOLDER.toString(),
dictionaryService.getType(ContentModel.TYPE_FOLDER).getTitle()));
// add any configured folder sub-types to the list
List<String> types = getSearchConfig().getFolderTypes();
if (types != null)
{
for (String type : types)
{
QName idQName = Repository.resolveToQName(type);
if (idQName != null)
{
TypeDefinition typeDef = dictionaryService.getType(idQName);
if (typeDef != null && dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_FOLDER))
{
// try and get label from the dictionary
String label = typeDef.getTitle();
// else just use the localname
if (label == null)
{
label = idQName.getLocalName();
}
this.folderTypes.add(new SelectItem(idQName.toString(), label));
}
}
}
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.folderTypes, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
}
}
return this.folderTypes;
}
/**
* @return Returns a list of content formats to allow the user to select from
*/
@@ -662,6 +731,7 @@ public class AdvancedSearchBean
this.lookin = LOOKIN_ALL;
this.contentType = null;
this.contentFormat = null;
this.folderType = null;
this.location = null;
this.locationChildren = true;
this.categories = new ArrayList<Node>(2);
@@ -822,6 +892,12 @@ public class AdvancedSearchBean
search.setContentType(this.contentType);
}
// folder type restriction
if (this.folderType != null)
{
search.setFolderType(this.folderType);
}
// set the Search Context onto the top-level navigator bean
// this causes the browse screen to switch into search results view
this.navigator.setSearchContext(search);
@@ -1168,6 +1244,7 @@ public class AdvancedSearchBean
this.contentType = search.getContentType();
this.contentFormat = search.getMimeType();
this.folderType = search.getFolderType();
this.description = search.getAttributeQuery(ContentModel.PROP_DESCRIPTION);
this.title = search.getAttributeQuery(ContentModel.PROP_TITLE);
@@ -1476,7 +1553,6 @@ public class AdvancedSearchBean
// ------------------------------------------------------------------------------
// Private data
private static final String MSG_CONTENT = "content";
private static final String MSG_ALL_FORMATS = "all_formats";
private static final String MSG_ERROR_SAVE_SEARCH = "error_save_search";
private static final String MSG_ERROR_RESTORE_SEARCH = "error_restore_search";
@@ -1536,17 +1612,23 @@ public class AdvancedSearchBean
/** lookup of custom property QName string to DataTypeDefinition for the property */
private Map<String, DataTypeDefinition> customPropertyLookup = null;
/** content types to for restricting searches */
private List<SelectItem> contentTypes;
/** content format list restricting searches */
private List<SelectItem> contentFormats;
/** content format selection */
private String contentFormat;
/** content type selection */
private String contentType;
/** content format selection */
private String contentFormat;
/** content types for restricting searches */
private List<SelectItem> contentTypes;
/** folder type selection */
private String folderType;
/** folder types for restricting searches */
private List<SelectItem> folderTypes;
/** the text to search for */
private String text = "";

View File

@@ -73,6 +73,7 @@ public final class SearchContext implements Serializable
private static final String ELEMENT_ATTRIBUTES = "attributes";
private static final String ELEMENT_MIMETYPE = "mimetype";
private static final String ELEMENT_CONTENT_TYPE = "content-type";
private static final String ELEMENT_FOLDER_TYPE = "folder-type";
private static final String ELEMENT_CATEGORY = "category";
private static final String ELEMENT_CATEGORIES = "categories";
private static final String ELEMENT_LOCATION = "location";
@@ -104,6 +105,9 @@ public final class SearchContext implements Serializable
/** categories to add to the search */
private String[] categories = new String[0];
/** folder type to restrict search against */
private String folderType = null;
/** content type to restrict search against */
private String contentType = null;
@@ -384,8 +388,16 @@ public final class SearchContext implements Serializable
fileTypeQuery = " TYPE:\"{" + NamespaceService.CONTENT_MODEL_1_0_URI + "}content\" ";
}
// match against FOLDER type
String folderTypeQuery = " TYPE:\"{" + NamespaceService.CONTENT_MODEL_1_0_URI + "}folder\" ";
// match against appropriate folder type
String folderTypeQuery;
if (folderType != null)
{
folderTypeQuery = " TYPE:\"" + folderType + "\" ";
}
else
{
folderTypeQuery = " TYPE:\"{" + NamespaceService.CONTENT_MODEL_1_0_URI + "}folder\" ";
}
String fullTextQuery = fullTextBuf.toString();
String nameAttrQuery = nameAttrBuf.toString();
@@ -595,6 +607,22 @@ public final class SearchContext implements Serializable
this.contentType = contentType;
}
/**
* @return Returns the folderType.
*/
public String getFolderType()
{
return this.folderType;
}
/**
* @param folderType The folder type to restrict attribute search against.
*/
public void setFolderType(String folderType)
{
this.folderType = folderType;
}
/**
* @return Returns the mimeType.
*/
@@ -690,6 +718,7 @@ public final class SearchContext implements Serializable
* <category>XPath</category>
* </categories>
* <content-type>String</content-type>
* <folder-type>String</folder-type>
* <mimetype>String</mimetype>
* <attributes>
* <attribute name="String">String</attribute>
@@ -735,6 +764,10 @@ public final class SearchContext implements Serializable
{
root.addElement(ELEMENT_CONTENT_TYPE).addText(this.contentType);
}
if (this.folderType != null)
{
root.addElement(ELEMENT_FOLDER_TYPE).addText(this.folderType);
}
if (this.mimeType != null && this.mimeType.length() != 0)
{
root.addElement(ELEMENT_MIMETYPE).addText(this.mimeType);
@@ -834,6 +867,11 @@ public final class SearchContext implements Serializable
{
this.contentType = contentTypeElement.getText();
}
Element folderTypeElement = rootElement.element(ELEMENT_FOLDER_TYPE);
if (folderTypeElement != null)
{
this.folderType = folderTypeElement.getText();
}
Element mimetypeElement = rootElement.element(ELEMENT_MIMETYPE);
if (mimetypeElement != null)
{

View File

@@ -35,10 +35,10 @@ import org.alfresco.repo.node.archive.RestoreNodeReport;
import org.alfresco.repo.node.archive.RestoreNodeReport.RestoreStatus;
import org.alfresco.repo.search.impl.lucene.QueryParser;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.ResultSetRow;
import org.alfresco.service.cmr.search.SearchParameters;
@@ -47,6 +47,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.util.CachingDateFormat;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.bean.repository.MapNode;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.NodePropertyResolver;
@@ -64,6 +65,23 @@ import org.alfresco.web.ui.common.component.data.UIRichList;
*/
public class TrashcanBean implements IContextListener
{
private static final String MSG_DELETED_ITEMS_FOR = "deleted_items_for";
private static final String MSG_DELETED_ITEMS = "deleted_items";
private static final String MSG_RECOVERED_ITEM_INTEGRITY = "recovered_item_integrity";
private static final String MSG_RECOVERED_ITEM_PERMISSION = "recovered_item_permission";
private static final String MSG_RECOVERED_ITEM_PARENT = "recovered_item_parent";
private static final String MSG_RECOVERED_ITEM_FAILURE = "recovered_item_failure";
private static final String MSG_RECOVERED_ITEM_INTEGRITY_S = "recovered_item_integrity_short";
private static final String MSG_RECOVERED_ITEM_PERMISSION_S = "recovered_item_permission_short";
private static final String MSG_RECOVERED_ITEM_PARENT_S = "recovered_item_parent_short";
private static final String MSG_RECOVERED_ITEM_FAILURE_S = "recovered_item_failure_short";
private static final String MSG_RECOVERED_ITEM_SUCCESS = "recovered_item_success";
private static final String MSG_RECOVERY_REASON = "recovery_report_reason";
private static final String MSG_LOCATION = "location";
private static final String MSG_NAME = "name";
private static final String PROP_RECOVERSTATUS = "recoverstatus";
private static final String FILTER_DATE_ALL = "all";
private static final String FILTER_DATE_TODAY = "today";
private static final String FILTER_DATE_WEEK = "week";
@@ -71,15 +89,8 @@ public class TrashcanBean implements IContextListener
private static final String FILTER_USER_ALL = "all";
private static final String FILTER_USER_USER = "user";
private static final String MSG_DELETED_ITEMS_FOR = "deleted_items_for";
private static final String MSG_DELETED_ITEMS = "deleted_items";
private static final String MSG_RECOVERED_ITEM_INTEGRITY = "recovered_item_integrity";
private static final String MSG_RECOVERED_ITEM_PERMISSION = "recovered_item_permission";
private static final String MSG_RECOVERED_ITEM_PARENT = "recovered_item_parent";
private static final String MSG_RECOVERED_ITEM_FAILURE = "recovered_item_failure";
private static final String MSG_RECOVERED_ITEM_SUCCESS = "recovered_item_success";
private static final String OUTCOME_DIALOGCLOSE = "dialog:close";
private static final String OUTCOME_RECOVERY_REPORT = "recoveryReport";
private static final String RICHLIST_ID = "trashcan-list";
private static final String RICHLIST_MSG_ID = "trashcan" + ':' + RICHLIST_ID;
@@ -121,6 +132,10 @@ public class TrashcanBean implements IContextListener
/** Currently listed items */
private List<Node> listedItems = Collections.<Node>emptyList();
private List<Node> successItems = Collections.<Node>emptyList();
private List<Node> failureItems = Collections.<Node>emptyList();
/** Current action context Node */
private Node actionNode;
@@ -331,6 +346,38 @@ public class TrashcanBean implements IContextListener
{
this.listedItems = listedItems;
}
/**
* @return HTML table of the listed items
*/
public String getListedItemsTable()
{
return buildItemsTable(getListedItems(), "recoveredItemsList", false, true);
}
/**
* @return HTML table of the items successfully recovered
*/
public String getSuccessItemsTable()
{
return buildItemsTable(this.successItems, "recoveredItemsList", false, false);
}
/**
* @return HTML table of the items that failed to recover
*/
public String getFailureItemsTable()
{
return buildItemsTable(this.failureItems, "failedItemsList", true, false);
}
/**
* @return count of the items that failed to recover
*/
public int getFailureItemsCount()
{
return this.failureItems.size();
}
/**
* @param node The item context for the current action
@@ -432,13 +479,31 @@ public class TrashcanBean implements IContextListener
private NodePropertyResolver resolverLocationPath = new NodePropertyResolver() {
public Object get(Node node) {
return (Path)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PATH);
ChildAssociationRef childRef =
(ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC);
if (nodeService.exists(childRef.getParentRef()))
{
return nodeService.getPath(childRef.getParentRef());
}
else
{
return null;
}
}
};
private NodePropertyResolver resolverDisplayPath = new NodePropertyResolver() {
public Object get(Node node) {
return Repository.getDisplayPath((Path)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PATH));
ChildAssociationRef childRef =
(ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC);
if (nodeService.exists(childRef.getParentRef()))
{
return Repository.getDisplayPath(nodeService.getPath(childRef.getParentRef()), true);
}
else
{
return "";
}
}
};
@@ -492,10 +557,6 @@ public class TrashcanBean implements IContextListener
// ------------------------------------------------------------------------------
// Action handlers
// TODO:
// need the following Action Handlers:
// deleteAllItemsOK, recoverAllItemsOK, recoverListedItemsOK, deleteListedItemsOK
/**
* Search the deleted item store by name
*/
@@ -580,6 +641,16 @@ public class TrashcanBean implements IContextListener
contextUpdated();
}
/**
* Action handler to setup actions that act on lists
*/
public void setupListAction(ActionEvent event)
{
// clear the UI state in preparation for finishing the next action
setDestination(null);
contextUpdated();
}
/**
* Delete single item OK button handler
*/
@@ -689,6 +760,146 @@ public class TrashcanBean implements IContextListener
return outcome;
}
/**
* Action handler to recover the list items
*/
public String recoverListedItemsOK()
{
FacesContext fc = FacesContext.getCurrentInstance();
// restore the nodes - the user may have requested a restore to a different parent
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
for (Node node : this.listedItems)
{
nodeRefs.add(node.getNodeRef());
}
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs);
}
else
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null);
}
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
saveReportDetail(reports);
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
}
return OUTCOME_RECOVERY_REPORT;
}
/**
* Action handler called to recover all items from the store (Admin only)
*/
public String recoverAllItemsOK()
{
FacesContext fc = FacesContext.getCurrentInstance();
// restore all nodes - the user may have requested a restore to a different parent
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef());
}
else
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null);
}
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
saveReportDetail(reports);
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
}
return OUTCOME_RECOVERY_REPORT;
}
/**
* @return outcome to close the main list screen and reset other beans ready for display
*/
public String close()
{
// call beans to update UI context for other screens
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
return OUTCOME_DIALOGCLOSE;
}
/**
* Action handler to delete the listed items
*/
public String deleteListedItemsOK()
{
try
{
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
for (Node node : this.listedItems)
{
nodeRefs.add(node.getNodeRef());
}
this.nodeArchiveService.purgeArchivedNodes(nodeRefs);
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}
return OUTCOME_DIALOGCLOSE;
}
/**
* Action handler to delete all items
*/
public String deleteAllItemsOK()
{
try
{
this.nodeArchiveService.purgeAllArchivedNodes(Repository.getStoreRef());
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}
return OUTCOME_DIALOGCLOSE;
}
/**
* Action handler to initially setup the trashcan screen
*/
@@ -825,6 +1036,145 @@ public class TrashcanBean implements IContextListener
return query;
}
/**
* Save the detail of the items that were successfully or unsuccessfully restored
*
* @param reports The List of RestoreNodeReport objects to walk for results
*/
private void saveReportDetail(List<RestoreNodeReport> reports)
{
// store the results ready for the next dialog page
this.successItems = new ArrayList<Node>(reports.size());
this.failureItems = new ArrayList<Node>(reports.size());
for (RestoreNodeReport report : reports)
{
if (RestoreStatus.SUCCESS == report.getStatus())
{
Node node = new Node(report.getRestoredNodeRef());
node.getProperties().put(PROP_RECOVERSTATUS, report.getStatus());
this.successItems.add(node);
}
else
{
Node node = new Node(report.getArchivedNodeRef());
node.getProperties().put(PROP_RECOVERSTATUS, report.getStatus());
this.failureItems.add(node);
}
}
}
/**
* Build an HTML table of the items that are to be or have been recovered.
*
* @param items List of Node objects to display in the table
* @param cssClass CSS style to apply to the table
* @param report Set true to report the reason for any failure. This flag requires that the Node
* object has a pseudo property "recoverstatus" containing the RestoreStatus.
* @param archivedPath Set true to show the path from the 'sys:archivedOriginalParentAssoc' property,
* else the current Node Path will be used.
*
*
* @return HTML table of node info
*/
private String buildItemsTable(List<Node> items, String cssClass, boolean report, boolean archivedPath)
{
FacesContext fc = FacesContext.getCurrentInstance();
String contextPath = fc.getExternalContext().getRequestContextPath();
StringBuilder buf = new StringBuilder(1024);
// outer table
buf.append("<table width=100% cellspacing=1 cellpadding=1 border=0 class='");
buf.append(cssClass);
buf.append("'>");
// title row
buf.append("<tr style='border-bottom:1px'><th></th><th align=left><b>");
buf.append(Application.getMessage(fc, MSG_NAME));
buf.append("</b></th>");
if (report == true)
{
buf.append("<th align=left>");
buf.append(Application.getMessage(fc, MSG_RECOVERY_REASON));
buf.append("</th>");
}
else
{
buf.append("<th align=left><b>");
buf.append(Application.getMessage(fc, MSG_LOCATION));
buf.append("</b></th>");
}
buf.append("</tr>");
for (Node node : items)
{
// listed item rows
buf.append("<tr><td width=16>");
String img;
if (this.dictionaryService.isSubClass(node.getType(), ContentModel.TYPE_FOLDER))
{
String icon = (String)node.getProperties().get("app:icon");
img = "/images/icons/" + (icon != null ? icon + "-16.gif" : BrowseBean.SPACE_SMALL_DEFAULT + ".gif");
}
else
{
img = Utils.getFileTypeImage(node.getName(), false);
}
buf.append("<img width=16 height=16 alt='' src='").append(contextPath).append(img).append("'>");
buf.append("</td><td>");
buf.append(node.getName());
buf.append("</td>");
if (report)
{
buf.append("<td>");
String msg;
switch ((RestoreStatus)node.getProperties().get(PROP_RECOVERSTATUS))
{
case FAILURE_INVALID_PARENT:
msg = MSG_RECOVERED_ITEM_PARENT_S;
break;
case FAILURE_PERMISSION:
msg = MSG_RECOVERED_ITEM_PERMISSION_S;
break;
case FAILURE_INTEGRITY:
msg = MSG_RECOVERED_ITEM_INTEGRITY_S;
break;
default:
msg = MSG_RECOVERED_ITEM_FAILURE_S;
break;
}
buf.append(Application.getMessage(fc, msg));
buf.append("</td>");
}
else
{
buf.append("<td>");
if (archivedPath)
{
ChildAssociationRef childRef =
(ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC);
if (nodeService.exists(childRef.getParentRef()))
{
buf.append(Repository.getNamePath(nodeService, nodeService.getPath(childRef.getParentRef()), null, "/", null));
}
}
else
{
buf.append(Repository.getNamePath(nodeService, nodeService.getPath(node.getNodeRef()), null, "/", null));
}
buf.append("</td>");
}
buf.append("</tr>");
}
// end table
buf.append("</table>");
return buf.toString();
}
private boolean isAdminUser()
{
return Application.getCurrentUser(FacesContext.getCurrentInstance()).isAdmin();

View File

@@ -306,12 +306,12 @@ public abstract class BaseActionWizard extends BaseWizardBean
}
else
{
logger.warn("Could not find aspects configuration element");
logger.warn("Could not find 'aspects' configuration element");
}
}
else
{
logger.warn("Could not find Action Wizards configuration section");
logger.warn("Could not find 'Action Wizards' configuration section");
}
}
@@ -334,10 +334,10 @@ public abstract class BaseActionWizard extends BaseWizardBean
// add any configured content sub-types to the list
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Custom Content Types");
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("content-types");
ConfigElement typesCfg = wizardCfg.getConfigElement("specialise-types");
if (typesCfg != null)
{
for (ConfigElement child : typesCfg.getChildren())
@@ -373,12 +373,12 @@ public abstract class BaseActionWizard extends BaseWizardBean
}
else
{
logger.warn("Could not find 'content-types' configuration element");
logger.warn("Could not find 'specialise-types' configuration element");
}
}
else
{
logger.warn("Could not find 'Custom Content Types' configuration section");
logger.warn("Could not find 'Action Wizards' configuration section");
}
}
@@ -456,12 +456,12 @@ public abstract class BaseActionWizard extends BaseWizardBean
}
else
{
logger.warn("Could not find transformers configuration element");
logger.warn("Could not find 'transformers' configuration element");
}
}
else
{
logger.warn("Could not find Action Wizards configuration section");
logger.warn("Could not find 'Action Wizards' configuration section");
}
}
@@ -509,12 +509,12 @@ public abstract class BaseActionWizard extends BaseWizardBean
}
else
{
logger.warn("Could not find image-transformers configuration element");
logger.warn("Could not find 'image-transformers' configuration element");
}
}
else
{
logger.warn("Could not find Action Wizards configuration section");
logger.warn("Could not find 'Action Wizards' configuration section");
}
}

View File

@@ -246,7 +246,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
// add any configured content sub-types to the list
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Custom Content Types");
Config wizardCfg = svc.getConfig("Content Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("content-types");
@@ -305,7 +305,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
}
else
{
logger.warn("Could not find 'Custom Content Types' configuration section");
logger.warn("Could not find 'Content Wizards' configuration section");
}
}

View File

@@ -90,6 +90,9 @@ public abstract class BaseDialogBean implements IDialogBean
}
catch (Throwable e)
{
// reset the flag so we can re-attempt the operation
isFinished = false;
// rollback the transaction
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
Utils.addErrorMessage(formatErrorMessage(e));

View File

@@ -94,6 +94,17 @@ public class DialogManager
return this.currentDialogConfig.getIcon();
}
/**
* Returns the error message to use in error conditions
*
* @return The error message
*/
public String getErrorMessage()
{
return Application.getMessage(FacesContext.getCurrentInstance(),
this.currentDialogConfig.getErrorMessageId());
}
/**
* Returns the resolved title to use for the dialog
*

View File

@@ -223,10 +223,25 @@ public final class Repository
* @return human readable form of the Path excluding the final element
*/
public static String getDisplayPath(Path path)
{
return getDisplayPath(path, false);
}
/**
* Return the human readable form of the specified node Path. Fast version of the method that
* simply converts QName localname components to Strings.
*
* @param path Path to extract readable form from
* @param showLeaf Whether to process the final leaf element of the path
*
* @return human readable form of the Path excluding the final element
*/
public static String getDisplayPath(Path path, boolean showLeaf)
{
StringBuilder buf = new StringBuilder(64);
for (int i=0; i<path.size()-1; i++)
int count = path.size() - (showLeaf ? 0 : 1);
for (int i=0; i<count; i++)
{
String elementString = null;
Path.Element element = path.get(i);

View File

@@ -243,7 +243,7 @@ public class CreateRuleWizard extends BaseActionWizard
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("types");
ConfigElement typesCfg = wizardCfg.getConfigElement("subtypes");
if (typesCfg != null)
{
this.modelTypes = new ArrayList<SelectItem>();
@@ -277,12 +277,12 @@ public class CreateRuleWizard extends BaseActionWizard
}
else
{
logger.warn("Could not find types configuration element");
logger.warn("Could not find 'subtypes' configuration element");
}
}
else
{
logger.warn("Could not find Action Wizards configuration section");
logger.warn("Could not find 'Action Wizards' configuration section");
}
}

View File

@@ -470,7 +470,7 @@ public class CreateSpaceWizard extends BaseWizardBean
// add any configured content sub-types to the list
Config wizardCfg = Application.getConfigService(FacesContext.getCurrentInstance()).
getConfig("Custom Folder Types");
getConfig("Space Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("folder-types");
@@ -548,7 +548,7 @@ public class CreateSpaceWizard extends BaseWizardBean
}
else
{
logger.warn("Could not find 'Custom Folder Types' configuration section");
logger.warn("Could not find 'Space Wizards' configuration section");
}
}

View File

@@ -499,7 +499,7 @@ public abstract class BaseContentWizard extends AbstractWizardBean
// add any configured content sub-types to the list
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Custom Content Types");
Config wizardCfg = svc.getConfig("Content Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("content-types");
@@ -558,7 +558,7 @@ public abstract class BaseContentWizard extends AbstractWizardBean
}
else
{
logger.warn("Could not find 'Custom Content Types' configuration section");
logger.warn("Could not find 'Content Wizards' configuration section");
}
}

View File

@@ -558,7 +558,7 @@ public class NewSpaceWizard extends AbstractWizardBean
// add any configured content sub-types to the list
Config wizardCfg = Application.getConfigService(FacesContext.getCurrentInstance()).
getConfig("Custom Folder Types");
getConfig("Space Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("folder-types");
@@ -624,7 +624,7 @@ public class NewSpaceWizard extends AbstractWizardBean
}
else
{
logger.warn("Could not find 'Custom Folder Types' configuration section");
logger.warn("Could not find 'Space Wizards' configuration section");
}
}

View File

@@ -115,6 +115,17 @@ public class WizardManager
return this.currentWizardConfig.getIcon();
}
/**
* Returns the error message to use in error conditions
*
* @return The error message
*/
public String getErrorMessage()
{
return Application.getMessage(FacesContext.getCurrentInstance(),
this.currentWizardConfig.getErrorMessageId());
}
/**
* Returns the resolved title to use for the wizard
*