Merge of all UI clustering changes originally applied to 2.2

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8292 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2008-02-15 14:59:11 +00:00
parent d20d8a7007
commit a450598ecb
281 changed files with 17771 additions and 15322 deletions

View File

@@ -59,7 +59,8 @@ import org.alfresco.web.bean.repository.Repository;
public class AddContentDialog extends BaseContentWizard
{
private final static String MSG_OK = "ok";
private static final long serialVersionUID = 3593557546118692687L;
protected List<String> inlineEditableMimeTypes;
protected File file;

View File

@@ -79,7 +79,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
// the NodeRef of the node created during finish
protected NodeRef createdNode;
protected List<SelectItem> objectTypes;
protected ContentService contentService;
transient private ContentService contentService;
protected static Log logger = LogFactory.getLog(BaseContentWizard.class);
@@ -322,11 +322,11 @@ public abstract class BaseContentWizard extends BaseWizardBean
QName idQName = Repository.resolveToQName(child.getAttribute("name"));
if (idQName != null)
{
TypeDefinition typeDef = this.dictionaryService.getType(idQName);
TypeDefinition typeDef = this.getDictionaryService().getType(idQName);
if (typeDef != null)
{
if (this.dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT))
if (this.getDictionaryService().isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT))
{
// try and get the display label from config
String label = Utils.getDisplayLabel(context, child);
@@ -390,6 +390,15 @@ public abstract class BaseContentWizard extends BaseWizardBean
this.contentService = contentService;
}
protected ContentService getContentService()
{
if (contentService == null)
{
contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService();
}
return contentService;
}
// ------------------------------------------------------------------------------
// Helper methods
@@ -407,14 +416,14 @@ public abstract class BaseContentWizard extends BaseWizardBean
String nodeId = this.navigator.getCurrentNodeId();
if (nodeId == null)
{
containerNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
containerNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef());
}
else
{
containerNodeRef = new NodeRef(Repository.getStoreRef(), nodeId);
}
FileInfo fileInfo = this.fileFolderService.create(
FileInfo fileInfo = this.getFileFolderService().create(
containerNodeRef,
this.fileName,
Repository.resolveToQName(this.objectType));
@@ -423,7 +432,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
// set the author aspect
Map<QName, Serializable> authorProps = new HashMap<QName, Serializable>(1, 1.0f);
authorProps.put(ContentModel.PROP_AUTHOR, this.author);
this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
this.getNodeService().addAspect(fileNodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
if (logger.isDebugEnabled())
logger.debug("Created file node for file: " + this.fileName);
@@ -432,7 +441,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(3, 1.0f);
titledProps.put(ContentModel.PROP_TITLE, this.title);
titledProps.put(ContentModel.PROP_DESCRIPTION, this.description);
this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps);
this.getNodeService().addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps);
if (logger.isDebugEnabled())
logger.debug("Added titled aspect with properties: " + titledProps);
@@ -442,14 +451,14 @@ public abstract class BaseContentWizard extends BaseWizardBean
{
Map<QName, Serializable> editProps = new HashMap<QName, Serializable>(1, 1.0f);
editProps.put(ApplicationModel.PROP_EDITINLINE, this.inlineEdit);
this.nodeService.addAspect(fileNodeRef, ApplicationModel.ASPECT_INLINEEDITABLE, editProps);
this.getNodeService().addAspect(fileNodeRef, ApplicationModel.ASPECT_INLINEEDITABLE, editProps);
if (logger.isDebugEnabled())
logger.debug("Added inlineeditable aspect with properties: " + editProps);
}
// get a writer for the content and put the file
ContentWriter writer = contentService.getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true);
ContentWriter writer = getContentService().getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true);
// set the mimetype and encoding
writer.setMimetype(this.mimeType);
writer.setEncoding(getEncoding());

View File

@@ -65,6 +65,8 @@ import org.w3c.dom.Document;
*/
public class CreateContentWizard extends BaseContentWizard
{
private static final long serialVersionUID = -2740634368271194418L;
protected String content = null;
protected List<SelectItem> createMimeTypes;
@@ -105,7 +107,7 @@ public class CreateContentWizard extends BaseContentWizard
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
props.put(WCMAppModel.PROP_PARENT_FORM_NAME, getFormName());
props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, "");
this.nodeService.addAspect(super.createdNode, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props);
getNodeService().addAspect(super.createdNode, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props);
}
return result;

