Michael Pasternak has uploaded a new change for review.

Change subject: codegen: implement support for the /capabilities resource
......................................................................

codegen: implement support for the /capabilities resource

Change-Id: Ie4d3b54769efaa4dbf51622c1d3be3c73a5675c9
Signed-off-by: Michael pasternak <mpast...@redhat.com>
---
M 
ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java
M ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java
A 
ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/decorators/Capabilities.java
A 
ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/decorators/VersionCaps.java
M 
ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/BaseResources.java
M 
ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/Capabilities.java
M 
ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/VersionCaps.java
M 
ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/CollectionUtils.java
M 
ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/StringUtils.java
9 files changed, 435 insertions(+), 63 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk-java 
refs/changes/11/15611/1

diff --git 
a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java
 
b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java
index f38961a..bd71282 100644
--- 
a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java
+++ 
b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java
@@ -47,6 +47,7 @@
 import org.ovirt.engine.sdk.codegen.utils.OsUtil;
 import org.ovirt.engine.sdk.codegen.utils.ReflectionHelper;
 import org.ovirt.engine.sdk.codegen.xsd.XsdCodegen;
+import org.ovirt.engine.sdk.entities.Capabilities;
 import org.ovirt.engine.sdk.entities.DetailedLink;
 import org.ovirt.engine.sdk.entities.GlusterBrick;
 import org.ovirt.engine.sdk.entities.GlusterBricks;
@@ -54,6 +55,7 @@
 import org.ovirt.engine.sdk.entities.HostNics;
 import org.ovirt.engine.sdk.entities.HttpMethod;
 import org.ovirt.engine.sdk.entities.RSDL;
+import org.ovirt.engine.sdk.entities.VersionCaps;
 import org.ovirt.engine.sdk.exceptions.ServerException;
 import org.ovirt.engine.sdk.utils.ArrayUtils;
 import org.ovirt.engine.sdk.utils.StringUtils;
@@ -100,8 +102,11 @@
     private static final String ADD_REL = "add";
     private static final String GET_REL = "get";
 
-    private static final String[] COLLECTION2ENTITY_EXCEPTIONS = new String[] 
{ "capabilities", "storage",
-            "versioncaps" };
+    private static final String[] COLLECTION2ENTITY_EXCEPTIONS = new String[] {
+            "capabilities",
+            "{capabilitie:id}",
+            "storage", "{storage:id}"
+    };
     private static final String[] RETURN_BODY_EXCEPTIONS = new String[] { 
"Response", "Responses" };
     private static final String[] ACTION_NAME_EXCEPTIONS = new String[] { 
"import", "export" };
 
@@ -226,34 +231,28 @@
                             String publicCollectionName = 
getPublicCollection(collection);
                             String decoratorEntityName = 
StringUtils.toSingular(decoratorCollectionName);
 
