String[] hourTokens = element.getValue().split(":"); Calendar result = Calendar.getInstance(); result.set(Calendar.HOUR_OF_DAY, (new Integer(hourTokens[0])).intValue()); result.set(Calendar.MINUTE, (new Integer(hourTokens[1])).intValue()); result.set(Calendar.SECOND, new Integer(0).intValue()); metadata.setLearningTime(result); typicallearningtime = false;
if (!org.apache.commons.lang.StringUtils.isEmpty(element.getValue())) { String[] hourTokens = element.getValue().split(":"); Calendar result = Calendar.getInstance(); result.set(Calendar.HOUR_OF_DAY, (new Integer(hourTokens[0])).intValue()); result.set(Calendar.MINUTE, (new Integer(hourTokens[1])).intValue()); result.set(Calendar.SECOND, new Integer(0).intValue()); metadata.setLearningTime(result); typicallearningtime = false; }
    private Metadata vector2Metadata(Vector<Element> vector, Metadata metadata) {        boolean difficulty = false, description = false, mainsubject = false, secondarysubject = false, level = false, author = false, value = false, typicallearningtime = false;        String secondarySubjectString = new String(), authorString = new String();        for (Element element : vector) {            String tag = element.getQName();            if ((tag.equals("difficulty"))) {                difficulty = true;                mainsubject = false;                author = false;                typicallearningtime = false;            }            if ((tag.equals("description"))) {                difficulty = false;                description = true;                mainsubject = false;                author = false;                typicallearningtime = false;            } else if ((tag.equals("mainsubject"))) {                mainsubject = true;                secondarysubject = false;                author = false;                typicallearningtime = false;            } else if ((tag.equals("secondarysubject"))) {                secondarysubject = true;                author = false;                typicallearningtime = false;            } else if ((tag.equals("author"))) {                author = true;                secondarysubject = false;                typicallearningtime = false;            } else if ((tag.equals("level"))) {                level = true;                secondarysubject = false;                author = false;                typicallearningtime = false;            } else if ((tag.equals("typicallearningtime"))) {                author = false;                secondarysubject = false;                typicallearningtime = true;            } else if ((tag.equals("value"))                    && (difficulty == true || mainsubject == true || secondarysubject == true)) {                value = true;            } else if ((tag.equals("langstring")) && difficulty == true && value == true) {                metadata.setDifficulty(element.getValue());                difficulty = false;                value = false;            } else if ((tag.equals("langstring")) && mainsubject == true && value == true) {                metadata.setMainSubject(element.getValue());                mainsubject = false;                value = false;            } else if ((tag.equals("langstring")) && secondarysubject == true && value == true) {                if (!secondarySubjectString.equals(""))                    secondarySubjectString = secondarySubjectString.concat(" / ");                secondarySubjectString = secondarySubjectString.concat(element.getValue());                value = false;            } else if ((tag.equals("langstring")) && description == true) {                metadata.setDescription(element.getValue());                description = false;            } else if ((tag.equals("langstring")) && level == true) {                metadata.setLevel(element.getValue());                level = false;            } else if ((tag.equals("langstring")) && author == true) {                if (!authorString.equals(""))                    authorString = authorString.concat(" / ");                authorString = authorString.concat(element.getValue());            }            else if ((tag.equals("datetime")) && typicallearningtime == true) {                String[] hourTokens = element.getValue().split(":");                Calendar result = Calendar.getInstance();                result.set(Calendar.HOUR_OF_DAY, (new Integer(hourTokens[0])).intValue());                result.set(Calendar.MINUTE, (new Integer(hourTokens[1])).intValue());                result.set(Calendar.SECOND, new Integer(0).intValue());                metadata.setLearningTime(result);                typicallearningtime = false;            }        }        metadata.setSecondarySubject(secondarySubjectString);        metadata.setAuthor(authorString);        return metadata;    }