use of com.emc.vipr.model.sys.backup.BackupSets.BackupSet in project coprhd-controller by CoprHD.
the class Backup method itemsJson.
/**
* Get local backup info
* @param ids
*/
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SYSTEM_MONITOR"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void itemsJson(@As(",") String[] ids) {
List<BackupDataTable.Backup> results = Lists.newArrayList();
if (ids != null) {
for (String id : ids) {
if (StringUtils.isNotBlank(id)) {
BackupSet backupSet = BackupUtils.getBackup(id);
if (backupSet != null) {
BackupDataTable.Backup backup = new BackupDataTable.Backup(backupSet);
BackupRestoreStatus restoreStatus = BackupUtils.getRestoreStatus(id, true);
backup.alterLocalBackupRestoreStatus(restoreStatus);
results.add(backup);
}
}
}
}
renderJSON(results);
}
use of com.emc.vipr.model.sys.backup.BackupSets.BackupSet in project coprhd-controller by CoprHD.
the class BackupDataTable method fetch.
public static List<Backup> fetch(Type type) {
List<Backup> results = Lists.newArrayList();
if (type == Type.LOCAL) {
for (BackupSet backupSet : BackupUtils.getBackups()) {
Backup backup = new Backup(backupSet);
BackupInfo backupInfo = BackupUtils.getBackupInfo(backupSet.getName(), true);
backup.alterLocalBackupInfo(backupInfo);
results.add(backup);
}
} else if (type == Type.REMOTE) {
try {
for (String name : BackupUtils.getExternalBackups()) {
results.add(new Backup(name, true));
}
} catch (Exception e) {
// should trim the error message, otherwise datatable.js#getErrorMessage will fail to parse the response
throw new RuntimeException(e.getMessage().trim());
}
}
return results;
}
Aggregations