-                            if 
(!this.collectionsHolder.containsKey(decoratorCollectionName.toLowerCase())) {
-                                
this.collectionsHolder.put(decoratorCollectionName.toLowerCase(),
-                                        new CollectionHolder(
-                                                decoratorCollectionName,
-                                                publicEntityName,
-                                                publicCollectionName,
-                                                decoratorEntityName,
-                                                StringUtils.toPlural(period),
-                                                collectionTemplate));
-                            }
-                            
addCollectionMethod(this.collectionsHolder.get(decoratorCollectionName.toLowerCase()),
-                                    url, rel, decoratorEntityName, 
publicEntityName, publicCollectionName, i, dl);
+                            addRootCollection(url,
+                                    rel,
+                                    dl,
+                                    i,
+                                    period,
+                                    decoratorCollectionName,
+                                    publicEntityName,
+                                    publicCollectionName,
+                                    decoratorEntityName);
+
                         } else if (i == 2) { // root-resource
                             String resource = 
getRootResourceName(collectionName);
                             String decoratorResourceName = 
StringUtils.toUpperCase(resource);
                             String publicEntityName = 
getPublicEntity(StringUtils.toSingular(collectionName));
 
-                            if 
(!this.resourcesHolder.containsKey(resource.toLowerCase())) {
-                                
this.resourcesHolder.put(resource.toLowerCase(),
-                                        new ResourceHolder(
-                                                decoratorResourceName,
-                                                publicEntityName,
-                                                resourceTemplate,
-                                                variableTemplate,
-                                                subCollectionGetterTemplate));
-                            }
-                            
addResourceMethod(this.resourcesHolder.get(resource.toLowerCase()),
-                                    url, rel, decoratorResourceName, 
publicEntityName, dl);
+                            addRootResource(url,
+                                    rel,
+                                    dl,
+                                    resource,
+                                    decoratorResourceName,
+                                    publicEntityName);
+
                         } else if (i % 2 != 0) { // sub-collection
                             String collection = 
getSubCollectionName(actualReturnType, parent, i, periods);
                             collectionName = collection;
@@ -264,50 +263,77 @@
                             String publicCollectionName =
                                     
getPublicCollection(StringUtils.toPlural(actualReturnType));
 
-                            if (!isAction(period, rel, requestMethod)) {
-                                if 
(!resourceHolder.getSubcollections().containsKey(collection.toLowerCase())) {
+                            addSubCollection(url,
+                                    rel,
+                                    parent,
+                                    requestMethod,
+                                    dl,
+                                    periods,
+                                    i,
+                                    period,
+                                    collection,
+                                    resourceHolder,
+                                    decoratorEntityName,
+                                    publicEntityName,
+                                    publicCollectionName);
 
-                                    String decoratorSubCollectionName = 
collection;
-                                    String parentDecoratorName = parent;
-                                    
resourceHolder.addSubCollection(collection.toLowerCase(),
-                                            new 
CollectionHolder(decoratorSubCollectionName,
-                                                    publicEntityName,
-                                                    publicCollectionName,
-                                                    parentDecoratorName,
-                                                    decoratorEntityName,
-                                                    
StringUtils.toPlural(period),
-                                                    subCollectionTemplate));
-                                }
-                            } else {
-                                // TODO: use extra params (besides action) 
defined by RSDL
-                                addCollectionAction(rel, periods, i, period, 
resourceHolder, dl);
-                            }
-                            
addCollectionMethod(resourceHolder.getSubcollections().get(collection.toLowerCase()),
-                                    url, rel, decoratorEntityName, 
publicEntityName, publicCollectionName, i, dl);
                         } else { // sub-resource
                             if (!isAction(period, rel, requestMethod)) {
                                 String resource = 
getSubResourceName(collectionName, parent);
                                 String subResourceDecoratorName = resource;
                                 String publicEntityName = 
getSubResourceEntityName(parent, collectionName);
-                                if 
(!this.resourcesHolder.containsKey(resource.toLowerCase())) {
-                                    
this.resourcesHolder.put(resource.toLowerCase(),
-                                            new 
ResourceHolder(subResourceDecoratorName,
-                                                    publicEntityName,
-                                                    subResourceTemplate,
-                                                    variableTemplate,
-                                                    
subCollectionGetterTemplate));
-                                }
-                                
addResourceMethod(this.resourcesHolder.get(resource.toLowerCase()), url, rel,
-                                        subResourceDecoratorName, 
publicEntityName, dl);
+
+                                addSubResource(url,
+                                        rel,
+                                        dl,
+                                        resource,
+                                        subResourceDecoratorName,
+                                        publicEntityName);
+
                                 parent = resource;
                             } else {
                                 // TODO: use extra params (besides action) 
defined by RSDL
                                 addResourceAction(rel, parent, collectionName, 
period, dl);
                             }
                         }
