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


Java ParameterCheck类代码示例

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


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


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