use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class EditUserDetailsDialog method finishImpl.
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception {
try {
ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
DictionaryService dd = services.getDictionaryService();
Map<QName, Serializable> props = getNodeService().getProperties(getPerson().getNodeRef());
for (String key : getPerson().getProperties().keySet()) {
QName propQName = QName.createQName(key);
if (dd.getProperty(propQName) == null || dd.getProperty(propQName).isProtected() == false) {
props.put(propQName, (Serializable) getPerson().getProperties().get(key));
}
}
// persist all property changes
NodeRef personRef = getPerson().getNodeRef();
this.getNodeService().setProperties(personRef, props);
// save person description content field
if (this.personDescription != null) {
ContentService cs = services.getContentService();
ContentWriter writer = cs.getWriter(personRef, ContentModel.PROP_PERSONDESC, true);
writer.setMimetype(MimetypeMap.MIMETYPE_HTML);
writer.putContent(this.personDescription);
}
// setup user avatar association
if (this.photoRef != null) {
List<AssociationRef> refs = this.getNodeService().getTargetAssocs(personRef, ContentModel.ASSOC_AVATAR);
// remove old association if it exists
if (refs.size() == 1) {
NodeRef existingRef = refs.get(0).getTargetRef();
this.getNodeService().removeAssociation(personRef, existingRef, ContentModel.ASSOC_AVATAR);
}
// setup new association
this.getNodeService().createAssociation(personRef, this.photoRef, ContentModel.ASSOC_AVATAR);
}
// if the above calls were successful, then reset Person Node in the session
Application.getCurrentUser(context).reset();
} catch (Throwable err) {
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err);
outcome = null;
ReportedException.throwIfNecessary(err);
}
return outcome;
}
use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class UpdateDocEvaluator method evaluate.
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node) {
DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
boolean isOfflineEditing = (EditOfflineDialog.OFFLINE_EDITING.equals(node.getProperties().get(ContentModel.PROP_WORKING_COPY_MODE)));
return dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT) && ((node.isWorkingCopyOwner() && !isOfflineEditing) || (!node.isLocked() && !node.hasAspect(ContentModel.ASPECT_WORKING_COPY)));
}
use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class EditDocOnlineCIFSEvaluator method evaluate.
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node) {
FacesContext fc = FacesContext.getCurrentInstance();
DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService();
boolean result = false;
// if the node is inline editable, the inline online editing should always be used
if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT)) {
Map<String, Object> props = node.getProperties();
if ("cifs".equals(Application.getClientConfig(fc).getEditLinkType()) && (!node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) || props.get(ApplicationModel.PROP_EDITINLINE) == null || !((Boolean) props.get(ApplicationModel.PROP_EDITINLINE)).booleanValue())) {
if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY)) {
result = (EditOnlineDialog.ONLINE_EDITING.equals(props.get(ContentModel.PROP_WORKING_COPY_MODE)));
} else {
result = super.evaluate(node);
}
}
}
return result;
}
use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class EditDocOnlineHttpEvaluator method evaluate.
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node) {
FacesContext fc = FacesContext.getCurrentInstance();
DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService();
boolean result = false;
if (node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) {
// this branch from EditDocHttpEvaluator
// skip, result = false
} else if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT)) {
Map<String, Object> props = node.getProperties();
if ((node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) && props.get(ApplicationModel.PROP_EDITINLINE) != null && ((Boolean) props.get(ApplicationModel.PROP_EDITINLINE)).booleanValue())) {
if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY)) {
result = EditOnlineDialog.ONLINE_EDITING.equals(props.get(ContentModel.PROP_WORKING_COPY_MODE));
} else {
result = super.evaluate(node);
}
}
}
return result;
}
use of org.alfresco.service.cmr.dictionary.DictionaryService in project acs-community-packaging by Alfresco.
the class EditDocOnlineWebDavEvaluator method evaluate.
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node) {
FacesContext fc = FacesContext.getCurrentInstance();
DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService();
boolean result = false;
// if the node is inline editable, the inline online editing should always be used
if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT)) {
Map<String, Object> props = node.getProperties();
if ("webdav".equals(Application.getClientConfig(fc).getEditLinkType()) && (!node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) || props.get(ApplicationModel.PROP_EDITINLINE) == null || !((Boolean) props.get(ApplicationModel.PROP_EDITINLINE)).booleanValue())) {
if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY)) {
result = (EditOnlineDialog.ONLINE_EDITING.equals(props.get(ContentModel.PROP_WORKING_COPY_MODE)));
} else {
result = super.evaluate(node);
}
}
}
return result;
}
Aggregations