mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.0 to HEAD
5448: (From V1.4) 5281 (V1.4): Patches not executed in read-only mode 5284 (V1.4): Integrity messages 5308 (V1.4): Category selector performance 5331 (V1.4): Category performance 5402 (V1.4): AR-1315 5410 (V1.4): 5417 (V1.4): Upgrade script performance 5435 (V1.4): Lucene test text encoding git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5482 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -52,6 +52,7 @@ import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.AVMConstants;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.WebResources;
|
||||
import org.springframework.web.jsf.FacesContextUtils;
|
||||
|
||||
/**
|
||||
* Abstract component to allow the selection of a hierarchical item
|
||||
@@ -272,6 +273,12 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
|
||||
NodeService service = getNodeService(context);
|
||||
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
{
|
||||
tx = Repository.getUserTransaction(context, true);
|
||||
tx.begin();
|
||||
|
||||
if (isDisabled())
|
||||
{
|
||||
// render a read-only view of the selected category (if any)
|
||||
@@ -339,12 +346,6 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
case MODE_CONFIRM_SELECTION:
|
||||
case MODE_CANCEL_SELECTION:
|
||||
{
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
{
|
||||
tx = Repository.getUserTransaction(context, true);
|
||||
tx.begin();
|
||||
|
||||
NodeRef submittedValue = (NodeRef)getSubmittedValue();
|
||||
if (submittedValue != null)
|
||||
{
|
||||
@@ -449,14 +450,6 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
.append(label)
|
||||
.append("</a></span>");
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||
Utils.addErrorMessage(err.getMessage(), err);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -519,12 +512,6 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
childRefs = getRootChildren(context);
|
||||
}
|
||||
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
{
|
||||
tx = Repository.getUserTransaction(context, true);
|
||||
tx.begin();
|
||||
|
||||
for (NodeRef childRef : childRefs)
|
||||
{
|
||||
// render each child found
|
||||
@@ -584,14 +571,6 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
|
||||
buf.append("</table>");
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||
throw new RuntimeException(err);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -611,6 +590,14 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
|
||||
context.getResponseWriter().write(buf.toString());
|
||||
}
|
||||
|
||||
// commit the transaction
|
||||
tx.commit();
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -804,7 +791,8 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
*/
|
||||
protected static NodeService getNodeService(FacesContext context)
|
||||
{
|
||||
NodeService service = Repository.getServiceRegistry(context).getNodeService();
|
||||
NodeService service = (NodeService)FacesContextUtils.getRequiredWebApplicationContext(
|
||||
context).getBean("nodeService");
|
||||
if (service == null)
|
||||
{
|
||||
throw new IllegalStateException("Unable to obtain NodeService bean reference.");
|
||||
|
Reference in New Issue
Block a user