本文整理汇总了Java中org.osc.sdk.manager.element.ManagerDeviceElement类的典型用法代码示例。如果您正苦于以下问题:Java ManagerDeviceElement类的具体用法?Java ManagerDeviceElement怎么用?Java ManagerDeviceElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ManagerDeviceElement类属于org.osc.sdk.manager.element包,在下文中一共展示了ManagerDeviceElement类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateVSSDevice
import org.osc.sdk.manager.element.ManagerDeviceElement; //导入依赖的package包/类
@Override
public void updateVSSDevice(ManagerDeviceElement device) throws Exception {
this.txControl.required(() -> {
DeviceEntity result = IsmDeviceApi.this.em.find(DeviceEntity.class, Long.parseLong(device.getId()));
if (result == null) {
String msg = String.format("Cannot find the device id: %s", device.getId());
LOG.error(msg);
throw new IllegalArgumentException(msg);
}
result.setName(device.getName());
IsmDeviceApi.this.em.merge(result);
return null;
});
}
示例2: deleteDevice
import org.osc.sdk.manager.element.ManagerDeviceElement; //导入依赖的package包/类
private void deleteDevice(ManagerDeviceApi mgrApi) throws Exception {
if (this.vs.getMgrId() == null) {
return;
}
try {
mgrApi.deleteVSSDevice();
} catch (Exception ex) {
try {
ManagerDeviceElement device = mgrApi.getDeviceById(this.vs.getMgrId());
if (device != null) {
throw ex;
}
} catch (Exception e) {
log.info("Fail to load Device: " + this.vs.getMgrId() + ". Assume already deleted.");
}
}
}
示例3: getDeviceIds
import org.osc.sdk.manager.element.ManagerDeviceElement; //导入依赖的package包/类
@GET
public List<String> getDeviceIds() throws Exception {
LOG.info("Listing device ids'");
List<? extends ManagerDeviceElement> devices = this.api.listDevices();
List<String> deviceList = new ArrayList<String>();
if (devices.isEmpty()) {
return deviceList;
}
deviceList = devices.stream().map(ManagerDeviceElement::getId).collect(Collectors.toList());
return deviceList;
}
示例4: listDevices
import org.osc.sdk.manager.element.ManagerDeviceElement; //导入依赖的package包/类
@Override
public List<? extends ManagerDeviceElement> listDevices() throws Exception {
return this.txControl.supports(() -> {
CriteriaBuilder criteriaBuilder = IsmDeviceApi.this.em.getCriteriaBuilder();
CriteriaQuery<DeviceEntity> query = criteriaBuilder.createQuery(DeviceEntity.class);
Root<DeviceEntity> r = query.from(DeviceEntity.class);
query.select(r);
return IsmDeviceApi.this.em.createQuery(query).getResultList();
});
}
示例5: getDeviceById
import org.osc.sdk.manager.element.ManagerDeviceElement; //导入依赖的package包/类
@Override
public ManagerDeviceElement getDeviceById(String id) throws Exception {
return this.txControl.supports(() -> IsmDeviceApi.this.em.find(DeviceEntity.class, Long.valueOf(id)));
}
示例6: getDeviceById
import org.osc.sdk.manager.element.ManagerDeviceElement; //导入依赖的package包/类
/**
* Retrieves a device (group) from the security manager by its identifier.
*
* @param id the unique identifier of the device
* @return the device, null if not found
* @throws Exception upon failure
*/
ManagerDeviceElement getDeviceById(String id) throws Exception;
示例7: listDevices
import org.osc.sdk.manager.element.ManagerDeviceElement; //导入依赖的package包/类
/**
* Retrieves all device (group) elements.
*
* @return the collection of all device elements
* @throws Exception upon failure
*/
List<? extends ManagerDeviceElement> listDevices() throws Exception;
示例8: updateVSSDevice
import org.osc.sdk.manager.element.ManagerDeviceElement; //导入依赖的package包/类
/**
* Updates the device for the current virtual system.
*
* @param device the device with fields to be updated
* @throws Exception upon failure
*/
void updateVSSDevice(ManagerDeviceElement device) throws Exception;