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


Java ParameterCheck.mandatoryString方法代码示例

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


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

示例1: fromQuery

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
/**
 * SearchParameters from the Query object
 * @param sp SearchParameters
 * @param q Query
 */
public void fromQuery(SearchParameters sp, Query q)
{
    ParameterCheck.mandatoryString("query", q.getQuery());
    String lang = q.getLanguage()==null?AFTS:q.getLanguage();

    switch (lang.toLowerCase())
    {
        case AFTS:
            sp.setLanguage(LANGUAGE_FTS_ALFRESCO);
            break;
        case LUCENE:
            sp.setLanguage(LANGUAGE_LUCENE);
            break;
        case CMIS:
            sp.setLanguage(LANGUAGE_CMIS_ALFRESCO);
            break;
        default:
            throw new InvalidArgumentException(InvalidArgumentException.DEFAULT_MESSAGE_ID,
                        new Object[] { ": language allowed values: afts,lucene,cmis" });
    }
    sp.setQuery(q.getQuery());
    sp.setSearchTerm(q.getUserQuery());
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:29,代码来源:SearchMapper.java

示例2: 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

示例3: 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

示例4: 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

示例5: getCustomModel

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

    Pair<CompiledModel, Boolean> compiledModelPair = getCustomCompiledModel(modelName);
    CustomModelDefinition result = (compiledModelPair == null) ? null : new CustomModelDefinitionImpl(
                compiledModelPair.getFirst(), compiledModelPair.getSecond(), dictionaryService);

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

示例6: getCustomCompiledModel

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
/**
 * Returns compiled custom model and whether the model is active or not as a {@code Pair} object
 *
 * @param modelName the name of the custom model to retrieve
 * @return the {@code Pair<CompiledModel, Boolean>} (or null, if it doesn't exist)
 */
protected Pair<CompiledModel, Boolean> getCustomCompiledModel(String modelName)
{
    ParameterCheck.mandatoryString("modelName", modelName);

    final NodeRef modelNodeRef = getModelNodeRef(modelName);

    if (modelNodeRef == null || !nodeService.exists(modelNodeRef))
    {
        return null;
    }

    M2Model model = null;
    final boolean isActive = Boolean.TRUE.equals(nodeService.getProperty(modelNodeRef, ContentModel.PROP_MODEL_ACTIVE));
    if (isActive)
    {
        QName modelQName = (QName) nodeService.getProperty(modelNodeRef, ContentModel.PROP_MODEL_NAME);
        if (modelQName == null)
        {
            return null;
        }
        try
        {
            CompiledModel compiledModel = dictionaryDAO.getCompiledModel(modelQName);
            model = compiledModel.getM2Model();
        }
        catch (Exception e)
        {
            throw new CustomModelException(MSG_RETRIEVE_MODEL, new Object[] { modelName }, e);
        }
    }
    else
    {
        model = getM2Model(modelNodeRef);
    }

    Pair<CompiledModel, Boolean> result = (model == null) ? null : new Pair<>(compileModel(model), isActive);

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

示例7: requestReset

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
@Override
public void requestReset(String userId, String clientName)
{
    ParameterCheck.mandatoryString("userId", userId);
    ParameterCheck.mandatoryString("clientName", clientName);

    String userEmail = validateUserAndGetEmail(userId);

    // Get the (latest) workflow definition for reset-password.
    WorkflowDefinition wfDefinition = workflowService.getDefinitionByName(WorkflowModelResetPassword.WORKFLOW_DEFINITION_NAME);

    // create workflow properties
    Map<QName, Serializable> props = new HashMap<>(7);
    props.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, I18NUtil.getMessage(WORKFLOW_DESCRIPTION_KEY));
    props.put(WorkflowModelResetPassword.WF_PROP_USERNAME, userId);
    props.put(WorkflowModelResetPassword.WF_PROP_USER_EMAIL, userEmail);
    props.put(WorkflowModelResetPassword.WF_PROP_CLIENT_NAME, clientName);
    props.put(WorkflowModel.ASSOC_PACKAGE, workflowService.createPackage(null));

    String guid = GUID.generate();
    props.put(WorkflowModelResetPassword.WF_PROP_KEY, guid);
    props.put(WorkflowModelResetPassword.WF_PROP_TIMER_END, timerEnd);

    // start the workflow
    WorkflowPath path = workflowService.startWorkflow(wfDefinition.getId(), props);
    if (path.isActive())
    {
        WorkflowTask startTask = workflowService.getStartTask(path.getInstance().getId());
        workflowService.endTask(startTask.getId(), null);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:ResetPasswordServiceImpl.java

示例8: getClientAppConfig

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
@Override
public ClientApp getClientAppConfig(String clientName)
{
    ParameterCheck.mandatoryString("clientName", clientName);

    ClientApp clientApp = clientAppConfig.getClient(clientName);
    if (clientApp == null)
    {
        throw new ClientAppNotFoundException("Client was not found [" + clientName + "]");
    }
    return clientApp;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:ResetPasswordServiceImpl.java

示例9: performResetPassword

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
@Override
public void performResetPassword(DelegateExecution execution)
{
    // This method chooses to take a rather indirect route to access the password value.
    // This is for security reasons. We do not want to store the password in the Activiti DB.

    // We can get the username from the execution (process scope).
    final String userName = (String) execution.getVariable(WorkflowModelResetPassword.WF_PROP_USERNAME_ACTIVITI);

    // But we cannot get the password from the execution as we have intentionally not stored the password there.
    // Instead we recover the password from the specific task in which it was set.
    List<Task> activitiTasks = activitiTaskService.createTaskQuery().taskDefinitionKey(WorkflowModelResetPassword.TASK_RESET_PASSWORD)
                .processInstanceId(execution.getProcessInstanceId()).list();
    if (activitiTasks.size() != 1)
    {
        throw new ResetPasswordWorkflowException("Unexpected count of task instances: " + activitiTasks.size());
    }
    Task activitiTask = activitiTasks.get(0);
    String activitiTaskId = activitiTask.getId();
    final String password = (String) activitiTaskService.getVariable(activitiTaskId, WorkflowModelResetPassword.WF_PROP_PASSWORD_ACTIVITI);

    if (LOGGER.isDebugEnabled())
    {
        LOGGER.debug("Retrieved new password from task " + activitiTaskId);
    }

    ParameterCheck.mandatoryString(WorkflowModelResetPassword.WF_PROP_USERNAME_ACTIVITI, userName);
    ParameterCheck.mandatoryString(WorkflowModelResetPassword.WF_PROP_PASSWORD_ACTIVITI, password);

    if (LOGGER.isDebugEnabled())
    {
        LOGGER.debug("Changing password for " + userName);
        // Don't LOG the password. :)
    }

    this.authenticationService.setAuthentication(userName, password.toCharArray());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:ResetPasswordServiceImpl.java

示例10: encodePassword

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
/**
 * Encode a password
 * @param rawPassword mandatory password
 * @param salt optional salt
 * @param encodingChain mandatory encoding chain
 * @return the encoded password
 */
public String encodePassword(String rawPassword, Object salt, List<String> encodingChain) {

    ParameterCheck.mandatoryString("rawPassword", rawPassword);
    ParameterCheck.mandatoryCollection("encodingChain", encodingChain);
    String encoded = new String(rawPassword);
    for (String encoderKey : encodingChain)
    {
        encoded = encode(encoderKey, encoded, salt);

    }
    if (encoded == rawPassword) throw new AlfrescoRuntimeException("No password encoding specified. "+encodingChain);
    return encoded;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:CompositePasswordEncoder.java

示例11: encode

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
/**
 *  Encode a password using the specified encoderKey
 * @param encoderKey the encoder to use
 * @param rawPassword  mandatory password
 * @param salt optional salt
 * @return the encoded password
 */
protected String encode(String encoderKey, String rawPassword, Object salt)
{
   ParameterCheck.mandatoryString("rawPassword", rawPassword);
   ParameterCheck.mandatoryString("encoderKey", encoderKey);
   Object encoder = encoders.get(encoderKey);
   if (encoder == null) throw new AlfrescoRuntimeException("Invalid encoder specified: "+encoderKey);
   if (encoder instanceof net.sf.acegisecurity.providers.encoding.PasswordEncoder)
   {
       net.sf.acegisecurity.providers.encoding.PasswordEncoder pEncoder = (net.sf.acegisecurity.providers.encoding.PasswordEncoder) encoder;
       if (MD4_KEY.equals(encoderKey))
       {
           //In the past MD4 password encoding didn't use a SALT
           salt = null;
       }
       if (logger.isDebugEnabled()) {
           logger.debug("Encoding using acegis PasswordEncoder: "+encoderKey);
       }
       return pEncoder.encodePassword(rawPassword, salt);
   }
   if (encoder instanceof org.springframework.security.crypto.password.PasswordEncoder)
   {
       org.springframework.security.crypto.password.PasswordEncoder passEncoder = (org.springframework.security.crypto.password.PasswordEncoder) encoder;
       if (logger.isDebugEnabled()) {
           logger.debug("Encoding using spring PasswordEncoder: "+encoderKey);
       }
       return passEncoder.encode(rawPassword);
   }

   throw new AlfrescoRuntimeException("Unsupported encoder specified: "+encoderKey);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:CompositePasswordEncoder.java

示例12: AuditUserInfo

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
public AuditUserInfo(final String userName, final NodeRef personRef, final AuthorisedState authorisedState)
{
    ParameterCheck.mandatoryString("userName", userName);
    ParameterCheck.mandatory("personRef", personRef);
    ParameterCheck.mandatory("authorisedState", authorisedState);
    this.userName = userName;
    this.personRef = personRef;
    this.authorisedState = authorisedState;
}
 
开发者ID:Acosix,项目名称:alfresco-audit,代码行数:10,代码来源:AuditUserGet.java

示例13: matches

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
/**
 * Does the password match?
 * @param encoderKey the encoder to use
 * @param rawPassword  mandatory password
 * @param encodedPassword mandatory hashed version
 * @param salt optional salt
 * @return true if they match
 */
protected boolean matches(String encoderKey, String rawPassword, String encodedPassword, Object salt)
{
    ParameterCheck.mandatoryString("rawPassword", rawPassword);
    ParameterCheck.mandatoryString("encodedPassword", encodedPassword);
    ParameterCheck.mandatoryString("encoderKey", encoderKey);
    Object encoder = encoders.get(encoderKey);
    if (encoder == null) throw new AlfrescoRuntimeException("Invalid matches encoder specified: "+encoderKey);
    if (encoder instanceof net.sf.acegisecurity.providers.encoding.PasswordEncoder)
    {
        net.sf.acegisecurity.providers.encoding.PasswordEncoder pEncoder = (net.sf.acegisecurity.providers.encoding.PasswordEncoder) encoder;
        if (MD4_KEY.equals(encoderKey))
        {
            //In the past MD4 password encoding didn't use a SALT
            salt = null;
        }
        if (logger.isDebugEnabled()) {
            logger.debug("Matching using acegis PasswordEncoder: "+encoderKey);
        }
        return pEncoder.isPasswordValid(encodedPassword, rawPassword, salt);
    }
    if (encoder instanceof org.springframework.security.crypto.password.PasswordEncoder)
    {
        org.springframework.security.crypto.password.PasswordEncoder passEncoder = (org.springframework.security.crypto.password.PasswordEncoder) encoder;
        if (logger.isDebugEnabled()) {
            logger.debug("Matching using spring PasswordEncoder: "+encoderKey);
        }
        return passEncoder.matches(rawPassword, encodedPassword);
    }
    throw new AlfrescoRuntimeException("Unsupported encoder for matching: "+encoderKey);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:CompositePasswordEncoder.java

示例14: fromTemplate

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
/**
 * SearchParameters from List<Template>
 * @param sp SearchParameters
 * @param templates List<Template>
 */
public void fromTemplate(SearchParameters sp, List<Template> templates)
{
    if (templates != null && !templates.isEmpty())
    {
        for (Template aTemplate:templates)
        {
            ParameterCheck.mandatoryString("template name", aTemplate.getName());
            ParameterCheck.mandatoryString("template template", aTemplate.getTemplate());
            sp.addQueryTemplate(aTemplate.getName(), aTemplate.getTemplate());
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:18,代码来源:SearchMapper.java

示例15: newReference

import org.alfresco.util.ParameterCheck; //导入方法依赖的package包/类
public Reference newReference(Encoding encoding, Resource templateResource, String templatePath,
            Resource actualNodeResource, List<Parameter> extraParameters)
{
    ParameterCheck.mandatoryString("templatePath", templatePath);
    ArrayList<Parameter> parameters = new ArrayList<Parameter>(3);
    parameters.add(new StringParameter(templatePath));
    parameters.add(new ResourceParameter(actualNodeResource));
    parameters.addAll(extraParameters);
    return new Reference(encoding,
                         this,
                         templateResource,
                         parameters);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:VirtualProtocol.java


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