Java Code Examples for org.alfresco.service.cmr.dictionary.DictionaryService

The following examples show how to use org.alfresco.service.cmr.dictionary.DictionaryService. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@BeforeClass public static void initTestsContext() throws Exception
{
    ApplicationContext testContext = APP_CONTEXT_INIT.getApplicationContext();
    
    PRIVATE_REMOTE_CREDENTIALS_SERVICE = (RemoteCredentialsService)testContext.getBean("remoteCredentialsService");
    REMOTE_CREDENTIALS_SERVICE = (RemoteCredentialsService)testContext.getBean("RemoteCredentialsService");
    
    AUTHENTICATION_SERVICE = (MutableAuthenticationService)testContext.getBean("authenticationService");
    BEHAVIOUR_FILTER       = (BehaviourFilter)testContext.getBean("policyBehaviourFilter");
    DICTIONARY_SERVICE     = (DictionaryService)testContext.getBean("dictionaryService");
    NAMESPACE_SERVICE      = (NamespaceService)testContext.getBean("namespaceService");
    REPOSITORY_HELPER      = (Repository)testContext.getBean("repositoryHelper");
    NODE_SERVICE           = (NodeService)testContext.getBean("nodeService");
    PUBLIC_NODE_SERVICE    = (NodeService)testContext.getBean("NodeService");
    PERSON_SERVICE         = (PersonService)testContext.getBean("personService");
    TRANSACTION_HELPER     = (RetryingTransactionHelper)testContext.getBean("retryingTransactionHelper");
    TRANSACTION_SERVICE    = (TransactionService)testContext.getBean("TransactionService");
    PERMISSION_SERVICE     = (PermissionService)testContext.getBean("permissionService");

    // Switch to a test shared system container
    RemoteCredentialsServiceImpl.setSharedCredentialsSystemContainerName(SHARED_SYSTEM_CONTAINER_NAME);
}
 
Example 2
/**
     * Context for building lucene queries
     *
     * @param dictionaryService
     * @param namespacePrefixResolver
     * @param tenantService
     * @param searchParameters
     * @param defaultSearchMLAnalysisMode
     * @param req
     * @param model
     */
    public Lucene4QueryBuilderContextSolrImpl(DictionaryService dictionaryService, NamespacePrefixResolver namespacePrefixResolver, TenantService tenantService,
            SearchParameters searchParameters, MLAnalysisMode defaultSearchMLAnalysisMode, SolrQueryRequest req, AlfrescoSolrDataModel model, FTSQueryParser.RerankPhase rerankPhase)
    {
          lqp = new Solr4QueryParser(req, Version.LATEST, searchParameters.getDefaultFieldName(), req.getSchema().getQueryAnalyzer(), rerankPhase);
//        lqp.setDefaultOperator(AbstractLuceneQueryParser.OR_OPERATOR);
        lqp.setDictionaryService(dictionaryService);
        lqp.setNamespacePrefixResolver(namespacePrefixResolver);
        lqp.setTenantService(tenantService);
          lqp.setSearchParameters(searchParameters);
//        lqp.setDefaultSearchMLAnalysisMode(defaultSearchMLAnalysisMode);
//        lqp.setIndexReader(indexReader);
//        lqp.setAllowLeadingWildcard(true);
//        this.namespacePrefixResolver = namespacePrefixResolver;
        
          Properties props = new CoreDescriptorDecorator(req.getCore().getCoreDescriptor()).getProperties();
          int topTermSpanRewriteLimit = Integer.parseInt(props.getProperty("alfresco.topTermSpanRewriteLimit", "1000"));
          lqp.setTopTermSpanRewriteLimit(topTermSpanRewriteLimit);
          
          lqpa = new Lucene4QueryParserAdaptor(lqp);
    }
 
Example 3
@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);		
}
 
Example 4
/**
 * Loads the test model required for building the node graphs
 */
public static DictionaryService loadModel(ApplicationContext applicationContext)
{
    DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
    
    // load the system model
    ClassLoader cl = PerformanceNodeServiceTest.class.getClassLoader();
    InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
    assertNotNull(modelStream);
    M2Model model = M2Model.createModel(modelStream);
    dictionaryDao.putModel(model);
    
    // load the test model
    modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
    assertNotNull(modelStream);
    model = M2Model.createModel(modelStream);
    dictionaryDao.putModel(model);
    
    DictionaryComponent dictionary = new DictionaryComponent();
    dictionary.setDictionaryDAO(dictionaryDao);
    
    return dictionary;
}
 