View File

@@ -34,6 +34,7 @@ import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -44,9 +45,9 @@ import org.apache.commons.logging.LogFactory;
*/
public class DeleteContentDialog extends BaseDialogBean
{
private static final long serialVersionUID = 4199496011879649213L;
protected MultilingualContentService multilingualContentService;
transient private MultilingualContentService multilingualContentService;
private static final Log logger = LogFactory.getLog(DeleteContentDialog.class);
@@ -67,7 +68,7 @@ public class DeleteContentDialog extends BaseDialogBean
logger.debug("Trying to delete multilingual container: " + node.getId() + " and its translations" );
// delete the mlContainer and its translations
multilingualContentService.deleteTranslationContainer(node.getNodeRef());
getMultilingualContentService().deleteTranslationContainer(node.getNodeRef());
}
else
{
@@ -75,7 +76,7 @@ public class DeleteContentDialog extends BaseDialogBean
logger.debug("Trying to delete content node: " + node.getId());
// delete the node
this.nodeService.deleteNode(node.getNodeRef());
this.getNodeService().deleteNode(node.getNodeRef());
}
}
@@ -156,4 +157,14 @@ public class DeleteContentDialog extends BaseDialogBean
{
this.multilingualContentService = multilingualContentService;
}
protected MultilingualContentService getMultilingualContentService()
{
if (multilingualContentService == null)
{
multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService();
}
return multilingualContentService;
}
}

View File

