package org.minager.core.entities.business;
 
/**
 * Object that contains the results of a system command.
 * 
 * @author takiguchi
 *
 */
public class SystemResult {
    /** The result code of the command. */
    private int resultCode;
    /** The standard output of the command. */
    private StringBuilder stdOut;
    /** The standard errors output of the command. */
    private StringBuilder stdErr;
 
    public SystemResult() {
        super();
        stdOut = new StringBuilder();
        stdErr = new StringBuilder();
    }
 
    /**
     * Gets the result code.
     *
     * @return the result code
     */
    public int getResultCode() {
        return resultCode;
    }
 
    /**
     * Sets the result code.
     *
     * @param resultCode
     *            the new result code
     */
    public void setResultCode(int resultCode) {
        this.resultCode = resultCode;
    }
 
    /**
     * Gets the std out.
     *
     * @return the std out
     */
    public String getStdOut() {
        return stdOut.toString();
    }
 
    /**
     * Add an output line to the {@code stdOut}.
     * 
     * @param pLine
     *            The output line to append.
     */
    public void addOutputLine(final String pLine) {
        stdOut.append(pLine);
    }
 
    /**
     * Sets the std out.
     *
     * @param stdOut
     *            the new std out
     */
    public void setStdOut(String stdOut) {
        this.stdOut = new StringBuilder(stdOut);
    }
 
    /**
     * Gets the std err.
     *
     * @return the std err
     */
    public String getStdErr() {
        return stdErr.toString();
    }
 
    /**
     * Add an error line to the {@code stdErr}.
     * 
     * @param pLine
     *            The error line to append.
     */
    public void addErrorLine(final String pLine) {
        stdErr.append(pLine);
    }
 
    /**
     * Sets the std err.
     *
     * @param stdErr
     *            the new std err
     */
    public void setStdErr(String stdErr) {
        this.stdErr = new StringBuilder(stdErr);
    }
}