Java 类com.vmware.vim25.VmDiskFileQuery 实例源码

项目:photon-model    文件:EnumerationClient.java   
/**
 *  Create search specification that searches for exact disk name.
 */
private HostDatastoreBrowserSearchSpec createHostDatastoreBrowserSearchSpecForDisk(String diskName) {
    VmDiskFileQueryFilter vdiskFilter = new VmDiskFileQueryFilter();
    VmDiskFileQuery fQuery = new VmDiskFileQuery();
    fQuery.setFilter(vdiskFilter);


    HostDatastoreBrowserSearchSpec searchSpec = new HostDatastoreBrowserSearchSpec();
    searchSpec.getQuery().add(fQuery);
    FileQueryFlags flag = new FileQueryFlags();
    flag.setFileOwner(true);
    flag.setFileSize(true);
    flag.setFileType(true);
    flag.setModification(true);
    searchSpec.setDetails(flag);
    searchSpec.getMatchPattern().add(diskName + ".vmdk");

    return searchSpec;
}