@@ -77,6 +77,8 @@ import org.alfresco.web.ui.common.component.UIActionLink;
*/
public class DocumentDetailsDialog extends BaseDetailsBean implements NavigationSupport
{
private static final long serialVersionUID = -8579599071702546214L;
private static final String OUTCOME_RETURN = null;
private static final String MSG_HAS_FOLLOWING_CATEGORIES = "has_following_categories";
@@ -93,12 +95,12 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
private static final String ML_VERSION_PANEL_ID = "ml-versions-panel";
protected LockService lockService;
protected VersionService versionService;
protected CheckOutCheckInService cociService;
protected MultilingualContentService multilingualContentService;
protected ContentFilterLanguagesService contentFilterLanguagesService;
protected EditionService editionService;
transient protected LockService lockService;
transient protected VersionService versionService;
transient protected CheckOutCheckInService cociService;
transient protected MultilingualContentService multilingualContentService;
transient protected ContentFilterLanguagesService contentFilterLanguagesService;
transient protected EditionService editionService;
private Node translationDocument;
@@ -184,7 +186,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
if (ApplicationModel.TYPE_FILELINK.equals(document.getType()))
{
NodeRef destRef = (NodeRef)document.getProperties().get(ContentModel.PROP_LINK_DESTINATION);
if (nodeService.exists(destRef))
if (getNodeService().exists(destRef))
{
document = new Node(destRef);
}
@@ -252,7 +254,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
if (getDocument().hasAspect(ContentModel.ASPECT_VERSIONABLE))
{
VersionHistory history = this.versionService.getVersionHistory(getDocument().getNodeRef());
VersionHistory history = this.getVersionService().getVersionHistory(getDocument().getNodeRef());
if (history != null)
{
@@ -333,7 +335,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
NodeRef mlContainer = getDocumentMlContainer().getNodeRef();
// get all editions and sort them ascending according their version label
List<Version> orderedEditionList = new ArrayList<Version>(editionService.getEditions(mlContainer).getAllVersions());
List<Version> orderedEditionList = new ArrayList<Version>(getEditionService().getEditions(mlContainer).getAllVersions());
Collections.sort(orderedEditionList, new VersionLabelComparator());
// the list of Single Edition Bean to return
@@ -369,16 +371,16 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
// Get the translations because the current edition doesn't content link with its
// translation in the version store.
Map<Locale, NodeRef> translations = multilingualContentService.getTranslations(mlContainer);
Map<Locale, NodeRef> translations = getMultilingualContentService().getTranslations(mlContainer);
translationHistories = new ArrayList<VersionHistory>(translations.size());
for (NodeRef translation : translations.values())
{
translationHistories.add(versionService.getVersionHistory(translation));
translationHistories.add(getVersionService().getVersionHistory(translation));
}
}
else
{
translationHistories = editionService.getVersionedTranslations(edition);
translationHistories = getEditionService().getVersionedTranslations(edition);
}
// add each translation in the SingleEditionBean
@@ -392,7 +394,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
Version lastVersion = orderedVersions.get(0);
// get the properties of the lastVersion
Map<QName, Serializable> lastVersionProperties = editionService.getVersionedMetadatas(lastVersion);
Map<QName, Serializable> lastVersionProperties = getEditionService().getVersionedMetadatas(lastVersion);
Locale language = (Locale) lastVersionProperties.get(ContentModel.PROP_LOCALE);
// create a map node representation of the last version
@@ -400,13 +402,13 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
clientLastVersion.put("versionName", lastVersionProperties.get(ContentModel.PROP_NAME));
// use the node service for the description to ensure that the returned value is a text and not a MLText
clientLastVersion.put("versionDescription", nodeService.getProperty(lastVersion.getFrozenStateNodeRef(), ContentModel.PROP_DESCRIPTION));
clientLastVersion.put("versionDescription", getNodeService().getProperty(lastVersion.getFrozenStateNodeRef(), ContentModel.PROP_DESCRIPTION));
clientLastVersion.put("versionAuthor", lastVersionProperties.get(ContentModel.PROP_AUTHOR));
clientLastVersion.put("versionCreatedDate", lastVersionProperties.get(ContentModel.PROP_CREATED));
clientLastVersion.put("versionModifiedDate", lastVersionProperties.get(ContentModel.PROP_MODIFIED));
clientLastVersion.put("versionLanguage", this.contentFilterLanguagesService.convertToNewISOCode(language.getLanguage()).toUpperCase());
clientLastVersion.put("versionLanguage", this.getContentFilterLanguagesService().convertToNewISOCode(language.getLanguage()).toUpperCase());
if(nodeService.hasAspect(lastVersion.getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
if(getNodeService().hasAspect(lastVersion.getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
{
clientLastVersion.put("versionUrl", null);
}
@@ -450,7 +452,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
// we know for now that the general classifiable aspect only will be
// applied so we can retrive the categories property direclty
Collection<NodeRef> categories = (Collection<NodeRef>)this.nodeService.getProperty(
Collection<NodeRef> categories = (Collection<NodeRef>)this.getNodeService().getProperty(
getDocument().getNodeRef(), ContentModel.PROP_CATEGORIES);
if (categories == null || categories.size() == 0)
@@ -465,10 +467,10 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
builder.append("<ul>");
for (NodeRef ref : categories)
{
if (this.nodeService.exists(ref))
if (this.getNodeService().exists(ref))
{
builder.append("<li>");
builder.append(Repository.getNameForNode(this.nodeService, ref));
builder.append(Repository.getNameForNode(this.getNodeService(), ref));
builder.append("</li>");
}
}
@@ -494,7 +496,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
public Object execute() throws Throwable
{
// add the general classifiable aspect to the node
nodeService.addAspect(getDocument().getNodeRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, null);
getNodeService().addAspect(getDocument().getNodeRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, null);
return null;
}
};
@@ -524,7 +526,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
public Object execute() throws Throwable
{
// add the versionable aspect to the node
nodeService.addAspect(getDocument().getNodeRef(), ContentModel.ASPECT_VERSIONABLE, null);
getNodeService().addAspect(getDocument().getNodeRef(), ContentModel.ASPECT_VERSIONABLE, null);
return null;
}
};
@@ -561,7 +563,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
public Object execute() throws Throwable
{
lockService.unlock(getNode().getNodeRef());
getLockService().unlock(getNode().getNodeRef());
String msg = Application.getMessage(fc, MSG_SUCCESS_UNLOCK);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
@@ -613,7 +615,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
props.put(ApplicationModel.PROP_EDITINLINE, true);
}
}
nodeService.addAspect(getDocument().getNodeRef(), ApplicationModel.ASPECT_INLINEEDITABLE, props);
getNodeService().addAspect(getDocument().getNodeRef(), ApplicationModel.ASPECT_INLINEEDITABLE, props);
return null;
}
@@ -768,7 +770,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
if (isLocked())
{
NodeRef workingCopyRef = this.cociService.getWorkingCopy(getDocument().getNodeRef());
NodeRef workingCopyRef = this.getCheckOutCheckInService().getWorkingCopy(getDocument().getNodeRef());
if (workingCopyRef != null)
{
workingCopyNode = new Node(workingCopyRef);
@@ -845,7 +847,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
NodeRef nodeRef = getNode().getNodeRef();
return new Node(multilingualContentService.getTranslationContainer(nodeRef));
return new Node(getMultilingualContentService().getTranslationContainer(nodeRef));
}
}
/**
@@ -857,6 +859,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
this.lockService = lockService;
}
protected LockService getLockService()
{
if (lockService == null)
{
lockService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getLockService();
}
return lockService;
}
/**
* Sets the version service instance the bean should use
@@ -867,6 +878,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
this.versionService = versionService;
}
protected VersionService getVersionService()
{
if (versionService == null)
{
versionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService();
}
return versionService;
}
/**
* Sets the checkincheckout service instance the bean should use
@@ -877,6 +897,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
this.cociService = cociService;
}
protected CheckOutCheckInService getCheckOutCheckInService()
{
if (cociService == null)
{
cociService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getCheckOutCheckInService();
}
return cociService;
}
/**
* @param multilingualContentService the multilingual ContentService to set
@@ -885,6 +914,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
this.multilingualContentService = multilingualContentService;
}
protected MultilingualContentService getMultilingualContentService()
{
if (multilingualContentService == null)
{
multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService();
}
return multilingualContentService;
}
/**
* @param contentFilterLanguagesService The Content Filter Languages Service to set.
@@ -893,6 +931,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
this.contentFilterLanguagesService = contentFilterLanguagesService;
}
protected ContentFilterLanguagesService getContentFilterLanguagesService()
{
if (contentFilterLanguagesService == null)
{
contentFilterLanguagesService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentFilterLanguagesService();
}
return contentFilterLanguagesService;
}
/**
* @param EditionService The Edition Service to set.
@@ -901,6 +948,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
{
this.editionService = editionService;
}
protected EditionService getEditionService()
{
if (editionService == null)
{
editionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getEditionService();
}
return editionService;
}
public String getCancelButtonLabel()
{
@@ -909,7 +965,8 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio
public String getContainerSubTitle()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getDocument().getNodePath().toDisplayPath(nodeService, permissionService);
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " +
getDocument().getNodePath().toDisplayPath(getNodeService(), getPermissionService());
}
public String getContainerTitle()

View File

@@ -66,7 +66,7 @@ public class DocumentLinkDetailsDialog extends BaseDetailsBean implements Naviga
if (ApplicationModel.TYPE_FILELINK.equals(document.getType()))
{
NodeRef destRef = (NodeRef)document.getProperties().get(ContentModel.PROP_LINK_DESTINATION);
if (nodeService.exists(destRef))
if (getNodeService().exists(destRef))
{
document = new Node(destRef);
}
@@ -198,7 +198,8 @@ public class DocumentLinkDetailsDialog extends BaseDetailsBean implements Naviga
public String getContainerSubTitle()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getDocument().getNodePath().toDisplayPath(nodeService, permissionService);
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " +
getDocument().getNodePath().toDisplayPath(getNodeService(), getPermissionService());
}
public String getContainerTitle()

View File

@@ -68,14 +68,16 @@ import org.alfresco.web.ui.common.Utils;
*
* @author gavinc
*/
public class DocumentPropertiesDialog
public class DocumentPropertiesDialog implements Serializable
{
private static final long serialVersionUID = 3065164840163513872L;
private static final String TEMP_PROP_MIMETYPE = "mimetype";
private static final String TEMP_PROP_ENCODING = "encoding";
protected NodeService nodeService;
protected FileFolderService fileFolderService;
protected DictionaryService dictionaryService;
transient private NodeService nodeService;
transient private FileFolderService fileFolderService;
transient private DictionaryService dictionaryService;
protected BrowseBean browseBean;
private List<SelectItem> contentTypes;
private Node editableNode;
@@ -136,10 +138,10 @@ public class DocumentPropertiesDialog
String name = (String) props.get(ContentModel.PROP_NAME);
if (name != null)
{
fileFolderService.rename(nodeRef, name);
getFileFolderService().rename(nodeRef, name);
}
Map<QName, Serializable> properties = this.nodeService.getProperties(nodeRef);
Map<QName, Serializable> properties = getNodeService().getProperties(nodeRef);
// we need to put all the properties from the editable bag back into
// the format expected by the repository
@@ -176,11 +178,11 @@ public class DocumentPropertiesDialog
if (author != null && author.length() != 0)
{
// add aspect if required
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
if (getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
{
Map<QName, Serializable> authorProps = new HashMap<QName, Serializable>(1, 1.0f);
authorProps.put(ContentModel.PROP_AUTHOR, author);
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
getNodeService().addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
}
// else it will get updated in the later setProperties() call
}
@@ -191,7 +193,7 @@ public class DocumentPropertiesDialog
if (title != null || description != null)
{
// add the aspect to be sure it's present
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
// props will get added later in setProperties()
}
@@ -209,7 +211,7 @@ public class DocumentPropertiesDialog
if ((propValue != null) && (propValue instanceof String) &&
(propValue.toString().length() == 0))
{
PropertyDefinition propDef = this.dictionaryService.getProperty(qname);
PropertyDefinition propDef = getDictionaryService().getProperty(qname);
if (propDef != null)
{
if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) ||
@@ -226,7 +228,7 @@ public class DocumentPropertiesDialog
}
// send the properties back to the repository
this.nodeService.setProperties(this.browseBean.getDocument().getNodeRef(), properties);
getNodeService().setProperties(this.browseBean.getDocument().getNodeRef(), properties);
// we also need to persist any association changes that may have been made
@@ -236,7 +238,7 @@ public class DocumentPropertiesDialog
{
for (AssociationRef assoc : typedAssoc.values())
{
this.nodeService.createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName());
getNodeService().createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName());
}
}
@@ -246,7 +248,7 @@ public class DocumentPropertiesDialog
{
for (AssociationRef assoc : typedAssoc.values())
{
this.nodeService.removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName());
getNodeService().removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName());
}
}
@@ -256,7 +258,7 @@ public class DocumentPropertiesDialog
{
for (ChildAssociationRef assoc : typedAssoc.values())
{
this.nodeService.addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName());
getNodeService().addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName());
}
}
@@ -266,7 +268,7 @@ public class DocumentPropertiesDialog
{
for (ChildAssociationRef assoc : typedAssoc.values())
{
this.nodeService.removeChild(assoc.getParentRef(), assoc.getChildRef());
getNodeService().removeChild(assoc.getParentRef(), assoc.getChildRef());
}
}
@@ -378,6 +380,11 @@ public class DocumentPropertiesDialog
*/
public NodeService getNodeService()
{
if (nodeService == null)
{
nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService();
}
return this.nodeService;
}
@@ -396,6 +403,15 @@ public class DocumentPropertiesDialog
{
this.fileFolderService = fileFolderService;
}
protected FileFolderService getFileFolderService()
{
if (fileFolderService == null)
{
fileFolderService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getFileFolderService();
}
return fileFolderService;
}
/**
* Sets the DictionaryService to use when persisting metadata
@@ -406,6 +422,15 @@ public class DocumentPropertiesDialog
{
this.dictionaryService = dictionaryService;
}
protected DictionaryService getDictionaryService()
{
if (dictionaryService == null)
{
dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
}
return dictionaryService;
}
/**
* @return The BrowseBean

View File

@@ -54,6 +54,8 @@ import org.alfresco.web.bean.repository.Repository;
*/
public class EditContentPropertiesDialog extends BaseDialogBean
{
private static final long serialVersionUID = -5681296528149487178L;
protected static final String TEMP_PROP_MIMETYPE = "mimetype";
protected static final String TEMP_PROP_ENCODING = "encoding";
@@ -100,12 +102,12 @@ public class EditContentPropertiesDialog extends BaseDialogBean
String name = (String) editedProps.get(ContentModel.PROP_NAME);
if (name != null)
{
fileFolderService.rename(nodeRef, name);
getFileFolderService().rename(nodeRef, name);
}
// we need to put all the properties from the editable bag back into
// the format expected by the repository
Map<QName, Serializable> repoProps = this.nodeService.getProperties(nodeRef);
Map<QName, Serializable> repoProps = this.getNodeService().getProperties(nodeRef);
// Extract and deal with the special mimetype property for ContentData
String mimetype = (String) editedProps.get(TEMP_PROP_MIMETYPE);
@@ -135,15 +137,15 @@ public class EditContentPropertiesDialog extends BaseDialogBean
}
// add the "author" aspect if required, properties will get set below
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
if (this.getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
{
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, null);
this.getNodeService().addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, null);
}
// add the "titled" aspect if required, properties will get set below
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false)
if (this.getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false)
{
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
}
// add the remaining properties
@@ -159,7 +161,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
// check for empty strings when using number types, set to null in this case
if (propValue instanceof String)
{
PropertyDefinition propDef = this.dictionaryService.getProperty(qname);
PropertyDefinition propDef = this.getDictionaryService().getProperty(qname);
if (((String)propValue).length() == 0)
{
if (propDef != null)
@@ -184,7 +186,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
}
// send the properties back to the repository
this.nodeService.setProperties(nodeRef, repoProps);
this.getNodeService().setProperties(nodeRef, repoProps);
// we also need to persist any association changes that may have been made
@@ -194,7 +196,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
{
for (AssociationRef assoc : typedAssoc.values())
{
this.nodeService.createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName());
this.getNodeService().createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName());
}
}
@@ -204,7 +206,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
{
for (AssociationRef assoc : typedAssoc.values())
{
this.nodeService.removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName());
this.getNodeService().removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName());
}
}
@@ -214,7 +216,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
{
for (ChildAssociationRef assoc : typedAssoc.values())
{
this.nodeService.addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName());
this.getNodeService().addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName());
}
}
@@ -224,7 +226,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
{
for (ChildAssociationRef assoc : typedAssoc.values())
{
this.nodeService.removeChild(assoc.getParentRef(), assoc.getChildRef());
this.getNodeService().removeChild(assoc.getParentRef(), assoc.getChildRef());
}
}

