org.springframework.extensions.surf.util.ParameterCheck Java Examples

The following examples show how to use org.springframework.extensions.surf.util.ParameterCheck. 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
Source File: PolicyComponentImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public BehaviourDefinition<ServiceBehaviourBinding> bindPropertyBehaviour(QName policy, Object service, Behaviour behaviour)
{
    // Validate arguments
    ParameterCheck.mandatory("Policy", policy);
    ParameterCheck.mandatory("Service", service);
    ParameterCheck.mandatory("Behaviour", behaviour);
    
    // Create behaviour definition and bind to policy
    ServiceBehaviourBinding binding = new ServiceBehaviourBinding(service);
    BehaviourDefinition<ServiceBehaviourBinding> definition = createBehaviourDefinition(PolicyType.Property, policy, binding, behaviour);
    getPropertyBehaviourIndex(policy).putServiceBehaviour(definition);
    
    if (logger.isInfoEnabled())
        logger.info("Bound " + behaviour + " to property policy " + policy + " for service " + service);

    return definition;
}
 
Example #2
Source File: ActivityPostServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: ExporterComponent.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void exportView(ExportPackageHandler exportHandler, ExporterCrawlerParameters parameters, Exporter progress)
{
    ParameterCheck.mandatory("Stream Handler", exportHandler);

    // create exporter around export handler
    exportHandler.startExport();
    OutputStream dataFile = exportHandler.createDataStream();
    Exporter xmlExporter = createXMLExporter(dataFile, parameters.getReferenceType());
    URLExporter urlExporter = new URLExporter(xmlExporter, exportHandler);

    // export        
    exportView(urlExporter, parameters, progress);
    
    // end export
    exportHandler.endExport();
}
 
Example #4
Source File: MultiTAdminServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean isEnabledTenant(String tenantDomain)
{       
    // Check that all the passed values are not null
    ParameterCheck.mandatory("tenantDomain", tenantDomain);
    
    tenantDomain = getTenantDomain(tenantDomain);
    
    Tenant tenant = getTenantAttributes(tenantDomain);
    if (tenant != null)
    {
        return tenant.isEnabled();
    }
    
    return false;
}
 
