use of org.alfresco.web.bean.content.DocumentDetailsDialog in project acs-community-packaging by Alfresco.
the class BrowseBean method setupContentAction.
/**
* Public helper to setup action pages with content context
*
* @param id of the content node to setup context for
*/
public void setupContentAction(String id, boolean invalidate) {
if (id != null && id.length() != 0) {
if (logger.isDebugEnabled())
logger.debug("Setup for action, setting current document to: " + id);
try {
// create the node ref, then our node representation
NodeRef ref = new NodeRef(Repository.getStoreRef(), id);
Node node = new MapNode(ref);
// store the URL to for downloading the content
if (ApplicationModel.TYPE_FILELINK.equals(node.getType())) {
node.addPropertyResolver("url", this.resolverLinkDownload);
node.addPropertyResolver("downloadUrl", this.resolverLinkDownload);
} else {
node.addPropertyResolver("url", this.resolverDownload);
node.addPropertyResolver("downloadUrl", this.resolverDownload);
}
node.addPropertyResolver("webdavUrl", this.resolverWebdavUrl);
node.addPropertyResolver("cifsPath", this.resolverCifsPath);
node.addPropertyResolver("fileType32", this.resolverFileType32);
node.addPropertyResolver("mimetype", this.resolverMimetype);
node.addPropertyResolver("encoding", this.resolverEncoding);
node.addPropertyResolver("size", this.resolverSize);
node.addPropertyResolver("lang", this.resolverLang);
for (NodeEventListener listener : getNodeEventListeners()) {
listener.created(node, node.getType());
}
// get hold of the DocumentDetailsDialog and reset it
DocumentDetailsDialog docDetails = (DocumentDetailsDialog) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("DocumentDetailsDialog");
if (docDetails != null) {
docDetails.reset();
}
// remember the document
setDocument(node);
// setup the dispatch context in case it is required
this.navigator.setupDispatchContext(node);
} catch (InvalidNodeRefException refErr) {
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] { id }));
throw new AbortProcessingException("Invalid node reference");
}
} else {
setDocument(null);
}
// clear the UI state in preparation for finishing the next action
if (invalidate == true) {
// use the context service to notify all registered beans
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
}
}
use of org.alfresco.web.bean.content.DocumentDetailsDialog in project acs-community-packaging by Alfresco.
the class BrowseBean method setupMLContainerContentAction.
/**
* Action event called by all actions that need to setup a <b>Multilingual</b> Content Document context on the
* BrowseBean before an action page/wizard is called. The context will be a Node in
* setDocument() which can be retrieved on the action page from BrowseBean.getDocument().
*/
public void setupMLContainerContentAction(ActionEvent event) {
UIActionLink link = (UIActionLink) event.getComponent();
Map<String, String> params = link.getParameterMap();
String id = params.get("id");
NodeRef translation = new NodeRef(Repository.getStoreRef(), id);
// remember the bean from which the action comes
FacesContext fc = FacesContext.getCurrentInstance();
DocumentDetailsDialog docDetails = (DocumentDetailsDialog) FacesHelper.getManagedBean(fc, "DocumentDetailsDialog");
docDetails.setTranslationDocument(new MapNode(translation));
MultilingualManageDialog mmDialog = (MultilingualManageDialog) FacesHelper.getManagedBean(fc, "MultilingualManageDialog");
mmDialog.setTranslationDocument(docDetails.getTranslationDocument());
// set the ml container as the current document
NodeRef mlContainer = getMultilingualContentService().getTranslationContainer(translation);
setupContentAction(mlContainer.getId(), true);
}
Aggregations