View File

@@ -65,7 +65,7 @@ public class EditContentWizard extends CreateContentWizard
this.nodeRef = node.getNodeRef();
try
{
formName = (String)nodeService.getProperty(nodeRef, WCMAppModel.PROP_PARENT_FORM_NAME); // getFormName() ...
formName = (String)getNodeService().getProperty(nodeRef, WCMAppModel.PROP_PARENT_FORM_NAME); // getFormName() ...
form = formsService.getForm(this.formName);
}
catch (FormNotFoundException fnfe)
@@ -74,9 +74,9 @@ public class EditContentWizard extends CreateContentWizard
throw new IllegalArgumentException(fnfe);
}
this.content = this.contentService.getReader(nodeRef, ContentModel.PROP_CONTENT).getContentString();
this.content = this.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT).getContentString();
this.fileName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); // getName() ...
this.fileName = (String)getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME); // getName() ...
this.mimeType = MimetypeMap.MIMETYPE_XML;
}
@@ -89,7 +89,7 @@ public class EditContentWizard extends CreateContentWizard
@Override
protected void saveContent(File fileContent, String strContent) throws Exception
{
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
ContentWriter writer = getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
writer.putContent(strContent);
}

View File

@@ -75,7 +75,7 @@ public class EditSimpleWorkflowDialog extends BaseDialogBean
try
{
Map<QName, Serializable> updateProps = nodeService.getProperties(getNode().getNodeRef());
Map<QName, Serializable> updateProps = getNodeService().getProperties(getNode().getNodeRef());
// update the simple workflow properties
@@ -129,7 +129,7 @@ public class EditSimpleWorkflowDialog extends BaseDialogBean
}
// set the properties on the node
nodeService.setProperties(getNode().getNodeRef(), updateProps);
getNodeService().setProperties(getNode().getNodeRef(), updateProps);
getNode().reset();
}
catch (Throwable e)