Example 5
@Override
protected void setUp() throws Exception
{
    super.setUp();
    
    repoAdminService = (RepoAdminService) ctx.getBean("RepoAdminService");
    dictionaryService = (DictionaryService) ctx.getBean("DictionaryService");
    transactionService = (TransactionService) ctx.getBean("TransactionService");
    nodeService = (NodeService) ctx.getBean("NodeService");
    contentService = (ContentService) ctx.getBean("ContentService");
    searchService = (SearchService) ctx.getBean("SearchService");
    namespaceService = (NamespaceService) ctx.getBean("NamespaceService");
    behaviourFilter = (BehaviourFilter)ctx.getBean("policyBehaviourFilter");
    dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO");
    
    DbNodeServiceImpl dbNodeService = (DbNodeServiceImpl)ctx.getBean("dbNodeService");
    dbNodeService.setEnableTimestampPropagation(false);
    
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
}
 
Example 6
@Override
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors, Map<String, Argument> functionArgs,  FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
{
    Function function = getFunction();
    if(function != null)
    {
        if(function instanceof DBQueryBuilderComponent)
        {
            DBQueryBuilderComponent dbQueryBuilderComponent = (DBQueryBuilderComponent)function;
            dbQueryBuilderComponent.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectors,  getFunctionArguments(), functionContext, supportBooleanFloatAndDouble);
        }
        else
        {
            throw new UnsupportedOperationException();
        }
    }
}
 
Example 7
@Override
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
        Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
{
    for (Constraint constraint : getConstraints())
    {
        if (constraint instanceof DBQueryBuilderComponent)
        {
            if(constraint.getOccur() == Occur.OPTIONAL)
            {
                throw new QueryModelException("Disjunctions are not suported");
            }
            DBQueryBuilderComponent dbQueryBuilderComponent = (DBQueryBuilderComponent) constraint;
            dbQueryBuilderComponent.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectors, functionArgs, functionContext, supportBooleanFloatAndDouble);
        }
        else
        {
            throw new UnsupportedOperationException();
        }
    }
}
 
Example 8
public void init()
{
    super.init();
    // Quickly scan the supplied association types and remove any that either
    // do not exist or are not child association types.
    DictionaryService dictionaryService = serviceRegistry.getDictionaryService();
    childAssociationTypes.clear();
    for (QName associationType : suppliedAssociationTypes)
    {
        AssociationDefinition assocDef = dictionaryService.getAssociation(associationType);
        if (assocDef != null && assocDef.isChild())
        {
            childAssociationTypes.add(associationType);
        }
    }
    initialised = true;
}
 
Example 9
@Override
public void updateDefinition(DictionaryService dictionaryService)
{
    AspectDefinition aspectDef = dictionaryService.getAspect(alfrescoName);

    if (aspectDef != null)
    {
        setTypeDefDisplayName(aspectDef.getTitle(dictionaryService));
        setTypeDefDescription(aspectDef.getDescription(dictionaryService));
    }
    else
    {
        super.updateDefinition(dictionaryService);
    }
    
    updateTypeDefInclProperties();
}
 
Example 10
Source Project: alfresco-mvc   Source File: BeanPropertiesMapper.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected BeanPropertiesMapper(final NamespaceService namespaceService, final DictionaryService dictionaryService,
		final BeanPropertiesMapperConfigurer<T> configurer, final boolean reportNamespaceException) {
	Assert.notNull(namespaceService, "[Assertion failed] - the namespaceService argument must be null");
	Assert.notNull(dictionaryService, "[Assertion failed] - the dictionaryService argument must be null");

	this.namespaceService = namespaceService;
	this.dictionaryService = dictionaryService;
	this.reportNamespaceException = reportNamespaceException;

	Class<T> mappedClass = (Class<T>) GenericTypeResolver.resolveTypeArgument(getClass(),
			NodePropertiesMapper.class);
	if (mappedClass != null) {
		setMappedClass(mappedClass);
	}

	BeanPropertiesMapperConfigurer<T> confTmp = configurer;
	if (configurer == null) {
		if (this instanceof BeanPropertiesMapperConfigurer) {
			confTmp = ((BeanPropertiesMapperConfigurer<T>) this);
		}
	}

	this.configurer = confTmp;
}
 
Example 11
/**
 * Construct.
 * 
 * @param dictionary  the dictionary service
 * @param policyClass  the policy interface class
 * @param index  the behaviour index to query against
 */