-                    } else {
-                        // TODO: implement unique treatment for 
COLLECTION2ENTITY_EXCEPTIONS
-                        break;
+                    } else { // unique treatment for 
COLLECTION2ENTITY_EXCEPTIONS
+                        if (period.equals("capabilities") || 
parent.equalsIgnoreCase("capabilities")) {
+                            if (i == 1) { // root-collection
+                                String collection = 
getRootCollectionName(period);
+                                collectionName = collection;
+                                parent = 
StringUtils.toUpperCase(collectionName);
+                                String decoratorCollectionName = 
StringUtils.toUpperCase(collection);
+                                String publicEntityName = 
getPublicEntity(VersionCaps.class.getSimpleName());
+                                String publicCollectionName = 
getPublicCollection(Capabilities.class.getSimpleName());
+                                String decoratorEntityName = 
VersionCaps.class.getSimpleName();
+
+                                addRootCollection(url,
+                                        rel,
+                                        dl,
+                                        i,
+                                        period,
+                                        decoratorCollectionName,
+                                        publicEntityName,
+                                        publicCollectionName,
+                                        decoratorEntityName);
+
+                            } else if (i == 2) { // root-resource
+                                String resource = 
VersionCaps.class.getSimpleName();
+                                String decoratorResourceName = resource;
+                                String publicEntityName = 
getPublicEntity(resource);
+
+                                addRootResource(url,
+                                        rel,
+                                        dl,
+                                        resource,
+                                        decoratorResourceName,
+                                        publicEntityName);
+
+                            }
+                        } else {
+                            // TODO: implement unique treatment for 
COLLECTION2ENTITY_EXCEPTIONS
+                            break;
+                        }
                     }
                     i++;
                 }
