- Submit action added for documents/folders for a user sandbox
   - To push a modifed item into the main staging area

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3894 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-09-22 16:31:46 +00:00
parent 1fe792cb65
commit 4591467318
6 changed files with 64 additions and 2 deletions

View File

@@ -24,12 +24,15 @@ import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
@@ -112,6 +115,8 @@ public class AVMBrowseBean implements IContextListener
/** AVM service bean reference */
protected AVMService avmService;
protected ActionService actionService;
/**
* Default Constructor
@@ -193,6 +198,14 @@ public class AVMBrowseBean implements IContextListener
this.navigator = navigator;
}
/**
* @param actionService The actionService to set.
*/
public void setActionService(ActionService actionService)
{
this.actionService = actionService;
}
/**
* Summary text for the staging store:
* Created On: xx/yy/zz
@@ -214,7 +227,8 @@ public class AVMBrowseBean implements IContextListener
if (store != null)
{
// count user stores
int users = avmService.queryStoresPropertyKeys(QName.createQName(null, AVMConstants.PROP_SANDBOX_STORE_PREFIX + storeRoot + "-%" + AVMConstants.STORE_MAIN)).size();
int users = avmService.queryStoresPropertyKeys(QName.createQName(null,
AVMConstants.PROP_SANDBOX_STORE_PREFIX + storeRoot + "-%" + AVMConstants.STORE_MAIN)).size();
summary.append(msg.getString(MSG_CREATED_ON)).append(": ")
.append(Utils.getDateFormat(fc).format(new Date(store.getCreateDate())))
.append("<p>");
@@ -567,6 +581,37 @@ public class AVMBrowseBean implements IContextListener
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
}
public void submitNode(ActionEvent event)
{
setupContentAction(event);
UserTransaction tx = null;
try
{
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context, true);
tx.begin();
Action action = this.actionService.createAction("simple-avm-submit");
this.actionService.executeAction(action, getAvmNode().getNodeRef());
// commit the transaction
tx.commit();
// if we get here, all was well - output friendly status message to the user
String msg = "Successfully submitted: " + getAvmNode().getName();
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
context.addMessage(formId + ':' + "sandboxes-panel", facesMsg);
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
// ------------------------------------------------------------------------------
// Private helpers

View File

@@ -404,7 +404,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
private void tagStoreDNSPath(String store, String... components)
{
String path = store + ":/" + AVMConstants.DIR_APPBASE + '/' + AVMConstants.DIR_WEBAPPS;
// TODO: DNS name mangle the property name - can only contain value DNS characters!
// DNS name mangle the property name - can only contain value DNS characters!
String dnsProp = AVMConstants.PROP_DNS + DNSNameMangler.MakeDNSName(components);
this.avmService.setStoreProperty(store, QName.createQName(null, dnsProp),
new PropertyValue(DataTypeDefinition.TEXT, path));