@SuppressWarnings("unchecked") 
/*package*/ AssociationPolicyDelegate(DictionaryService dictionary, Class<P> policyClass, BehaviourIndex<ClassFeatureBehaviourBinding> index, long tryLockTimeout)
{
    // Get list of all pre-registered behaviours for the policy and
    // ensure they are valid.
    Collection<BehaviourDefinition> definitions = index.getAll();
    for (BehaviourDefinition definition : definitions)
    {
        definition.getBehaviour().getInterface(policyClass);
    }

    // Rely on cached implementation of policy factory
    // Note: Could also use PolicyFactory (without caching)
    this.factory = new CachedPolicyFactory<ClassFeatureBehaviourBinding, P>(policyClass, index);
    this.factory.setTryLockTimeout(tryLockTimeout);
    this.dictionary = dictionary;
}
 
Example 12
/**
 * Construct.
 * 
 * @param dictionary  the dictionary service
 * @param policyClass  the policy interface class
 * @param index  the behaviour index to query against
 */
@SuppressWarnings("unchecked")
/*package*/ ClassPolicyDelegate(DictionaryService dictionary, Class<P> policyClass, BehaviourIndex<ClassBehaviourBinding> index, long tryLockTimeout)
{
    // Get list of all pre-registered behaviours for the policy and
    // ensure they are valid.
    Collection<BehaviourDefinition> definitions = index.getAll();
    for (BehaviourDefinition definition : definitions)
    {
        definition.getBehaviour().getInterface(policyClass);
    }

    // Rely on cached implementation of policy factory
    // Note: Could also use PolicyFactory (without caching)
    this.factory = new CachedPolicyFactory<ClassBehaviourBinding, P>(policyClass, index);
    this.factory.setTryLockTimeout(tryLockTimeout);
    this.dictionary = dictionary;
}
 
Example 13
@SuppressWarnings("unchecked")
private DictionaryService makeDictionaryService()
{
    DictionaryService mock = mock(DictionaryService.class);
    TypeDefinition taskTypeDef = definition.getStartTaskDefinition().getMetadata();
    when(mock.getAnonymousType((QName) any(), (Collection<QName>) any())).thenReturn(taskTypeDef);
    return mock;
}
 
Example 14
@Before
public void before()
{
    this.actionService = (ActionService)ctx.getBean("actionService");
    this.ruleService = (RuleService)ctx.getBean("ruleService");
	this.fileFolderService = (FileFolderService)ctx.getBean("FileFolderService");
	this.transactionService = (TransactionService)ctx.getBean("transactionService");
	this.nodeService = (NodeService)ctx.getBean("NodeService");
	this.contentService = (ContentService)ctx.getBean("ContentService");
    this.versionService = (VersionService) ctx.getBean("versionService");
    this.lockService = (LockService) ctx.getBean("lockService");
    this.taggingService = (TaggingService) ctx.getBean("TaggingService");
    this.namespaceService = (NamespaceService) ctx.getBean("namespaceService");
    this.repositoryHelper = (Repository)ctx.getBean("repositoryHelper");
	this.factory = (AlfrescoCmisServiceFactory)ctx.getBean("CMISServiceFactory");
    this.versionService = (VersionService) ctx.getBean("versionService");
	this.cmisConnector = (CMISConnector) ctx.getBean("CMISConnector");
    this.nodeDAO = (NodeDAO) ctx.getBean("nodeDAO");
    this.authorityService = (AuthorityService)ctx.getBean("AuthorityService");
    this.auditSubsystem = (AuditModelRegistryImpl) ctx.getBean("Audit");
    this.permissionService = (PermissionService) ctx.getBean("permissionService");
	this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO");
	this.cmisDictionaryService = (CMISDictionaryService)ctx.getBean("OpenCMISDictionaryService1.1");
    this.auditDAO = (AuditDAO) ctx.getBean("auditDAO");
    this.nodeArchiveService = (NodeArchiveService) ctx.getBean("nodeArchiveService");
    this.dictionaryService = (DictionaryService) ctx.getBean("dictionaryService");
    this.workflowService = (WorkflowService) ctx.getBean("WorkflowService");
    this.workflowAdminService = (WorkflowAdminService) ctx.getBean("workflowAdminService");
    this.authenticationContext = (AuthenticationContext) ctx.getBean("authenticationContext");
    this.tenantAdminService = (TenantAdminService) ctx.getBean("tenantAdminService");
    this.tenantService = (TenantService) ctx.getBean("tenantService");
    this.searchService = (SearchService) ctx.getBean("SearchService");
    this.auditComponent = (AuditComponentImpl) ctx.getBean("auditComponent");

    this.globalProperties = (java.util.Properties) ctx.getBean("global-properties");
    this.globalProperties.setProperty(VersionableAspectTest.AUTO_VERSION_PROPS_KEY, "true");
}
 