@@ -328,6 +354,159 @@
     }
 
     /**
+     * Adds SubResource to the resourcesHolder
+     * 
+     * @param url
+     * @param rel
+     * @param dl
+     *            DetailedLink
+     * @param resource
+     * @param subResourceDecoratorName
+     * @param publicEntityName
+     */
+    private void addSubResource(String url,
+            String rel,
+            DetailedLink dl,
+            String resource,
+            String subResourceDecoratorName,
+            String publicEntityName) {
+        if (!this.resourcesHolder.containsKey(resource.toLowerCase())) {
+            this.resourcesHolder.put(resource.toLowerCase(),
+                    new ResourceHolder(subResourceDecoratorName,
+                            publicEntityName,
+                            subResourceTemplate,
+                            variableTemplate,
+                            subCollectionGetterTemplate));
+        }
+        addResourceMethod(this.resourcesHolder.get(resource.toLowerCase()), 
url, rel,
+                subResourceDecoratorName, publicEntityName, dl);
+    }
+
+    /**
+     * adds SubCollection to the resourceHolder
+     * 
+     * @param url
+     * @param rel
+     * @param parent
+     * @param requestMethod
+     * @param dl
+     *            DetailedLink
+     * @param periods
+     * @param i
+     *            the index offset in URI
+     * @param period
+     *            the URI period
+     * @param collection
+     * @param resourceHolder
+     * @param decoratorEntityName
+     * @param publicEntityName
+     * @param publicCollectionName
+     */
+    private void addSubCollection(String url,
+            String rel,
+            String parent,
+            HttpMethod requestMethod,
+            DetailedLink dl,
+            String[] periods,
+            int i,
+            String period,
+            String collection,
+            ResourceHolder resourceHolder,
+            String decoratorEntityName,
+            String publicEntityName,
+            String publicCollectionName) {
+        if (!isAction(period, rel, requestMethod)) {
+            if 
(!resourceHolder.getSubcollections().containsKey(collection.toLowerCase())) {
+
+                String decoratorSubCollectionName = collection;
+                String parentDecoratorName = parent;
+                resourceHolder.addSubCollection(collection.toLowerCase(),
+                        new CollectionHolder(decoratorSubCollectionName,
+                                publicEntityName,
+                                publicCollectionName,
+                                parentDecoratorName,
+                                decoratorEntityName,
+                                StringUtils.toPlural(period),
+                                subCollectionTemplate));
+            }
+        } else {
+            // TODO: use extra params (besides action) defined by RSDL
+            addCollectionAction(rel, periods, i, period, resourceHolder, dl);
+        }
+        
addCollectionMethod(resourceHolder.getSubcollections().get(collection.toLowerCase()),
+                url, rel, decoratorEntityName, publicEntityName, 
publicCollectionName, i, dl);
+    }
+
+    /**
+     * adds RootResource to the resourcesHolder
+     * 
+     * @param url
+     * @param rel
+     * @param dl
+     *            DetailedLink
+     * @param resource
+     * @param decoratorResourceName
+     * @param publicEntityName
+     */
+    private void addRootResource(String url,
+            String rel,
+            DetailedLink dl,
+            String resource,
+            String decoratorResourceName,
+            String publicEntityName) {
+        if (!this.resourcesHolder.containsKey(resource.toLowerCase())) {
+            this.resourcesHolder.put(resource.toLowerCase(),
+                    new ResourceHolder(
+                            decoratorResourceName,
+                            publicEntityName,
+                            resourceTemplate,
+                            variableTemplate,
+                            subCollectionGetterTemplate));
+        }
+        addResourceMethod(this.resourcesHolder.get(resource.toLowerCase()),
+                url, rel, decoratorResourceName, publicEntityName, dl);
+    }
+
+    /**
+     * adds RootCollection to the collectionsHolder
+     * 
+     * @param url
+     * @param rel
+     * @param dl
+     *            DetailedLink
+     * @param i
+     *            the index offset in URI
+     * @param period
+     *            the URI period
+     * @param decoratorCollectionName
+     * @param publicEntityName
+     * @param publicCollectionName
+     * @param decoratorEntityName
+     */
+    private void addRootCollection(String url,
+            String rel,
+            DetailedLink dl,
+            int i,
+            String period,
+            String decoratorCollectionName,
+            String publicEntityName,
+            String publicCollectionName,
+            String decoratorEntityName) {
+        if 
(!this.collectionsHolder.containsKey(decoratorCollectionName.toLowerCase())) {
+            this.collectionsHolder.put(decoratorCollectionName.toLowerCase(),
+                    new CollectionHolder(
+                            decoratorCollectionName,
+                            publicEntityName,
+                            publicCollectionName,
+                            decoratorEntityName,
+                            StringUtils.toPlural(period),
+                            collectionTemplate));
+        }
+        
addCollectionMethod(this.collectionsHolder.get(decoratorCollectionName.toLowerCase()),
+                url, rel, decoratorEntityName, publicEntityName, 
publicCollectionName, i, dl);
+    }
+
+    /**
      * @return list of public collection names
      */
     private Map<String, List<String>> getPublicAccessors() {
diff --git a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java
index 49caae9..8bb2f2f 100644
--- a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java
+++ b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java
@@ -55,6 +55,7 @@
     private Hosts hosts;
     private VMs vMs;
     private VmPools vmPools;
+    private Capabilities capabilities;
     private StorageDomains storageDomains;
     private Groups groups;
 
@@ -533,6 +534,19 @@
         return vmPools;
     }
     /**
+     * Gets the value of the Capabilities property. 
+     *
+     * @return
+     *     {@link Capabilities }
+     *
+     */
+    public synchronized Capabilities getCapabilities() {
+        if (this.capabilities == null) {
+            this.capabilities = new Capabilities(proxy);
+        }
+        return capabilities;
+    }
+    /**
      * Gets the value of the StorageDomains property. 
      *
      * @return
diff --git 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/decorators/Capabilities.java
 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/decorators/Capabilities.java
new file mode 100644
index 0000000..58c23de
--- /dev/null
+++ 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/decorators/Capabilities.java
@@ -0,0 +1,99 @@
+//
+// Copyright (c) 2012 Red Hat, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//           http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// *********************************************************************
+// ********************* GENERATED CODE - DO NOT MODIFY ****************
+// *********************************************************************
+
+package org.ovirt.engine.sdk.decorators;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.http.Header;
+import org.apache.http.client.ClientProtocolException;
+import org.ovirt.engine.sdk.common.CollectionDecorator;
+import org.ovirt.engine.sdk.exceptions.ServerException;
+import org.ovirt.engine.sdk.utils.CollectionUtils;
+import org.ovirt.engine.sdk.utils.HttpHeaderBuilder;
+import org.ovirt.engine.sdk.utils.HttpHeaderUtils;
+import org.ovirt.engine.sdk.utils.UrlBuilder;
+import org.ovirt.engine.sdk.utils.UrlBuilder;
+import org.ovirt.engine.sdk.utils.UrlHelper;
+import org.ovirt.engine.sdk.web.HttpProxyBroker;
+import org.ovirt.engine.sdk.web.UrlParameterType;
+import org.ovirt.engine.sdk.entities.Action;
+
+/**
+ * <p>Capabilities providing relation and functional services
+ * <p>to {@link org.ovirt.engine.sdk.entities.Capabilities } .
+ */
+@SuppressWarnings("unused")
+public class Capabilities extends
+        CollectionDecorator<org.ovirt.engine.sdk.entities.VersionCaps, 
+                            org.ovirt.engine.sdk.entities.Capabilities, 
+                            VersionCaps> {
+
+    /**
+     * @param proxy HttpProxyBroker
+     */
+    public Capabilities(HttpProxyBroker proxy) {
+        super(proxy, "capabilities");
+    }
+
+    /**
+     * Lists VersionCaps objects.
+     *
+     * @return
+     *     List of {@link VersionCaps }
+     *
+     * @throws ClientProtocolException
+     *             Signals that HTTP/S protocol error has occurred.
+     * @throws ServerException
+     *             Signals that an oVirt api error has occurred.
+     * @throws IOException
+     *             Signals that an I/O exception of some sort has occurred.
+     */
+    @Override
+    public List<VersionCaps> list() throws ClientProtocolException,
+            ServerException, IOException {
+        String url = SLASH + getName();
+        return list(url, org.ovirt.engine.sdk.entities.Capabilities.class, 
VersionCaps.class);
+    }
+
+    /**
+     * Fetches VersionCaps object by id.
+     *
+     * @return {@link VersionCaps }
+     *
+     * @throws ClientProtocolException
+     *             Signals that HTTP/S protocol error has occurred.
+     * @throws ServerException
+     *             Signals that an oVirt api error has occurred.
+     * @throws IOException
+     *             Signals that an I/O exception of some sort has occurred.
+     */
+    @Override
+    public VersionCaps get(UUID id) throws ClientProtocolException,
+            ServerException, IOException {
+        String url = SLASH + getName() + SLASH + id.toString();
+        return getProxy().get(url, 
org.ovirt.engine.sdk.entities.VersionCaps.class, VersionCaps.class);
+    }
+
+
+}
+
diff --git 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/decorators/VersionCaps.java
 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/decorators/VersionCaps.java
