• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ParameterCheck类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SubethaEmailMessagePart

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * Object can be built on existing message part only.
 * 
 * @param messagePart Message part.
 */
public SubethaEmailMessagePart(Part messagePart)
{
    ParameterCheck.mandatory("messagePart", messagePart);

    try
    {
        fileSize = messagePart.getSize();
        fileName = messagePart.getFileName();
        contentType = messagePart.getContentType();

        Matcher matcher = encodingExtractor.matcher(contentType);
        if (matcher.find())
        {
            encoding = matcher.group(1);
            if (!Charset.isSupported(encoding))
            {
                throw new EmailMessageException(ERR_UNSUPPORTED_ENCODING, encoding);
            }
        }

        try
        {
            contentInputStream = messagePart.getInputStream(); 
        }
        catch (Exception ex)
        {
            throw new EmailMessageException(ERR_FAILED_TO_READ_CONTENT_STREAM, ex.getMessage());
        }
    }
    catch (MessagingException e)
    {
        throw new EmailMessageException(ERR_INCORRECT_MESSAGE_PART, e.getMessage());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:40,代码来源:SubethaEmailMessagePart.java


示例2: convert

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * General conversion method to convert collection contents to the specified
 * type.
 * 
 * @param propertyType - the target property type
 * @param values - the value to be converted
 * @return - the converted value as the correct type
 * @throws DictionaryException if the property type's registered java class is invalid
 * @throws TypeConversionException if the conversion cannot be performed
 */
public final Collection<?> convert(DataTypeDefinition propertyType, Collection<?> values)
{
    ParameterCheck.mandatory("Property type definition", propertyType);
    
    // Convert property type to java class
    Class<?> javaClass = null;
    String javaClassName = propertyType.getJavaClassName();
    try
    {
        javaClass = Class.forName(javaClassName);
    }
    catch (ClassNotFoundException e)
    {
        throw new DictionaryException("Java class " + javaClassName + " of property type " + propertyType.getName() + " is invalid", e);
    }
    
    return convert(javaClass, values);
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:29,代码来源:TypeConverter.java


示例3: updateAclMember

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
public void updateAclMember(AclMemberEntity entity)
{
    ParameterCheck.mandatory("entity", entity);
    ParameterCheck.mandatory("entity.id", entity.getId());
    ParameterCheck.mandatory("entity.version", entity.getVersion());
    ParameterCheck.mandatory("entity.aceId", entity.getAceId());
    ParameterCheck.mandatory("entity.aclId", entity.getAclId());
    ParameterCheck.mandatory("entity.pos", entity.getPos());
    
    int updated = updateAclMemberEntity(entity);
    
    if (updated < 1)
    {
        aclEntityCache.removeByKey(entity.getId());
        throw new ConcurrencyFailureException("AclMemberEntity with ID (" + entity.getId() + ") no longer exists or has been updated concurrently");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AbstractAclCrudDAOImpl.java


示例4: addAclMembersToAcl

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
public void addAclMembersToAcl(long aclId, List<Long> aceIds, int depth)
{
    ParameterCheck.mandatory("aceIds", aceIds);
    
    List<AclMemberEntity> newMembers = new ArrayList<AclMemberEntity>(aceIds.size());
    
    for (Long aceId : aceIds)
    {
        AclMemberEntity newMember = new AclMemberEntity();
        newMember.setAclId(aclId);
        newMember.setAceId(aceId);
        newMember.setPos(depth);
        
        AclMemberEntity result = createAclMemberEntity(newMember);
        newMembers.add(result);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AbstractAclCrudDAOImpl.java


示例5: postActivity

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
public void postActivity(String activityType, String siteId, String appTool, NodeRef nodeRef, String name, QName typeQName, NodeRef parentNodeRef)
{
    // primarily for delete node activities - eg. delete document, delete folder
    
    ParameterCheck.mandatory("nodeRef", nodeRef);
    ParameterCheck.mandatory("typeQName", typeQName);
    ParameterCheck.mandatory("parentNodeRef", parentNodeRef);
    
    StringBuffer sb = new StringBuffer();
    sb.append("{").append("\""+PostLookup.JSON_NODEREF_LOOKUP+"\":\"").append(nodeRef.toString()).append("\"").append(",")
                  .append("\""+PostLookup.JSON_NAME+"\":\"").append(name).append("\"").append(",")
                  .append("\""+PostLookup.JSON_TYPEQNAME+"\":\"").append(typeQName.toPrefixString()).append("\"").append(",") // TODO toPrefixString does not return prefix ??!!
                  .append("\""+PostLookup.JSON_NODEREF_PARENT+"\":\"").append(parentNodeRef.toString()).append("\"")
                  .append("}");
    
    postActivity(activityType, siteId, appTool, sb.toString(), ActivityPostEntity.STATUS.PENDING, getCurrentUser(), null,null);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:ActivityPostServiceImpl.java


示例6: getContainerGroups

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * Gets the groups that contain the specified authority
 * 
 * @param person       the user (cm:person) to get the containing groups for
 * 
 * @return the containing groups as a List of TemplateNode objects, can be null
 */
public List<TemplateNode> getContainerGroups(TemplateNode person)
{
    ParameterCheck.mandatory("Person", person);
    List<TemplateNode> parents;
    Set<String> authorities = this.authorityService.getContainingAuthoritiesInZone(
            AuthorityType.GROUP,
            (String)person.getProperties().get(ContentModel.PROP_USERNAME),
            AuthorityService.ZONE_APP_DEFAULT, null, 1000);
    parents = new ArrayList<TemplateNode>(authorities.size());
    for (String authority : authorities)
    {
        TemplateNode group = getGroup(authority);
        if (group != null)
        {
            parents.add(group); 
        }
    }
    return parents;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:People.java


示例7: parserImport

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * Perform Import via Parser
 * 
 * @param nodeRef node reference to import under
 * @param location the location to import under
 * @param viewReader the view Reader
 * @param streamHandler the content property import stream handler
 * @param binding import configuration
 * @param progress import progress
 */
public void parserImport(NodeRef nodeRef, Location location, Reader viewReader, ImportPackageHandler streamHandler, ImporterBinding binding, ImporterProgress progress)
{
    ParameterCheck.mandatory("Node Reference", nodeRef);
    ParameterCheck.mandatory("View Reader", viewReader);
    ParameterCheck.mandatory("Stream Handler", streamHandler);
    
    Importer nodeImporter = new NodeImporter(nodeRef, location, binding, streamHandler, progress);
    try
    {
        nodeImporter.start();
        viewParser.parse(viewReader, nodeImporter);
        nodeImporter.end();
    }
    catch(RuntimeException e)
    {
        nodeImporter.error(e);
        throw e;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:ImporterComponent.java


示例8: getApplicationId

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
private Long getApplicationId(String applicationName)
{
    ParameterCheck.mandatory("applicationName", applicationName);
    AlfrescoTransactionSupport.checkTransactionReadState(true);

    AuditApplication application = auditModelRegistry.getAuditApplicationByName(applicationName);
    if (application == null)
    {
        if (logger.isDebugEnabled())
        {
            logger.debug("No audit application named '" + applicationName + "' has been registered.");
        }
        return null;
    }

    return application.getApplicationId();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AuditComponentImpl.java


示例9: createAce

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
public Ace createAce(Permission permission, Authority authority, ACEType type, AccessStatus accessStatus)
{
    ParameterCheck.mandatory("permission", permission);
    ParameterCheck.mandatory("authority", authority);
    ParameterCheck.mandatory("type", type);
    ParameterCheck.mandatory("accessStatus", accessStatus);
    
    AceEntity entity = new AceEntity();
    
    entity.setApplies(type.getId()); // note: 'applies' stores the ACE type
    entity.setAllowed((accessStatus == AccessStatus.ALLOWED) ? true : false);
    entity.setAuthorityId(authority.getId());
    entity.setPermissionId(permission.getId());
    
    long aceId = createAceEntity(entity);
    
    entity.setVersion(0L);
    entity.setId(aceId);
    
    return entity;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:AbstractAclCrudDAOImpl.java


示例10: execute

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * Execute script
 * 
 * @param location  the location of the script 
 * @param model     context model
 * @return Object   the result of the script
 */
protected Object execute(ScriptProcessor processor, ScriptLocation location, Map<String, Object> model)
{
    ParameterCheck.mandatory("location", location);
    if (logger.isDebugEnabled())
    {
        logger.debug("Executing script:\n" + location);
    }
    try
    {
        return processor.execute(location, model);
    }
    catch (Throwable err)
    {
        throw translateProcessingException(location.toString(), err);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:ScriptServiceImpl.java


示例11: executeString

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * Execute script string
 * 
 * @param script    the script string
 * @param model     the context model
 * @return Object   the result of the script 
 */
protected Object executeString(ScriptProcessor processor, String script, Map<String, Object> model)
{
    ParameterCheck.mandatoryString("script", script);
    
    if (logger.isDebugEnabled())
    {
        logger.debug("Executing script:\n" + script);
    }
    try
    {
        return processor.executeString(script, model);
    }
    catch (Throwable err)
    {
        throw translateProcessingException("provided by caller", err);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ScriptServiceImpl.java


示例12: getContainerGroups

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * Gets the groups that contain the specified authority
 * 
 * @param person       the user (cm:person) to get the containing groups for
 * 
 * @return the containing groups as a JavaScript array
 */
public Scriptable getContainerGroups(ScriptNode person)
{
    ParameterCheck.mandatory("Person", person);
    Object[] parents = null;
    Set<String> authorities = this.authorityService.getContainingAuthoritiesInZone(
            AuthorityType.GROUP,
            (String)person.getProperties().get(ContentModel.PROP_USERNAME),
            AuthorityService.ZONE_APP_DEFAULT, null, 1000);
    parents = new Object[authorities.size()];
    int i = 0;
    for (String authority : authorities)
    {
        ScriptNode group = getGroup(authority);
        if (group != null)
        {
            parents[i++] = group; 
        }
    }
    return Context.getCurrentContext().newArray(getScope(), parents);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:People.java


示例13: createGroup

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * Create a new group with the specified unique name
 * 
 * @param parentGroup   The parent group node - can be null for a root level group
 * @param groupName     The unique group name to create - NOTE: do not prefix with "GROUP_"
 * 
 * @return the group reference if successful or null if failed
 */
public ScriptNode createGroup(ScriptNode parentGroup, String groupName)
{
    ParameterCheck.mandatoryString("GroupName", groupName);
    
    ScriptNode group = null;
    
    String actualName = services.getAuthorityService().getName(AuthorityType.GROUP, groupName);
    if (authorityService.authorityExists(actualName) == false)
    {
        String result = authorityService.createAuthority(AuthorityType.GROUP, groupName);
        if (parentGroup != null)
        {
            String parentGroupName = (String)parentGroup.getProperties().get(ContentModel.PROP_AUTHORITY_NAME);
            if (parentGroupName != null)
            {
                authorityService.addAuthority(parentGroupName, actualName);
            }
        }
        group = getGroup(result);
    }
    
    return group;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:People.java


示例14: getPermissionImpl

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
private PermissionEntity getPermissionImpl(PermissionReference permissionReference)
{
    ParameterCheck.mandatory("permissionReference", permissionReference);
    
    PermissionEntity entity = null;
    
    // Get the persistent ID for the QName
    Pair<Long, QName> qnamePair = qnameDAO.getOrCreateQName(permissionReference.getQName());
    if (qnamePair != null)
    {
        Long qnameId  = qnamePair.getFirst();
        
        PermissionEntity permission = new PermissionEntity(qnameId, permissionReference.getName());
        Pair<Long, PermissionEntity> entityPair = permissionEntityCache.getByValue(permission);
        if (entityPair != null)
        {
            entity = entityPair.getSecond();
        }
    }
    
    return entity;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:AbstractAclCrudDAOImpl.java


示例15: bindPropertyBehaviour

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
public BehaviourDefinition<ClassFeatureBehaviourBinding> bindPropertyBehaviour(QName policy, QName className, QName propertyName, Behaviour behaviour)
{
    // Validate arguments
    ParameterCheck.mandatory("Policy", policy);
    ParameterCheck.mandatory("Class Reference", className);
    ParameterCheck.mandatory("Property Reference", propertyName);
    ParameterCheck.mandatory("Behaviour", behaviour);

    // Validate Binding
    PropertyDefinition propertyDefinition = dictionary.getProperty(className, propertyName);
    if (propertyDefinition == null)
    {
        throw new IllegalArgumentException("Property " + propertyName + " of class " + className + " has not been defined in the data dictionary");
    }
    
    // Create behaviour definition and bind to policy
    ClassFeatureBehaviourBinding binding = new ClassFeatureBehaviourBinding(dictionary, className, propertyName);
    BehaviourDefinition<ClassFeatureBehaviourBinding> definition = createBehaviourDefinition(PolicyType.Property, policy, binding, behaviour);
    getPropertyBehaviourIndex(policy).putClassBehaviour(definition);
    
    if (logger.isInfoEnabled())
        logger.info("Bound " + behaviour + " to policy " + policy + " for property " + propertyName + " of class " + className);

    return definition;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:PolicyComponentImpl.java


示例16: bindAssociationBehaviour

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
public BehaviourDefinition<ClassFeatureBehaviourBinding> bindAssociationBehaviour(QName policy, QName className, QName assocName, Behaviour behaviour)
{
    // Validate arguments
    ParameterCheck.mandatory("Policy", policy);
    ParameterCheck.mandatory("Class Reference", className);
    ParameterCheck.mandatory("Association Reference", assocName);
    ParameterCheck.mandatory("Behaviour", behaviour);

    // Validate Binding
    AssociationDefinition assocDefinition = dictionary.getAssociation(assocName);
    if (assocDefinition == null)
    {
        throw new IllegalArgumentException("Association " + assocName + " of class " + className + " has not been defined in the data dictionary");
    }
    
    // Create behaviour definition and bind to policy
    ClassFeatureBehaviourBinding binding = new ClassFeatureBehaviourBinding(dictionary, className, assocName);
    BehaviourDefinition<ClassFeatureBehaviourBinding> definition = createBehaviourDefinition(PolicyType.Association, policy, binding, behaviour);
    getAssociationBehaviourIndex(policy).putClassBehaviour(definition);
    
    if (logger.isInfoEnabled())
        logger.info("Bound " + behaviour + " to policy " + policy + " for association " + assocName + " of class " + className);

    return definition;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:PolicyComponentImpl.java


示例17: removeAuthority

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
 * Remove an authority (a user or group) from a group
 * 
 * @param parentGroup   The parent container group
 * @param authority     The authority (user or group) to remove
 */
public void removeAuthority(ScriptNode parentGroup, ScriptNode authority)
{
    ParameterCheck.mandatory("Authority", authority);
    ParameterCheck.mandatory("ParentGroup", parentGroup);
    if (parentGroup.getQNameType().equals(ContentModel.TYPE_AUTHORITY_CONTAINER))
    {
        String parentGroupName = (String)parentGroup.getProperties().get(ContentModel.PROP_AUTHORITY_NAME);
        String authorityName;
        if (authority.getQNameType().equals(ContentModel.TYPE_AUTHORITY_CONTAINER))
        {
            authorityName = (String)authority.getProperties().get(ContentModel.PROP_AUTHORITY_NAME);
        }
        else
        {
            authorityName = (String)authority.getProperties().get(ContentModel.PROP_USERNAME);
        }
        authorityService.removeAuthority(parentGroupName, authorityName);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:People.java


示例18: getWorkflowIdsForContent

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
/**
* {@inheritDoc}
 */
@Extend(traitAPI=WorkflowPackageTrait.class,extensionAPI=WorkflowPackageExtension.class)
public List<String> getWorkflowIdsForContent(NodeRef packageItem)
{
    ParameterCheck.mandatory("packageItem", packageItem);
    List<String> workflowIds = new ArrayList<String>();
    if (nodeService.exists(packageItem))
    {
        List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(packageItem);
        for (ChildAssociationRef parentAssoc : parentAssocs)
        {
            NodeRef parentRef = parentAssoc.getParentRef();
            if (nodeService.hasAspect(parentRef, WorkflowModel.ASPECT_WORKFLOW_PACKAGE)
                        && !nodeService.hasAspect(parentRef, ContentModel.ASPECT_ARCHIVED))
            {
                String workflowInstance = (String) nodeService.getProperty(parentRef,
                            WorkflowModel.PROP_WORKFLOW_INSTANCE_ID);
                if (workflowInstance != null && workflowInstance.length() > 0)
                {
                    workflowIds.add(workflowInstance);
                }
            }
        }
    }
    return workflowIds;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:WorkflowPackageImpl.java


示例19: createTenant

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
@Override
public TenantEntity createTenant(TenantEntity entity)
{
    ParameterCheck.mandatory("entity", entity);
    ParameterCheck.mandatoryString("entity.tenantDomain", entity.getTenantDomain());
    
    if (entity.getEnabled() == null)
    {
        entity.setEnabled(true);
    }
    
    // force lower-case on create
    entity.setTenantDomain(entity.getTenantDomain().toLowerCase());
    
    entity.setVersion(0L);
    
    Pair<String, TenantEntity> entityPair = tenantEntityCache.getOrCreateByValue(entity);
    return entityPair.getSecond();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:AbstractTenantAdminDAOImpl.java


示例20: transformDocument

import org.springframework.extensions.surf.util.ParameterCheck; //导入依赖的package包/类
private ScriptNode transformDocument(String mimetype, NodeRef destination)
{
    ParameterCheck.mandatoryString("Mimetype", mimetype);
    ParameterCheck.mandatory("Destination Node", destination);
    final NodeRef sourceNodeRef = nodeRef;
    
    // the delegate definition for transforming a document
    Transformer transformer = new AbstractTransformer()
    {
        protected void doTransform(ContentService contentService,
            ContentReader reader, ContentWriter writer)
        {
            TransformationOptions options = new TransformationOptions();
            options.setSourceNodeRef(sourceNodeRef);
            contentService.transform(reader, writer, options);
        }
    };
    
    return transformNode(transformer, mimetype, destination);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:ScriptNode.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DavServletResponse类代码示例发布时间:2022-05-23
下一篇:
Java AWSElasticBeanstalkClient类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap