03-25-2010 02:50 AM
StoreRef storeRef5 = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
ResultSet rs = serviceRegistry.getSearchService().query(storeRef5, SearchService.LANGUAGE_XPATH, "/app:company_home");
NodeRef companyHomeNodeRef = null;
try
{
if (rs.length() == 0)
{
throw new AlfrescoRuntimeException("Didn't find Company Home");
}
companyHomeNodeRef = rs.getNodeRef(0);
}catch (Exception e) {
logger.error("Error while getting company home "+e.getMessage());
}
List<ChildAssociationRef> children = serviceRegistry.getNodeService().getChildAssocs(companyHomeNodeRef);
for (ChildAssociationRef childAssoc : children) {
NodeRef childNodeRef = childAssoc.getChildRef();
logger.debug("childNodeRef "+" "+childNodeRef.getId()+childNodeRef.getStoreRef());
}
net.sf.acegisecurity.AuthenticationCredentialsNotFoundException: A valid SecureContext was not provided in the RequestContext
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:477)
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:355)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:238)
at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:205)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:153)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy27.query(Unknown Source)
at com.xxxx.alfresco.km.constraints.CommunitySearchConstraint.getAllowedValues(CommunitySearchConstraint.java:182)
at org.alfresco.cmis.dictionary.CMISBasePropertyDefinition.<init>(CMISBasePropertyDefinition.java:108)
at org.alfresco.cmis.dictionary.CMISAbstractTypeDefinition.createProperty(CMISAbstractTypeDefinition.java:126)
at org.alfresco.cmis.dictionary.CMISAbstractTypeDefinition.createProperties(CMISAbstractTypeDefinition.java:104)…..
ResultSet rs = serviceRegistry.getSearchService().query(storeRef5, SearchService.LANGUAGE_XPATH, "/app:company_home");
03-25-2010 03:42 AM
Access to Java Foundation API
The Java Foundation API is in fact a set of interfaces; each interface represents a function of the repository. A Spring Framework Bean is provided as the implementation for each interface.
The list of available public services (that is, Spring beans) can be found in:
the configuration file /projects/repository/config/alfresco/public-services-context.xml
the service interface org.alfresco.service.ServiceRegistry
There are three approaches to accessing the interfaces in your own code:
Use standard Spring dependency injection (recommended, if your client code is also Spring based)
Manual access via the Spring getBean() method
Indirectly via Alfresco's ServiceRegistry
Spring provides excellent documentation on how to bind Beans together, so that will not be duplicated here.
03-30-2010 07:49 AM
03-30-2010 08:02 AM
04-05-2010 12:39 AM
04-13-2010 07:02 AM
07-27-2010 11:24 AM
07-22-2011 04:43 AM
10-04-2016 04:08 PM
All code which do critical operations against repository requires to run with secure context and within one single transaction.
You can achieve this by putting code under runas block.
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() {
public Void doWork(){
//Put you logic here
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
Hope this helps to all other users.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.