new file mode 100644
index 0000000..54ab12e
--- /dev/null
+++ 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/decorators/VersionCaps.java
@@ -0,0 +1,67 @@
+//
+// Copyright (c) 2012 Red Hat, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//           http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// *********************************************************************
+// ********************* GENERATED CODE - DO NOT MODIFY ****************
+// *********************************************************************
+
+package org.ovirt.engine.sdk.decorators;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.http.Header;
+import org.apache.http.client.ClientProtocolException;
+import org.ovirt.engine.sdk.entities.Action;
+import org.ovirt.engine.sdk.entities.Response;
+import org.ovirt.engine.sdk.exceptions.ServerException;
+import org.ovirt.engine.sdk.utils.HttpHeaderBuilder;
+import org.ovirt.engine.sdk.utils.HttpHeaderUtils;
+import org.ovirt.engine.sdk.utils.UrlBuilder;
+import org.ovirt.engine.sdk.web.HttpProxyBroker;
+import org.ovirt.engine.sdk.web.UrlParameterType;
+
+/**
+ * <p>VersionCaps providing relation and functional services
+ * <p>to {@link org.ovirt.engine.sdk.entities.VersionCaps }. 
+ */
+@SuppressWarnings("unused")
+public class VersionCaps extends
+        org.ovirt.engine.sdk.entities.VersionCaps {
+
+    private HttpProxyBroker proxy;
+
+
+
+    /**
+     * @param proxy HttpProxyBroker
+     */
+    public VersionCaps(HttpProxyBroker proxy) {
+        this.proxy = proxy;
+    }
+
+    /**
+     * @return HttpProxyBroker
+     */
+    private HttpProxyBroker getProxy() {
+        return proxy;
+    }
+
+
+
+
+}
+
diff --git 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/BaseResources.java
 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/BaseResources.java
