Search in sources :

Example 1 with SupportPackageCreator

use of util.support.SupportPackageCreator in project coprhd-controller by CoprHD.

the class SystemHealth method download.

/**
 * Download logs capability really creates the old support package.
 */
public static void download(String nodeId, String[] service, Integer severity, String searchMessage, String startTime, String endTime, String orderTypes) {
    SupportPackageCreator creator = new SupportPackageCreator(request, BourneUtil.getSysClient(), Models.currentTenant(), BourneUtil.getCatalogClient());
    if (StringUtils.isNotEmpty(nodeId)) {
        creator.setNodeIds(Lists.newArrayList(nodeId));
    }
    if (service != null && service.length > 0) {
        List<String> logNames = getLogNames(service);
        creator.setLogNames(logNames);
    }
    if (StringUtils.isNotEmpty(searchMessage)) {
        creator.setMsgRegex("(?i).*" + searchMessage + ".*");
    }
    if (StringUtils.isNotEmpty(startTime)) {
        creator.setStartTimeWithRestriction(startTime);
    }
    if (StringUtils.isNotEmpty(endTime)) {
        creator.setEndTime(endTime);
    }
    if (severity != null && severity > 0) {
        creator.setLogSeverity(severity);
    }
    if (DisasterRecoveryUtils.isActiveSite()) {
        if (StringUtils.equalsIgnoreCase(orderTypes, OrderTypes.ALL.name())) {
            creator.setOrderTypes(OrderTypes.ALL);
        } else if (StringUtils.equals(orderTypes, OrderTypes.ERROR.name())) {
            creator.setOrderTypes(OrderTypes.ERROR);
        }
    }
    if (Security.isSystemAdmin()) {
        List<URI> tenantIds = Lists.newArrayList();
        for (TenantOrgRestRep tenant : TenantUtils.getAllTenants()) {
            tenantIds.add(tenant.getId());
        }
        creator.setTenantIds(tenantIds);
    }
    renderSupportPackage(creator);
}
Also used : SupportPackageCreator(util.support.SupportPackageCreator) TenantOrgRestRep(com.emc.storageos.model.tenant.TenantOrgRestRep) URI(java.net.URI)

Aggregations

TenantOrgRestRep (com.emc.storageos.model.tenant.TenantOrgRestRep)1 URI (java.net.URI)1 SupportPackageCreator (util.support.SupportPackageCreator)1