/*
 * Copyright (C) 2013 salesforce.com, 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.
 */

package org.auraframework.impl.design;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.auraframework.def.ComponentDefRef;
import org.auraframework.def.design.DesignAttributeDefaultDef;
import org.auraframework.impl.system.DefinitionImpl;
import org.auraframework.throwable.quickfix.QuickFixException;
import org.auraframework.util.json.Json;

import java.io.IOException;
import java.util.List;

/**
 * Implementation for attribute default.
 * Used to define a facet attributes default markup.
 */
public class DesignAttributeDefaultDefImpl extends DefinitionImpl<DesignAttributeDefaultDef> implements DesignAttributeDefaultDef {
    private static final long serialVersionUID = 7728564360281471637L;

    private final List<ComponentDefRef> defaultFacet;

    protected DesignAttributeDefaultDefImpl(Builder builder) {
        super(builder);
        this.defaultFacet = builder.defaultFacet;
    }

    @Override
    public void validateReferences() throws QuickFixException {
        super.validateReferences();
        for (ComponentDefRef ref : defaultFacet) {
            ref.validateReferences();
        }
    }

    @Override
    public List<ComponentDefRef> getComponentRefs() {
        return ImmutableList.copyOf(defaultFacet);
    }

    @Override
    public void serialize(Json json) throws IOException {}

    public static class Builder extends DefinitionImpl.BuilderImpl<DesignAttributeDefaultDef> {
        private List<ComponentDefRef> defaultFacet = Lists.newArrayList();

        public Builder() {
            super(DesignAttributeDefaultDef.class);
        }

        public void addComponentRef(ComponentDefRef def) {
            defaultFacet.add(def);
        }

        @Override
        public DesignAttributeDefaultDef build() throws QuickFixException {
            return new DesignAttributeDefaultDefImpl(this);
        }
    }
}

@@ -776,24 +776,68 @@
 nentDefRef;%0A
+import org.auraframework.def.DefDescriptor;%0A
 import org.a
@@ -883,24 +883,24 @@
 DefaultDef;%0A
-
 import org.a
@@ -1095,16 +1095,38 @@
 il.List;
+%0Aimport java.util.Set;
 %0A%0A/**%0A *
@@ -1567,16 +1567,16 @@
 ilder);%0A
-
         
@@ -1616,32 +1616,286 @@
 ltFacet;%0A    %7D%0A%0A
+    @Override%0A    public void appendDependencies(Set%3CDefDescriptor%3C?%3E%3E dependencies) %7B%0A        super.appendDependencies(dependencies);%0A        for (ComponentDefRef ref : defaultFacet) %7B%0A            dependencies.add(ref.getDescriptor());%0A        %7D%0A    %7D%0A%0A
     @Override%0A  

Fix for component compile error due to missing dependencys