All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.spdx.maven.utils.SpdxDefaultFileInformation Maven / Gradle / Ivy

/*
 * Copyright 2014 Source Auditor 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.spdx.maven.utils;

import java.util.ArrayList;
import java.util.List;

import org.spdx.library.InvalidSPDXAnalysisException;
import org.spdx.library.model.license.AnyLicenseInfo;
import org.spdx.library.model.license.SpdxNoAssertionLicense;

import org.spdx.maven.SnippetInfo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Simple structure to hold information obout default file information
 *
 * @author Gary O'Neall
 */
public class SpdxDefaultFileInformation
{
    private static final Logger LOG = LoggerFactory.getLogger( SpdxDefaultFileInformation.class );

    private AnyLicenseInfo declaredLicense;
    private String copyright = "NOASSERTION";
    private String notice = "";
    private String comment = "";
    private String[] contributors = new String[0];
    private AnyLicenseInfo concludedLicense;
    private String licenseComment = "";
    private List snippets = new ArrayList<>();
    
    public SpdxDefaultFileInformation() throws InvalidSPDXAnalysisException
    {
        declaredLicense = new SpdxNoAssertionLicense();
        concludedLicense = new SpdxNoAssertionLicense();
    }

    public AnyLicenseInfo getDeclaredLicense()
    {
        return this.declaredLicense;
    }

    public void setDeclaredLicense( AnyLicenseInfo license )
    {
        this.declaredLicense = license;
    }

    public String getCopyright()
    {
        return this.copyright;
    }

    public void setCopyright( String copyright )
    {
        this.copyright = copyright;
    }

    public String getNotice()
    {
        return this.notice;
    }

    public void setNotice( String notice )
    {
        this.notice = notice;
    }

    public String getComment()
    {
        return this.comment;
    }

    public void setComment( String comment )
    {
        this.comment = comment;
    }

    public String[] getContributors()
    {
        return this.contributors;
    }

    public void setContributors( String[] contributors )
    {
        this.contributors = contributors;
    }

    public AnyLicenseInfo getConcludedLicense()
    {
        return this.concludedLicense;
    }

    public void setConcludedLicense( AnyLicenseInfo license )
    {
        this.concludedLicense = license;
    }

    public String getLicenseComment()
    {
        return this.licenseComment;
    }

    public void setLicenseComment( String licenseComment )
    {
        this.licenseComment = licenseComment;
    }


    /**
     * @return the snippets
     */
    public List getSnippets()
    {
        return snippets;
    }

    /**
     * @param snippets the snippets to set
     */
    public void setSnippets( List snippets )
    {
        this.snippets = snippets;
    }

    /**
     * Primarily for debugging purposes.  Dump all the field information to the log Info
     */
    public void logInfo()
    {
        LOG.debug( "Default File Comment: " + getComment() );
        LOG.debug( "Default File Copyright: " + getCopyright() );
        LOG.debug( "Default File License Comment: " + getLicenseComment() );
        LOG.debug( "Default File Notice: " + getNotice() );
        LOG.debug( "Default File Concluded License: " + getConcludedLicense().toString() );
        LOG.debug( "Default File Declared License: " + getDeclaredLicense().toString() );
        if ( contributors != null )
        {
            for ( String contributor : contributors )
            {
                LOG.debug( "Default File Contributors: " + contributor );
            }
        }
        if ( this.snippets != null )
        {
            for ( SnippetInfo snippet : snippets )
            {
                snippet.logInfo();
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy