本文整理汇总了Java中org.alfresco.repo.policy.PolicyComponent类的典型用法代码示例。如果您正苦于以下问题:Java PolicyComponent类的具体用法?Java PolicyComponent怎么用?Java PolicyComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PolicyComponent类属于org.alfresco.repo.policy包,在下文中一共展示了PolicyComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NodeMonitor
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
/**
* Class constructor
*
* @param filesysCtx ContentContext
* @param nodeService NodeService
* @param policyComponent PolicyComponent
* @param fileFolderService FileFolderService
* @param permissionService PermissionService
* @param transService TransactionService
*/
protected NodeMonitor(ContentContext filesysCtx, NodeService nodeService, PolicyComponent policyComponent,
FileFolderService fileFolderService, PermissionService permissionService, TransactionService transService) {
m_filesysCtx = filesysCtx;
// Set various services
m_nodeService = nodeService;
m_policyComponent = policyComponent;
m_fileFolderService = fileFolderService;
m_permissionService = permissionService;
m_transService = transService;
// Initialize the node monitor
init();
}
示例2: initStaticData
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
@BeforeClass public static void initStaticData() throws Exception
{
CONTENT_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("ContentService", ContentService.class);
NODE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("NodeService", NodeService.class);
SERVICE_REGISTRY = APP_CONTEXT_INIT.getApplicationContext().getBean("ServiceRegistry", ServiceRegistry.class);
TRANSACTION_HELPER = APP_CONTEXT_INIT.getApplicationContext().getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
PERMISSION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("permissionService", PermissionServiceSPI.class);
SEARCH_SCRIPT = APP_CONTEXT_INIT.getApplicationContext().getBean("searchScript", Search.class);
VERSIONABLE_ASPECT = APP_CONTEXT_INIT.getApplicationContext().getBean("versionableAspect", VersionableAspect.class);
VERSION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("VersionService", VersionService.class);
DICTIONARY_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("DictionaryService", DictionaryService.class);
NAMESPACE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("namespaceService", NamespaceService.class);
DICTIONARY_DAO = APP_CONTEXT_INIT.getApplicationContext().getBean("dictionaryDAO", DictionaryDAO.class);
TENANT_ADMIN_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("tenantAdminService", TenantAdminService.class);
MESSAGE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("messageService", MessageService.class);
TRANSACTION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("transactionComponent", TransactionService.class);
POLICY_COMPONENT = APP_CONTEXT_INIT.getApplicationContext().getBean("policyComponent", PolicyComponent.class);
USER_ONES_TEST_SITE = STATIC_TEST_SITES.createTestSiteWithUserPerRole(GUID.generate(), "sitePreset", SiteVisibility.PRIVATE, USER_ONE_NAME);
USER_ONES_TEST_FILE = STATIC_TEST_NODES.createQuickFile(MimetypeMap.MIMETYPE_TEXT_PLAIN, USER_ONES_TEST_SITE.doclib, "test.txt", USER_ONE_NAME);
}
示例3: bindBehaviour
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
protected void bindBehaviour()
{
if (logger.isDebugEnabled())
{
logger.debug("[bindBeahaviour] Binding behaviours");
}
PolicyComponent policyComponent = (PolicyComponent) serviceRegistry.getService(QName.createQName(NamespaceService.ALFRESCO_URI, "policyComponent"));
// Only listen to folders we've tagged with imap properties - not all folders or we'll really slow down the repository!
policyComponent.bindAssociationBehaviour(
OnCreateChildAssociationPolicy.QNAME,
ImapModel.ASPECT_IMAP_FOLDER,
ContentModel.ASSOC_CONTAINS,
new JavaBehaviour(this, "onCreateChildAssociation", NotificationFrequency.EVERY_EVENT));
policyComponent.bindAssociationBehaviour(
OnDeleteChildAssociationPolicy.QNAME,
ImapModel.ASPECT_IMAP_FOLDER,
ContentModel.ASSOC_CONTAINS,
new JavaBehaviour(this, "onDeleteChildAssociation", NotificationFrequency.EVERY_EVENT));
policyComponent.bindClassBehaviour(
OnUpdatePropertiesPolicy.QNAME,
ContentModel.TYPE_CONTENT,
new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.EVERY_EVENT));
policyComponent.bindClassBehaviour(
BeforeDeleteNodePolicy.QNAME,
ContentModel.TYPE_CONTENT,
new JavaBehaviour(this, "beforeDeleteNode", NotificationFrequency.EVERY_EVENT));
policyComponent.bindClassBehaviour(
OnRestoreNodePolicy.QNAME,
ContentModel.TYPE_CONTENT,
new JavaBehaviour(this, "onRestoreNode", NotificationFrequency.EVERY_EVENT));
}
示例4: setUp
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
public void setUp() throws Exception
{
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
{
throw new AlfrescoRuntimeException(
"A previous tests did not clean up transaction: " +
AlfrescoTransactionSupport.getTransactionId());
}
serviceRegistry = (ServiceRegistry)ctx.getBean("ServiceRegistry");
SimpleCache<String, RepositoryAuthenticationDao.CacheEntry> authenticationCache = (SimpleCache<String, RepositoryAuthenticationDao.CacheEntry>) ctx.getBean("authenticationCache");
SimpleCache<String, NodeRef> immutableSingletonCache = (SimpleCache<String, NodeRef>) ctx.getBean("immutableSingletonCache");
TenantService tenantService = (TenantService) ctx.getBean("tenantService");
compositePasswordEncoder = (CompositePasswordEncoder) ctx.getBean("compositePasswordEncoder");
PolicyComponent policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
repositoryAuthenticationDao = new RepositoryAuthenticationDao();
repositoryAuthenticationDao.setTransactionService(serviceRegistry.getTransactionService());
repositoryAuthenticationDao.setAuthorityService(serviceRegistry.getAuthorityService());
repositoryAuthenticationDao.setTenantService(tenantService);
repositoryAuthenticationDao.setNodeService(serviceRegistry.getNodeService());
repositoryAuthenticationDao.setNamespaceService(serviceRegistry.getNamespaceService());
repositoryAuthenticationDao.setCompositePasswordEncoder(compositePasswordEncoder);
repositoryAuthenticationDao.setPolicyComponent(policyComponent);
repositoryAuthenticationDao.setAuthenticationCache(authenticationCache);
repositoryAuthenticationDao.setSingletonCache(immutableSingletonCache);
upgradePasswordHashWorker = (UpgradePasswordHashWorker)ctx.getBean("upgradePasswordHashWorker");
nodeService = serviceRegistry.getNodeService();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
}
示例5: setUp
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext();
JobLockService jobLockService = (JobLockService) ctx.getBean("JobLockService");
PolicyComponent policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
NodeService nodeService = (NodeService) ctx.getBean("NodeService");
siteService = (SiteService) ctx.getBean("SiteService");
personService = (PersonService) ctx.getBean("PersonService");
feedDAO = (ActivityFeedDAO) ctx.getBean("feedDAO");
transactionHelper = (RetryingTransactionHelper)ctx.getBean("retryingTransactionHelper");
nodeArchiveService = (NodeArchiveService)ctx.getBean("nodeArchiveService");
// Let's shut down the scheduler so that we aren't competing with the scheduled versions of jobs (ie. feed cleaner)
Scheduler scheduler = (Scheduler) ctx.getBean("schedulerFactory");
scheduler.shutdown();
tearDown();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
for (int i = 1; i <= 7; i++)
{
siteService.createSite("myPreset", "testSite"+i, null, null, SiteVisibility.PUBLIC);
}
AuthenticationUtil.setRunAsUserSystem();
// construct the test cleaner
cleaner = new FeedCleaner();
cleaner.setFeedDAO(feedDAO);
cleaner.setPolicyComponent(policyComponent);
cleaner.setJobLockService(jobLockService);
cleaner.setNodeService(nodeService);
}
示例6: onSetUp
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
/**
* Called during the transaction setup
*/
protected void onSetUp() throws Exception
{
super.onSetUp();
System.out.println("java.io.tmpdir == " + System.getProperty("java.io.tmpdir"));
// Get the required services
this.nodeService = (NodeService) this.applicationContext.getBean("nodeService");
this.contentService = (ContentService) this.applicationContext.getBean("contentService");
this.authenticationService = (MutableAuthenticationService) this.applicationContext
.getBean("authenticationService");
this.actionService = (ActionService) this.applicationContext.getBean("actionService");
this.transactionService = (TransactionService) this.applicationContext.getBean("transactionComponent");
this.authenticationComponent = (AuthenticationComponent) this.applicationContext
.getBean("authenticationComponent");
this.receiver = (RepoTransferReceiverImpl) this.getApplicationContext().getBean("transferReceiver");
this.policyComponent = (PolicyComponent) this.getApplicationContext().getBean("policyComponent");
this.searchService = (SearchService) this.getApplicationContext().getBean("searchService");
this.repositoryHelper = (Repository) this.getApplicationContext().getBean("repositoryHelper");
this.namespaceService = (NamespaceService) this.getApplicationContext().getBean("namespaceService");
this.dummyContent = "This is some dummy content.";
this.dummyContentBytes = dummyContent.getBytes("UTF-8");
setTransactionDefinition(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
authenticationComponent.setSystemUserAsCurrentUser();
startNewTransaction();
guestHome = repositoryHelper.getGuestHome();
endTransaction();
}
示例7: setUp
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext();
transactionService = (TransactionService) ctx.getBean("TransactionService");
nodeService = (NodeService) ctx.getBean("NodeService");
contentService = (ContentService) ctx.getBean(ServiceRegistry.CONTENT_SERVICE.getLocalName());
this.policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
// authenticate
this.authenticationComponent.setSystemUserAsCurrentUser();
// start the transaction
txn = getUserTransaction();
txn.begin();
// create a store and get the root node
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, getName());
if (!nodeService.exists(storeRef))
{
storeRef = nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
}
rootNodeRef = nodeService.getRootNode(storeRef);
// create a content node
ContentData contentData = new ContentData(null, "text/plain", 0L, "UTF-16", Locale.CHINESE);
PropertyMap properties = new PropertyMap();
properties.put(ContentModel.PROP_CONTENT, contentData);
ChildAssociationRef assocRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(TEST_NAMESPACE, GUID.generate()),
ContentModel.TYPE_CONTENT,
properties);
contentNodeRef = assocRef.getChildRef();
}
示例8: onSetUpInTransaction
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
/**
* On setup in transaction implementation
*/
@Override
protected void onSetUpInTransaction()
throws Exception
{
// Get the required services
this.nodeService = (NodeService)this.applicationContext.getBean("nodeService");
this.policyComponent = (PolicyComponent)this.applicationContext.getBean("policyComponent");
this.serviceRegistry = (ServiceRegistry)this.applicationContext.getBean("ServiceRegistry");
AuthenticationComponent authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Create the store and get the root node reference
this.storeRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
NodeRef rootNodeRef = this.nodeService.getRootNode(storeRef);
// Create folder node
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
props.put(ContentModel.PROP_NAME, "TestFolder");
ChildAssociationRef childAssocRef = this.nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}TestFolder"),
ContentModel.TYPE_FOLDER,
props);
this.folderNodeRef = childAssocRef.getChildRef();
}
示例9: testAR1303
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
public void testAR1303() throws Exception
{
PolicyComponent policyComponent = (PolicyComponent) this.applicationContext.getBean("policyComponent");
JavaBehaviour behaviour = new JavaBehaviour(this, "onUpdateProperties");
BehaviourDefinition<ClassBehaviourBinding> bindClassBehaviour = null;
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
props.put(ContentModel.PROP_NAME, "test_testAR1303.txt");
NodeRef nodeRef = this.nodeService.createNode(this.rootNodeRef, ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN,
ContentModel.TYPE_CONTENT, props).getChildRef();
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, "my description");
nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, "my title");
try
{
bindClassBehaviour = policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), ContentModel.ASPECT_TITLED,
behaviour);
behaviourExecuted = false;
// Update the title property and check that the behaviour has been fired
nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, "changed title");
assertTrue("The onUpdateProperties behaviour has not been fired.", behaviourExecuted);
}
finally
{
if (bindClassBehaviour != null)
{
policyComponent.removeClassDefinition(bindClassBehaviour);
}
}
}
示例10: setUp
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
searchService = ctx.getBean("SearchService", SearchService.class);
fileFolderService = ctx.getBean("FileFolderService", FileFolderService.class);
nodeService = ctx.getBean("NodeService", NodeService.class);
transactionService = ctx.getBean("transactionService", TransactionService.class);
webDAVHelper = ctx.getBean("webDAVHelper", WebDAVHelper.class);
lockService = ctx.getBean("LockService", LockService.class);
policyComponent = ctx.getBean("policyComponent", PolicyComponent.class);
namespaceService = ctx.getBean("namespaceService", NamespaceService.class);
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
repositoryHelper = (Repository)ctx.getBean("repositoryHelper");
companyHomeNodeRef = repositoryHelper.getCompanyHome();
InputStream testDataIS = getClass().getClassLoader().getResourceAsStream(TEST_DATA_FILE_NAME);
InputStream davLockInfoIS = getClass().getClassLoader().getResourceAsStream(DAV_LOCK_INFO_XML);
testDataFile = IOUtils.toByteArray(testDataIS);
davLockInfoFile = IOUtils.toByteArray(davLockInfoIS);
testDataIS.close();
davLockInfoIS.close();
txn = transactionService.getUserTransaction();
txn.begin();
}
示例11: setUp
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
searchService = ctx.getBean("SearchService", SearchService.class);
fileFolderService = ctx.getBean("FileFolderService", FileFolderService.class);
nodeService = ctx.getBean("NodeService", NodeService.class);
transactionService = ctx.getBean("transactionService", TransactionService.class);
webDAVHelper = ctx.getBean("webDAVHelper", WebDAVHelper.class);
lockService = ctx.getBean("LockService", LockService.class);
policyComponent = ctx.getBean("policyComponent", PolicyComponent.class);
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
companyHomeNodeRef = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
{
@Override
public NodeRef execute() throws Throwable
{
// find "Company Home"
ResultSet resultSet = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, "PATH:\"/app:company_home\"");
NodeRef result = resultSet.getNodeRef(0);
resultSet.close();
return result;
}
});
InputStream testDataIS = getClass().getClassLoader().getResourceAsStream(TEST_DATA_FILE_NAME);
InputStream davLockInfoIS = getClass().getClassLoader().getResourceAsStream(DAV_LOCK_INFO_XML);
testDataFile = IOUtils.toByteArray(testDataIS);
davLockInfoFile = IOUtils.toByteArray(davLockInfoIS);
testDataIS.close();
davLockInfoIS.close();
txn = transactionService.getUserTransaction();
txn.begin();
}
示例12: initServices
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
/**
* Initialise the service beans.
*/
protected void initServices()
{
applicationContext = getServer().getApplicationContext();
// Common test utils
utils = new CommonRMTestUtils(applicationContext);
// Get services
nodeService = (NodeService)applicationContext.getBean("NodeService");
contentService = (ContentService)applicationContext.getBean("ContentService");
retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper");
namespaceService = (NamespaceService)applicationContext.getBean("NamespaceService");
searchService = (SearchService)applicationContext.getBean("SearchService");
policyComponent = (PolicyComponent)applicationContext.getBean("policyComponent");
dictionaryService = (DictionaryService)applicationContext.getBean("DictionaryService");
siteService = (SiteService)applicationContext.getBean("SiteService");
authorityService = (AuthorityService)applicationContext.getBean("AuthorityService");
authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
personService = (PersonService)applicationContext.getBean("PersonService");
transactionService = (TransactionService)applicationContext.getBean("TransactionService");
taggingService = (TaggingService)applicationContext.getBean("TaggingService");
// Get RM services
dispositionService = (DispositionService)applicationContext.getBean("DispositionService");
eventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService");
adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService");
actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService");
rmSearchService = (RecordsManagementSearchService)applicationContext.getBean("RecordsManagementSearchService");
filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService");
filePlanPermissionService = (FilePlanPermissionService)applicationContext.getBean("FilePlanPermissionService");
auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService");
capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService");
vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService");
filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService");
recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService");
caveatConfigService = (RMCaveatConfigService)applicationContext.getBean("CaveatConfigService");
}
示例13: onSetUp
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
/**
* Called during the transaction setup
*/
protected void onSetUp() throws Exception
{
super.onSetUp();
System.out.println("java.io.tmpdir == " + System.getProperty("java.io.tmpdir"));
// Get the required services
this.nodeService = (NodeService) this.applicationContext.getBean("nodeService");
this.contentService = (ContentService) this.applicationContext.getBean("contentService");
this.authenticationService = (MutableAuthenticationService) this.applicationContext
.getBean("authenticationService");
this.actionService = (ActionService) this.applicationContext.getBean("actionService");
this.transactionService = (TransactionService) this.applicationContext.getBean("transactionComponent");
this.authenticationComponent = (AuthenticationComponent) this.applicationContext
.getBean("authenticationComponent");
this.receiver = (RepoTransferReceiverImpl) this.getApplicationContext().getBean("transferReceiver");
this.policyComponent = (PolicyComponent) this.getApplicationContext().getBean("policyComponent");
this.searchService = (SearchService) this.getApplicationContext().getBean("searchService");
this.dummyContent = "This is some dummy content.";
this.dummyContentBytes = dummyContent.getBytes("UTF-8");
setTransactionDefinition(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
authenticationComponent.setSystemUserAsCurrentUser();
startNewTransaction();
String guestHomeQuery = "/app:company_home/app:guest_home";
ResultSet guestHomeResult = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_XPATH, guestHomeQuery);
assertEquals("", 1, guestHomeResult.length());
guestHome = guestHomeResult.getNodeRef(0);
endTransaction();
}
示例14: setUp
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
transactionService = (TransactionService) ctx.getBean("TransactionService");
nodeService = (NodeService) ctx.getBean("NodeService");
contentService = (ContentService) ctx.getBean(ServiceRegistry.CONTENT_SERVICE.getLocalName());
this.policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
// authenticate
this.authenticationComponent.setSystemUserAsCurrentUser();
// start the transaction
txn = getUserTransaction();
txn.begin();
// create a store and get the root node
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, getName());
if (!nodeService.exists(storeRef))
{
storeRef = nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
}
rootNodeRef = nodeService.getRootNode(storeRef);
// create a content node
ContentData contentData = new ContentData(null, "text/plain", 0L, "UTF-16", Locale.CHINESE);
PropertyMap properties = new PropertyMap();
properties.put(ContentModel.PROP_CONTENT, contentData);
ChildAssociationRef assocRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(TEST_NAMESPACE, GUID.generate()),
ContentModel.TYPE_CONTENT,
properties);
contentNodeRef = assocRef.getChildRef();
}
示例15: testAR1303
import org.alfresco.repo.policy.PolicyComponent; //导入依赖的package包/类
public void testAR1303() throws Exception
{
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
props.put(ContentModel.PROP_NAME, "test.txt");
NodeRef nodeRef = this.nodeService.createNode(
this.rootNodeRef,
ContentModel.ASSOC_CHILDREN,
ContentModel.ASSOC_CHILDREN,
ContentModel.TYPE_CONTENT,
props).getChildRef();
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, "my description");
nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, "my title");
JavaBehaviour behaviour = new JavaBehaviour(this, "onUpdateProperties");
PolicyComponent policyComponent = (PolicyComponent)this.applicationContext.getBean("policyComponent");
policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
ContentModel.ASPECT_TITLED,
behaviour);
behaviourExecuted = false;
// Update the title property and check that the behaviour has been fired
nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, "changed title");
assertTrue("The onUpdateProperties behaviour has not been fired.", behaviourExecuted);
}