/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.netbeans.modules.jakarta.web.beans.analysis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.lang.model.element.Element;

import org.netbeans.api.java.source.CompilationInfo;
import org.netbeans.spi.editor.hints.ErrorDescription;
import org.netbeans.spi.editor.hints.Severity;


/**
 * @author ads
 *
 */
public class CdiAnalysisTestResult extends CdiAnalysisResult 
    implements TestProblems
{
    
    public CdiAnalysisTestResult( CompilationInfo info ) {
        super(info, null);
    }

    /* (non-Javadoc)
     * @see org.netbeans.modules.jakarta.web.beans.analysis.CdiAnalysisResult#addError(javax.lang.model.element.Element, java.lang.String)
     */
    @Override
    public void addError( Element subject, String message ) {
        /* TODO: method signature needs to be changed to get a key 
         * (id of message ) of bundle instead of  localized message
         */ 
        myErrors.put( subject , message );
    }

    /* (non-Javadoc)
     * @see org.netbeans.modules.jakarta.web.beans.analysis.CdiAnalysisResult#addNotification(org.netbeans.spi.editor.hints.Severity, javax.lang.model.element.Element, java.lang.String)
     */
    @Override
    public void addNotification( Severity severity, Element element,
            String message )
    {
        if ( severity == Severity.WARNING ){
            myWarnings.put( element , message );
        }
        else {
            assert false;
        }
    }

    /* (non-Javadoc)
     * @see org.netbeans.modules.jakarta.web.beans.analysis.CdiAnalysisResult#getProblems()
     */
    @Override
    public List<ErrorDescription> getProblems() {
        return null;
    }

    /* (non-Javadoc)
     * @see org.netbeans.modules.jakarta.web.beans.analysis.CdiAnalysisResult#requireCdiEnabled(javax.lang.model.element.Element)
     */
    @Override
    public void requireCdiEnabled( Element element ) {
    }
    
    @Override
    public Map<Element,String> getErrors(){
        return myErrors;
    }

    @Override
    public Map<Element,String> getWarings(){
        return myWarnings;
    }
    
    private Map<Element,String> myErrors = new HashMap<Element, String>();
    private Map<Element,String> myWarnings = new HashMap<Element, String>();
}
