Subversion Repositories bacoAlunos

Rev

Rev 1314 | Rev 1325 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package pt.estgp.estgweb.domain;

import pt.estgp.estgweb.utils.ConfigProperties;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Created by jorgemachado on 09/03/16.
 */

public class QuestionarioImpl extends Questionario
{

    public enum 1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State
    {

        CREATED(1),
        ASSIGNED(2), // -> All tipologies prototypes created and assigned to student answers
        PROCESSING(3), // -> Impossible to change or edit prototypes, possible to answer
        CLOSED(4), // -> Impossible to answer
        STATISTICS1(5);

        private int pos = 1;

        1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State(int pos)
        {
            this.pos = pos;
        }

        public static 1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State parse(1.5.0/docs/api/java/lang/String.html">String state)
        {
            for(1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State s: 1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State.values())
            {
                if(s.name().equals(state))
                    return s;
            }
            return CREATED;
        }

        public int getPosition()
        {
            return pos;
        }
    }



    public QuestionarioImpl() {
        super();

        setState(1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State.CREATED.name());

        setIntroHtml(ConfigProperties.getProperty("questionario.intro.text"));
        setGroup1Title(ConfigProperties.getProperty("questionario.group1.title"));
        setGroup2Title(ConfigProperties.getProperty("questionario.group2.title"));
        setGroup3Title(ConfigProperties.getProperty("questionario.group3.title"));
        setGroup4Title(ConfigProperties.getProperty("questionario.group4.title"));
        setGroup5Title(ConfigProperties.getProperty("questionario.group5.title"));


        for(int i = 1; i <=30;i++)
        {

            try {
                1.5.0/docs/api/java/lang/String.html">String group = ConfigProperties.getProperty("questionario.p" + i + ".group");
                1.5.0/docs/api/java/lang/reflect/Method.html">Method m = this.getClass().getMethod("setP" + i + "Group",1.5.0/docs/api/java/lang/String.html">String.class);
                m.invoke(this,group);

                1.5.0/docs/api/java/lang/String.html">String pergunta = ConfigProperties.getProperty("questionario.p" + i);
                1.5.0/docs/api/java/lang/reflect/Method.html">Method m2 = this.getClass().getMethod("setP" + i,1.5.0/docs/api/java/lang/String.html">String.class);
                m2.invoke(this,pergunta);
            } catch (1.5.0/docs/api/java/lang/NoSuchMethodException.html">NoSuchMethodException e) {
                e.printStackTrace();
            } catch (1.5.0/docs/api/java/lang/reflect/InvocationTargetException.html">InvocationTargetException e) {
                e.printStackTrace();
            } catch (1.5.0/docs/api/java/lang/IllegalAccessException.html">IllegalAccessException e) {
                e.printStackTrace();
            }
        }

    }

    public static void main(1.5.0/docs/api/java/lang/String.html">String[] args)
    {
        QuestionarioImpl q =  new QuestionarioImpl();
        1.5.0/docs/api/java/lang/System.html">System.out.println(q);
    }

    public 1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State getStateEnum()
    {
        return 1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State.parse(getState());
    }
}