Example #5
Source File: MultiTAdminServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Call all {@link TenantDeployer#onEnableTenant() TenantDeployers} as the system tenant.
 */
protected void notifyAfterEnableTenant(String tenantDomain)
{
    // Check that all the passed values are not null
    ParameterCheck.mandatory("tenantDomain", tenantDomain);
    
    // notify listeners that tenant has been enabled
    TenantUtil.runAsSystemTenant(new TenantRunAsWork<Object>()
    {
        public Object doWork()
        {
            for (TenantDeployer tenantDeployer : tenantDeployers)
            {
                tenantDeployer.onEnableTenant();
            }
            return null;
        }
    }, tenantDomain);
    
    if (logger.isDebugEnabled())
    {
        logger.debug("Tenant enabled: " + tenantDomain);
    }
}
 
Example #6
Source File: PolicyComponentImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public BehaviourDefinition<ClassBehaviourBinding> bindClassBehaviour(QName policy, QName classRef, Behaviour behaviour)
{
    // Validate arguments
    ParameterCheck.mandatory("Policy", policy);
    ParameterCheck.mandatory("Class Reference", classRef);
    ParameterCheck.mandatory("Behaviour", behaviour);

    // Validate Binding
    ClassDefinition classDefinition = dictionary.getClass(classRef);
    if (classDefinition == null)
    {
        throw new IllegalArgumentException("Class " + classRef + " has not been defined in the data dictionary");
    }
    
    // Create behaviour definition and bind to policy
    ClassBehaviourBinding binding = new ClassBehaviourBinding(dictionary, classRef);
    BehaviourDefinition<ClassBehaviourBinding> definition = createBehaviourDefinition(PolicyType.Class, policy, binding, behaviour);
    getClassBehaviourIndex(policy).putClassBehaviour(definition);
    
    if (logger.isInfoEnabled())
        logger.info("Bound " + behaviour + " to policy " + policy + " for class " + classRef);

    return definition;
}
 
Example #7
Source File: PolicyComponentImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public BehaviourDefinition<ServiceBehaviourBinding> bindClassBehaviour(QName policy, Object service, Behaviour behaviour)
{
    // Validate arguments
    ParameterCheck.mandatory("Policy", policy);
    ParameterCheck.mandatory("Service", service);
    ParameterCheck.mandatory("Behaviour", behaviour);
    
    // Create behaviour definition and bind to policy
    ServiceBehaviourBinding binding = new ServiceBehaviourBinding(service);
    BehaviourDefinition<ServiceBehaviourBinding> definition = createBehaviourDefinition(PolicyType.Class, policy, binding, behaviour);
    getClassBehaviourIndex(policy).putServiceBehaviour(definition);
    
    if (logger.isInfoEnabled())
        logger.info("Bound " + behaviour + " to policy " + policy + " for service " + service);

    return definition;
}
 
Example #8
Source File: AbstractAclCrudDAOImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void addAclMembersToAcl(long aclId, List<Pair<Long, Integer>> aceIdsWithDepths)
{
    ParameterCheck.mandatory("aceIdsWithDepths", aceIdsWithDepths);
    
    List<AclMemberEntity> newMembers = new ArrayList<AclMemberEntity>(aceIdsWithDepths.size());
    
    for (Pair<Long,Integer> aceIdWithDepth : aceIdsWithDepths)
    {
        AclMemberEntity newMember = new AclMemberEntity();
        newMember.setAclId(aclId);
        newMember.setAceId(aceIdWithDepth.getFirst());
        newMember.setPos(aceIdWithDepth.getSecond());
        
        AclMemberEntity result = createAclMemberEntity(newMember);
        newMembers.add(result);
    }
}
 
Example #9
Source File: WorkflowPackageImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
* {@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;
}
 
Example #10
Source File: PolicyComponentImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public BehaviourDefinition<ClassFeatureBehaviourBinding> bindPropertyBehaviour(QName policy, QName className, Behaviour behaviour)
{
    // Validate arguments
    ParameterCheck.mandatory("Policy", policy);
    ParameterCheck.mandatory("Class Reference", className);
    ParameterCheck.mandatory("Behaviour", behaviour);

    // Validate Binding
    ClassDefinition classDefinition = dictionary.getClass(className);
    if (classDefinition == null)
    {
        throw new IllegalArgumentException("Class " + className + " has not been defined in the data dictionary");
    }
    
    // Create behaviour definition and bind to policy
    ClassFeatureBehaviourBinding binding = new ClassFeatureBehaviourBinding(dictionary, className, FEATURE_WILDCARD);
    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 " + FEATURE_WILDCARD + " of class " + className);

    return definition;
}
 
Example #11
Source File: ActivityServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public List<FeedControl> getFeedControls(String userId)
{
    ParameterCheck.mandatoryString("userId", userId);
    
    if (! userNamesAreCaseSensitive)
    {
        userId = userId.toLowerCase();
    }
    
    String currentUser = getCurrentUser();
    
    if ((currentUser == null) || 
        (! ((authorityService.isAdminAuthority(currentUser)) ||
            (currentUser.equals(userId)) ||
            (AuthenticationUtil.getSystemUserName().equals(this.tenantService.getBaseNameUser(currentUser))))))
    {
        throw new AlfrescoRuntimeException("Current user " + currentUser + " is not permitted to get feed controls for " + userId);
    }
    
    return getFeedControlsImpl(userId);
}
 
Example #12
Source File: ScriptServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/** 
 * Execute script
 * 
 * @param location  the classpath string locating the script
 * @param model     the context model
 * @return Object   the result of the script
 */
protected Object execute(ScriptProcessor processor, String location, Map<String, Object> model)
{
    ParameterCheck.mandatoryString("location", location);
    if (logger.isDebugEnabled())
    {
        logger.debug("Executing script:\n" + location);
    }
    try
    {
        return processor.execute(location, model);
    }
    catch (Throwable err)
    {
        throw translateProcessingException(location, err);
    }
}
 
Example #13
Source File: AuditComponentImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
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();
}
 
Example #14
Source File: People.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #15
Source File: AuditComponentImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 * @since 3.2
 */
public void resetDisabledPaths(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;
    }
    Long disabledPathsId = application.getDisabledPathsId();
    propertyValueDAO.updateProperty(disabledPathsId, (Serializable) Collections.emptySet());
    // Done
    if (logger.isDebugEnabled())
    {
        logger.debug("Removed all disabled paths for application " + applicationName);
    }
}
 
Example #16
Source File: TypeConverter.java    From alfresco-data-model with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #17
Source File: TypeConverter.java    From alfresco-data-model with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * General conversion method to Object types (note it cannot support
 * conversion to primary types due the restrictions of reflection. Use the
 * static conversion methods to primitive types)
 * 
 * @param propertyType - the target property type
 * @param value - the value to be converted
 * @return - the converted value as the correct type
 */
public final Object convert(DataTypeDefinition propertyType, Object value)
{
    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, value);
}
 
Example #18
Source File: ScriptServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @see org.alfresco.service.cmr.repository.ScriptService#executeScript(java.lang.String, java.util.Map)
 */