Example 15
@Override
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
        Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
{
    // TODO Auto-generated method stub
    
}
 
Example 16
@Override
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
        Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
{
    // TODO Auto-generated method stub
    
}
 
Example 17
public void enableVariablesSupport(NamespaceService namespaceService, DictionaryService dictionaryService)
{
    variablesEnabled = true;
    if (namespaceService == null)
    {
        throw new IllegalArgumentException("namespace service can't be null");
    }
    if (dictionaryService == null)
    {
        throw new IllegalArgumentException("dictionary service can't be null");
    }
    this.namespaceService = namespaceService;
    this.dictionaryService = dictionaryService;
    variableProperties = new ArrayList<QueryVariableHolder>();
}
 
Example 18
/**
 * @return true if the node is a Category instance
 */
public boolean getIsCategory()
{
    if (isCategory == null)
    {
        DictionaryService dd = this.services.getDictionaryService();
        isCategory = Boolean.valueOf(dd.isSubClass(getType(), ContentModel.TYPE_CATEGORY));
    }

    return isCategory.booleanValue();
}
 
Example 19
@Override
protected void setUp() throws Exception
{
    super.setUp();
    ctx = ApplicationContextHelper.getApplicationContext(new String[] { ApplicationContextHelper.CONFIG_LOCATIONS[0], "classpath:tenant/mt-*context.xml" });

    nodeService = (NodeService) ctx.getBean("NodeService");
    nodeArchiveService = (NodeArchiveService) ctx.getBean("nodeArchiveService");
    namespaceService = (NamespaceService) ctx.getBean("NamespaceService");
    authenticationService = (MutableAuthenticationService) ctx.getBean("AuthenticationService");
    tenantAdminService = (TenantAdminService) ctx.getBean("tenantAdminService");
    tenantService = (TenantService) ctx.getBean("tenantService");
    personService = (PersonService) ctx.getBean("PersonService");
    searchService = (SearchService) ctx.getBean("SearchService");
    contentService = (ContentService) ctx.getBean("ContentService");
    permissionService = (PermissionService) ctx.getBean("PermissionService");
    ownableService = (OwnableService) ctx.getBean("OwnableService");
    authorityService = (AuthorityService) ctx.getBean("AuthorityService");
    categoryService = (CategoryService) ctx.getBean("CategoryService");
    cociService = (CheckOutCheckInService) ctx.getBean("CheckoutCheckinService");
    repoAdminService = (RepoAdminService) ctx.getBean("RepoAdminService");
    dictionaryService = (DictionaryService) ctx.getBean("DictionaryService");
    usageService = (UsageService) ctx.getBean("usageService");
    transactionService = (TransactionService) ctx.getBean("TransactionService");
    fileFolderService = (FileFolderService) ctx.getBean("FileFolderService");
    ownableService = (OwnableService) ctx.getBean("OwnableService");
    repositoryHelper = (Repository) ctx.getBean("repositoryHelper");
    siteService = (SiteService) ctx.getBean("SiteService");
    
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); // authenticate as super-admin
    
    createTenants();
    createUsers();
}
 
Example 20
@Override
protected void setUp() throws Exception
{
    super.setUp();
    super.item = new Item("workflow", WF_DEF_NAME);
    definition = makeWorkflowDefinition();
    super.workflowService = makeWorkflowService();
    super.nodeService = makeNodeService();
    DictionaryService dictionaryService = makeDictionaryService();
    super.namespaceService = makeNamespaceService();
    MockFieldProcessorRegistry fieldProcessorRegistry = new MockFieldProcessorRegistry(namespaceService,
                dictionaryService);
    DefaultFieldProcessor defaultProcessor = super.makeDefaultFieldProcessor(dictionaryService);
    super.processor = makeWorkflowFormProcessor(dictionaryService, fieldProcessorRegistry, defaultProcessor);
}
 
Example 21
/**
 * Generates a list of property fields with values.
 * 
 * @param propDefAndValue Map of property definitions and corresponding values
 * @param group The group the field belongs to
 * @param namespaceService NamespaceService instance
 * @return List of generated Field objects
 */
