/*
 * Copyright © 2010 Red Hat, Inc.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package com.redhat.rhevm.api.command.datacenters;

import com.redhat.rhevm.api.model.Attachment;
import com.redhat.rhevm.api.model.DataCenter;

import com.redhat.rhevm.api.command.base.VerboseDisplay;

public class DataCenterVerboseDisplay implements VerboseDisplay<DataCenter> {
    @Override
    public void expand(DataCenter model) {
        if (model.isSetStatus()) {
            System.out.println("  status: " + model.getStatus());
        }
        if (model.isSetStorageType()) {
            System.out.println("  storage type: " + model.getStorageType());
        }
        if (model.isSetAttachments() && model.getAttachments().getAttachments().size() > 0) {
            System.out.println("  Attachments: ");
            for (Attachment attachment : model.getAttachments().getAttachments()) {
                if (attachment.isSetMaster()) {
                    System.out.println("    master: " + attachment.isMaster());
                }
                if (attachment.isSetDataCenter()) {
                    System.out.println("    data center: " + attachment.getDataCenter().getName());
                }
                if (attachment.isSetStorageDomain()) {
                    if (attachment.getStorageDomain().isSetName()) {
                        System.out.println("    storage domain: " + attachment.getStorageDomain().getName());
                    } else if (attachment.getStorageDomain().isSetId()) {
                        System.out.println("    storage domain ID: " + attachment.getStorageDomain().getId());
                    }
                }
                if (attachment.isSetStatus()) {
                    System.out.println("    storage domain status: " + attachment.getStatus());
                }
                System.out.println();
            }
        }
    }
}

@@ -865,54 +865,8 @@
 s;%0A%0A
-import com.redhat.rhevm.api.model.Attachment;%0A
 impo
@@ -1343,1236 +1343,8 @@
   %7D%0A
-        if (model.isSetAttachments() && model.getAttachments().getAttachments().size() %3E 0) %7B%0A            System.out.println(%22  Attachments: %22);%0A            for (Attachment attachment : model.getAttachments().getAttachments()) %7B%0A                if (attachment.isSetMaster()) %7B%0A                    System.out.println(%22    master: %22 + attachment.isMaster());%0A                %7D%0A                if (attachment.isSetDataCenter()) %7B%0A                    System.out.println(%22    data center: %22 + attachment.getDataCenter().getName());%0A                %7D%0A                if (attachment.isSetStorageDomain()) %7B%0A                    if (attachment.getStorageDomain().isSetName()) %7B%0A                        System.out.println(%22    storage domain: %22 + attachment.getStorageDomain().getName());%0A                    %7D else if (attachment.getStorageDomain().isSetId()) %7B%0A                        System.out.println(%22    storage domain ID: %22 + attachment.getStorageDomain().getId());%0A                    %7D%0A                %7D%0A                if (attachment.isSetStatus()) %7B%0A                    System.out.println(%22    storage domain status: %22 + attachment.getStatus());%0A                %7D%0A                System.out.println();%0A            %7D%0A        %7D%0A
     

remove attachments list from verbose data center display