class StorageUnitHelper {

    public BusinessObjectDataStorageUnitKey createStorageUnitKeyFromEntity(StorageUnitEntity storageUnitEntity)
    {
        // Get the business object data entity.
        BusinessObjectDataEntity businessObjectDataEntity = storageUnitEntity.getBusinessObjectData();

        // Create and initialize the storage unit key.
        BusinessObjectDataStorageUnitKey storageUnitKey = new BusinessObjectDataStorageUnitKey();
        storageUnitKey.setNamespace(businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode());
        storageUnitKey.setBusinessObjectDefinitionName(businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName());
        storageUnitKey.setBusinessObjectFormatUsage(businessObjectDataEntity.getBusinessObjectFormat().getUsage());
        storageUnitKey.setBusinessObjectFormatFileType(businessObjectDataEntity.getBusinessObjectFormat().getFileType().getCode());
        storageUnitKey.setBusinessObjectFormatVersion(businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion());
        storageUnitKey.setPartitionValue(businessObjectDataEntity.getPartitionValue());
        storageUnitKey.setSubPartitionValues(businessObjectDataHelper.getSubPartitionValues(businessObjectDataEntity));
        storageUnitKey.setBusinessObjectDataVersion(businessObjectDataEntity.getVersion());
        storageUnitKey.setStorageName(storageUnitEntity.getStorage().getName());

        return storageUnitKey;
    }

}