public static List<Field> makePropertyFields(
            Map<PropertyDefinition, Object> propDefAndValue,
            FieldGroup group,
            NamespaceService namespaceService,
            DictionaryService dictionaryService)
{
    return makePropertyFields(propDefAndValue.keySet(), propDefAndValue, group, namespaceService, dictionaryService);
}
 
Example 22
public static DataTypeDefinition getDataTypeDefinition(DictionaryService dictionaryService, QName propertyQname)
{
    if(propertyQname == null)
    {
        return null;
    }
    PropertyDefinition propDef = dictionaryService.getProperty(propertyQname);
    if(propDef == null)
    {
        return null;
    }
    return propDef.getDataType();
}
 
Example 23
/**
 * @return true if this Node is a container (i.e. a folder)
 */
public boolean getIsContainer()
{
    if (isContainer == null)
    {
        DictionaryService dd = this.services.getDictionaryService();
        isContainer = Boolean.valueOf((dd.isSubClass(getQNameType(), ContentModel.TYPE_FOLDER) == true &&
                dd.isSubClass(getQNameType(), ContentModel.TYPE_SYSTEM_FOLDER) == false));
    }
    
    return isContainer.booleanValue();
}
 
Example 24
@BeforeClass public static void initTestsContext() throws Exception
{
    AUTHENTICATION_SERVICE = (MutableAuthenticationService)testContext.getBean("authenticationService");
    BEHAVIOUR_FILTER       = (BehaviourFilter)testContext.getBean("policyBehaviourFilter");
    CALENDAR_SERVICE       = (CalendarService)testContext.getBean("CalendarService");
    DICTIONARY_SERVICE     = (DictionaryService)testContext.getBean("dictionaryService");
    NODE_SERVICE           = (NodeService)testContext.getBean("nodeService");
    PUBLIC_NODE_SERVICE    = (NodeService)testContext.getBean("NodeService");
    PERSON_SERVICE         = (PersonService)testContext.getBean("personService");
    TRANSACTION_HELPER     = (RetryingTransactionHelper)testContext.getBean("retryingTransactionHelper");
    PERMISSION_SERVICE     = (PermissionService)testContext.getBean("permissionService");
    SITE_SERVICE           = (SiteService)testContext.getBean("SiteService");
    // Get the canned query registry, and from that the factory
    @SuppressWarnings("unchecked")
    NamedObjectRegistry<CannedQueryFactory<? extends Object>> calendarCannedQueryRegistry =
       (NamedObjectRegistry<CannedQueryFactory<? extends Object>>)testContext.getBean("calendarCannedQueryRegistry");
    CALENDAR_CQ_FACTORY = (GetCalendarEntriesCannedQueryFactory)
       calendarCannedQueryRegistry.getNamedObject(CalendarServiceImpl.CANNED_QUERY_GET_ENTRIES);
    
    // Do the setup as admin
    AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER);
    createUser(TEST_USER);
    
    // We need to create the test site as the test user so that they can contribute content to it in tests below.
    AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER);
    createTestSites();
}
 
Example 25
public void resolveInheritance(CMISMapping cmisMapping,
        CMISDictionaryRegistry registry, DictionaryService dictionaryService)
{
    PropertyDefinition<?> propertyDefintion;

    if (parent != null)
    {
        for (PropertyDefinitionWrapper propDef : parent.getProperties(false))
        {
            if (propertiesById.containsKey(propDef.getPropertyId()))
            {
                continue;
            }

            org.alfresco.service.cmr.dictionary.PropertyDefinition alfrescoPropDef = dictionaryService.getProperty(
                    propDef.getOwningType().getAlfrescoName(), propDef.getAlfrescoName());

            propertyDefintion = createPropertyDefinition(cmisMapping, propDef.getPropertyId(),
                    alfrescoPropDef.getName(), dictionaryService, alfrescoPropDef, true);

            if (propertyDefintion != null)
            {
                registerProperty(new BasePropertyDefintionWrapper(propertyDefintion, alfrescoPropDef.getName(),
                        propDef.getOwningType(), propDef.getPropertyAccessor(), propDef.getPropertyLuceneBuilder()));
            }
        }
    }

    List<TypeDefinitionWrapper> children = registry.getChildren(typeDef.getId());
    for (TypeDefinitionWrapper child : children)
    {
        if (child instanceof AbstractTypeDefinitionWrapper)
        {
            ((AbstractTypeDefinitionWrapper) child).resolveInheritance(cmisMapping, registry,
                    dictionaryService);
        }
    }
}
 