public Object executeScript(String scriptClasspath, Map<String, Object> model)
    throws ScriptException
{
    ParameterCheck.mandatory("scriptClasspath", scriptClasspath);
    ScriptProcessor scriptProcessor = getScriptProcessor(scriptClasspath);
    return execute(scriptProcessor, scriptClasspath, model);
}
 
Example #19
Source File: People.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Gets a map of capabilities (boolean assertions) for the given person.
 * 
 * @param person
 *            the person
 * @return the capability map
 */
public Map<String, Boolean> getCapabilities(final ScriptNode person)
{
    ParameterCheck.mandatory("Person", person);
    Map<String,Boolean> retVal = new ScriptableHashMap<String, Boolean>();
    retVal.putAll(this.valueDerivingMapFactory.getMap(person));
    return retVal;
}
 
Example #20
Source File: ScriptNode.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Return true if the user has the specified permission on the node.
 * <p>
 * The default permissions are found in <code>org.alfresco.service.cmr.security.PermissionService</code>.
 * Most commonly used are "Write", "Delete" and "AddChildren".
 * 
 * @param permission as found in <code>org.alfresco.service.cmr.security.PermissionService</code>
 * @return true if the user has the specified permission on the node.
 */
public boolean hasPermission(String permission)
{
    ParameterCheck.mandatory("Permission Name", permission);
    
    boolean allowed = false;
    
    if (permission != null && permission.length() != 0)
    {
        AccessStatus status = this.services.getPermissionService().hasPermission(this.nodeRef, permission);
        allowed = (AccessStatus.ALLOWED == status);
    }
    
    return allowed;
}
 
Example #21
Source File: Search.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Find a single Node by the Node reference
 * 
 * @param ref       The NodeRef of the Node to find
 * 
 * @return the Node if found or null if failed to find
 */
public ScriptNode findNode(NodeRef ref)
{
    ParameterCheck.mandatory("ref", ref);       
    if (this.services.getNodeService().exists(ref)
                && (this.services.getPermissionService().hasPermission(ref,
                            PermissionService.READ) == AccessStatus.ALLOWED))
    {
        return new ScriptNode(ref, this.services, getScope());
    }
    return null;
}
 
Example #22
Source File: MultiTAdminServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @see #MAX_LEN
 * @see #REGEX_CONTAINS_ALPHA
 * @see #REGEX_VALID_DNS_LABEL
 */
protected void validateTenantName(String tenantDomain)
{
    ParameterCheck.mandatory("tenantDomain", tenantDomain);
    
    if (tenantDomain.length() > MAX_LEN)
    {
    	throw new IllegalArgumentException(tenantDomain + " is not a valid tenant name (must be less than " + MAX_LEN + " characters)");
    }
    
    if (! Pattern.matches(REGEX_CONTAINS_ALPHA, tenantDomain))
    {
    	throw new IllegalArgumentException(tenantDomain + " is not a valid tenant name (must contain at least one alpha character)");
    }
    
    String[] dnsLabels = tenantDomain.split("\\.");
    if (dnsLabels.length != 0)
    {
     for (int i = 0; i < dnsLabels.length; i++)
     {
      if (! Pattern.matches(REGEX_VALID_DNS_LABEL, dnsLabels[i]))
      {
      	throw new IllegalArgumentException(dnsLabels[i] + " is not a valid DNS label (must match " + REGEX_VALID_DNS_LABEL + ")");
      }
     }
    }
    else
    {
     if (! Pattern.matches(REGEX_VALID_DNS_LABEL, tenantDomain))
     {
     	throw new IllegalArgumentException(tenantDomain + " is not a valid DNS label (must match " + REGEX_VALID_DNS_LABEL + ")");
     }
    }
}
 
Example #23
Source File: AbstractAclCrudDAOImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
private AuthorityEntity getAuthorityImpl(String authorityName)
{
    ParameterCheck.mandatory("authorityName", authorityName);
    
    AuthorityEntity authority = new AuthorityEntity();
    authority.setAuthority(authorityName);
    
    Pair<Long, AuthorityEntity> entityPair = authorityEntityCache.getByValue(authority);
    if (entityPair == null)
    {
        return null;
    }
    return entityPair.getSecond();
}
 
