use of com.emc.storageos.hds.model.PortController in project coprhd-controller by CoprHD.
the class HDSCommunicationInterface method processStorageAdapterResponse.
/**
* Process the StorageAdapter response received from the server.
*
* @param system : storagesystem details.
* @param portControllerList : List of portcontrollers info received from server.
* @param accessProfile : accessProfile details.
* @throws IOException
*/
private void processStorageAdapterResponse(StorageSystem system, List<PortController> portControllerList, AccessProfile accessProfile) throws IOException {
List<StorageHADomain> newAdapters = new ArrayList<StorageHADomain>();
List<StorageHADomain> updateAdapters = new ArrayList<StorageHADomain>();
if (null != portControllerList && !portControllerList.isEmpty()) {
for (PortController portControllerFromResponse : portControllerList) {
boolean isNew = false;
String nativeGuid = NativeGUIDGenerator.generateNativeGuid(system, portControllerFromResponse.getObjectID(), NativeGUIDGenerator.ADAPTER);
StorageHADomain adapter = checkAdapterExistsInDB(nativeGuid);
if (null == adapter) {
isNew = true;
adapter = new StorageHADomain();
adapter.setStorageDeviceURI(system.getId());
adapter.setId(URIUtil.createId(StorageHADomain.class));
adapter.setAdapterName(portControllerFromResponse.getDisplayName());
adapter.setLabel(portControllerFromResponse.getDisplayName());
adapter.setNativeGuid(nativeGuid);
newAdapters.add(adapter);
}
adapter.setAdapterName(portControllerFromResponse.getDisplayName());
adapter.setLabel(portControllerFromResponse.getDisplayName());
if (!HDSConstants.NO_CLUSTER_ID.equalsIgnoreCase(portControllerFromResponse.getCluster())) {
adapter.setSlotNumber(portControllerFromResponse.getCluster());
}
adapter.setName(portControllerFromResponse.getDisplayName());
if (!isNew) {
updateAdapters.add(adapter);
}
}
_dbClient.createObject(newAdapters);
_dbClient.persistObject(updateAdapters);
}
}
Aggregations