Example 26
@Override
protected void setUp() throws Exception
{
    super.setUp();
    namespaceService = new NamespaceServiceMemoryImpl();
    namespaceService.registerNamespace("test", URI);
    namespaceService.registerNamespace(NamespaceService.CONTENT_MODEL_PREFIX, NamespaceService.CONTENT_MODEL_1_0_URI);
    namespaceService.registerNamespace(NamespaceService.BPM_MODEL_PREFIX, NamespaceService.BPM_MODEL_1_0_URI);
    
    personService = mock(PersonService.class);
    when(personService.getPerson(userName)).thenReturn(person);
    when(personService.personExists(userName)).thenReturn(true);
    
    nodeService = mock(NodeService.class);
    Map<QName, Serializable> personProps = new HashMap<QName, Serializable>();
    personProps.put(ContentModel.PROP_USERNAME, userName);
    personProps.put(ContentModel.PROP_FIRSTNAME, firstName);
    personProps.put(ContentModel.PROP_LASTNAME, lastName);
    when(nodeService.getProperties(person)).thenReturn(personProps);
    when(nodeService.getProperty(person, ContentModel.PROP_USERNAME)).thenReturn(userName);
    when(nodeService.getProperty(person, ContentModel.PROP_FIRSTNAME)).thenReturn(firstName);
    when(nodeService.getProperty(person, ContentModel.PROP_LASTNAME)).thenReturn(lastName);
    
    workflowService = mock(WorkflowService.class);
    dictionaryService = mock(DictionaryService.class);
    authenticationService = mock(AuthenticationService.class);
    
    builder = new WorkflowModelBuilder(namespaceService, nodeService, authenticationService, personService, workflowService, dictionaryService);
}
 
Example 27
@Override
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
        Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
{
    // TODO Auto-generated method stub
    
}
 
Example 28
public void init()
{
    super.init();
    DictionaryService dictionaryService = serviceRegistry.getDictionaryService();
    peerAssociationTypes.clear();
    for (QName associationType : suppliedAssociationTypes)
    {
        AssociationDefinition assocDef = dictionaryService.getAssociation(associationType);
        if (assocDef != null && !assocDef.isChild())
        {
            peerAssociationTypes.add(associationType);
        }
    }
    initialised = true;
}
 
Example 29
AttributeOrder(QName attribute, boolean ascending, NodeService nodeService, DictionaryService dictionaryService, Collator collator, Locale locale)
{
    this.attribute = attribute;
    this.ascending = ascending;
    this.nodeService = nodeService;
    this.dictionaryService = dictionaryService;
    this.collator = collator;
    this.locale = locale;
}
 
Example 30
public PolicyTypeDefintionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping propertyAccessorMapping, 
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, ClassDefinition cmisClassDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisClassDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new PolicyTypeDefinitionImpl();

    typeDef.setBaseTypeId(BaseTypeId.CMIS_POLICY);
    typeDef.setId(typeId);
    typeDef.setLocalName(alfrescoName.getLocalName());
    typeDef.setLocalNamespace(alfrescoName.getNamespaceURI());

    if (BaseTypeId.CMIS_POLICY.value().equals(typeId))
    {
        typeDef.setQueryName(ISO9075.encodeSQL(typeId));
        typeDef.setParentTypeId(null);
    } else
    {
        typeDef.setQueryName(ISO9075.encodeSQL(cmisMapping.buildPrefixEncodedString(alfrescoName)));
        QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName());
        if (parentQName == null)
        {
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(CMISMapping.ASPECTS_QNAME));
        } else if (cmisMapping.isValidCmisPolicy(parentQName))
        {
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_POLICY, parentQName));
        } else
        {
            throw new IllegalStateException("The CMIS type model should ignore aspects that inherit from excluded aspects");
        }
    }

    typeDef.setDisplayName(null);
    typeDef.setDescription(null);

    typeDef.setIsCreatable(false);
    typeDef.setIsQueryable(true);
    typeDef.setIsFulltextIndexed(true);
    typeDef.setIsControllablePolicy(false);
    typeDef.setIsControllableAcl(false);
    typeDef.setIsIncludedInSupertypeQuery(cmisClassDef.getIncludedInSuperTypeQuery());
    typeDef.setIsFileable(false);

    typeDefInclProperties = CMISUtils.copy(typeDef);
    setTypeDefinition(typeDef, typeDefInclProperties);

    createOwningPropertyDefinitions(cmisMapping, propertyAccessorMapping, luceneBuilderMapping, dictionaryService, cmisClassDef);
    createActionEvaluators(propertyAccessorMapping, BaseTypeId.CMIS_POLICY);
}