View File

@@ -37,6 +37,8 @@ import org.alfresco.web.bean.wizard.BaseInviteUsersWizard;
*/
public class InviteContentUsersWizard extends BaseInviteUsersWizard
{
private static final long serialVersionUID = 9198783146031469545L;
/** Cache of available content permissions */
Set<String> contentPermissions = null;
@@ -45,7 +47,7 @@ public class InviteContentUsersWizard extends BaseInviteUsersWizard
{
if (this.contentPermissions == null)
{
this.contentPermissions = this.permissionService.getSettablePermissions(ContentModel.TYPE_CONTENT);
this.contentPermissions = getPermissionService().getSettablePermissions(ContentModel.TYPE_CONTENT);
}
return this.contentPermissions;

View File

@@ -33,6 +33,8 @@ import org.alfresco.web.app.AlfrescoNavigationHandler;
*/
public class SetContentPropertiesDialog extends EditContentPropertiesDialog
{
private static final long serialVersionUID = -7705362669371767349L;
@Override
protected String getDefaultCancelOutcome()
{

View File

@@ -64,14 +64,16 @@ import org.alfresco.web.ui.common.component.UIActionLink;
*
* @author Yanick Pignot
*/
public class VersionedDocumentDetailsDialog
public class VersionedDocumentDetailsDialog implements Serializable
{
/** Dependencies */
protected VersionService versionService;
protected EditionService editionService;
protected NodeService nodeService;
protected MultilingualContentService multilingualContentService;
protected ContentFilterLanguagesService contentFilterLanguagesService;
private static final long serialVersionUID = 1575175076564595262L;
/** Dependencies */
transient private VersionService versionService;
transient private EditionService editionService;
transient private NodeService nodeService;
transient private MultilingualContentService multilingualContentService;
transient private ContentFilterLanguagesService contentFilterLanguagesService;
private static final Comparator VERSION_LABEL_COMPARATOR = new VersionLabelComparator();
@@ -130,7 +132,7 @@ public class VersionedDocumentDetailsDialog
NodeRef currentNodeRef = new NodeRef(Repository.getStoreRef(), id);
// the threatment is different if the node is a translation or a mlContainer
if(nodeService.getType(currentNodeRef).equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER))
if(getNodeService().getType(currentNodeRef).equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER))
{
// test if the lang parameter is valid
ParameterCheck.mandatoryString("The lang of the node", lang);
@@ -140,7 +142,7 @@ public class VersionedDocumentDetailsDialog
versionLabel = cleanVersionLabel(versionLabel);
// set the edition information of the mlContainer of the selected translation version
this.editionHistory = editionService.getEditions(currentNodeRef);
this.editionHistory = getEditionService().getEditions(currentNodeRef);
this.documentEdition = editionHistory.getVersion(versionLabel);
// set the version to display
@@ -151,7 +153,7 @@ public class VersionedDocumentDetailsDialog
fromPreviousEditon = false;
// set the version history
this.versionHistory = versionService.getVersionHistory(currentNodeRef);
this.versionHistory = getVersionService().getVersionHistory(currentNodeRef);
// set the version to display
this.documentVersion = getBrowsingVersionForDocument(currentNodeRef, versionLabel);
}
@@ -242,7 +244,7 @@ public class VersionedDocumentDetailsDialog
public List getTranslations()
{
// get the version of the mlContainer and its translations
List<VersionHistory> translationsList = editionService.getVersionedTranslations(this.documentEdition);
List<VersionHistory> translationsList = getEditionService().getVersionedTranslations(this.documentEdition);
Map<Locale, NodeRef> translationNodeRef;
@@ -250,7 +252,7 @@ public class VersionedDocumentDetailsDialog
if(translationsList.size() == 0)
{
// the selection edition is the current: use the multilingual content service
translationNodeRef = multilingualContentService.getTranslations(this.documentEdition.getVersionedNodeRef());
translationNodeRef = getMultilingualContentService().getTranslations(this.documentEdition.getVersionedNodeRef());
}
else
{
@@ -270,7 +272,7 @@ public class VersionedDocumentDetailsDialog
if(lastVersion != null)
{
NodeRef versionNodeRef = lastVersion.getFrozenStateNodeRef();
Locale locale = (Locale) nodeService.getProperty(versionNodeRef, ContentModel.PROP_LOCALE);
Locale locale = (Locale) getNodeService().getProperty(versionNodeRef, ContentModel.PROP_LOCALE);
translationNodeRef.put(locale, versionNodeRef);
}
}
@@ -289,14 +291,14 @@ public class VersionedDocumentDetailsDialog
String lgge = (locale != null) ?
// convert the locale into new ISO codes
contentFilterLanguagesService.convertToNewISOCode(locale.getLanguage()).toUpperCase()
getContentFilterLanguagesService().convertToNewISOCode(locale.getLanguage()).toUpperCase()
: null;
mapNode.put("name", nodeService.getProperty(nodeRef, ContentModel.PROP_NAME));
mapNode.put("name", getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME));
mapNode.put("language", lgge);
mapNode.put("url", DownloadContentServlet.generateBrowserURL(nodeRef, mapNode.getName()));
mapNode.put("notEmpty", new Boolean(!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)));
mapNode.put("notEmpty", new Boolean(!getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)));
// add the client side version to the list
translations.add(mapNode);
@@ -390,7 +392,7 @@ public class VersionedDocumentDetailsDialog
*/
public String getName()
{
String name = (String) nodeService.getProperty(getFrozenStateNodeRef(), ContentModel.PROP_NAME);
String name = (String)getNodeService().getProperty(getFrozenStateNodeRef(), ContentModel.PROP_NAME);
return name;
}
@@ -405,7 +407,7 @@ public class VersionedDocumentDetailsDialog
public boolean isEmptyTranslation()
{
return nodeService.hasAspect(getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION);
return getNodeService().hasAspect(getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION);
}
/**
@@ -443,7 +445,7 @@ public class VersionedDocumentDetailsDialog
*/
private Version getBrowsingVersionForDocument(NodeRef document, String versionLabel)
{
return this.versionService.getVersionHistory(document).getVersion(versionLabel);
return this.getVersionService().getVersionHistory(document).getVersion(versionLabel);
}
/**
@@ -451,10 +453,10 @@ public class VersionedDocumentDetailsDialog
*/
private Version getBrowsingCurrentVersionForMLContainer(NodeRef document, String lang)
{
NodeRef translation = multilingualContentService.getTranslationForLocale(document, I18NUtil.parseLocale(lang));
this.versionHistory = versionService.getVersionHistory(translation);
NodeRef translation = getMultilingualContentService().getTranslationForLocale(document, I18NUtil.parseLocale(lang));
this.versionHistory = getVersionService().getVersionHistory(translation);
return versionService.getCurrentVersion(translation);
return getVersionService().getCurrentVersion(translation);
}
/**
@@ -464,7 +466,7 @@ public class VersionedDocumentDetailsDialog
private Version getBrowsingVersionForMLContainer(NodeRef document, String editionLabel, String lang)
{
// get the list of translations of the given edition of the mlContainer
List<VersionHistory> translations = editionService.getVersionedTranslations(this.documentEdition);
List<VersionHistory> translations = getEditionService().getVersionedTranslations(this.documentEdition);
// if translation size == 0, the edition is the current edition and the translations are not yet attached.
if(translations.size() == 0)
@@ -488,7 +490,7 @@ public class VersionedDocumentDetailsDialog
if(lastVersion != null)
{
Map<QName, Serializable> properties = editionService.getVersionedMetadatas(lastVersion);
Map<QName, Serializable> properties = getEditionService().getVersionedMetadatas(lastVersion);
Locale locale = (Locale) properties.get(ContentModel.PROP_LOCALE);
if(locale.getLanguage().equalsIgnoreCase(lang))
@@ -512,6 +514,15 @@ public class VersionedDocumentDetailsDialog
{
this.versionService = versionService;
}
protected VersionService getVersionService()
{
if (versionService == null)
{
versionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService();
}
return versionService;
}
/**
* @param editionService the Edition Service to set
@@ -520,6 +531,15 @@ public class VersionedDocumentDetailsDialog
{
this.editionService = editionService;
}
protected EditionService getEditionService()
{
if (editionService == null)
{
editionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getEditionService();
}
return editionService;
}
/**
* @param nodeService the Node Service to set
@@ -528,6 +548,15 @@ public class VersionedDocumentDetailsDialog
{
this.nodeService = nodeService;
}
protected NodeService getNodeService()
{
if (nodeService == null)
{
nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService();
}
return nodeService;
}
/**
* @param contentFilterLanguagesService the Content Filter Languages Service to set
@@ -536,6 +565,15 @@ public class VersionedDocumentDetailsDialog
{
this.contentFilterLanguagesService = contentFilterLanguagesService;
}
protected ContentFilterLanguagesService getContentFilterLanguagesService()
{
if (contentFilterLanguagesService == null)
{
contentFilterLanguagesService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentFilterLanguagesService();
}
return contentFilterLanguagesService;
}
/**
* @param Multilingual Content Service the Multilingual Content Service to set
@@ -544,4 +582,13 @@ public class VersionedDocumentDetailsDialog
{
this.multilingualContentService = multilingualContentService;
}
protected MultilingualContentService getMultilingualContentService()
{
if (multilingualContentService == null)
{
multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService();
}
return multilingualContentService;
}
}

View File

@@ -41,6 +41,8 @@ import org.alfresco.web.bean.repository.Node;
*/
public class ViewContentPropertiesDialog extends BaseDialogBean
{
private static final long serialVersionUID = -867609607881256449L;
protected static final String TEMP_PROP_MIMETYPE = "mimetype";
protected static final String TEMP_PROP_ENCODING = "encoding";