/**
 * 
 */
package pt.utl.ist.scripts.dataTransferObject;

import net.sourceforge.fenixedu.util.StringFormatter;

/**
 * @author - Shezad Anavarali (shezad@ist.utl.pt)
 * 
 */
public class ExternalCurricularCourseDTO implements IFileLine {

    private String code;

    private String name;

    private String school;

    @Override
    public boolean fillWithFileLineData(String dataLine) {

        if (dataLine.endsWith("IST") || dataLine.trim().length() == 0) {
            return false;
        }

        String[] lineSplited = dataLine.split("\t");

        if (lineSplited.length > 2) {
            if (lineSplited[2].trim().equals("IST") /*
                                                    * ||
                                                    * lineSplited[2].trim().length() ==
                                                    * 0
                                                    */) {
                return false;
            }
            code = lineSplited[0].trim();
            name = StringFormatter.prettyPrint(lineSplited[1].trim());
            school = lineSplited[2];
            return true;
        }

        return false;
    }

    @Override
    public String getUniqueKey() {
        return code;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getSchool() {
        return school;
    }

}