index 33c2623..0b596cd 100644
--- 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/BaseResources.java
+++ 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/BaseResources.java
@@ -69,6 +69,7 @@
     Quotas.class,
     GlusterMemoryPools.class,
     GlusterVolumes.class,
+    Capabilities.class,
     Users.class,
     IPs.class,
     DataCenters.class,
diff --git 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/Capabilities.java
 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/Capabilities.java
index affc4ab..203f933 100644
--- 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/Capabilities.java
+++ 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/Capabilities.java
@@ -37,13 +37,13 @@
  * <pre>
  * &lt;complexType name="Capabilities">
  *   &lt;complexContent>
- *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType";>
+ *     &lt;extension base="{}BaseResources">
  *       &lt;sequence>
  *         &lt;element name="version" type="{}VersionCaps" 
maxOccurs="unbounded"/>
  *         &lt;element name="permits" type="{}Permits" minOccurs="0"/>
  *         &lt;element name="scheduling_policies" type="{}SchedulingPolicies" 
minOccurs="0"/>
  *       &lt;/sequence>
- *     &lt;/restriction>
+ *     &lt;/extension>
  *   &lt;/complexContent>
  * &lt;/complexType>
  * </pre>
@@ -56,7 +56,9 @@
     "permits",
     "schedulingPolicies"
 })
-public class Capabilities {
+public class Capabilities
+    extends BaseResources
+{
 
     @XmlElement(name = "version", required = true)
     protected List<VersionCaps> versions;
diff --git 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/VersionCaps.java
 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/VersionCaps.java
index 57d4b7c..c9c2d8f 100644
--- 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/VersionCaps.java
+++ 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/VersionCaps.java
@@ -1457,4 +1457,3 @@
     }
 
 }
-
diff --git 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/CollectionUtils.java
 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/CollectionUtils.java
index 00f7fb9..66cd49d 100644
--- 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/CollectionUtils.java
+++ 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/CollectionUtils.java
@@ -36,7 +36,7 @@
      */
     public static <T extends BaseResource> T getItemByName(String name, 
List<T> collection) {
         for (T item : collection) {
-            if (item.getName().equals(name)) {
+            if (!StringUtils.isNull(item.getName()) && 
item.getName().equals(name)) {
                 return item;
             }
         }
diff --git 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/StringUtils.java
 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/StringUtils.java
index 0b6c638..c8d36aa 100644
--- 
a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/StringUtils.java
+++ 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/utils/StringUtils.java
@@ -122,6 +122,17 @@
      * @return if string is null or empty true else false
      */
     public static boolean isNulOrEmpty(String string) {
-        return string == null || "".equals(string);
+        return isNull(string) || string.isEmpty();
+    }
+
+    /**
+     * Checks if string is null
+     * 
+     * @param string
+     * 
+     * @return if string is null true else false
+     */
+    public static boolean isNull(String string) {
+        return string == null;
     }
 }


-- 
To view, visit http://gerrit.ovirt.org/15611
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4d3b54769efaa4dbf51622c1d3be3c73a5675c9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk-java
Gerrit-Branch: master
Gerrit-Owner: Michael Pasternak <mpast...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to