Example #24
Source File: ScriptNode.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Create a new folder (cm:folder) node as a child of this node.
 * 
 * Beware: Any unsaved property changes will be lost when this is called.  To preserve property changes call {@link #save()} first.
 *    
 * @param name Name of the folder to create
 * @param type Type of the folder to create (if null, defaults to ContentModel.TYPE_FOLDER)
 * 
 * @return Newly created Node or null if failed to create.
 */
public ScriptNode createFolder(String name, String type)
{
    ParameterCheck.mandatoryString("Node Name", name);
    
    FileInfo fileInfo = this.services.getFileFolderService().create(
            this.nodeRef, name, type == null ? ContentModel.TYPE_FOLDER : createQName(type));
    
    reset();
    
    return newInstance(fileInfo.getNodeRef(), this.services, this.scope);
}
 
Example #25
Source File: SiteTitleDisplayHandler.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public SiteTitleDisplayHandler(Set<String> supportedFieldFacets, Map<String, String> nonSiteLocationsLabels)
{
    ParameterCheck.mandatory("supportedFieldFacets", supportedFieldFacets);

    this.supportedFieldFacets = Collections.unmodifiableSet(new HashSet<>(supportedFieldFacets));
    this.nonSiteLocationsLabels = nonSiteLocationsLabels == null ? Collections.<String, String> emptyMap() : nonSiteLocationsLabels;
}
 
Example #26
Source File: ContentSizeBucketsDisplayHandler.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ContentSizeBucketsDisplayHandler(Set<String> facetQueryFields, LinkedHashMap<String, String> sizeBucketsMap)
{
    ParameterCheck.mandatory("facetQueryFields", facetQueryFields);
    ParameterCheck.mandatory("sizeBucketsMap", sizeBucketsMap);

    this.supportedFieldFacets = Collections.unmodifiableSet(facetQueryFields);

    facetLabelMap = new HashMap<>(sizeBucketsMap.size());
    Map<String, List<String>> facetQueries = new LinkedHashMap<>(facetQueryFields.size());

    for (String facetQueryField : facetQueryFields)
    {
        List<String> queries = new ArrayList<>();
        int index = 0;
        for (Entry<String, String> bucket : sizeBucketsMap.entrySet())
        {
            String sizeRange = bucket.getKey().trim();
            Matcher matcher = SIZE_RANGE_PATTERN.matcher(sizeRange);
            if (!matcher.find())
            {
                throw new SolrFacetConfigException(
                            "Invalid size range. Example of a valid size range is: [0 TO 1024]");
            }
            // build the facet query. e.g. {http://www.alfresco.org/model/content/1.0}content.size:[0 TO 1024]
            String facetQuery = facetQueryField + ':' + sizeRange;
            queries.add(facetQuery);

            // indexOf('[') => 1
            String sizeRangeQuery = sizeRange.substring(1, sizeRange.length() - 1);
            sizeRangeQuery = sizeRangeQuery.replaceFirst("\\sTO\\s", "\"..\"");
            facetLabelMap.put(facetQuery, new FacetLabel(sizeRangeQuery, bucket.getValue(), index++));
        }
        facetQueries.put(facetQueryField, queries);
    }
    this.facetQueriesMap = Collections.unmodifiableMap(facetQueries);
}
 
Example #27
Source File: ThumbnailParentAssociationDetails.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Constructor.  All parameters must be specified.
 * 
 * @param parent        the parent node reference
 * @param assocType     the child association type
 * @param assocName     the child association name
 */
public ThumbnailParentAssociationDetails(NodeRef parent, QName assocType, QName assocName)
{
    // Make sure all the details of the parent are provided
    ParameterCheck.mandatory("parent", parent);
    ParameterCheck.mandatory("assocType", assocType);
    ParameterCheck.mandatory("assocName", assocName);
    
    // Set the values
    this.parent = parent;
    this.assocType = assocType;
    this.assocName = assocName;
}
 
Example #28
Source File: People.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Change the password for the currently logged in user.
 * Old password must be supplied.
 *  
 * @param oldPassword       Old user password
 * @param newPassword       New user password
 */
public void changePassword(String oldPassword, String newPassword)
{
    ParameterCheck.mandatoryString("oldPassword", oldPassword);
    ParameterCheck.mandatoryString("newPassword", newPassword);
    
    this.services.getAuthenticationService().updateAuthentication(
            AuthenticationUtil.getFullyAuthenticatedUser(), oldPassword.toCharArray(), newPassword.toCharArray());
}
 
Example #29
Source File: AuditComponentImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults)
{
    ParameterCheck.mandatory("callback", callback);
    ParameterCheck.mandatory("parameters", parameters);
    
    // Shortcuts
    if (parameters.isZeroResultQuery())
    {
        return;
    }
    
    auditDAO.findAuditEntries(callback, parameters, maxResults);
}
 
Example #30
Source File: JavaBehaviour.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Construct.
 * 
 * @param instance  the object instance holding the method
 * @param method  the method name
 */
public JavaBehaviour(Object instance, String method, NotificationFrequency frequency)
{
	super(frequency);
	ParameterCheck.mandatory("Instance", instance);
    ParameterCheck.mandatory("Method", method);
    this.method = method;
    this.instance = instance;
}