Search in sources :

Example 11 with TemplateFilter

use of com.cloud.template.VirtualMachineTemplate.TemplateFilter in project cosmic by MissionCriticalCloud.

the class ListIsosCmd method listInReadyState.

public boolean listInReadyState() {
    final Account account = CallContext.current().getCallingAccount();
    // It is account specific if account is admin type and domainId and accountName are not null
    final boolean isAccountSpecific = (account == null || _accountService.isAdmin(account.getId())) && (getAccountName() != null) && (getDomainId() != null);
    // Show only those that are downloaded.
    final TemplateFilter templateFilter = TemplateFilter.valueOf(getIsoFilter());
    boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) || (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
    if (!onlyReady) {
        if (isReady() != null && isReady().booleanValue() != onlyReady) {
            onlyReady = isReady().booleanValue();
        }
    }
    return onlyReady;
}
Also used : Account(com.cloud.user.Account) TemplateFilter(com.cloud.template.VirtualMachineTemplate.TemplateFilter)

Example 12 with TemplateFilter

use of com.cloud.template.VirtualMachineTemplate.TemplateFilter in project cloudstack by apache.

the class ListTemplatesCmd method listInReadyState.

public boolean listInReadyState() {
    Account account = CallContext.current().getCallingAccount();
    // It is account specific if account is admin type and domainId and accountName are not null
    boolean isAccountSpecific = (account == null || _accountService.isAdmin(account.getId())) && (getAccountName() != null) && (getDomainId() != null);
    // Show only those that are downloaded.
    TemplateFilter templateFilter = TemplateFilter.valueOf(getTemplateFilter());
    boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) || (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
    return onlyReady;
}
Also used : Account(com.cloud.user.Account) TemplateFilter(com.cloud.template.VirtualMachineTemplate.TemplateFilter)

Aggregations

TemplateFilter (com.cloud.template.VirtualMachineTemplate.TemplateFilter)12 Account (com.cloud.user.Account)12 HypervisorType (com.cloud.hypervisor.Hypervisor.HypervisorType)6 ArrayList (java.util.ArrayList)6 ListProjectResourcesCriteria (com.cloud.projects.Project.ListProjectResourcesCriteria)4 Ternary (com.cloud.utils.Ternary)4 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)3 InvalidParameterValueException (com.cloud.utils.exception.InvalidParameterValueException)3 TemplateJoinVO (com.cloud.api.query.vo.TemplateJoinVO)2 DomainVO (com.cloud.domain.DomainVO)2 VMTemplateVO (com.cloud.storage.VMTemplateVO)2 Pair (com.cloud.utils.Pair)2 Filter (com.cloud.utils.db.Filter)2 SearchCriteria (com.cloud.utils.db.SearchCriteria)2 List (java.util.List)1 Map (java.util.Map)1