当前位置: 首页>>代码示例>>Java>>正文


Java ParameterCheck类代码示例

本文整理汇总了Java中org.alfresco.util.ParameterCheck的典型用法代码示例。如果您正苦于以下问题:Java ParameterCheck类的具体用法?Java ParameterCheck怎么用?Java ParameterCheck使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParameterCheck类属于org.alfresco.util包,在下文中一共展示了ParameterCheck类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getModelNodeRef

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
@Override
public NodeRef getModelNodeRef(String modelName)
{
    ParameterCheck.mandatoryString("modelName", modelName);

    StringBuilder builder = new StringBuilder(120);
    builder.append(repoModelsLocation.getPath()).append("//.[@cm:name='").append(modelName).append("' and ")
                .append(RepoAdminServiceImpl.defaultSubtypeOfDictionaryModel).append(']');

    List<NodeRef> nodeRefs = searchService.selectNodes(getRootNode(), builder.toString(), null, namespaceDAO, false);

    if (nodeRefs.size() == 0)
    {
        return null;
    }
    else if (nodeRefs.size() > 1)
    {
        // unexpected: should not find multiple nodes with same name
        throw new CustomModelException(MSG_MULTIPLE_MODELS, new Object[] { modelName });
    }

    return nodeRefs.get(0);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:CustomModelServiceImpl.java

示例2: createNodesHierarchyJob

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
@Override
public NodeRef createNodesHierarchyJob(final NodeRef sourcePathNodeRef, int numberOfNodes, int hierarchyDepth) {
	ParameterCheck.mandatory("sourcePathNodeRef", sourcePathNodeRef);
	return transactionHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>() {
		@Override
		public NodeRef execute() throws Throwable {
			// Create a download node
			final NodeRef monitorNode = monitorStorage
					.createMonitorJobNode(MonitorModel.TYPE_MONITOR_NODES_HIERARCHY);
			monitorStorage.setOperation(monitorNode, JobOperation.NODES_HIERARCHY);
			// Add requested nodes
			if (sourcePathNodeRef != null) {
				monitorStorage.addSourcePathNode(monitorNode, sourcePathNodeRef);
			}
			monitorStorage.addHierarchyDepth(monitorNode, hierarchyDepth);
			monitorStorage.addNumberOfChildren(monitorNode, numberOfNodes);

			return monitorNode;
		}
	}, false, true);
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:22,代码来源:NodesHierarchyJobImpl.java

示例3: deletePropertyValues

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void deletePropertyValues(final List<Long> ids)
{
    ParameterCheck.mandatoryCollection("ids", ids);

    LOGGER.debug("Deleting {} alf_prop_value entries", ids.size());
    LOGGER.trace("Deleting alf_prop_value entries: {}", ids);

    this.sqlSessionTemplate.delete(DELETE_UNUSED_PROPERTY_VALUES, ids);

    if (this.propertyRootCache != null)
    {
        for (final Long id : ids)
        {
            this.propertyValueCache.remove(id);
        }
    }
}
 
开发者ID:Acosix,项目名称:alfresco-audit,代码行数:22,代码来源:PropertyTablesCleanupDAOImpl.java

示例4: isNamespaceUriExists

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
@Override
public boolean isNamespaceUriExists(String modelNamespaceUri)
{
    ParameterCheck.mandatoryString("modelNamespaceUri", modelNamespaceUri);

    Collection<String> uris = namespaceDAO.getURIs();
    if (uris.contains(modelNamespaceUri))
    {
        return true;
    }

    for (CompiledModel model : getAllCustomM2Models(false))
    {
        if (modelNamespaceUri.equals(getModelNamespaceUriPrefix(model.getM2Model()).getFirst()))
        {
            return true;
        }
    }
    return false;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:CustomModelServiceImpl.java

示例5: isNamespacePrefixExists

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
@Override
public boolean isNamespacePrefixExists(String modelNamespacePrefix)
{
    ParameterCheck.mandatoryString("modelNamespacePrefix", modelNamespacePrefix);

    Collection<String> prefixes = namespaceDAO.getPrefixes();
    if (prefixes.contains(modelNamespacePrefix))
    {
        return true;
    }

    for (CompiledModel model : getAllCustomM2Models(false))
    {
        if (modelNamespacePrefix.equals(getModelNamespaceUriPrefix(model.getM2Model()).getSecond()))
        {
            return true;
        }
    }
    return false;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:CustomModelServiceImpl.java

示例6: Authorization

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
/**
 * Construct
 * 
 * @param authorization String
 */
public Authorization(String authorization)
{
    ParameterCheck.mandatoryString("authorization", authorization);
    if (authorization.length() == 0)
    {
        throw new IllegalArgumentException("authorization does not consist of username and password");
    }

    int idx = authorization.indexOf(':');

    if (idx == -1)
    {
        setUser(null, authorization);
    }
    else
    {
        setUser(authorization.substring(0, idx), authorization.substring(idx + 1));
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:Authorization.java

示例7: sendNotification

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
/** 
 * @see org.alfresco.service.cmr.notification.NotificationService#sendNotification(java.lang.String, org.alfresco.service.cmr.notification.NotificationContext)
 */
@Override
public void sendNotification(String notificationProvider, NotificationContext notificationContext) 
{
    // Check the mandatory params
    ParameterCheck.mandatory("notificationProvider", notificationProvider);
    ParameterCheck.mandatory("notificationContext", notificationContext);
    
    // Check that the notificaiton provider exists
    if (exists(notificationProvider) == false)
    {
        throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NP_DOES_NOT_EXIST, notificationProvider));
    }
    
    // Get the notification provider and send notification
    NotificationProvider provider = providers.get(notificationProvider);
    provider.sendNotification(notificationContext);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:NotificationServiceImpl.java

示例8: afterPropertiesSet

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    ParameterCheck.mandatory("authenticationContextManager", authenticationContextManager);

    //Attempt to get RepositoryAuthenticationDao from the subsystem
    for(String contextName : authenticationContextManager.getInstanceIds())
    {
        ApplicationContext ctx = authenticationContextManager.getApplicationContext(contextName);
        try
        {
            authenticationDao = (RepositoryAuthenticationDao)
                    ctx.getBean(RepositoryAuthenticationDao.class);
        } catch(NoSuchBeanDefinitionException e) {}
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:AdminUserPatch.java

示例9: getTypedItem

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
@Override
protected ItemType getTypedItem(Item item)
{
    try
    {
        ParameterCheck.mandatory("item", item);
        return getTypedItemForDecodedId(item.getId());
    }
    catch (AccessDeniedException ade)
    {
        throw ade;
    }
    catch (Exception e)
    {
        throw new FormNotFoundException(item, e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AbstractWorkflowFormProcessor.java

示例10: fromFacetQuery

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
/**
 ** SearchParameters from List<FacetQuery>
 * @param sp
 * @param facetQueries
 */
public void fromFacetQuery(SearchParameters sp, List<FacetQuery> facetQueries)
{
    if (facetQueries != null && !facetQueries.isEmpty())
    {
        for (FacetQuery fq:facetQueries)
        {
            ParameterCheck.mandatoryString("facetQuery query", fq.getQuery());
            String query = fq.getQuery();
            String label = fq.getLabel()!=null?fq.getLabel():query;

            if (query.startsWith("{!afts"))
            {
                throw new InvalidArgumentException(InvalidArgumentException.DEFAULT_MESSAGE_ID,
                            new Object[] { ": Facet queries should not start with !afts" });
            }
            query = "{!afts key='"+label+"'}"+query;
            sp.addFacetQuery(query);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:SearchMapper.java

示例11: getDownloadsCannedQuery

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
public CannedQuery<DownloadEntity> getDownloadsCannedQuery(NodeRef containerNode, Date before)
{
    ParameterCheck.mandatory("before", before);
    
    GetDownloadsCannedQueryParams parameterBean = new GetDownloadsCannedQueryParams
                (
                            getNodeId(containerNode),
                            getQNameId(ContentModel.PROP_NAME),
                            getQNameId(DownloadModel.TYPE_DOWNLOAD),
                            before
                );
    CannedQueryParameters params = new CannedQueryParameters(parameterBean);

    final GetDownloadsCannedQuery cq = new GetDownloadsCannedQuery(
          cannedQueryDAO, methodSecurity, params
    );
    
    return cq;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:GetDownloadsCannedQueryFactory.java

示例12: register

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void register(String locatorName, NodeLocator locator)
{
    ParameterCheck.mandatory("locatorName", locatorName);
    ParameterCheck.mandatory("locator", locator);
    
    if (locators.containsKey(locatorName))
    {
        String msg = "Locator with name '" + locatorName + "' is already registered!";
        throw new IllegalArgumentException(msg);
    }
    
    if (logger.isDebugEnabled())
    {
        logger.debug("Registered node locator: " + locatorName);
    }
    
    locators.put(locatorName, locator);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:NodeLocatorServiceImpl.java

示例13: runMonitorOperation

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
@Override
public void runMonitorOperation(NodeRef monitorNodeRef) {
	ParameterCheck.mandatory("monitorNodeRef", monitorNodeRef);
	boolean runProcess = transactionHelper.doInTransaction(new RetryingTransactionCallback<Boolean>() {
           @Override
           public Boolean execute() throws Throwable {
       		final JobStatus status = getMonitorStatus(monitorNodeRef);
       		if (status.getStatus() == JobStatus.Status.PENDING){
       			monitorStorage.updateStatus(monitorNodeRef, new JobStatus(JobStatus.Status.PROCESSING,null));
       			return true;
       		}
       		return false;
           }
       }, false, true);
	if(runProcess){
		final JobOperation oper = getMonitorOperation(monitorNodeRef);
		final ActionServiceHelper action = serviceHelpers.get(oper); 
		if (action != null){
			action.executeAction(monitorNodeRef);
		}else{
			LOGGER.error("Not registered action for type: MonitorAction.{}",oper);
			throw new AlfrescoRuntimeException(String.format("Not registered action for type: MonitorAction.%s", oper));
		}
	}
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:26,代码来源:MonitorServiceImpl.java

示例14: getGetPublishedCannedQuery

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
public CannedQuery<BlogEntity> getGetPublishedCannedQuery(NodeRef blogContainerNode, Date fromDate, Date toDate, String byUser, PagingRequest pagingReq)
{
    ParameterCheck.mandatory("blogContainerNode", blogContainerNode);
    ParameterCheck.mandatory("pagingReq", pagingReq);
    
    int requestTotalCountMax = pagingReq.getRequestTotalCountMax();
    
    boolean isPublished = true;
    GetBlogPostsCannedQueryParams paramBean = new GetBlogPostsCannedQueryParams(getNodeId(blogContainerNode),
                                                                                getQNameId(ContentModel.PROP_NAME),
                                                                                getQNameId(ContentModel.PROP_PUBLISHED),
                                                                                getQNameId(ContentModel.TYPE_CONTENT),
                                                                                byUser,
                                                                                isPublished,
                                                                                fromDate, toDate,
                                                                                null, null);
    
    CannedQueryPageDetails cqpd = createCQPageDetails(pagingReq);
    CannedQuerySortDetails cqsd = createCQSortDetails(ContentModel.PROP_PUBLISHED, SortOrder.DESCENDING);
    
    // create query params holder
    CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, cqsd, requestTotalCountMax, pagingReq.getQueryExecutionId());
    
    // return canned query instance
    return getCannedQuery(params);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:GetBlogPostsCannedQueryFactory.java

示例15: getTags

import org.alfresco.util.ParameterCheck; //导入依赖的package包/类
/**
 * @see org.alfresco.service.cmr.tagging.TaggingService#getTags(org.alfresco.service.cmr.repository.StoreRef, java.lang.String)
 */
public List<String> getTags(StoreRef storeRef, String filter)
{
    ParameterCheck.mandatory("storeRef", storeRef);
    
    List<String> result = null;
    if (filter == null || filter.length() == 0)
    {
        result = getTags(storeRef);
    }
    else
    {
        Collection<ChildAssociationRef> rootCategories = this.categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE);
        result = new ArrayList<String>(rootCategories.size());
        for (ChildAssociationRef rootCategory : rootCategories)
        {
            String name = (String)this.nodeService.getProperty(rootCategory.getChildRef(), ContentModel.PROP_NAME);
            if (name.contains(filter.toLowerCase()) == true)
            {
                result.add(name);
            }
        }
    }
    
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:TaggingServiceImpl.java


注:本文中的org.alfresco.util.ParameterCheck类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。